summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2017-08-24 12:56:15 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2017-08-24 12:56:15 +0000
commit6632adf452a9f514545a1f8be8adcd922a0ccbc5 (patch)
treedd0f4774ed3d9f67950d51a95da409597db48610
parent54e447a9f1a9e94d68e6f5f616617ce49682192a (diff)
parent879a306c8c6285e9ef8dcbbba96bb84e62a9654c (diff)
downloaddefinitions-6632adf452a9f514545a1f8be8adcd922a0ccbc5.tar.gz
Merge remote-tracking branch 'buildstream-tests/gnu-toolchain' into sam/buildstream-autoconvert
This branch contains a manual conversion of the Baserock bootstrap process to BuildStream. The original branch can be found here: https://gitlab.com/BuildStream/buildstream-tests/tree/gnu-toolchain It's not possible to automatically convert the existing Baserock bootstrap due to differences in how BuildStream works.
-rw-r--r--elements/gnu-toolchain.bst20
-rw-r--r--elements/gnu-toolchain/base-platform.bst23
-rw-r--r--elements/gnu-toolchain/base-sdk.bst20
-rw-r--r--elements/gnu-toolchain/binutils.bst24
-rw-r--r--elements/gnu-toolchain/busybox.bst104
-rw-r--r--elements/gnu-toolchain/ccache.bst28
-rw-r--r--elements/gnu-toolchain/fhs-dirs.bst26
-rw-r--r--elements/gnu-toolchain/gawk.bst20
-rw-r--r--elements/gnu-toolchain/gcc.bst67
-rw-r--r--elements/gnu-toolchain/glibc.bst77
-rw-r--r--elements/gnu-toolchain/linux-api-headers.bst39
-rw-r--r--elements/gnu-toolchain/m4-tarball.bst20
-rw-r--r--elements/gnu-toolchain/make.bst21
-rw-r--r--elements/gnu-toolchain/stage1-binutils.bst38
-rw-r--r--elements/gnu-toolchain/stage1-gcc.bst101
-rw-r--r--elements/gnu-toolchain/stage1.bst7
-rw-r--r--elements/gnu-toolchain/stage2-binutils.bst40
-rw-r--r--elements/gnu-toolchain/stage2-busybox.bst101
-rw-r--r--elements/gnu-toolchain/stage2-fake-bash.bst17
-rw-r--r--elements/gnu-toolchain/stage2-fhs-dirs.bst31
-rw-r--r--elements/gnu-toolchain/stage2-gawk.bst30
-rw-r--r--elements/gnu-toolchain/stage2-gcc-fixed-headers.bst37
-rw-r--r--elements/gnu-toolchain/stage2-gcc.bst102
-rw-r--r--elements/gnu-toolchain/stage2-glibc.bst128
-rw-r--r--elements/gnu-toolchain/stage2-libstdcxx.bst55
-rw-r--r--elements/gnu-toolchain/stage2-linux-api-headers.bst41
-rw-r--r--elements/gnu-toolchain/stage2-make.bst29
-rw-r--r--elements/gnu-toolchain/stage2-reset-specs.bst35
-rw-r--r--elements/gnu-toolchain/stage2.bst22
-rw-r--r--elements/gnu-toolchain/zlib.bst23
-rw-r--r--keys/gnome-sdk.gpgbin0 -> 629 bytes
-rw-r--r--project.conf62
32 files changed, 1388 insertions, 0 deletions
diff --git a/elements/gnu-toolchain.bst b/elements/gnu-toolchain.bst
new file mode 100644
index 00000000..f38a05da
--- /dev/null
+++ b/elements/gnu-toolchain.bst
@@ -0,0 +1,20 @@
+kind: stack
+
+depends:
+- gnu-toolchain/fhs-dirs.bst
+- gnu-toolchain/binutils.bst
+- gnu-toolchain/busybox.bst
+- gnu-toolchain/ccache.bst
+- gnu-toolchain/gawk.bst
+- gnu-toolchain/gcc.bst
+- gnu-toolchain/glibc.bst
+- gnu-toolchain/linux-api-headers.bst
+- gnu-toolchain/m4-tarball.bst
+- gnu-toolchain/make.bst
+
+# Build essential is the base runtime, ldconfig
+# must be run on it.
+public:
+ bst:
+ integration-commands:
+ - ldconfig
diff --git a/elements/gnu-toolchain/base-platform.bst b/elements/gnu-toolchain/base-platform.bst
new file mode 100644
index 00000000..ce9cdc0a
--- /dev/null
+++ b/elements/gnu-toolchain/base-platform.bst
@@ -0,0 +1,23 @@
+kind: import
+description: Import the base freedesktop platform
+config:
+ source: files
+public:
+ bst:
+ integration-commands:
+ - ldconfig
+host-arches:
+ x86_64:
+ sources:
+ - kind: ostree
+ url: gnomesdk:repo/
+ track: runtime/org.freedesktop.BasePlatform/x86_64/1.4
+ gpg-key: keys/gnome-sdk.gpg
+ ref: c9d09b7250a12ef09d95952fc4f49a35e5f8c2c1dd7141b7eeada4069e6f6576
+ i386:
+ sources:
+ - kind: ostree
+ url: gnomesdk:repo/
+ track: runtime/org.freedesktop.BasePlatform/i386/1.4
+ gpg-key: keys/gnome-sdk.gpg
+ ref: 27ebae91839a454596a273391b0e53063eaa8aca4fc9cb64654582bfbc338c96
diff --git a/elements/gnu-toolchain/base-sdk.bst b/elements/gnu-toolchain/base-sdk.bst
new file mode 100644
index 00000000..61c29f64
--- /dev/null
+++ b/elements/gnu-toolchain/base-sdk.bst
@@ -0,0 +1,20 @@
+kind: import
+description: Import the base freedesktop SDK
+config:
+ source: files
+ target: usr
+host-arches:
+ x86_64:
+ sources:
+ - kind: ostree
+ url: gnomesdk:repo/
+ track: runtime/org.freedesktop.BaseSdk/x86_64/1.4
+ gpg-key: keys/gnome-sdk.gpg
+ ref: 0d9d255d56b08aeaaffb1c820eef85266eb730cb5667e50681185ccf5cd7c882
+ i386:
+ sources:
+ - kind: ostree
+ url: gnomesdk:repo/
+ track: runtime/org.freedesktop.BaseSdk/i386/1.4
+ gpg-key: keys/gnome-sdk.gpg
+ ref: 16036b747c1ec8e7fe291f5b1f667cb942f0267d08fcad962e9b7627d6cf1981
diff --git a/elements/gnu-toolchain/binutils.bst b/elements/gnu-toolchain/binutils.bst
new file mode 100644
index 00000000..5983c465
--- /dev/null
+++ b/elements/gnu-toolchain/binutils.bst
@@ -0,0 +1,24 @@
+kind: autotools
+
+sources:
+- kind: git
+ url: upstream:binutils-tarball
+ track: binutils-2.25
+ ref: 5500a97a2ad1735db5b35bc51cfb825c1f4c38df
+
+depends:
+- filename: gnu-toolchain/stage2.bst
+ type: build
+- gnu-toolchain/fhs-dirs.bst
+- gnu-toolchain/glibc.bst
+- gnu-toolchain/zlib.bst
+
+environment:
+ PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
+
+config:
+
+ configure-commands:
+ - |
+ ./configure --prefix="%{prefix}" --disable-nls --disable-werror \
+ --with-system-zlib
diff --git a/elements/gnu-toolchain/busybox.bst b/elements/gnu-toolchain/busybox.bst
new file mode 100644
index 00000000..be14fa51
--- /dev/null
+++ b/elements/gnu-toolchain/busybox.bst
@@ -0,0 +1,104 @@
+kind: manual
+
+sources:
+- kind: git
+ url: upstream:busybox
+ track: 1_23_1
+ ref: 1ecfe811fe2f70380170ef7d820e8150054e88ca
+
+depends:
+- filename: gnu-toolchain/stage2.bst
+ type: build
+- gnu-toolchain/fhs-dirs.bst
+- gnu-toolchain/glibc.bst
+
+environment:
+ PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
+
+config:
+ configure-commands:
+ # Busybox's default config has everything enabled.
+ - make defconfig KCONFIG_NOTIMESTAMP=1
+
+ - sed -e 's|.*UDHCPC_DEFAULT_SCRIPT.*|CONFIG_UDHCPC_DEFAULT_SCRIPT="'%{prefix}/share/udhcpc/default.script'"|'
+ -i .config
+ - sed -e 's|.*IFUPDOWN_IFSTATE_PATH.*|CONFIG_IFUPDOWN_IFSTATE_PATH="/run/ifstate"|'
+ -i .config
+
+ # Avoid dividing applets between %{prefix}/[s]bin and %{prefix}/usr/[s]bin.
+ - '[ "%{prefix}" = /usr ] || sed -e ''s/.*INSTALL_NO_USR.*/CONFIG_INSTALL_NO_USR=y/''
+ -i .config'
+ # We have GAWK, but in GENIVI baseline we want to get rid of it
+ # - sed -e 's/CONFIG_AWK=y.*/# CONFIG_AWK is not set/' -i .config
+
+ # Depends on stuff that was removed since eglibc 2.14.
+ - sed -e 's/CONFIG_INETD=y.*/# CONFIG_INETD is not set/' -i .config
+
+ # Busybox Patch is incompatible enough with GNU Patch that it can't be
+ # used for GNULib projects built from Git.
+ - sed -e 's/CONFIG_PATCH=y.*/# CONFIG_PATCH is not set/' -i .config
+
+ # None of this is needed because we have kmod; and it actually breaks the
+ # Linux build because depmod isn't compatible enough with util-linux's.
+ - sed -e 's/CONFIG_DEPMOD=y.*/# CONFIG_DEPMOD is not set/' -i .config
+ - sed -e 's/CONFIG_INSMOD=y.*/# CONFIG_INSMOD is not set/' -i .config
+ - sed -e 's/CONFIG_MODPROBE=y.*/# CONFIG_MODPROBE is not set/' -i .config
+ - sed -e 's/CONFIG_MODPROBE_SMALL=y.*/# CONFIG_MODPROBE_SMALL is not set/' -i .config
+ - sed -e 's/CONFIG_LSMOD=y.*/# CONFIG_LSMOD is not set/' -i .config
+ - sed -e 's/CONFIG_RMMOD=y.*/# CONFIG_RMMOD is not set/' -i .config
+
+ # General features that we don't need.
+ - sed -e 's/CONFIG_FEATURE_MOUNT_CIFS=y.*/# CONFIG_FEATURE_MOUNT_CIFS is not set/'
+ -i .config
+ - sed -e 's/CONFIG_FEATURE_EXTRA_QUIET=y.*/# CONFIG_FEATURE_EXTRA_QUIET is not set/'
+ -i .config
+ - sed -e 's/CONFIG_FEATURE_INIT_COREDUMPS=y.*/# CONFIG_FEATURE_INIT_COREDUMPS is not
+ set/' -i .config
+ - sed -e 's/CONFIG_FEATURE_INIT_SCTTY=y.*/# CONFIG_FEATURE_INIT_SCTTY is not set/'
+ -i .config
+ - sed -e 's/CONFIG_FEATURE_INIT_SYSLOG=y.*/# CONFIG_FEATURE_INIT_SYSLOG is not set/'
+ -i .config
+ - sed -e 's/CONFIG_FEATURE_INITRD=y.*/# CONFIG_FEATURE_INITRD is not set/' -i .config
+ - sed -e 's/CONFIG_FEATURE_MINIX2=y.*/# CONFIG_FEATURE_MINIX2 is not set/' -i .config
+ - sed -e 's/CONFIG_FSCK_MINIX=y.*/# CONFIG_FSCK_MINIX is not set/' -i .config
+ - sed -e 's/CONFIG_LOSETUP=y.*/# CONFIG_LOSETUP is not set/' -i .config
+ - sed -e 's/CONFIG_LSUSB=y.*/# CONFIG_LSUSB is not set/' -i .config
+ - sed -e 's/CONFIG_LSPCI=y.*/# CONFIG_LSPCI is not set/' -i .config
+ - sed -e 's/CONFIG_LZMA=y.*/# CONFIG_LZMA is not set/' -i .config
+ - sed -e 's/CONFIG_MKFS_EXT2=y.*/# CONFIG_MKFS_EXT2 is not set/' -i .config
+ - sed -e 's/CONFIG_MKFS_MINIX=y.*/# CONFIG_MKFS_MINIX is not set/' -i .config
+ - sed -e 's/CONFIG_STRINGS=y.*/# CONFIG_STRINGS is not set/' -i .config
+ - sed -e 's/CONFIG_UNLZMA=y.*/# CONFIG_UNLZMA is not set/' -i .config
+ - sed -e 's/CONFIG_UNXZ=y.*/# CONFIG_UNXZ is not set/' -i .config
+ - sed -e 's/CONFIG_XZ=y.*/# CONFIG_XZ is not set/' -i .config
+
+ # Now turn on some little bits we do need
+ - sed -e 's/# CONFIG_BBCONFIG is not set/CONFIG_BBCONFIG=y/' -i .config
+ - sed -e 's/# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set/CONFIG_FEATURE_COMPRESS_BBCONFIG=y/'
+ -i .config
+ - sed -e 's/# CONFIG_FEATURE_MOUNT_HELPERS is not set/CONFIG_FEATURE_MOUNT_HELPERS=y/'
+ -i .config
+
+ build-commands:
+ - make KCONFIG_NOTIMESTAMP=1
+
+ install-commands:
+ - |
+ # Note here we intentionally ignore '%{prefix}', this is going into '/'
+ make CONFIG_PREFIX="%{install-root}" KCONFIG_NOTIMESTAMP=1 install &&
+ chmod 6755 "%{install-root}/bin/busybox"
+
+ # Set up man environment variables
+ - mkdir -p "%{install-root}/etc"
+ - |
+ cat << EOF > "%{install-root}/etc/man.conf"
+ # This file is used by man to provide a manpath for those without one by
+ # examining their PATH environment variable.
+ #
+ # Lines beginning with `#' are comments and are ignored. Any combination of
+ # tabs or spaces may be used as `whitespace' separators.
+
+ MANDATORY_MANPATH /usr/man
+ MANDATORY_MANPATH /usr/share/man
+ MANDATORY_MANPATH /usr/local/share/man
+ EOF
diff --git a/elements/gnu-toolchain/ccache.bst b/elements/gnu-toolchain/ccache.bst
new file mode 100644
index 00000000..f66a37ca
--- /dev/null
+++ b/elements/gnu-toolchain/ccache.bst
@@ -0,0 +1,28 @@
+kind: autotools
+
+sources:
+- kind: git
+ url: upstream:ccache
+ track: baserock/gnu-toolchain
+ ref: 567631456f0899cdf0c382f898d38aadc8901d32
+
+depends:
+- filename: gnu-toolchain/stage2.bst
+ type: build
+- gnu-toolchain/fhs-dirs.bst
+- gnu-toolchain/glibc.bst
+- gnu-toolchain/zlib.bst
+
+environment:
+ PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
+
+config:
+ configure-commands:
+ - ./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";
+ done
+ - for cc in gcc cc g++ c++; do ln -sf "%{prefix}/bin/ccache" "%{install-root}%{prefix}/lib/ccache/%{target}-$cc";
+ done
diff --git a/elements/gnu-toolchain/fhs-dirs.bst b/elements/gnu-toolchain/fhs-dirs.bst
new file mode 100644
index 00000000..df715755
--- /dev/null
+++ b/elements/gnu-toolchain/fhs-dirs.bst
@@ -0,0 +1,26 @@
+kind: manual
+
+sources:
+- kind: git
+ url: baserock:baserock/fhs-dirs
+ track: master
+ ref: 9fafca436000bb57ddd5c498f8a75ea7b274f6c5
+
+depends:
+- filename: gnu-toolchain/stage2.bst
+ type: build
+
+environment:
+ PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
+
+config:
+ install-commands:
+ - sh ./create-fhs-dirs "%{install-root}"
+ - install -m 644 passwd "%{install-root}/etc/passwd"
+ - install -m 600 shadow "%{install-root}/etc/shadow"
+ - install -m 644 interfaces "%{install-root}/etc/network/interfaces"
+ - install -m 644 group "%{install-root}/etc/group"
+ - install -m 644 issue "%{install-root}/etc/issue"
+ - install -m 644 services "%{install-root}/etc/services"
+ - install -m 644 protocols "%{install-root}/etc/protocols"
+ - echo baserock > "%{install-root}/etc/hostname"
diff --git a/elements/gnu-toolchain/gawk.bst b/elements/gnu-toolchain/gawk.bst
new file mode 100644
index 00000000..7a612bfd
--- /dev/null
+++ b/elements/gnu-toolchain/gawk.bst
@@ -0,0 +1,20 @@
+kind: autotools
+
+sources:
+- kind: git
+ url: upstream:gawk
+ track: gawk-4.1-stable
+ ref: 925f9363c4b0a5bb9375298afcdcf404efb32587
+
+depends:
+- filename: gnu-toolchain/stage2.bst
+ type: build
+- gnu-toolchain/fhs-dirs.bst
+- gnu-toolchain/glibc.bst
+
+environment:
+ PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
+
+config:
+ configure-commands:
+ - ./configure --prefix="%{prefix}" --disable-nls
diff --git a/elements/gnu-toolchain/gcc.bst b/elements/gnu-toolchain/gcc.bst
new file mode 100644
index 00000000..e9a54834
--- /dev/null
+++ b/elements/gnu-toolchain/gcc.bst
@@ -0,0 +1,67 @@
+kind: manual
+
+sources:
+- kind: git
+ url: upstream:gcc-tarball
+ track: baserock/gcc-7.1.0
+ ref: 3b0dbcfa2e5d12bd80cab1b35f08653d61fe7838
+
+depends:
+- filename: gnu-toolchain/stage2.bst
+ type: build
+- gnu-toolchain/fhs-dirs.bst
+- gnu-toolchain/linux-api-headers.bst
+- gnu-toolchain/glibc.bst
+- gnu-toolchain/zlib.bst
+- gnu-toolchain/m4-tarball.bst
+
+environment:
+ PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
+
+config:
+
+ configure-commands:
+ - mkdir o
+
+ # Configure flag notes:
+ # 1. An attempt to stop anything going in %{prefix}/lib64 (which doesn't
+ # fully work; we will need to hobble the multilib configuration in
+ # config/i386/t-linux64 if we really want to kill /lib64).
+ # 2. Avoid having more than one copy of ZLib in use on the system
+ # 3. Multilib does not make sense in Baserock.
+ - |
+ case "%{bst-target-arch}" in
+ armv7lhf) ARCH_FLAGS="--with-arch=armv7-a \
+ --with-cpu=cortex-a9 \
+ --with-tune=cortex-a9 \
+ --with-fpu=vfpv3-d16 \
+ --with-float=hard" ;;
+ armv7*) ARCH_FLAGS="--with-arch=armv7-a" ;;
+ esac
+
+ cd o && ../configure \
+ $ARCH_FLAGS \
+ --prefix="%{prefix}" \
+ `# [1]` --libdir=%{prefix}/lib \
+ --disable-bootstrap \
+ `# [2]` --with-system-zlib \
+ `# [3]` --disable-multilib \
+ --enable-languages=c,c++,fortran
+
+ build-commands:
+ - |
+ case "%{bst-target-arch}" in
+ armv5*) sed -i "s/--host=none/--host=armv5/" o/Makefile
+ sed -i "s/--target=none/--target=armv5/" o/Makefile ;;
+ armv7*) sed -i "s/--host=none/--host=armv7a/" o/Makefile
+ sed -i "s/--target=none/--target=armv7a/" o/Makefile ;;
+ esac
+ cd o && make
+
+ install-commands:
+ - cd o && make DESTDIR="%{install-root}" install
+ - ln -s gcc "%{install-root}%{prefix}/bin/cc"
+ - |
+ for fortran_alias in f77 f90 f95; do
+ ln -s gfortran "%{install-root}%{prefix}/bin/$fortran_alias"
+ done
diff --git a/elements/gnu-toolchain/glibc.bst b/elements/gnu-toolchain/glibc.bst
new file mode 100644
index 00000000..48e9262e
--- /dev/null
+++ b/elements/gnu-toolchain/glibc.bst
@@ -0,0 +1,77 @@
+kind: manual
+
+sources:
+- kind: git
+ url: upstream:glibc
+ track: release/2.25/master
+ ref: adc7e06fb412a2a1ee52f8cb788caf436335b9f3
+
+depends:
+- filename: gnu-toolchain/stage2.bst
+ type: build
+- gnu-toolchain/fhs-dirs.bst
+- gnu-toolchain/linux-api-headers.bst
+
+environment:
+ PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
+
+config:
+
+ configure-commands:
+ - mkdir o
+
+ - |
+ case "%{bst-arch}" in
+ armv7*)
+ ARCH_FLAGS="--without-fp" ;;
+ esac
+
+ # We override the PATH here to remove /tools/bin from it.
+ # Thanks to this glibc finds bash in /bin/bash through the /bin
+ # symlink. This is important because glibc changes the path to bash
+ # of the shebang in some scripts and these scripts will be broken if
+ # they point to bash in /tools/bin/bash.
+ export PATH="/usr/bin:/sbin:/bin";
+ export CFLAGS="-O2 $CFLAGS";
+ cd o && ../configure \
+ $ARCH_FLAGS \
+ --prefix="%{prefix}" \
+ --disable-profile \
+ --enable-kernel=3.0.0 \
+ --without-cvs \
+ --without-selinux \
+ --enable-obsolete-rpc
+
+ build-commands:
+ - cd o && make localtime=UTC
+
+ install-commands:
+ - cd o && make install_root="%{install-root}" localtime=UTC install
+ - cd o && make install_root="%{install-root}" localtime=UTC localedata/install-locales
+ - mkdir -p "%{install-root}/etc"
+ - mkdir -p "%{install-root}/etc/ld.so.conf.d"
+ - |
+ cat <<EOF > nsswitch.conf
+ passwd: compat
+ group: compat
+ shadow: compat
+
+ hosts: files myhostname mdns4_minimal [NOTFOUND=return] dns mdns4
+ networks: files
+
+ protocols: db files
+ services: db files
+ ethers: db files
+ rpc: db files
+
+ netgroup: nis
+ EOF
+ - install -m 644 -o root -g root nsswitch.conf "%{install-root}/etc/nsswitch.conf"
+ - |
+ cat <<EOF > ld.so.conf
+ /lib
+ /usr/lib
+ /usr/local/lib
+ include /etc/ld.so.conf.d/*.conf
+ EOF
+ - install -m 644 -o root -g root ld.so.conf "%{install-root}/etc/ld.so.conf"
diff --git a/elements/gnu-toolchain/linux-api-headers.bst b/elements/gnu-toolchain/linux-api-headers.bst
new file mode 100644
index 00000000..db89f18d
--- /dev/null
+++ b/elements/gnu-toolchain/linux-api-headers.bst
@@ -0,0 +1,39 @@
+kind: manual
+
+sources:
+- kind: git
+ url: upstream:linux
+ track: v4.0
+ ref: 39a8804455fb23f09157341d3ba7db6d7ae6ee76
+
+depends:
+- filename: gnu-toolchain/stage2.bst
+ type: build
+- gnu-toolchain/fhs-dirs.bst
+
+environment:
+ PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
+
+config:
+ install-commands:
+ - |
+ case "%{bst-target-arch}" in
+ armv5l)
+ ARCH="arm" ;;
+ armv7b|armv7l|armv7lhf)
+ ARCH="arm" ;;
+ armv8l64|armv8b64)
+ ARCH="arm64" ;;
+ x86_32)
+ ARCH="i386" ;;
+ x86_64)
+ ARCH="x86_64" ;;
+ ppc64)
+ ARCH="powerpc" ;;
+ *)
+ echo "Error: unsupported architecture: %{bst-target-arch}" >&2
+ exit 1
+ esac
+ ARCH=$ARCH make INSTALL_HDR_PATH=dest headers_install
+ - install -d "%{install-root}%{includedir}"
+ - cp -r dest/include/* "%{install-root}%{includedir}"
diff --git a/elements/gnu-toolchain/m4-tarball.bst b/elements/gnu-toolchain/m4-tarball.bst
new file mode 100644
index 00000000..1019c57a
--- /dev/null
+++ b/elements/gnu-toolchain/m4-tarball.bst
@@ -0,0 +1,20 @@
+kind: autotools
+
+sources:
+- kind: git
+ url: upstream:m4-tarball
+ track: m4-1.4.17
+ ref: 23c11479b3ad787adc7a651ee0c4347839e47723
+
+depends:
+- filename: gnu-toolchain/stage2.bst
+ type: build
+- gnu-toolchain/fhs-dirs.bst
+- gnu-toolchain/glibc.bst
+
+environment:
+ PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
+
+config:
+ configure-commands:
+ - ./configure --prefix="%{prefix}" --disable-gcc-warnings
diff --git a/elements/gnu-toolchain/make.bst b/elements/gnu-toolchain/make.bst
new file mode 100644
index 00000000..731d1a9f
--- /dev/null
+++ b/elements/gnu-toolchain/make.bst
@@ -0,0 +1,21 @@
+kind: autotools
+
+sources:
+- kind: git
+ url: upstream:make-tarball
+ track: baserock/make-4.1-ttyname-segfault-fix
+ ref: 4978d7129e42340ab9efeb0cb9cae4ad0fa052d4
+
+depends:
+- filename: gnu-toolchain/stage2.bst
+ type: build
+- gnu-toolchain/fhs-dirs.bst
+- gnu-toolchain/glibc.bst
+
+environment:
+ PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
+
+config:
+
+ configure-commands:
+ - ./configure --prefix="%{prefix}" --disable-nls
diff --git a/elements/gnu-toolchain/stage1-binutils.bst b/elements/gnu-toolchain/stage1-binutils.bst
new file mode 100644
index 00000000..72d51bcb
--- /dev/null
+++ b/elements/gnu-toolchain/stage1-binutils.bst
@@ -0,0 +1,38 @@
+kind: autotools
+
+sources:
+- kind: git
+ url: upstream:binutils-tarball
+ track: binutils-2.25
+ ref: 5500a97a2ad1735db5b35bc51cfb825c1f4c38df
+
+depends:
+- gnu-toolchain/base-platform.bst
+- gnu-toolchain/base-sdk.bst
+
+variables:
+ prefix: /tools
+
+environment:
+ PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+config:
+ configure-commands:
+ # We set the sysroot location dynamically at runtime by passing
+ # `--sysroot` to GCC, so we need to build a linker with sysroot support.
+ # We set it to a non-existent directory as a safety net to avoid looking
+ # at the host dirs in case we forget to set the sysroot. Setting the
+ # lib path is vital to avoid the tools we build linking to the libraries
+ # on the host system; the '=' makes the path we give relative to the
+ # sysroot, which we can then set at runtime by passing -Wl,--sysroot to
+ # GCC. Although nothing should be installed on /lib64, we configure the
+ # linker to look at that directory as well to make things more robust
+ # (currently GCC installs libraries to this directory at least on
+ # x86_64).
+
+ - |
+ %{configure} --disable-nls --disable-werror \
+ --build=$(sh config.guess) \
+ --host=$(sh config.guess) \
+ --target=%{target-stage1} \
+ --with-sysroot=/nonexistentdir --with-lib-path="=%{prefix}/lib:=%{prefix}/lib64"
diff --git a/elements/gnu-toolchain/stage1-gcc.bst b/elements/gnu-toolchain/stage1-gcc.bst
new file mode 100644
index 00000000..bcf30bc3
--- /dev/null
+++ b/elements/gnu-toolchain/stage1-gcc.bst
@@ -0,0 +1,101 @@
+kind: autotools
+
+sources:
+- kind: git
+ url: upstream:gcc-tarball
+ track: baserock/gcc-7.1.0
+ ref: 3b0dbcfa2e5d12bd80cab1b35f08653d61fe7838
+
+depends:
+- gnu-toolchain/base-platform.bst
+- gnu-toolchain/base-sdk.bst
+- gnu-toolchain/stage1-binutils.bst
+
+variables:
+ prefix: /tools
+
+environment:
+ PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+config:
+ configure-commands:
+ # Workaround from LFS due GCC not detecting stack protection correctly
+ - |
+ sed -i -e '/k prot/a \
+ gcc_cv_libc_provides_ssp=yes
+ ' gcc/configure
+
+ - mkdir o
+
+ # Configure flag notes:
+ # 1. See gcc.morph.
+ # 2. Although we will be setting a sysroot at runtime, giving a
+ # temporary one at configuration time seems necessary so that
+ # `--with-native-system-header-dir` produces effect and
+ # /tools/include is in the include path for the newly built GCC. We
+ # set it by default to a non-existent directory to avoid GCC looking
+ # at the host dirs, in case we forget to give it at runtime.
+ # 3. Disable searching /usr/local/include for headers
+ # 4. The pass 1 compiler needs to find the libraries we build in pass
+ # 2. Include path must be set explicility, because it defaults to
+ # $SYSROOT/usr/include rather than $SYSROOT/include.
+ # 5. Disable stuff that doesn't work when building a cross compiler
+ # without an existing libc, and generally try to keep this build as
+ # simple as possible.
+ - |
+ case "%{bst-target-arch}" in
+ armv7lhf) ARCH_FLAGS="--with-arch=armv7-a \
+ --with-cpu=cortex-a9 \
+ --with-tune=cortex-a9 \
+ --with-fpu=vfpv3-d16 \
+ --with-float=hard" ;;
+ armv7*) ARCH_FLAGS="--with-arch=armv7-a" ;;
+ esac
+
+ cd o && ../configure \
+ $ARCH_FLAGS \
+ --build=$(sh ../config.guess) \
+ --host=$(sh ../config.guess) \
+ --target=%{target-stage1} \
+ --prefix="%{prefix}" \
+ `# [1]` --libdir="%{libdir}" \
+ `# [2]` --with-sysroot=/nonexistentdir \
+ --with-newlib \
+ `# [3]` --with-local-prefix="%{prefix}" \
+ `# [4]` --with-native-system-header-dir="%{prefix}/include" \
+ --without-headers \
+ --disable-nls \
+ --disable-shared \
+ --disable-multilib \
+ `# [5]` --disable-decimal-float \
+ `# [5]` --disable-threads \
+ `# [5]` --disable-libatomic \
+ `# [5]` --disable-libgomp \
+ `# [5]` --disable-libitm \
+ `# [5]` --disable-libmpx \
+ `# [5]` --disable-libquadmath \
+ `# [5]` --disable-libsanitizer \
+ `# [5]` --disable-libssp \
+ `# [5]` --disable-libvtv \
+ `# [5]` --disable-libcilkrts \
+ `# [5]` --disable-libstdc++-v3 \
+ --enable-languages=c,c++
+
+ build-commands:
+ - |
+ # GCC is not passing the correct host/target flags to GMP's configure
+ # script, which causes it to not use the machine-dependent code for
+ # the platform and use the generic one instead. However, the generic
+ # code results on an undefined reference to `__gmpn_invert_limb' in
+ # ARMv7. Fix the invocation of GMP's configure script so that GMP can
+ # use the machine-dependent code.
+ case "%{bst-target-arch}" in
+ armv5*) sed -i "s/--host=none/--host=armv5/" o/Makefile
+ sed -i "s/--target=none/--target=armv5/" o/Makefile ;;
+ armv7*) sed -i "s/--host=none/--host=armv7a/" o/Makefile
+ sed -i "s/--target=none/--target=armv7a/" o/Makefile ;;
+ esac
+ cd o && make
+
+ install-commands:
+ - cd o && make DESTDIR="%{install-root}" install
diff --git a/elements/gnu-toolchain/stage1.bst b/elements/gnu-toolchain/stage1.bst
new file mode 100644
index 00000000..80d3aa43
--- /dev/null
+++ b/elements/gnu-toolchain/stage1.bst
@@ -0,0 +1,7 @@
+kind: stack
+
+depends:
+- gnu-toolchain/base-platform.bst
+- gnu-toolchain/base-sdk.bst
+- gnu-toolchain/stage1-binutils.bst
+- gnu-toolchain/stage1-gcc.bst
diff --git a/elements/gnu-toolchain/stage2-binutils.bst b/elements/gnu-toolchain/stage2-binutils.bst
new file mode 100644
index 00000000..e3ef2eaa
--- /dev/null
+++ b/elements/gnu-toolchain/stage2-binutils.bst
@@ -0,0 +1,40 @@
+kind: autotools
+
+sources:
+- kind: git
+ url: upstream:binutils-tarball
+ track: binutils-2.25
+ ref: 5500a97a2ad1735db5b35bc51cfb825c1f4c38df
+
+depends:
+- filename: gnu-toolchain/stage1.bst
+ type: build
+- filename: gnu-toolchain/stage2-fhs-dirs.bst
+ type: runtime
+- gnu-toolchain/stage2-linux-api-headers.bst
+- gnu-toolchain/stage2-glibc.bst
+
+variables:
+ prefix: /tools
+
+environment:
+ PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+config:
+ configure-commands:
+ - |
+ export STAGE2_SYSROOT="$(dirname $(dirname $(pwd)))"
+ export CXX="%{target-stage1}-g++ --sysroot=$STAGE2_SYSROOT"
+ # binutils has its own embedded libtool, which is old and strips out
+ # `--sysroot`. Work around by modifying the compiler command to
+ # include the sysroot flag
+ export CC="%{target-stage1}-gcc --sysroot=$STAGE2_SYSROOT"
+ ./configure --prefix="%{prefix}" --disable-nls --disable-werror \
+ --build=$(sh config.guess) \
+ --host=%{target-stage1} \
+ --target=%{target-stage1}
+
+ build-commands:
+ - |
+ export STAGE2_SYSROOT="$(dirname $(dirname $(pwd)))"
+ make
diff --git a/elements/gnu-toolchain/stage2-busybox.bst b/elements/gnu-toolchain/stage2-busybox.bst
new file mode 100644
index 00000000..a1774abd
--- /dev/null
+++ b/elements/gnu-toolchain/stage2-busybox.bst
@@ -0,0 +1,101 @@
+kind: manual
+
+sources:
+- kind: git
+ url: upstream:busybox
+ track: 1_23_1
+ ref: 1ecfe811fe2f70380170ef7d820e8150054e88ca
+
+depends:
+- filename: gnu-toolchain/stage1.bst
+ type: build
+- filename: gnu-toolchain/stage2-fhs-dirs.bst
+ type: runtime
+- gnu-toolchain/stage2-linux-api-headers.bst
+- gnu-toolchain/stage2-glibc.bst
+
+variables:
+ prefix: /tools
+
+environment:
+ PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+config:
+
+ configure-commands:
+ # Explicitly setting HOSTCC is required because we have a 'gcc' earlier in
+ # the PATH supplied by the stage2-gcc chunk, which can't execute outside of
+ # the stage 3 staging area.
+ - make HOSTCC="/usr/bin/gcc" CROSS_COMPILE=%{target-stage1}- KCONFIG_NOTIMESTAMP=1 defconfig
+
+ # Avoid dividing applets between %{prefix}/[s]bin and %{prefix}/usr/[s]bin.
+ - '[ "%{prefix}" = /usr ] || sed -e ''s/.*INSTALL_NO_USR.*/CONFIG_INSTALL_NO_USR=y/''
+ -i .config'
+ # We have GAWK.
+ - sed -e 's/CONFIG_AWK=y.*/# CONFIG_AWK is not set/' -i .config
+
+ # Depends on stuff that was removed since eglibc 2.14.
+ - sed -e 's/CONFIG_INETD=y.*/# CONFIG_INETD is not set/' -i .config
+
+ # Busybox Patch is incompatible enough with GNU Patch that it can't be
+ # used for GNULib projects built from Git.
+ - sed -e 's/CONFIG_PATCH=y.*/# CONFIG_PATCH is not set/' -i .config
+
+ # None of this is needed because we have kmod; and it actually breaks the
+ # Linux build because depmod isn't compatible enough with util-linux's.
+ - sed -e 's/CONFIG_DEPMOD=y.*/# CONFIG_DEPMOD is not set/' -i .config
+ - sed -e 's/CONFIG_INSMOD=y.*/# CONFIG_INSMOD is not set/' -i .config
+ - sed -e 's/CONFIG_MODPROBE=y.*/# CONFIG_MODPROBE is not set/' -i .config
+ - sed -e 's/CONFIG_MODPROBE_SMALL=y.*/# CONFIG_MODPROBE_SMALL is not set/' -i .config
+ - sed -e 's/CONFIG_LSMOD=y.*/# CONFIG_LSMOD is not set/' -i .config
+ - sed -e 's/CONFIG_RMMOD=y.*/# CONFIG_RMMOD is not set/' -i .config
+
+ # General features that we don't need.
+ - sed -e 's/CONFIG_FEATURE_MOUNT_CIFS=y.*/# CONFIG_FEATURE_MOUNT_CIFS is not set/'
+ -i .config
+ - sed -e 's/CONFIG_FEATURE_EXTRA_QUIET=y.*/# CONFIG_FEATURE_EXTRA_QUIET is not set/'
+ -i .config
+ - sed -e 's/CONFIG_FEATURE_INIT_COREDUMPS=y.*/# CONFIG_FEATURE_INIT_COREDUMPS is not
+ set/' -i .config
+ - sed -e 's/CONFIG_FEATURE_INIT_SCTTY=y.*/# CONFIG_FEATURE_INIT_SCTTY is not set/'
+ -i .config
+ - sed -e 's/CONFIG_FEATURE_INIT_SYSLOG=y.*/# CONFIG_FEATURE_INIT_SYSLOG is not set/'
+ -i .config
+ - sed -e 's/CONFIG_FEATURE_INITRD=y.*/# CONFIG_FEATURE_INITRD is not set/' -i .config
+ - sed -e 's/CONFIG_FEATURE_USE_INITTAB=y.*/# CONFIG_FEATURE_USE_INITTAB is not set/'
+ -i .config
+ - sed -e 's/CONFIG_FEATURE_MINIX2=y.*/# CONFIG_FEATURE_MINIX2 is not set/' -i .config
+ - sed -e 's/CONFIG_FSCK_MINIX=y.*/# CONFIG_FSCK_MINIX is not set/' -i .config
+ - sed -e 's/CONFIG_HALT=y.*/# CONFIG_HALT is not set/' -i .config
+ - sed -e 's/CONFIG_INIT=y.*/# CONFIG_INIT is not set/' -i .config
+ - sed -e 's/CONFIG_INIT_TERMINAL_TYPE=y.*/CONFIG_INIT_TERMINAL_TYPE=""/' -i .config
+ - sed -e 's/CONFIG_LOSETUP=y.*/# CONFIG_LOSETUP is not set/' -i .config
+ - sed -e 's/CONFIG_LSUSB=y.*/# CONFIG_LSUSB is not set/' -i .config
+ - sed -e 's/CONFIG_LZMA=y.*/# CONFIG_LZMA is not set/' -i .config
+ - sed -e 's/CONFIG_MKFS_EXT2=y.*/# CONFIG_MKFS_EXT2 is not set/' -i .config
+ - sed -e 's/CONFIG_MKFS_MINIX=y.*/# CONFIG_MKFS_MINIX is not set/' -i .config
+ - sed -e 's/CONFIG_RUNLEVEL=y.*/# CONFIG_RUNLEVEL is not set/' -i .config
+ - sed -e 's/CONFIG_STRINGS=y.*/# CONFIG_STRINGS is not set/' -i .config
+ - sed -e 's/CONFIG_UNLZMA=y.*/# CONFIG_UNLZMA is not set/' -i .config
+ - sed -e 's/CONFIG_UNXZ=y.*/# CONFIG_UNXZ is not set/' -i .config
+ - sed -e 's/CONFIG_XZ=y.*/# CONFIG_XZ is not set/' -i .config
+
+ build-commands:
+ - |
+ export STAGE2_SYSROOT="$(dirname $(dirname $(pwd)))"
+ export CPPFLAGS="--sysroot=$STAGE2_SYSROOT"
+ export LDFLAGS="--sysroot=$STAGE2_SYSROOT"
+ make HOSTCC="/usr/bin/gcc" CROSS_COMPILE=%{target-stage1}- KCONFIG_NOTIMESTAMP=1
+
+ install-commands:
+ # We expect to be built with a non-standard prefix in stage 2 (i.e. not
+ # /usr). The install will break if prefix is set to /usr.
+ - |
+ export STAGE2_SYSROOT="$(dirname $(dirname $(pwd)))"
+ export CPPFLAGS="--sysroot=$STAGE2_SYSROOT"
+ export LDFLAGS="--sysroot=$STAGE2_SYSROOT"
+ make CONFIG_PREFIX="%{install-root}%{prefix}" \
+ HOSTCC="/usr/bin/gcc" \
+ CROSS_COMPILE=%{target-stage1}- \
+ KCONFIG_NOTIMESTAMP=1 install &&
+ chmod 6755 "%{install-root}%{prefix}"/bin/busybox
diff --git a/elements/gnu-toolchain/stage2-fake-bash.bst b/elements/gnu-toolchain/stage2-fake-bash.bst
new file mode 100644
index 00000000..85e0dced
--- /dev/null
+++ b/elements/gnu-toolchain/stage2-fake-bash.bst
@@ -0,0 +1,17 @@
+kind: manual
+
+depends:
+- filename: gnu-toolchain/stage1.bst
+ type: build
+- filename: gnu-toolchain/stage2-fhs-dirs.bst
+ type: runtime
+
+variables:
+ prefix: /tools
+
+environment:
+ PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+config:
+ install-commands:
+ - printf '#!/bin/sh\nexec /bin/sh "$@"\n' | install -D /proc/self/fd/0 -m 755 "%{install-root}%{prefix}/bin/bash"
diff --git a/elements/gnu-toolchain/stage2-fhs-dirs.bst b/elements/gnu-toolchain/stage2-fhs-dirs.bst
new file mode 100644
index 00000000..f91f2f1f
--- /dev/null
+++ b/elements/gnu-toolchain/stage2-fhs-dirs.bst
@@ -0,0 +1,31 @@
+kind: manual
+
+sources:
+- kind: git
+ url: baserock:baserock/fhs-dirs
+ track: baserock/usr_merge
+ ref: 9fafca436000bb57ddd5c498f8a75ea7b274f6c5
+
+depends:
+- filename: gnu-toolchain/stage1.bst
+ type: build
+
+variables:
+ prefix: /tools
+
+environment:
+ PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+config:
+ install-commands:
+ - sh ./create-fhs-dirs "%{install-root}"
+ - rmdir "%{install-root}/usr/bin"
+ - ln -s "%{prefix}/bin" "%{install-root}/usr/bin"
+ - install -m 644 passwd "%{install-root}/etc/passwd"
+ - install -m 600 shadow "%{install-root}/etc/shadow"
+ - install -m 644 interfaces "%{install-root}/etc/network/interfaces"
+ - install -m 644 group "%{install-root}/etc/group"
+ - install -m 644 issue "%{install-root}/etc/issue"
+ - install -m 644 services "%{install-root}/etc/services"
+ - install -m 644 protocols "%{install-root}/etc/protocols"
+ - echo baserock > "%{install-root}/etc/hostname"
diff --git a/elements/gnu-toolchain/stage2-gawk.bst b/elements/gnu-toolchain/stage2-gawk.bst
new file mode 100644
index 00000000..1c15d53a
--- /dev/null
+++ b/elements/gnu-toolchain/stage2-gawk.bst
@@ -0,0 +1,30 @@
+kind: autotools
+
+sources:
+- kind: git
+ url: upstream:gawk
+ track: gawk-4.1-stable
+ ref: 925f9363c4b0a5bb9375298afcdcf404efb32587
+
+depends:
+- filename: gnu-toolchain/stage1.bst
+ type: build
+- filename: gnu-toolchain/stage2-fhs-dirs.bst
+ type: runtime
+- gnu-toolchain/stage2-linux-api-headers.bst
+- gnu-toolchain/stage2-glibc.bst
+
+variables:
+ prefix: /tools
+
+environment:
+ PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+config:
+
+ configure-commands:
+ - STAGE2_SYSROOT="$(dirname $(dirname $(pwd)))" CPPFLAGS="--sysroot=$STAGE2_SYSROOT" CXX=false
+ LDFLAGS="--sysroot=$STAGE2_SYSROOT" ./configure --prefix="%{prefix}" --disable-nls
+ --build=$(sh config.guess) --host=%{target-stage1}
+ build-commands:
+ - STAGE2_SYSROOT="$(dirname $(dirname $(pwd)))" make
diff --git a/elements/gnu-toolchain/stage2-gcc-fixed-headers.bst b/elements/gnu-toolchain/stage2-gcc-fixed-headers.bst
new file mode 100644
index 00000000..80c9bf32
--- /dev/null
+++ b/elements/gnu-toolchain/stage2-gcc-fixed-headers.bst
@@ -0,0 +1,37 @@
+kind: manual
+
+sources:
+- kind: git
+ url: upstream:gcc-tarball
+ track: baserock/gcc-7.1.0
+ ref: 3b0dbcfa2e5d12bd80cab1b35f08653d61fe7838
+
+depends:
+- filename: gnu-toolchain/stage1.bst
+ type: build
+- gnu-toolchain/stage2-linux-api-headers.bst
+- gnu-toolchain/stage2-glibc.bst
+
+variables:
+ prefix: /tools
+
+environment:
+ PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+config:
+ install-commands:
+ # Stage 1 GCC's fixincludes process created a limits.h before there was
+ # a real limits.h available for the target. This step (taken from Linux
+ # Linux From Scratch) creates a better one so that stage 2 GCC can compile.
+ #
+ # THIS IS A FRAGILE HACK! We need to replace the headers. The only way to
+ # overwrite files in a staging area is to install a new chunk.
+ # This is undesired behaviour in the long term, as we want to never
+ # have overlaps, so this functionality may go away.
+ - |
+ libgcc_dir=$(dirname $(%{target-stage1}-gcc -print-libgcc-file-name))
+ sysroot="$(dirname $(dirname $(pwd)))"
+ target_libgcc_dir="${libgcc_dir#$sysroot}"
+ mkdir -p "%{install-root}/$target_libgcc_dir/include-fixed"
+ cat "gcc/limitx.h" "gcc/glimits.h" "gcc/limity.h" \
+ >"%{install-root}/$target_libgcc_dir/include-fixed/limits.h"
diff --git a/elements/gnu-toolchain/stage2-gcc.bst b/elements/gnu-toolchain/stage2-gcc.bst
new file mode 100644
index 00000000..beaff58f
--- /dev/null
+++ b/elements/gnu-toolchain/stage2-gcc.bst
@@ -0,0 +1,102 @@
+kind: manual
+
+sources:
+- kind: git
+ url: upstream:gcc-tarball
+ track: baserock/gcc-7.1.0
+ ref: 3b0dbcfa2e5d12bd80cab1b35f08653d61fe7838
+
+depends:
+- filename: gnu-toolchain/stage1.bst
+ type: build
+- gnu-toolchain/stage2-linux-api-headers.bst
+- gnu-toolchain/stage2-glibc.bst
+- gnu-toolchain/stage2-gcc-fixed-headers.bst
+- gnu-toolchain/stage2-libstdcxx.bst
+
+variables:
+ prefix: /tools
+
+environment:
+ PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+config:
+ configure-commands:
+ - mkdir o
+
+ # In other projects we specify the sysroot location using CPPFLAGS.
+ # Here, that breaks because GCC compiles stuff for the *build* machine,
+ # too ... and this requires using the host's compiler, which cannot use
+ # the same set of CPPFLAGS as the target. If we specify the sysroot
+ # using CC instead then we don't interfere, because we are only
+ # specifying the *host* C compiler.
+ #
+ # Configure flag notes:
+ # 1. It's vital that this compiler runs in the bootstrap machine, and
+ # targets the same machine (TARGET_STAGE1) so that the stage 1 GCC
+ # is used instead of the compiler of the build machine.
+ # 2. See gcc.morph.
+ # 3. Disable searching /usr/local/include for headers
+ # 4. This flag causes the correct --sysroot flag to be passed when
+ # calling stage 1 GCC.
+ - |
+ case "%{bst-target-arch}" in
+ armv7lhf) ARCH_FLAGS="--with-arch=armv7-a \
+ --with-cpu=cortex-a9 \
+ --with-tune=cortex-a9 \
+ --with-fpu=vfpv3-d16 \
+ --with-float=hard" ;;
+ armv7*) ARCH_FLAGS="--with-arch=armv7-a" ;;
+ esac
+ export STAGE2_SYSROOT="$(dirname $(dirname $(pwd)))"
+ export CC="%{target-stage1}-gcc --sysroot=$STAGE2_SYSROOT"
+ export CXX="%{target-stage1}-g++ --sysroot=$STAGE2_SYSROOT"
+ export AR="%{target-stage1}-ar"
+ export RANLIB="%{target-stage1}-ranlib"
+ cd o && ../configure \
+ $ARCH_FLAGS \
+ --build=$(sh ../config.guess) \
+ `# [1]` --host=%{target-stage1} \
+ `# [1]` --target=%{target-stage1} \
+ --prefix="%{prefix}" \
+ `# [2]` --libdir=%{prefix}/lib \
+ `# [3]` --with-local-prefix=%{prefix} \
+ `# [4]` --with-build-sysroot="$STAGE2_SYSROOT" \
+ --disable-bootstrap \
+ --disable-nls \
+ --disable-multilib \
+ --disable-libgomp \
+ --disable-libstdcxx-pch \
+ --enable-languages=c,c++
+
+ build-commands:
+ - |
+ case "%{bst-target-arch}" in
+ armv5*) sed -i "s/--host=none/--host=armv5/" o/Makefile
+ sed -i "s/--target=none/--target=armv5/" o/Makefile ;;
+ armv7*) sed -i "s/--host=none/--host=armv7a/" o/Makefile
+ sed -i "s/--target=none/--target=armv7a/" o/Makefile ;;
+ esac
+ export STAGE2_SYSROOT="$(dirname $(dirname $(pwd)))"
+ cd o && make
+
+ install-commands:
+ - cd o && make DESTDIR="%{install-root}" install
+
+ # Stage 3 builds need to link against this file in the location that
+ # it will be in the final system, so we make a temporary link now.
+ #
+ # On x86_64 GCC resolutely installs its libraries into lib64. To fix this
+ # would require hobbling the MULTILIB_OSDIRNAMES field in
+ # gcc/config/i386/t-linux64 and this might break things, so for now we
+ # tolerate the inconsistency.
+ - |
+ if [ "$(echo %{target} | cut -c -6)" = "x86_64" ]; then
+ libdir=lib64
+ else
+ libdir=lib
+ fi
+
+ install -d "%{install-root}/lib"
+ ln -s "%{prefix}/$libdir/libgcc_s.so" "%{install-root}/lib/"
+ ln -s "%{prefix}/$libdir/libgcc_s.so.1" "%{install-root}/lib/"
diff --git a/elements/gnu-toolchain/stage2-glibc.bst b/elements/gnu-toolchain/stage2-glibc.bst
new file mode 100644
index 00000000..043dccb4
--- /dev/null
+++ b/elements/gnu-toolchain/stage2-glibc.bst
@@ -0,0 +1,128 @@
+kind: manual
+
+sources:
+- kind: git
+ url: upstream:glibc
+ track: release/2.25/master
+ ref: 49f97e641e4e84a42246655d30adbc4756e67114
+
+depends:
+- filename: gnu-toolchain/stage1.bst
+ type: build
+- filename: gnu-toolchain/stage2-fhs-dirs.bst
+ type: runtime
+- gnu-toolchain/stage2-linux-api-headers.bst
+
+variables:
+ prefix: /tools
+
+environment:
+ PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+config:
+
+ configure-commands:
+ - mkdir o
+
+ # Configure flag notes:
+ # 1. Avoid installing to PREFIX/lib64 on x86_64.
+ # 2. Location of linux-api-headers.
+ # 3. Normal flags. See glibc.morph.
+ # 4. Force configuration values of certain things that can't be detected
+ # in a cross-compile.
+ - |
+ case "%{bst-target-arch}" in
+ armv7*)
+ ARCH_FLAGS="--without-fp" ;;
+ esac
+
+ export CFLAGS="-O2 $CFLAGS"; export CXX=false; \
+ cd o && ../configure \
+ $ARCH_FLAGS \
+ --build=$(../scripts/config.guess) --host=%{target-stage1} \
+ --prefix="%{prefix}" \
+ `# [1]` --libdir="%{prefix}/lib" \
+ `# [2]` --with-headers="%{prefix}/include" \
+ `# [3]` --disable-profile --enable-kernel=2.6.25 \
+ `# [4]` libc_cv_c_cleanup=yes libc_cv_ctors_header=yes \
+ libc_cv_forced_unwind=yes libc_cv_ssp=no
+
+ build-commands:
+ - cd o && make localtime=UTC
+
+ install-commands:
+ - cd o && make install_root="%{install-root}" localtime=UTC install
+ - mkdir -p "%{install-root}/etc"
+ - mkdir -p "%{install-root}/etc/ld.so.conf.d"
+ - |
+ cat <<EOF > ld.so.conf
+ /lib
+ /usr/lib
+ /usr/local/lib
+ include /etc/ld.so.conf.d/*.conf
+ EOF
+ - install -m 644 -o root -g root ld.so.conf "%{install-root}/etc/ld.so.conf"
+ - |
+ # Fix up GCC to handle the sysroot containing glibc being in a different
+ # location for each chunk build.
+ #
+ # For headers, it's enough to pass -B in the CPPFLAGS. This would work for
+ # the startup files (crt*.o) as well, except where libtool is involved (in
+ # which case it strips -B out of your LDFLAGS before calling GCC). We get
+ # around this by making GCC locate them relative to the environment variable
+ # STAGE2_SYSROOT, which we can then set along with CPPFLAGS in each stage 2
+ # chunk build.
+ #
+ # We also force the use of the program loader at PREFIX/lib/ld.so instead
+ # of its usual home in /lib or /lib64, which is necessary for the output of
+ # stage 2 to work as a chroot when building stage 3.
+
+ sysroot="$(dirname $(dirname $(pwd)))"
+ specs_dir="$(dirname $(%{target-stage1}-gcc --print-libgcc-file-name))"
+ target_specs_dir="%{install-root}/${specs_dir#$sysroot}"
+ mkdir -p "$target_specs_dir"
+
+ %{target-stage1}-gcc -dumpspecs |
+ sed -e "s@[gMS]\?crt[1in].o%s@%:getenv(STAGE2_SYSROOT %{libdir}/&)@g" \
+ -e "s@/lib\(64\)\?/ld@%{libdir}/ld@g" \
+ > "$target_specs_dir/specs-for-sysroot"
+
+ # NASTY HACK #
+ # We create a symlink to the actual specs here, so that later the
+ # symlink can be replaced with a dangling link.
+ #
+ # This is necessary as we need to have gcc use its internal specs,
+ # which can differ to the specs generated by `gcc -dumpspecs`.
+ #
+ # The dangling symlink will not make it onto the final system, just
+ # like all other bootstrap only components.
+ ln -s specs-for-sysroot "$target_specs_dir/specs"
+
+ # Install a symlink for the program interpreter (ld.so) so that binaries
+ # built in stage 3 before the stage 3 glibc is built can use it.
+ #
+ # The name of the dynamic loader is hardcoded in GCC during its 'configure'
+ # stage, but the file is actually provided by the libc (usually GLIBC). It
+ # would be better if we could ask GCC or GLIBC what the expected name of the
+ # ld.so is for the given platform rather than figuring it out
+ - install -d %{install-root}/lib
+ - |
+ case "%{bst-target-arch}" in
+ x86_64)
+ install -d "%{install-root}/lib64"
+ ln -s "%{prefix}/lib/ld-linux-x86-64.so.2" \
+ "%{install-root}/lib64/ld-linux-x86-64.so.2" ;;
+ ppc64l)
+ install -d "%{install-root}/lib64"
+ ln -s "%{prefix}/lib/ld64.so.2" \
+ "%{install-root}/lib64/ld64.so.2" ;;
+ ppc64b)
+ install -d "%{install-root}/lib64"
+ ln -s "%{prefix}/lib/ld64.so.1" \
+ "%{install-root}/lib64/ld64.so.1" ;;
+ *)
+ loader=$(basename $(ls "%{install-root}%{prefix}"/lib/ld-linux*))
+ [ -z $loader ] && loader=$(basename $(ls "%{install-root}%{prefix}"/lib/ld.so*))
+ [ -z $loader ] && ( echo "Bug in stage2-glibc ld.so symlinks" ; exit 1 )
+ ln -s "%{prefix}/lib/$loader" "%{install-root}/lib/$loader"
+ esac
diff --git a/elements/gnu-toolchain/stage2-libstdcxx.bst b/elements/gnu-toolchain/stage2-libstdcxx.bst
new file mode 100644
index 00000000..12ea73fa
--- /dev/null
+++ b/elements/gnu-toolchain/stage2-libstdcxx.bst
@@ -0,0 +1,55 @@
+kind: manual
+
+sources:
+- kind: git
+ url: upstream:gcc-tarball
+ track: baserock/gcc-7.1.0
+ ref: 3b0dbcfa2e5d12bd80cab1b35f08653d61fe7838
+
+depends:
+- filename: gnu-toolchain/stage1.bst
+ type: build
+- gnu-toolchain/stage2-linux-api-headers.bst
+- gnu-toolchain/stage2-glibc.bst
+
+variables:
+ prefix: /tools
+
+environment:
+ PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+config:
+ configure-commands:
+ - mkdir o
+
+ # Configure flag notes:
+ # 1. The thread C++ library cannot be built, as the thread C library
+ # was not build in stage1-gcc.
+ # 2. Prevents the installation of precompiled include files, which are
+ # not needed at this stage.
+ # 3. From LFS: the header location of C++ needs to be explicitly given
+ # as we are running the configure script from the top-level
+ # directory.
+ - |
+ export STAGE2_SYSROOT="$(dirname $(dirname $(pwd)))"
+ # -fPIC must be given, otherwise it will not be possible to create
+ # shared libraries linked to libstdc++
+ export CPPFLAGS="--sysroot=$STAGE2_SYSROOT -fPIC"
+ export LDFLAGS="--sysroot=$STAGE2_SYSROOT"
+ cd o && ../libstdc++-v3/configure \
+ --build=$(sh ../config.guess) \
+ --host="%{target-stage1}" \
+ --target="%{target-stage1}" \
+ --prefix="%{prefix}" \
+ --disable-nls \
+ --disable-shared \
+ --disable-multilib \
+ `# [1]` --disable-libstdcxx-threads \
+ `# [2]` --disable-libstdcxx-pch \
+ `# [3]` --with-gxx-include-dir=/tools/%{target-stage1}/include/c++/7.1.0
+
+ build-commands:
+ - cd o && make
+
+ install-commands:
+ - cd o && make DESTDIR="%{install-root}" install
diff --git a/elements/gnu-toolchain/stage2-linux-api-headers.bst b/elements/gnu-toolchain/stage2-linux-api-headers.bst
new file mode 100644
index 00000000..10ec224a
--- /dev/null
+++ b/elements/gnu-toolchain/stage2-linux-api-headers.bst
@@ -0,0 +1,41 @@
+kind: manual
+
+sources:
+- kind: git
+ url: upstream:linux
+ track: v4.0
+ ref: 39a8804455fb23f09157341d3ba7db6d7ae6ee76
+
+depends:
+- filename: gnu-toolchain/stage1.bst
+ type: build
+
+variables:
+ prefix: /tools
+
+environment:
+ PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+config:
+ install-commands:
+ - |
+ case "%{bst-target-arch}" in
+ armv5l)
+ ARCH="arm" ;;
+ armv7b|armv7l|armv7lhf)
+ ARCH="arm" ;;
+ armv8l64|armv8b64)
+ ARCH="arm64" ;;
+ x86_32)
+ ARCH="i386" ;;
+ x86_64)
+ ARCH="x86_64" ;;
+ ppc64b|ppc64l)
+ ARCH="powerpc" ;;
+ *)
+ echo "Error: unsupported architecture: %{bst-target-arch}" >&2
+ exit 1
+ esac
+ ARCH=$ARCH make INSTALL_HDR_PATH=dest headers_install
+ - install -d "%{install-root}%{includedir}"
+ - cp -r dest/include/* "%{install-root}%{includedir}"
diff --git a/elements/gnu-toolchain/stage2-make.bst b/elements/gnu-toolchain/stage2-make.bst
new file mode 100644
index 00000000..9c804f1b
--- /dev/null
+++ b/elements/gnu-toolchain/stage2-make.bst
@@ -0,0 +1,29 @@
+kind: autotools
+
+sources:
+- kind: git
+ url: upstream:make-tarball
+ track: baserock/make-4.1-ttyname-segfault-fix
+ ref: 4978d7129e42340ab9efeb0cb9cae4ad0fa052d4
+
+depends:
+- filename: gnu-toolchain/stage1.bst
+ type: build
+- filename: gnu-toolchain/stage2-fhs-dirs.bst
+ type: runtime
+- gnu-toolchain/stage2-linux-api-headers.bst
+- gnu-toolchain/stage2-glibc.bst
+
+variables:
+ prefix: /tools
+
+environment:
+ PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+config:
+ configure-commands:
+ - STAGE2_SYSROOT="$(dirname $(dirname $(pwd)))" CPPFLAGS="--sysroot=$STAGE2_SYSROOT" CXX=false
+ LDFLAGS="--sysroot=$STAGE2_SYSROOT" ./configure --prefix="%{prefix}" --disable-nls --without-guile
+ --build=$(sh config/config.guess) --host=%{target-stage1}
+ build-commands:
+ - STAGE2_SYSROOT="$(dirname $(dirname $(pwd)))" make
diff --git a/elements/gnu-toolchain/stage2-reset-specs.bst b/elements/gnu-toolchain/stage2-reset-specs.bst
new file mode 100644
index 00000000..5910903e
--- /dev/null
+++ b/elements/gnu-toolchain/stage2-reset-specs.bst
@@ -0,0 +1,35 @@
+kind: manual
+
+depends:
+- filename: gnu-toolchain/stage1.bst
+ type: build
+- filename: gnu-toolchain/stage2-fhs-dirs.bst
+ type: runtime
+- gnu-toolchain/stage2-linux-api-headers.bst
+- gnu-toolchain/stage2-glibc.bst
+
+variables:
+ prefix: /tools
+
+environment:
+ PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+config:
+ # Nasty hack to get around being unable to reliably add configuration to gcc,
+ # hence the gcc specs are modified, combined with Baserock's rootfs protection
+ # preventing specs being modified before builds.
+ # The limitation is overcome by installing files as part of a chunk, which
+ # overwrites previous files.
+ # New specs were added for the bootstrap builds, but after stage2 we start
+ # having chrooted builds, so the old specs need to be replaced.
+ # Unfortunately we can't just replace the specs with the ones gcc produces,
+ # since gcc behaves differently without specs to with specs it produces!
+ # So we use a **NASTY HACK** to replace the specs symlink with one that
+ # points to a file that doesn't exist.
+ install-commands:
+ - |
+ STAGE2_SYSROOT="$(dirname $(dirname $(pwd)))"
+ specs_dir="$(dirname $(%{target-stage1}-gcc -print-libgcc-file-name))"
+ target_specs_dir="%{install-root}/${specs_dir#$STAGE2_SYSROOT}"
+ mkdir -p "$target_specs_dir"
+ ln -s "temporary specs removed by baserock bootstrap" "$target_specs_dir/specs"
diff --git a/elements/gnu-toolchain/stage2.bst b/elements/gnu-toolchain/stage2.bst
new file mode 100644
index 00000000..ccabaf58
--- /dev/null
+++ b/elements/gnu-toolchain/stage2.bst
@@ -0,0 +1,22 @@
+kind: stack
+
+depends:
+- gnu-toolchain/stage2-binutils.bst
+- gnu-toolchain/stage2-busybox.bst
+- gnu-toolchain/stage2-fhs-dirs.bst
+- gnu-toolchain/stage2-glibc.bst
+- gnu-toolchain/stage2-gawk.bst
+- gnu-toolchain/stage2-gcc.bst
+- gnu-toolchain/stage2-linux-api-headers.bst
+- gnu-toolchain/stage2-make.bst
+- gnu-toolchain/stage2-fake-bash.bst
+- gnu-toolchain/stage2-reset-specs.bst
+
+# Stage 2 is a minimal base used to build the
+# base runtime, must ldconfig when building on stage2
+public:
+ bst:
+ integration-commands:
+ - |
+ # In this stage, it may be that ld.so.conf doesnt exist yet
+ ldconfig || exit 0
diff --git a/elements/gnu-toolchain/zlib.bst b/elements/gnu-toolchain/zlib.bst
new file mode 100644
index 00000000..1dd353c5
--- /dev/null
+++ b/elements/gnu-toolchain/zlib.bst
@@ -0,0 +1,23 @@
+kind: manual
+
+sources:
+- kind: git
+ url: upstream:zlib
+ track: v1.2.8
+ ref: 50893291621658f355bc5b4d450a8d06a563053d
+
+depends:
+- filename: gnu-toolchain/stage2.bst
+ type: build
+- gnu-toolchain/glibc.bst
+
+environment:
+ PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
+
+config:
+ configure-commands:
+ - ./configure --prefix="%{prefix}"
+ build-commands:
+ - make
+ install-commands:
+ - make DESTDIR="%{install-root}" install
diff --git a/keys/gnome-sdk.gpg b/keys/gnome-sdk.gpg
new file mode 100644
index 00000000..8434b686
--- /dev/null
+++ b/keys/gnome-sdk.gpg
Binary files differ
diff --git a/project.conf b/project.conf
new file mode 100644
index 00000000..76445475
--- /dev/null
+++ b/project.conf
@@ -0,0 +1,62 @@
+# The GNU Toolchain project provides a base runtime with gcc,
+# glibc and some base tools to get off the ground including
+# busybox and GNU make.
+name: gnu-toolchain
+
+aliases:
+ upstream: git://git.baserock.org/delta/
+ baserock: git://git.baserock.org/baserock/
+ gnomesdk: https://sdk.gnome.org/
+
+# All the elements go here
+element-path: elements
+
+variables:
+ cpu: "%{bst-target-arch}"
+ abi: gnu
+ target-stage1: "%{cpu}-bootstrap-linux-%{abi}"
+ target: "%{cpu}-baserock-linux-%{abi}"
+
+# Resolve the cpu and ABI portions of the host triple based
+# on architecture names.
+arches:
+ x86_32:
+ variables:
+ cpu: i686
+ armv5l:
+ variables:
+ abi: gnueabi
+ armv7b:
+ variables:
+ abi: gnueabi
+ armv7l:
+ variables:
+ abi: gnueabi
+ armv7lhf:
+ variables:
+ abi: gnueabi
+ armv8l64:
+ variables:
+ cpu: aarch64
+ armv8b64:
+ variables:
+ cpu: aarch64_be
+ mips64b:
+ variables:
+ cpu: mips64
+ abi: gnuabi64
+ mips64l:
+ variables:
+ cpu: mips64el
+ mips32b:
+ variables:
+ cpu: mips
+ mips32l:
+ variables:
+ cpu: mipsel
+ ppc64b:
+ variables:
+ cpu: powerpc64
+ ppc64l:
+ variables:
+ cpu: powerpc64le