summaryrefslogtreecommitdiff
path: root/strata/build-essential/gcc-runtime.morph
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2016-03-05 21:58:25 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2016-03-08 17:31:34 +0900
commit7361c3715115ec4b2afe6c2a63e677476746391c (patch)
tree7db2d3b847bf46f840cbb4d8b078b4ddf5f1592e /strata/build-essential/gcc-runtime.morph
parentfab3afb984b8344ff272b9889c079156a7698c22 (diff)
downloaddefinitions-7361c3715115ec4b2afe6c2a63e677476746391c.tar.gz
Adding gcc-runtime to the new build-essential
This chunk completes the glibc runtime, gcc needs to be compiled with the musl host and glibc target so that we have gcc runtimes and libstdc++ compiled against the host glibc.
Diffstat (limited to 'strata/build-essential/gcc-runtime.morph')
-rw-r--r--strata/build-essential/gcc-runtime.morph94
1 files changed, 94 insertions, 0 deletions
diff --git a/strata/build-essential/gcc-runtime.morph b/strata/build-essential/gcc-runtime.morph
new file mode 100644
index 00000000..d0894aed
--- /dev/null
+++ b/strata/build-essential/gcc-runtime.morph
@@ -0,0 +1,94 @@
+name: gcc-runtime
+kind: chunk
+build-system: autotools
+configure-commands:
+- mkdir o
+- |
+ case "$MORPH_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
+ MUSL_TRIPLE=${MORPH_ARCH}-unknown-linux-musl
+ GNU_TRIPLE=${MORPH_ARCH}-unknown-linux-gnu
+ case "$MORPH_ARCH" in
+ arm*)
+ MUSL_TRIPLE=${MUSL_TRIPLE}eabi
+ GNU_TRIPLE=${GNU_TRIPLE}eabi
+ ;;
+ esac
+
+ # Do some really ugly setup stuff here, writing outside of our build area
+ #
+ ln -s . /usr/${GNU_TRIPLE}
+ ln -s /tools/usr/cc /usr/cc
+ ln -s /tools/usr/c++ /usr/c++
+ cd o
+
+ # Finally we're ready to run configure
+ #
+ RANLIB=`which ranlib` AR=`which ar` RANLIB_FOR_TARGET=`which ranlib` \
+ AR_FOR_TARGET=`which ar` NM_FOR_TARGET=`which nm` AS_FOR_TARGET=`which as` \
+ ac_cv_path_AR_FOR_TARGET=`which ar` \
+ ac_cv_path_RANLIB_FOR_TARGET=`which ranlib` \
+ ac_cv_path_NM_FOR_TARGET=`which nm` \
+ ac_cv_path_AS_FOR_TARGET=`which as` \
+ ac_cv_path_LD_FOR_TARGET=`which ld` \
+ ../configure $ARCH_FLAGS --prefix="$PREFIX" \
+ --build=${MUSL_TRIPLE} \
+ --host=${MUSL_TRIPLE} \
+ --target=${GNU_TRIPLE} \
+ --disable-multilib --disable-libmudflap \
+ --disable-libsanitizer --enable-tls --disable-lto \
+ --disable-nls --enable-c99 --enable-__cxa_atexit \
+ --enable-long-long --enable-shared \
+ --enable-threads=posix --enable-languages=c,c++
+build-commands:
+- |
+ # Here we specify LD_LIBRARY_PATH so that the built host tools which
+ # run during the gcc build find the musl based libstdc++
+ export LD_LIBRARY_PATH=/tools/usr/lib
+ cd o
+ make
+install-commands:
+- |
+ # Resolve our target triple again
+ GNU_TRIPLE=${MORPH_ARCH}-unknown-linux-gnu
+ case "$MORPH_ARCH" in
+ arm*)
+ GNU_TRIPLE=${GNU_TRIPLE}eabi
+ ;;
+ esac
+
+ # Thats right, still need to run C++ programs we built
+ # at install time, so still need to set LD_LIBRARY_PATH
+ export LD_LIBRARY_PATH=/tools/usr/lib
+ cd o
+ make DESTDIR=`pwd`/temp install
+
+ # Create compiler specific directories that ccwrap searches in
+ mkdir -p ${DESTDIR}/usr/cc/lib
+ mkdir -p ${DESTDIR}/usr/c++
+
+ # Get rid of a pesky directory first
+ rm -rf temp/usr/lib/gcc/*/*/install-tools
+
+ # Move the C headers in place
+ mv temp/usr/lib/gcc/*/*/include ${DESTDIR}/usr/cc/include
+
+ # Move gcc start/end stubs and static libraries in place,
+ # this also includes the 'fixed-headers' directory
+ #
+ mv temp/usr/lib/gcc/*/*/* ${DESTDIR}/usr/cc/lib
+
+ # Move C++ headers in place
+ mv temp/usr/${GNU_TRIPLE}/include/c++/* ${DESTDIR}/usr/c++/include
+
+ # Link the extra include path, the ccwrap program expects it in extra-includes
+ ln -s ${GNU_TRIPLE} ${DESTDIR}/usr/c++/include/extra-includes
+
+ # Finally move the target libstdc++ and other target libraries into the regular libdir
+ mv temp/usr/${GNU_TRIPLE}/lib ${DESTDIR}/usr/lib