diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-02-01 20:37:29 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-02-03 19:48:45 +0900 |
commit | d85382e41efbe3f3f9012a08851f93bb4919de65 (patch) | |
tree | bdcdac1cd8463f6847b2b30a6b643e715144372d /build-essential/stage2-gcc.bst | |
parent | 7d6dc7242598361009ab492db2367e545fc53189 (diff) | |
download | definitions-d85382e41efbe3f3f9012a08851f93bb4919de65.tar.gz |
Manual conversion of Baserock's build-essential stratum
This huge commit is a manual conversion, notes on what was
needed:
o project.conf defines the arch specific stuff which was
previously hardcoded into YBD, so the stage1 target and target
etc are all defined by the build-essential project.conf
o Direct and easy changes for git source representation
o Added stage1.bst & stage2.bst "stacks", everything built in
stage2 build-depends on stage1.bst, and the final build-essential
products build-depend on stage2.bst (note build-depend means
to depend _only_ for building, not propagated forward).
o Instead of using host tools we build on the GNOME flatpak
sdk/platform bundles
o Some build-essential morph files use $(dirname $(pwd)) for a sysroot,
which is weird, it means the morph files rely on building at one directory
below the slash sysroot - in buildstream we build in /buildstream/build
which is two - had to replace these with $(dirname $(dirname $(pwd))) instead
o Remove the devices sections from the fhs-dirs elements, not allowed
to create static device nodes in buildstream.
Diffstat (limited to 'build-essential/stage2-gcc.bst')
-rw-r--r-- | build-essential/stage2-gcc.bst | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/build-essential/stage2-gcc.bst b/build-essential/stage2-gcc.bst new file mode 100644 index 00000000..445fe6f7 --- /dev/null +++ b/build-essential/stage2-gcc.bst @@ -0,0 +1,102 @@ +kind: manual + +sources: +- kind: git + url: upstream:gcc-tarball + track: baserock/build-essential + ref: b3c9b176c1f10ebeff5700eb3760e9511f23fa06 + +depends: +- filename: build-essential/stage1.bst + type: build +- build-essential/stage2-linux-api-headers.bst +- build-essential/stage2-glibc.bst +- build-essential/stage2-gcc-fixed-headers.bst +- build-essential/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-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-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/" |