diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2013-03-15 16:22:30 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2013-03-15 16:22:30 +0000 |
commit | 8fb3844421f5f1a8d559a062a85d8b4b7addb92c (patch) | |
tree | e659ec1d01176c3cc4e7f817f68c2171cc52992e | |
parent | 8e7ed389991ffb569dd5bc44883e814d4d14ff39 (diff) | |
parent | 20e6d36c600d01da323a3db2a2889aea7e2c073a (diff) | |
download | eglibc2-8fb3844421f5f1a8d559a062a85d8b4b7addb92c.tar.gz |
Merge branch 'baserock/samthursfield/build-essential-2-rebase' into baserock/2.15-build-essential
-rw-r--r--[-rwxr-xr-x] | eglibc.morph | 6 | ||||
-rw-r--r-- | eglibc.morph.yaml | 25 | ||||
-rwxr-xr-x | morph-arch-config | 10 | ||||
-rw-r--r-- | stage2-eglibc-fix-specs | 26 | ||||
-rw-r--r-- | stage2-eglibc.morph | 18 | ||||
-rw-r--r-- | stage2-eglibc.morph.yaml | 52 |
6 files changed, 133 insertions, 4 deletions
diff --git a/eglibc.morph b/eglibc.morph index 0d88226a5..6d5da0352 100755..100644 --- a/eglibc.morph +++ b/eglibc.morph @@ -2,11 +2,9 @@ "name": "eglibc", "kind": "chunk", "configure-commands": [ - "cd libc && ln -s ../ports ports", "mkdir o", - "cd o && touch configure-flags", - "cd o && if echo \"$TOOLCHAIN_TARGET\" | grep arm; then echo \"--without-fp\" > configure-flags; fi", - "SYSROOT=\"$PREFIX\"; cd o && CFLAGS=\"-O2 $CFLAGS\" ../libc/configure $(cat configure-flags) --prefix=\"$PREFIX\" --disable-profile --enable-add-ons --enable-kernel=2.6.25 --with-headers=\"$SYSROOT/include\" --without-cvs --without-selinux libc_cv_c_cleanup=yes libc_cv_ctors_header=yes libc_cv_forced_unwind=yes libc_cv_ssp=no" + "cd libc && ln -s ../ports ports", + "export CFLAGS=\"-O2 $CFLAGS\"; cd o &&\n../libc/configure \\\n $(morph-arch-config) \\\n --prefix=\"$PREFIX\" \\\n --disable-profile \\\n --enable-kernel=2.6.25 \\\n --enable-add-ons=nptl,ports \\\n --without-cvs \\\n --without-selinux\n" ], "build-commands": [ "cd o && make localtime=UTC" diff --git a/eglibc.morph.yaml b/eglibc.morph.yaml new file mode 100644 index 000000000..834e08771 --- /dev/null +++ b/eglibc.morph.yaml @@ -0,0 +1,25 @@ +name: eglibc +kind: chunk + +configure-commands: + - mkdir o + + # Necessary for ARM port + - cd libc && ln -s ../ports ports + + - | + export CFLAGS="-O2 $CFLAGS"; cd o && + ../libc/configure \ + $(morph-arch-config) \ + --prefix="$PREFIX" \ + --disable-profile \ + --enable-kernel=2.6.25 \ + --enable-add-ons=nptl,ports \ + --without-cvs \ + --without-selinux + +build-commands: + - cd o && make localtime=UTC + +install-commands: + - cd o && make install_root="$DESTDIR" localtime=UTC install diff --git a/morph-arch-config b/morph-arch-config new file mode 100755 index 000000000..e13b36496 --- /dev/null +++ b/morph-arch-config @@ -0,0 +1,10 @@ +#!/bin/sh + +# morph-arch-config: ouput eglibc-specific configuration for specific +# Morph architectures + +# Morph does not support hard float platforms for now +case "$MORPH_ARCH" in + armv7*) echo "--without-fp" ;; +esac + diff --git a/stage2-eglibc-fix-specs b/stage2-eglibc-fix-specs new file mode 100644 index 000000000..82e292036 --- /dev/null +++ b/stage2-eglibc-fix-specs @@ -0,0 +1,26 @@ +#!/bin/sh + +# Fix up GCC to handle the sysroot containing eglibc 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. + +set -eu + +specs_dir="$(dirname $($TARGET_STAGE1-gcc --print-libgcc-file-name))" +mkdir -p "$specs_dir" + +$TARGET_STAGE1-gcc -dumpspecs | \ + sed -e "s@[gMS]\?crt[1in].o%s@%:getenv(STAGE2_SYSROOT $PREFIX/lib/&)@g" \ + -e "s@/lib\(64\)\?/ld@$PREFIX/lib/ld@g" \ + > "$specs_dir/specs" + diff --git a/stage2-eglibc.morph b/stage2-eglibc.morph new file mode 100644 index 000000000..756227262 --- /dev/null +++ b/stage2-eglibc.morph @@ -0,0 +1,18 @@ +{ + "name": "stage2-eglibc", + "kind": "chunk", + "configure-commands": [ + "mkdir o", + "cd libc && ln -s ../ports ports", + "export CFLAGS=\"-O2 $CFLAGS\"; export CXX=false; \\\ncd o && ../libc/configure \\\n $(morph-arch-config) \\\n --build=$(../libc/scripts/config.guess) --host=$TARGET_STAGE1 \\\n --prefix=\"$PREFIX\" \\\n `# [1]` --libdir=\"$PREFIX/lib\" \\\n `# [2]` --with-headers=\"$(pwd)/../../$PREFIX/include\" \\\n `# [3]` --disable-profile --enable-kernel=2.6.25 \\\n --enable-add-ons=nptl,ports --without-cvs --without-selinux \\\n `# [4]` libc_cv_c_cleanup=yes libc_cv_ctors_header=yes \\\n libc_cv_forced_unwind=yes libc_cv_ssp=no\n" + ], + "build-commands": [ + "cd o && make localtime=UTC" + ], + "install-commands": [ + "cd o && make install_root=\"$DESTDIR\" localtime=UTC install", + "install -m 755 stage2-eglibc-fix-specs $DESTDIR$PREFIX/bin", + "install -d $DESTDIR/lib", + "cpu=$(echo $TARGET | cut -d '-' -f 1)\nif [ \"$cpu\" == \"x86_64\" ]; then\n install -d \"$DESTDIR/lib64\"\n ln -s \"$PREFIX/lib/ld-linux-x86-64.so.2\" \\\n \"$DESTDIR/lib64/ld-linux-x86-64.so.2\"\nelse\n loader=$(basename $(ls \"$DESTDIR$PREFIX\"/lib/ld-linux*))\n ln -s \"$PREFIX/lib/$loader\" \"$DESTDIR/lib/$loader\"\nfi\n" + ] +} diff --git a/stage2-eglibc.morph.yaml b/stage2-eglibc.morph.yaml new file mode 100644 index 000000000..371199084 --- /dev/null +++ b/stage2-eglibc.morph.yaml @@ -0,0 +1,52 @@ +name: stage2-eglibc +kind: chunk + +configure-commands: + - mkdir o + + # Necessary for ARM port + - cd libc && ln -s ../ports ports + + # Configure flag notes: + # 1. Avoid installing to PREFIX/lib64 on x86_64. + # 2. Location of linux-api-headers. + # 3. Normal flags. See eglibc.morph. + # 4. Force configuration values of certain things that can't be detected + # in a cross-compile. + - | + export CFLAGS="-O2 $CFLAGS"; export CXX=false; \ + cd o && ../libc/configure \ + $(morph-arch-config) \ + --build=$(../libc/scripts/config.guess) --host=$TARGET_STAGE1 \ + --prefix="$PREFIX" \ + `# [1]` --libdir="$PREFIX/lib" \ + `# [2]` --with-headers="$(pwd)/../../$PREFIX/include" \ + `# [3]` --disable-profile --enable-kernel=2.6.25 \ + --enable-add-ons=nptl,ports --without-cvs --without-selinux \ + `# [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="$DESTDIR" localtime=UTC install + - install -m 755 stage2-eglibc-fix-specs $DESTDIR$PREFIX/bin + + # Install a symlink for the program interpreter (ld.so) so that binaries + # built in stage 3 before the stage 3 eglibc is built can use it. + # FIXME: get a better way of finding the name of the loader. The lib64 + # path is hardcoded into eglibc in the file + # sysdeps/unix/sysv/linux/configure. + - install -d $DESTDIR/lib + - | + cpu=$(echo $TARGET | cut -d '-' -f 1) + if [ "$cpu" == "x86_64" ]; then + install -d "$DESTDIR/lib64" + ln -s "$PREFIX/lib/ld-linux-x86-64.so.2" \ + "$DESTDIR/lib64/ld-linux-x86-64.so.2" + else + loader=$(basename $(ls "$DESTDIR$PREFIX"/lib/ld-linux*)) + ln -s "$PREFIX/lib/$loader" "$DESTDIR/lib/$loader" + fi + |