summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2017-11-03 12:46:07 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2017-12-04 16:44:27 +0000
commite230e8172a80cfde96f780af5f6be901b55bfbd0 (patch)
treefc6ef454ca057afa50c3a773520bc123e2bba866
parentb07c7e832a3079d22fa1a5ef53d8ccfd75756343 (diff)
downloaddefinitions-sam/split-rules.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 91650b09..9c59a19e 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 ef86087c..c8fc9229 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 7e435476..b8a580fd 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 d00bd6d8..d97255eb 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 bf6eca66..37f7a5b6 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 01c1971f..73408726 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 af3732c9..b1b80e0d 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 c6192008..92ca84f7 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 68d967f4..5573a2ff 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/**