summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2016-04-25 19:35:24 +0100
committerAlexander Larsson <alexl@redhat.com>2016-05-17 09:40:31 +0200
commit75927f43c9b1b92f1c62f792b1846a7cc398582e (patch)
tree97a039631715e6b3e545d043edbcedc6524f6b07
parentde7f0795454efd3ee00e34399451a880fd7f4bca (diff)
Generate metadata and pass new --arch option to flatpak-builder
Allows us to keep some build configurations in the same place so they do not have to be duplicated, and lets us easily build on mulitple architectures without having to edit the metadata. https://bugs.freedesktop.org/show_bug.cgi?id=95439
-rw-r--r--Makefile32
-rw-r--r--metadata.platform.in (renamed from metadata.platform)4
-rw-r--r--metadata.sdk.in (renamed from metadata.sdk)4
-rw-r--r--org.freedesktop.Sdk.json.in (renamed from org.freedesktop.Sdk.json)4
4 files changed, 36 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 0713bee..0450faf 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,33 @@
-all: repo org.freedesktop.Sdk.json
- flatpak-builder --force-clean --ccache --require-changes --repo=repo --subject="build of org.freedesktop.Sdk, `date`" ${EXPORT_ARGS} sdk org.freedesktop.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.freedesktop.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))
+ $(call subst-metadata)
+ flatpak-builder --force-clean --ccache --require-changes --repo=repo --arch=${ARCH} \
+ --subject="build of org.freedesktop.Sdk, `date`" \
+ ${EXPORT_ARGS} sdk org.freedesktop.Sdk.json
rm -rf sdk
repo:
diff --git a/metadata.platform b/metadata.platform.in
index 172c401..b9a61cb 100644
--- a/metadata.platform
+++ b/metadata.platform.in
@@ -1,7 +1,7 @@
[Runtime]
name=org.freedesktop.Platform
-runtime=org.freedesktop.Platform/x86_64/1.5
-sdk=org.freedesktop.Sdk/x86_64/1.5
+runtime=org.freedesktop.Platform/@@SDK_ARCH@@/@@SDK_BRANCH@@
+sdk=org.freedesktop.Sdk/@@SDK_ARCH@@/@@SDK_BRANCH@@
[Extension org.freedesktop.Platform.GL]
directory=lib/GL
diff --git a/metadata.sdk b/metadata.sdk.in
index 5da3637..a873086 100644
--- a/metadata.sdk
+++ b/metadata.sdk.in
@@ -1,7 +1,7 @@
[Runtime]
name=org.freedesktop.Sdk
-runtime=org.freedesktop.Platform/x86_64/1.5
-sdk=org.freedesktop.Sdk/x86_64/1.5
+runtime=org.freedesktop.Platform/@@SDK_ARCH@@/@@SDK_BRANCH@@
+sdk=org.freedesktop.Sdk/@@SDK_ARCH@@/@@SDK_BRANCH@@
[Extension org.freedesktop.Platform.GL]
directory=lib/GL
diff --git a/org.freedesktop.Sdk.json b/org.freedesktop.Sdk.json.in
index 2120449..e2c78a9 100644
--- a/org.freedesktop.Sdk.json
+++ b/org.freedesktop.Sdk.json.in
@@ -2,10 +2,10 @@
"build-runtime": true,
"id": "org.freedesktop.Sdk",
"id-platform": "org.freedesktop.Platform",
- "branch": "1.5",
+ "branch": "@@SDK_BRANCH@@",
"runtime": "org.freedesktop.BasePlatform",
"sdk": "org.freedesktop.BaseSdk",
- "runtime-version": "1.4",
+ "runtime-version": "@@SDK_RUNTIME_VERSION@@",
"writable-sdk": true,
"sdk-extensions": [],
"metadata": "metadata.sdk",