Blob Blame History Raw
From a6f50db0e183fd2a88cd211159a2168905f83cd8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Gimenez?= <gimenez@pps.jussieu.fr>
Date: Mon, 1 Dec 2014 14:10:42 +0100
Subject: [PATCH 02/11] Packaging Metadata

Based on the following commits

commit 023f2dc386164ed5bfd43a26fd65433ab2f49cca
Author: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Date:   Wed Nov 19 11:00:34 2014 +0300

    implement appdata to show laby in Software Centers

    Reference: https://github.com/sgimenez/laby/issues/31
    Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>

commit cae6ecc53f777940dbe5f4dd4b3cde992241a9b3
Author: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Date:   Wed Nov 19 10:53:41 2014 +0300

    improve desktop-file

    Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
---
 Makefile                   | 19 ++++++++++++++++++-
 build                      |  4 ++--
 packaging/laby.appdata.xml | 31 +++++++++++++++++++++++++++++++
 packaging/laby.desktop     | 10 ++++++++++
 src/config.sh              |  4 ++--
 5 files changed, 63 insertions(+), 5 deletions(-)
 create mode 100644 packaging/laby.appdata.xml
 create mode 100644 packaging/laby.desktop

diff --git a/Makefile b/Makefile
index ca18c1e..b30577d 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,11 @@
 include project.conf
 PROJECT_ARCHIVE=$(PROJECT_NAME)-$(PROJECT_VERSION)
 
+DESTDIR ?=
+PREFIX ?= /usr
+BINDIR ?= ${PREFIX}/bin
+DATADIR ?= ${PREFIX}/share
+
 default: all
 
 all:
@@ -14,8 +19,20 @@ clean:
 byte native byte-debug native-profile:
 	@./build --$@
 
+install:
+	install -Dp --mode=0755 laby \
+		"${DESTDIR}${BINDIR}/laby"
+	install -d "${DESTDIR}${DATADIR}/laby/"
+	cp -pr data/* "${DESTDIR}${DATADIR}/laby/"
+	install -Dp --mode=0644 data/tiles/ant-e.svg \
+		"${DESTDIR}${DATADIR}/icons/hicolor/scalable/apps/laby.svg"
+	desktop-file-install packaging/laby.desktop \
+		--dir="${DESTDIR}${DATADIR}/applications"
+	install -Dp --mode=0644 packaging/laby.appdata.xml \
+		"${DESTDIR}${DATADIR}/appdata/laby.appdata.xml"
+
 dist:
 	@mkdir _dist
 	@git archive --prefix="$(PROJECT_ARCHIVE)/" HEAD \
-		 | gzip >_dist/"$(PROJECT_ARCHIVE)".tar.gz
+		 | gzip >"_dist/$(PROJECT_ARCHIVE).tar.gz"
 	@echo archive stored in "_dist/$(PROJECT_ARCHIVE).tar.gz"
diff --git a/build b/build
index 6ff36ff..8787694 100755
--- a/build
+++ b/build
@@ -6,8 +6,8 @@ cd $(dirname $0)
 source build.conf || exit 1
 
 export PREFIX=${PREFIX-/usr}
-export SYSDATADIR=${SYSDATADIR-${PREFIX}/share}
-export SYSTMPDIR=${SYSTMPDIR-/tmp}
+export DATADIR=${DATADIR-${PREFIX}/share}
+export TMPDIR=${TMPDIR-/tmp}
 
 export PROJECT_NAME=${PROJECT_NAME-unknown}
 export PROJECT_VERSION=${PROJECT_VERSION-unknown}
diff --git a/packaging/laby.appdata.xml b/packaging/laby.appdata.xml
new file mode 100644
index 0000000..691fe28
--- /dev/null
+++ b/packaging/laby.appdata.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright 2014 Igor Gnatenko <i.gnatenko.brain@gmail.com> -->
+<component type="desktop">
+ <id>laby.desktop</id>
+ <metadata_license>CC0-1.0</metadata_license>
+ <project_license>GPL-3.0+</project_license>
+ <name>Laby</name>
+ <summary>Learn programming, playing with ants and spider webs</summary>
+ <description>
+  <p>
+   Laby is a small program to learn how to program with ants and spider webs.
+   You have to move an ant out of a labyrinth, avoid spider webs, move rocks, etc.
+  </p>
+ </description>
+ <screenshots>
+  <screenshot type="default">
+   <image>https://sgimenez.github.io/laby/laby.png</image>
+   <caption>The main window showing the application in action</caption>
+  </screenshot>
+ </screenshots>
+ <url type="homepage">https://sgimenez.github.io/laby/</url>
+ <releases>
+  <release version="0.6.4" timestamp="1417079209" />
+  <release version="0.6.3" timestamp="1305222180" />
+  <release version="0.6.2" timestamp="1283520256" />
+ </releases>
+ <provides>
+   <binary>laby</binary>
+ </provides>
+ <updatecontact>i.gnatenko.brain@gmail.com</updatecontact>
+</component>
diff --git a/packaging/laby.desktop b/packaging/laby.desktop
new file mode 100644
index 0000000..aebc46f
--- /dev/null
+++ b/packaging/laby.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Name=Laby
+Comment=Learn how to program with ants and spider webs
+Comment[fr]=Apprendre à programmer avec des fourmis
+Exec=laby
+Icon=laby
+Terminal=false
+Type=Application
+Categories=GNOME;GTK;Game;LogicGame;
+StartupNotify=true
diff --git a/src/config.sh b/src/config.sh
index b90e7fd..1474907 100644
--- a/src/config.sh
+++ b/src/config.sh
@@ -26,6 +26,6 @@ let build_system = "${OCAML_SYSTEM}"
 let build_arch = "${OCAML_ARCH}"
 let build_ocaml = "${OCAML_VERSION}"
 let build_lablgtk = "${BUILD_LABLGTK}"
-let _ = Res.sys_data_dir := "${SYSDATADIR}"
-let _ = Res.sys_tmp_dir := "${SYSTMPDIR}"
+let _ = Res.sys_data_dir := "${DATADIR}"
+let _ = Res.sys_tmp_dir := "${TMPDIR}"
 EOF
-- 
2.9.4