diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2013-02-08 16:20:20 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2013-03-11 13:31:40 +0000 |
commit | 6c076e87772ff70fa600f1e126c392a8e3a01b71 (patch) | |
tree | 135c8ef83768c84a199b0a4e879114e214d6bc4c | |
parent | 8e7ed389991ffb569dd5bc44883e814d4d14ff39 (diff) | |
download | eglibc2-6c076e87772ff70fa600f1e126c392a8e3a01b71.tar.gz |
Add morphs for build-essential bootstrap
JSON versions are generated from .yaml versions using the edit-morph
script in the Morph source tree:
'scripts/edit-morph to-json *.morph.yaml'
The .morph files themselves should be converted to YAML after the next
Baserock release.
-rw-r--r--[-rwxr-xr-x] | eglibc.morph | 8 | ||||
-rw-r--r-- | eglibc.morph.yaml | 29 | ||||
-rw-r--r-- | stage2-eglibc-fix-specs | 26 | ||||
-rw-r--r-- | stage2-eglibc.morph | 20 | ||||
-rw-r--r-- | stage2-eglibc.morph.yaml | 56 |
5 files changed, 135 insertions, 4 deletions
diff --git a/eglibc.morph b/eglibc.morph index 0d88226a5..755d84183 100755..100644 --- a/eglibc.morph +++ b/eglibc.morph @@ -2,11 +2,11 @@ "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", + "cd o && touch extra-configure-flags", + "cd o && if echo \"$TOOLCHAIN_TARGET\" | grep arm; then\n echo \"--without-fp\" > extra-configure-flags;\nfi\n", + "CFLAGS=\"-O2 $CFLAGS\"; cd o &&\n../libc/configure $(cat extra-configure-flags) \\\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..ff8a1a3f9 --- /dev/null +++ b/eglibc.morph.yaml @@ -0,0 +1,29 @@ +name: eglibc +kind: chunk + +configure-commands: + - mkdir o + + # Necessary for ARM port + - cd libc && ln -s ../ports ports + - cd o && touch extra-configure-flags + - | + cd o && if echo "$TOOLCHAIN_TARGET" | grep arm; then + echo "--without-fp" > extra-configure-flags; + fi + + - | + CFLAGS="-O2 $CFLAGS"; cd o && + ../libc/configure $(cat extra-configure-flags) \ + --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/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..b2a3fde30 --- /dev/null +++ b/stage2-eglibc.morph @@ -0,0 +1,20 @@ +{ + "name": "stage2-eglibc", + "kind": "chunk", + "configure-commands": [ + "mkdir o", + "cd libc && ln -s ../ports ports", + "cd o && touch extra-configure-flags", + "cd o && if echo \"$TARGET\" | grep arm; then \\\n echo \"--without-fp\" > extra-configure-flags; \\\nfi\n", + "CFLAGS=\"-O2 $CFLAGS\"; \\\ncd o && ../libc/configure $(cat extra-configure-flags) \\\n --prefix=\"$PREFIX\" --build=$BUILD --host=$TARGET_STAGE1 \\\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..bc02a2ba9 --- /dev/null +++ b/stage2-eglibc.morph.yaml @@ -0,0 +1,56 @@ +name: stage2-eglibc +kind: chunk + +configure-commands: + - mkdir o + + # Necessary for ARM port + - cd libc && ln -s ../ports ports + - cd o && touch extra-configure-flags + - | + cd o && if echo "$TARGET" | grep arm; then \ + echo "--without-fp" > extra-configure-flags; \ + fi + + # Configure flag notes: + # 1. If prefix is set to /usr, without this flag eglibc decides to + # install its libraries in /usr/lib64 on Linux. + # 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. + - | + CFLAGS="-O2 $CFLAGS"; \ + cd o && ../libc/configure $(cat extra-configure-flags) \ + --prefix="$PREFIX" --build=$BUILD --host=$TARGET_STAGE1 \ + `# [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 + |