[gnome-sdk-images/wip/tvb/aarch64: 1/8] Generate metadata & org.gnome.Sdk.json



commit b9667379b5d02a09771f653ab7ac5314dde95867
Author: Tristan Van Berkom <tristan vanberkom codethink co uk>
Date:   Mon Apr 25 20:23:10 2016 +0100

    Generate metadata & org.gnome.Sdk.json
    
    Allows us to keep some build configurations in the same place
    so they do not have to be duplicated.
    
    Now set the architecture and versions directly in the Makefile

 Makefile                                    |   28 ++++++++++++++++++++++++++-
 metadata.platform => metadata.platform.in   |   10 ++++----
 metadata.sdk => metadata.sdk.in             |   10 ++++----
 org.gnome.Sdk.json => org.gnome.Sdk.json.in |    4 +-
 4 files changed, 39 insertions(+), 13 deletions(-)
---
diff --git a/Makefile b/Makefile
index 231a00a..dd347f9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,31 @@
-all: repo org.gnome.Sdk.json
+# Override the arch with `make ARCH=i386`
+ARCH   ?= $(shell xdg-app --default-arch)
+
+# SDK Versions setup here
+#
+# SDK_BRANCH:          The version (branch) of runtime and sdk to produce
+# SDK_RUNTIME_VERSION: The org.freedesktop.BaseSdk and platform version to build against
+#
+SDK_BRANCH=1.5
+SDK_RUNTIME_VERSION=1.4
+
+# Canned recipe for generating metadata
+SUBST_FILES=org.gnome.Sdk.json metadata.sdk metadata.platform
+define subst-metadata
+       @echo -n "Generating files: ${SUBST_FILES}... ";
+       @for file in ${SUBST_FILES}; do                                         \
+         file_source=$${file}.in;                                              \
+         sed -e 's/@@SDK_ARCH@@/${ARCH}/g'                                     \
+             -e 's/@@SDK_BRANCH@@/${SDK_BRANCH}/g'                             \
+             -e 's/@@SDK_RUNTIME_VERSION@@/${SDK_RUNTIME_VERSION}/g'           \
+             $$file_source > $$file.tmp && mv $$file.tmp $$file || exit 1;     \
+       done
+       @echo "Done.";
+endef
+
+all: repo $(patsubst %,%.in,$(SUBST_FILES))
        rm -rf sdk
+       $(call subst-metadata)
        xdg-app-builder --ccache --require-changes --repo=repo --subject="build of org.gnome.Sdk, `date`" 
${EXPORT_ARGS} sdk org.gnome.Sdk.json
        rm -rf sdk
 
diff --git a/metadata.platform b/metadata.platform.in
similarity index 70%
rename from metadata.platform
rename to metadata.platform.in
index 4ca8c46..c17d296 100644
--- a/metadata.platform
+++ b/metadata.platform.in
@@ -1,18 +1,18 @@
 [Runtime]
 name=org.gnome.Platform
-runtime=org.gnome.Platform/x86_64/master
-sdk=org.gnome.Sdk/x86_64/master
+runtime=org.gnome.Platform/@@SDK_ARCH@@/@@SDK_BRANCH@@
+sdk=org.gnome.Sdk/@@SDK_ARCH@@/@@SDK_BRANCH@@
 
 [Extension org.freedesktop.Platform.GL]
-version=1.4
+version=@@SDK_RUNTIME_VERSION@@
 directory=lib/GL
 
 [Extension org.freedesktop.Platform.Timezones]
-version=1.4
+version=@@SDK_RUNTIME_VERSION@@
 directory=share/zoneinfo
 
 [Extension org.freedesktop.Platform.GStreamer]
-version=1.4
+version=@@SDK_RUNTIME_VERSION@@
 directory=lib/extensions/gstreamer-1.0
 subdirectories=true
 
diff --git a/metadata.sdk b/metadata.sdk.in
similarity index 70%
rename from metadata.sdk
rename to metadata.sdk.in
index 280d014..271e75a 100644
--- a/metadata.sdk
+++ b/metadata.sdk.in
@@ -1,18 +1,18 @@
 [Runtime]
 name=org.gnome.Sdk
-runtime=org.gnome.Platform/x86_64/master
-sdk=org.gnome.Sdk/x86_64/master
+runtime=org.gnome.Platform/@@SDK_ARCH@@/@@SDK_BRANCH@@
+sdk=org.gnome.Sdk/@@SDK_ARCH@@/@@SDK_BRANCH@@
 
 [Extension org.freedesktop.Platform.GL]
-version=1.4
+version=@@SDK_RUNTIME_VERSION@@
 directory=lib/GL
 
 [Extension org.freedesktop.Platform.Timezones]
-version=1.4
+version=@@SDK_RUNTIME_VERSION@@
 directory=share/zoneinfo
 
 [Extension org.freedesktop.Platform.GStreamer]
-version=1.4
+version=@@SDK_RUNTIME_VERSION@@
 directory=lib/extensions/gstreamer-1.0
 subdirectories=true
 
diff --git a/org.gnome.Sdk.json b/org.gnome.Sdk.json.in
similarity index 99%
rename from org.gnome.Sdk.json
rename to org.gnome.Sdk.json.in
index 2e602c0..a868da7 100644
--- a/org.gnome.Sdk.json
+++ b/org.gnome.Sdk.json.in
@@ -2,10 +2,10 @@
     "build-runtime": true,
     "id": "org.gnome.Sdk",
     "id-platform": "org.gnome.Platform",
-    "branch": "master",
+    "branch": "@@SDK_BRANCH@@",
     "runtime": "org.freedesktop.Platform",
     "sdk": "org.freedesktop.Sdk",
-    "runtime-version": "1.4",
+    "runtime-version": "@@SDK_RUNTIME_VERSION@@",
     "writable-sdk": true,
     "sdk-extensions": ["org.freedesktop.Sdk.Debug", "org.freedesktop.Sdk.Locale"],
     "platform-extensions": [ "org.freedesktop.Platform.Locale"],


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]