summaryrefslogtreecommitdiff
path: root/convert
diff options
context:
space:
mode:
Diffstat (limited to 'convert')
-rwxr-xr-xconvert65
1 files changed, 65 insertions, 0 deletions
diff --git a/convert b/convert
new file mode 100755
index 00000000..32ea03c7
--- /dev/null
+++ b/convert
@@ -0,0 +1,65 @@
+#!/usr/bin/bash
+# Baserock definitions -> BuildStream conversion script.
+#
+# This script aims to be the "canonical" conversion of the Baserock definitions
+# repository for use with the BuildStream build tool.
+
+set -eu
+
+# This must point to a clone of https://gitlab.com/BuildStream/defs2bst/
+CONVERTER=../defs2bst/defs2bst.py
+
+# This must point to a clone of https://gitlab.com/baserock/ybd/
+YBD=../ybd/ybd.py
+
+# Only the following systems will be converted.
+systems="
+ systems/base-system-x86_64-generic.morph
+ systems/build-system-x86_64.morph
+ systems/devel-system-x86_64-generic.morph
+ systems/minimal-system-x86_64-generic.morph
+ gnome/systems/gnome-system-x86_64.morph
+ genivi/systems/genivi-demo-platform-x86_64-generic.morph
+ ivi/systems/ivi-system-x86_64.morph
+ trove/systems/trove-system-x86_64.morph
+ weston/systems/weston-system-x86_64-generic.morph
+ weston/systems/weston-qt5-system-x86_64.morph
+ unmaintained/systems/openstack-system-x86_64.morph"
+
+mkdir -p elements/
+mkdir -p elements/systems/
+
+for system_morph in $systems; do
+ # Run the defs2bst script for $system_morph. This will produce a .bst
+ # file for every chunk involved in the build, and will produce a file named
+ # something like XX-system-x86_64-content.bst from the system .morph file.
+ $CONVERTER --ybd $YBD \
+ --definitions ./ \
+ --output ./elements \
+ --rebase strata/build-essential.morph gnu-toolchain.bst \
+ $system_morph x86_64
+
+ # Figure out the .bst file defs2bst will have produced for $system_morph.
+ system_bst_initial=$(echo $system_morph | sed -e 's@systems/@@' -e 's@\.morph$@-content.bst@')
+
+ # Now we remove x86_64 from the name; BuildStream allows architecture
+ # conditionals so we don't need to duplicate everything per platform.
+ #
+ # We take the opportunity to remove -generic as well if present.
+ system_bst_final=$(basename $system_bst_initial | sed -e 's@-x86_64@@' -e 's@-generic@@')
+
+ # All systems go in an elements/systems/ subdirectory, rather than being
+ # spread around different dirs like they are currently.
+ mv elements/$system_bst_initial elements/systems/$system_bst_final
+
+ echo
+ echo "convert: Created elements/systems/$system_bst_final from elements/$system_bst_initial"
+ echo
+done
+
+# Manual fix for libffi build instructions. The output of $(gcc -dumpmachine)
+# is not the same as the output of $(sh ./config.guess) when building with
+# the BuildStream gnu-toolchain definitions.
+#
+# We cannot fix this in definitions.git master, see: https://gitlab.com/baserock/definitions/merge_requests/49
+sed -i elements/core/libffi.bst -e 's@\$(gcc -dumpmachine)@$(sh ./config.guess)@'