summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2017-11-03 12:46:07 (GMT)
committerSam Thursfield <sam.thursfield@codethink.co.uk>2017-12-04 16:44:27 (GMT)
commite230e8172a80cfde96f780af5f6be901b55bfbd0 (patch)
treefc6ef454ca057afa50c3a773520bc123e2bba866
parentb07c7e832a3079d22fa1a5ef53d8ccfd75756343 (diff)
downloaddefinitions-e230e8172a80cfde96f780af5f6be901b55bfbd0.tar.gz
gnu-toolchain: Split rule improvementssam/split-rules
This includes many fixes that result in us being able to produce a minimal OS image or initramfs of a reasonable size. I have built an initramfs of 16MB uncompressed with this change: still a bit bigger than necessary, but much better than the comical ~700MB thing complete with kernel source code and C++ compiler that I got before these changes. Note that the gnu-toolchain stack now puts all the toolchain binaries into the 'devel' artifact. The 'runtime' artifact just contains libraries needed to run programs that are built with that toolchain. We should split this up further in future so that C programs don't depend on libstdc++. Special care is taken for GCC and GLIBC to handle the lib/ and lib64/ split that they do on some 64-bit platforms. We also globally put /usr/src into the devel artifact, which is only useful for the linux.bsp element at present but makes sense as a global rule.
-rw-r--r--elements/gnu-toolchain/binutils.bst13
-rw-r--r--elements/gnu-toolchain/busybox.bst10
-rw-r--r--elements/gnu-toolchain/ccache.bst19
-rw-r--r--elements/gnu-toolchain/gawk.bst17
-rw-r--r--elements/gnu-toolchain/gcc.bst38
-rw-r--r--elements/gnu-toolchain/glibc.bst37
-rw-r--r--elements/gnu-toolchain/m4-tarball.bst11
-rw-r--r--elements/gnu-toolchain/make.bst11
-rw-r--r--project.conf5
9 files changed, 156 insertions, 5 deletions
diff --git a/elements/gnu-toolchain/binutils.bst b/elements/gnu-toolchain/binutils.bst
index 91650b0..9c59a19 100644
--- a/elements/gnu-toolchain/binutils.bst
+++ b/elements/gnu-toolchain/binutils.bst
@@ -29,3 +29,16 @@ config:
strip-commands:
- |
%{stage3-strip-binaries}
+
+public:
+ bst:
+ split-rules:
+ runtime:
+ (=): []
+
+ devel:
+ (>):
+ - |
+ %{bindir}/*
+ - |
+ %{prefix}/%{target}/**
diff --git a/elements/gnu-toolchain/busybox.bst b/elements/gnu-toolchain/busybox.bst
index ef86087..c8fc922 100644
--- a/elements/gnu-toolchain/busybox.bst
+++ b/elements/gnu-toolchain/busybox.bst
@@ -106,3 +106,13 @@ config:
strip-commands:
- |
%{stage3-strip-binaries}
+
+public:
+ bst:
+ split-rules:
+ runtime:
+ (>):
+ - |
+ /bin/*
+ - |
+ /sbin/*
diff --git a/elements/gnu-toolchain/ccache.bst b/elements/gnu-toolchain/ccache.bst
index 7e43547..b8a580f 100644
--- a/elements/gnu-toolchain/ccache.bst
+++ b/elements/gnu-toolchain/ccache.bst
@@ -21,12 +21,25 @@ config:
- ./configure --prefix="%{prefix}"
install-commands:
- make DESTDIR="%{install-root}" install
- - mkdir -p "%{install-root}%{prefix}/lib/ccache"
- - for cc in gcc cc g++ c++; do ln -sf "%{prefix}/bin/ccache" "%{install-root}%{prefix}/lib/ccache/$cc";
+ - mkdir -p "%{install-root}%{libdir}/ccache"
+ - for cc in gcc cc g++ c++; do ln -sf "%{prefix}/bin/ccache" "%{install-root}%{libdir}/ccache/$cc";
done
- - for cc in gcc cc g++ c++; do ln -sf "%{prefix}/bin/ccache" "%{install-root}%{prefix}/lib/ccache/%{target}-$cc";
+ - for cc in gcc cc g++ c++; do ln -sf "%{prefix}/bin/ccache" "%{install-root}%{libdir}/ccache/%{target}-$cc";
done
strip-commands:
- |
%{stage3-strip-binaries}
+
+public:
+ bst:
+ split-rules:
+ runtime:
+ (=): []
+
+ devel:
+ (>):
+ - |
+ %{bindir}/*
+ - |
+ %{libdir}/ccache/*
diff --git a/elements/gnu-toolchain/gawk.bst b/elements/gnu-toolchain/gawk.bst
index d00bd6d..d97255e 100644
--- a/elements/gnu-toolchain/gawk.bst
+++ b/elements/gnu-toolchain/gawk.bst
@@ -22,3 +22,20 @@ config:
strip-commands:
- |
%{stage3-strip-binaries}
+
+public:
+ bst:
+ split-rules:
+ runtime:
+ (=): []
+
+ devel:
+ (>):
+ - |
+ %{bindir}/*
+ - |
+ %{libdir}/gawk/*.so
+ - |
+ %{libexecdir}/awk/*
+ - |
+ %{datadir}/awk/*
diff --git a/elements/gnu-toolchain/gcc.bst b/elements/gnu-toolchain/gcc.bst
index bf6eca6..37f7a5b 100644
--- a/elements/gnu-toolchain/gcc.bst
+++ b/elements/gnu-toolchain/gcc.bst
@@ -35,6 +35,9 @@ variables:
--with-fpu=vfpv3-d16
--with-float=hard
+ - arch in ["armv8b64", "armv8l64", "ppc64b", "ppc64l", "x86_64"]:
+ lib: lib64
+
environment:
PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
@@ -93,3 +96,38 @@ config:
(<):
- sed -i "s/--host=none/--host=armv7a/" o/Makefile
- sed -i "s/--target=none/--target=armv7a/" o/Makefile
+
+public:
+ bst:
+ split-rules:
+ runtime:
+ - |
+ %{prefix}/%{lib}/lib*.so*
+
+ devel:
+ (>):
+ - |
+ %{bindir}/*
+ - |
+ %{prefix}/%{lib}/lib*.a
+ - |
+ %{prefix}/%{lib}/lib*.las
+ - |
+ %{prefix}/lib/gcc
+ - |
+ %{prefix}/lib/gcc/**
+ - |
+ %{libexecdir}/gcc
+ - |
+ %{libexecdir}/gcc/**
+ - |
+ %{prefix}/%{target}
+ - |
+ %{prefix}/%{target}/*
+
+ debug:
+ (>):
+ - |
+ %{datadir}/gcc-*/
+ - |
+ %{datadir}/gcc-*/**
diff --git a/elements/gnu-toolchain/glibc.bst b/elements/gnu-toolchain/glibc.bst
index 01c1971..7340872 100644
--- a/elements/gnu-toolchain/glibc.bst
+++ b/elements/gnu-toolchain/glibc.bst
@@ -19,6 +19,11 @@ variables:
- arch.startswith("armv7"):
glibc-arch-flags: --without-fp
+ - arch in ["armv8b64", "armv8l64", "ppc64b", "ppc64l", "x86_64"]:
+ # Setting this will affect BuildStream's default %{libdir} which
+ # affects the built-in split rules.
+ lib: "lib64"
+
environment:
PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
@@ -74,3 +79,35 @@ config:
strip-commands:
- |
%{stage3-strip-binaries}
+
+public:
+ bst:
+ split-rules:
+ runtime:
+ (>):
+ - |
+ %{sysconfdir}/*
+ - |
+ /%{lib}/ld*.so*
+ - |
+ /%{lib}/lib*.so*
+ - |
+ %{libdir}/*crt*.o
+
+ devel:
+ (>):
+ - |
+ /%{lib}/lib*.a
+ - |
+ /%{lib}/lib*.la
+
+ locale:
+ (>):
+ - |
+ %{libdir}/gconv
+ - |
+ %{libdir}/gconv/*
+ - |
+ %{prefix}/lib/locale
+ - |
+ %{prefix}/lib/locale/locale-archive
diff --git a/elements/gnu-toolchain/m4-tarball.bst b/elements/gnu-toolchain/m4-tarball.bst
index af3732c..b1b80e0 100644
--- a/elements/gnu-toolchain/m4-tarball.bst
+++ b/elements/gnu-toolchain/m4-tarball.bst
@@ -22,3 +22,14 @@ config:
strip-commands:
- |
%{stage3-strip-binaries}
+
+public:
+ bst:
+ split-rules:
+ runtime:
+ (=): []
+
+ devel:
+ (>):
+ - |
+ %{bindir}/*
diff --git a/elements/gnu-toolchain/make.bst b/elements/gnu-toolchain/make.bst
index c619200..92ca84f 100644
--- a/elements/gnu-toolchain/make.bst
+++ b/elements/gnu-toolchain/make.bst
@@ -23,3 +23,14 @@ config:
strip-commands:
- |
%{stage3-strip-binaries}
+
+public:
+ bst:
+ split-rules:
+ runtime:
+ (=): []
+
+ devel:
+ (>):
+ - |
+ %{bindir}/*
diff --git a/project.conf b/project.conf
index 68d967f..5573a2f 100644
--- a/project.conf
+++ b/project.conf
@@ -130,6 +130,7 @@ artifacts:
url: https://ostree.baserock.org/cache/
split-rules:
- locale:
+ devel:
(>):
- - "%{libdir}/locale/locale-archive"
+ - |
+ %{prefix}/src/**