From f501976babcc283c7d2ae4bea25e5feefc4b98c2 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Wed, 22 Mar 2017 09:47:09 +0000 Subject: Moved all elements under the elements directory --- elements/gnu-toolchain/stage2-glibc.bst | 122 ++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 elements/gnu-toolchain/stage2-glibc.bst (limited to 'elements/gnu-toolchain/stage2-glibc.bst') diff --git a/elements/gnu-toolchain/stage2-glibc.bst b/elements/gnu-toolchain/stage2-glibc.bst new file mode 100644 index 00000000..1c3745e1 --- /dev/null +++ b/elements/gnu-toolchain/stage2-glibc.bst @@ -0,0 +1,122 @@ +kind: manual + +sources: +- kind: git + url: upstream:glibc + track: release/2.22/master + ref: b995d95a5943785be3ab862b2d3276f3b4a22481 + +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-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 < 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. + # FIXME: get a better way of finding the name of the loader. The lib64 + # path is hardcoded into glibc in the file + # sysdeps/unix/sysv/linux/configure. + - install -d %{install-root}/lib + - | + case "%{bst-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" ;; + ppc64) + 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 -- cgit v1.2.1 From aaefeb1e22579deef6a7829d055eee70c8a7a4f0 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Tue, 20 Jun 2017 08:58:28 +0000 Subject: Update GCC to 7.1.0, and GLIBC to 2.25 --- elements/gnu-toolchain/stage2-glibc.bst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'elements/gnu-toolchain/stage2-glibc.bst') diff --git a/elements/gnu-toolchain/stage2-glibc.bst b/elements/gnu-toolchain/stage2-glibc.bst index 1c3745e1..63740088 100644 --- a/elements/gnu-toolchain/stage2-glibc.bst +++ b/elements/gnu-toolchain/stage2-glibc.bst @@ -3,8 +3,8 @@ kind: manual sources: - kind: git url: upstream:glibc - track: release/2.22/master - ref: b995d95a5943785be3ab862b2d3276f3b4a22481 + track: release/2.25/master + ref: 49f97e641e4e84a42246655d30adbc4756e67114 depends: - filename: gnu-toolchain/stage1.bst -- cgit v1.2.1 From 23a3a3c746261c3ecb2aa961d91f988f0602a032 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Wed, 14 Jun 2017 22:58:52 +0100 Subject: Support cross-building the stage1 and stage2 components This requires a feature recently added to BuildStream (in commit 03906221) that adds a framework for elements to support being cross-compiled. To build an armv8l64 native toolchain and sysroot on an x86_64 build machine, for example, you can do this: bst build --target-arch=armv8l64 gnu-toolchain/stage2.bst You can then run `bst checkout` to get at the resulting binaries and copy them onto an armv8l64 machine where they can be executed. --- elements/gnu-toolchain/stage2-glibc.bst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'elements/gnu-toolchain/stage2-glibc.bst') diff --git a/elements/gnu-toolchain/stage2-glibc.bst b/elements/gnu-toolchain/stage2-glibc.bst index 63740088..a5153c5b 100644 --- a/elements/gnu-toolchain/stage2-glibc.bst +++ b/elements/gnu-toolchain/stage2-glibc.bst @@ -31,7 +31,7 @@ config: # 4. Force configuration values of certain things that can't be detected # in a cross-compile. - | - case "%{bst-arch}" in + case "%{bst-target-arch}" in armv7*) ARCH_FLAGS="--without-fp" ;; esac @@ -105,12 +105,12 @@ config: # sysdeps/unix/sysv/linux/configure. - install -d %{install-root}/lib - | - case "%{bst-arch}" in + 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" ;; - ppc64) + ppc64l|ppc64b) install -d "%{install-root}/lib64" ln -s "%{prefix}/lib/ld64.so.1" \ "%{install-root}/lib64/ld64.so.1" ;; -- cgit v1.2.1 From 28dba2a2843bf6d5c16256a8e4df47ce18ec48f1 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Mon, 19 Jun 2017 12:43:09 +0000 Subject: Proper support for powerpc64 (little and big endian) --- elements/gnu-toolchain/stage2-glibc.bst | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'elements/gnu-toolchain/stage2-glibc.bst') diff --git a/elements/gnu-toolchain/stage2-glibc.bst b/elements/gnu-toolchain/stage2-glibc.bst index a5153c5b..043dccb4 100644 --- a/elements/gnu-toolchain/stage2-glibc.bst +++ b/elements/gnu-toolchain/stage2-glibc.bst @@ -100,9 +100,11 @@ config: # 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. - # FIXME: get a better way of finding the name of the loader. The lib64 - # path is hardcoded into glibc in the file - # sysdeps/unix/sysv/linux/configure. + # + # 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 @@ -110,7 +112,11 @@ config: 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|ppc64b) + 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" ;; -- cgit v1.2.1