Find nacl-gcc via PATH rather than hard-coding a relative pathname
authorMark Seaborn <mrs@mythic-beasts.com>
Mon, 18 Jan 2010 13:05:53 +0000 (18 13:05 +0000)
committerMark Seaborn <mrs@mythic-beasts.com>
Mon, 18 Jan 2010 13:05:53 +0000 (18 13:05 +0000)
Allows the glibc source tree to be put in a different location.

link-libcso.sh
make-example-dynamic.sh
make-example.sh
myconfig.sh

dissimilarity index 73%
index bbcf946..60dfb1b 100755 (executable)
@@ -1,39 +1,39 @@
-#!/bin/bash
-
-# This script is a shortcut for building libc.so, the dynamic linker,
-# and some other libraries.
-# It's faster than running make on glibc.
-
-set -e
-
-BUILD=build
-
-echo - ld.so
-../tools_bin/linux/sdk/nacl-sdk/bin/nacl-gcc \
-    -nostdlib -nostartfiles -shared \
-    -o $BUILD/elf/ld.so                        \
-    -Wl,-z,relro -Wl,--hash-style=both -Wl,-z,defs     \
-    $BUILD/elf/librtld.os -Wl,--version-script=$BUILD/ld.map           \
-    -Wl,-Map,$BUILD/elf/ld.so.map                              \
-    -Wl,-soname=ld-linux.so.2 -Lld
-
-echo - libc_pic.os
-../tools_bin/linux/sdk/nacl-sdk/bin/nacl-gcc \
-    -nostdlib -nostartfiles -r -o $BUILD/libc_pic.os \
-    -Wl,-d -Wl,--whole-archive $BUILD/libc_pic.a \
-    -Wl,-Map,$BUILD/libc_pic.os.map
-
-echo - libc.so
-../tools_bin/linux/sdk/nacl-sdk/bin/nacl-gcc   -shared -static-libgcc -Wl,-O1  -Wl,-z,defs -Wl,-dynamic-linker=/lib/ld-linux.so.2  -B$BUILD/csu/  -Wl,--version-script=$BUILD/libc.map -Wl,-soname=libc.so.6 -Wl,-z,relro -Wl,--hash-style=both -nostdlib -nostartfiles -e __libc_main -L$BUILD -L$BUILD/math -L$BUILD/elf -L$BUILD/dlfcn -L$BUILD/nss -L$BUILD/nis -L$BUILD/rt -L$BUILD/resolv -L$BUILD/crypt -L$BUILD/nptl -Wl,-rpath-link=$BUILD:$BUILD/math:$BUILD/elf:$BUILD/dlfcn:$BUILD/nss:$BUILD/nis:$BUILD/rt:$BUILD/resolv:$BUILD/crypt:$BUILD/nptl -o $BUILD/libc.so $BUILD/csu/abi-note.o $BUILD/elf/soinit.os $BUILD/libc_pic.os $BUILD/elf/sofini.os $BUILD/elf/interp.os $BUILD/elf/ld.so -lgcc -Lld \
-    -Wl,-Map,$BUILD/libc.so.map
-
-echo - libdl.so
-../tools_bin/linux/sdk/nacl-sdk/bin/nacl-gcc -L$BUILD/../ld   -shared -static-libgcc -Wl,-O1  -Wl,-z,defs -Wl,-dynamic-linker=/work/nacl/2/googleclient/native_client/install/lib/ld-linux.so.2  -B$BUILD/csu/  -Wl,--version-script=$BUILD/libdl.map -Wl,-soname=libdl.so.2 -Wl,-z,relro -Wl,--hash-style=both  -L$BUILD -L$BUILD/math -L$BUILD/elf -L$BUILD/dlfcn -L$BUILD/nss -L$BUILD/nis -L$BUILD/rt -L$BUILD/resolv -L$BUILD/crypt -L$BUILD/nptl -Wl,-rpath-link=$BUILD:$BUILD/math:$BUILD/elf:$BUILD/dlfcn:$BUILD/nss:$BUILD/nis:$BUILD/rt:$BUILD/resolv:$BUILD/crypt:$BUILD/nptl -o $BUILD/dlfcn/libdl.so $BUILD/csu/abi-note.o -Wl,--whole-archive $BUILD/dlfcn/libdl_pic.a -Wl,--no-whole-archive $BUILD/elf/interp.os $BUILD/libc.so $BUILD/libc_nonshared.a $BUILD/elf/ld.so  \
-    -Wl,-Map,$BUILD/dlfcn/libdl.so.map
-
-echo - libmemusage.so
-../tools_bin/linux/sdk/nacl-sdk/bin/nacl-gcc -L$BUILD/../ld   -shared -static-libgcc -Wl,-O1  -Wl,-z,defs -Wl,-dynamic-linker=/work/nacl/2/googleclient/native_client/install/lib/ld-linux.so.2  -B$BUILD/csu/   -Wl,-soname=libmemusage.so -Wl,-z,relro -Wl,--hash-style=both  -L$BUILD -L$BUILD/math -L$BUILD/elf -L$BUILD/dlfcn -L$BUILD/nss -L$BUILD/nis -L$BUILD/rt -L$BUILD/resolv -L$BUILD/crypt -L$BUILD/nptl -Wl,-rpath-link=$BUILD:$BUILD/math:$BUILD/elf:$BUILD/dlfcn:$BUILD/nss:$BUILD/nis:$BUILD/rt:$BUILD/resolv:$BUILD/crypt:$BUILD/nptl -o $BUILD/malloc/libmemusage.so $BUILD/csu/abi-note.o -Wl,--whole-archive $BUILD/malloc/libmemusage_pic.a -Wl,--no-whole-archive $BUILD/elf/interp.os $BUILD/dlfcn/libdl.so $BUILD/elf/ld.so  \
-    -Wl,-Map,$BUILD/malloc/libmemusage.so.map
-
-echo - libpthread.so
-../tools_bin/linux/sdk/nacl-sdk/bin/nacl-gcc -L$BUILD/../ld   -shared -static-libgcc -Wl,-O1  -Wl,-z,defs -Wl,-dynamic-linker=/work/nacl/3/googleclient/native_client/install/lib/ld-linux.so.2 -B$BUILD/nptl/ -B$BUILD/csu/ -B$BUILD/nptl/ -Wl,--version-script=$BUILD/libpthread.map -Wl,-soname=libpthread.so.0 -Wl,-z,relro -Wl,--hash-style=both -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst -e __nptl_main -L$BUILD -L$BUILD/math -L$BUILD/elf -L$BUILD/dlfcn -L$BUILD/nss -L$BUILD/nis -L$BUILD/rt -L$BUILD/resolv -L$BUILD/crypt -L$BUILD/nptl -Wl,-rpath-link=$BUILD:$BUILD/math:$BUILD/elf:$BUILD/dlfcn:$BUILD/nss:$BUILD/nis:$BUILD/rt:$BUILD/resolv:$BUILD/crypt:$BUILD/nptl -o $BUILD/nptl/libpthread.so $BUILD/csu/abi-note.o -Wl,--whole-archive $BUILD/nptl/libpthread_pic.a -Wl,--no-whole-archive $BUILD/elf/interp.os $BUILD/libc.so $BUILD/libc_nonshared.a $BUILD/elf/ld.so 
+#!/bin/bash
+
+# This script is a shortcut for building libc.so, the dynamic linker,
+# and some other libraries.
+# It's faster than running make on glibc.
+
+set -e
+
+BUILD=build
+
+echo - ld.so
+nacl-gcc \
+    -nostdlib -nostartfiles -shared \
+    -o $BUILD/elf/ld.so                        \
+    -Wl,-z,relro -Wl,--hash-style=both -Wl,-z,defs     \
+    $BUILD/elf/librtld.os -Wl,--version-script=$BUILD/ld.map           \
+    -Wl,-Map,$BUILD/elf/ld.so.map                              \
+    -Wl,-soname=ld-linux.so.2 -Lld
+
+echo - libc_pic.os
+nacl-gcc \
+    -nostdlib -nostartfiles -r -o $BUILD/libc_pic.os \
+    -Wl,-d -Wl,--whole-archive $BUILD/libc_pic.a \
+    -Wl,-Map,$BUILD/libc_pic.os.map
+
+echo - libc.so
+nacl-gcc   -shared -static-libgcc -Wl,-O1  -Wl,-z,defs -Wl,-dynamic-linker=/lib/ld-linux.so.2  -B$BUILD/csu/  -Wl,--version-script=$BUILD/libc.map -Wl,-soname=libc.so.6 -Wl,-z,relro -Wl,--hash-style=both -nostdlib -nostartfiles -e __libc_main -L$BUILD -L$BUILD/math -L$BUILD/elf -L$BUILD/dlfcn -L$BUILD/nss -L$BUILD/nis -L$BUILD/rt -L$BUILD/resolv -L$BUILD/crypt -L$BUILD/nptl -Wl,-rpath-link=$BUILD:$BUILD/math:$BUILD/elf:$BUILD/dlfcn:$BUILD/nss:$BUILD/nis:$BUILD/rt:$BUILD/resolv:$BUILD/crypt:$BUILD/nptl -o $BUILD/libc.so $BUILD/csu/abi-note.o $BUILD/elf/soinit.os $BUILD/libc_pic.os $BUILD/elf/sofini.os $BUILD/elf/interp.os $BUILD/elf/ld.so -lgcc -Lld \
+    -Wl,-Map,$BUILD/libc.so.map
+
+echo - libdl.so
+nacl-gcc -L$BUILD/../ld   -shared -static-libgcc -Wl,-O1  -Wl,-z,defs -Wl,-dynamic-linker=/work/nacl/2/googleclient/native_client/install/lib/ld-linux.so.2  -B$BUILD/csu/  -Wl,--version-script=$BUILD/libdl.map -Wl,-soname=libdl.so.2 -Wl,-z,relro -Wl,--hash-style=both  -L$BUILD -L$BUILD/math -L$BUILD/elf -L$BUILD/dlfcn -L$BUILD/nss -L$BUILD/nis -L$BUILD/rt -L$BUILD/resolv -L$BUILD/crypt -L$BUILD/nptl -Wl,-rpath-link=$BUILD:$BUILD/math:$BUILD/elf:$BUILD/dlfcn:$BUILD/nss:$BUILD/nis:$BUILD/rt:$BUILD/resolv:$BUILD/crypt:$BUILD/nptl -o $BUILD/dlfcn/libdl.so $BUILD/csu/abi-note.o -Wl,--whole-archive $BUILD/dlfcn/libdl_pic.a -Wl,--no-whole-archive $BUILD/elf/interp.os $BUILD/libc.so $BUILD/libc_nonshared.a $BUILD/elf/ld.so  \
+    -Wl,-Map,$BUILD/dlfcn/libdl.so.map
+
+echo - libmemusage.so
+nacl-gcc -L$BUILD/../ld   -shared -static-libgcc -Wl,-O1  -Wl,-z,defs -Wl,-dynamic-linker=/work/nacl/2/googleclient/native_client/install/lib/ld-linux.so.2  -B$BUILD/csu/   -Wl,-soname=libmemusage.so -Wl,-z,relro -Wl,--hash-style=both  -L$BUILD -L$BUILD/math -L$BUILD/elf -L$BUILD/dlfcn -L$BUILD/nss -L$BUILD/nis -L$BUILD/rt -L$BUILD/resolv -L$BUILD/crypt -L$BUILD/nptl -Wl,-rpath-link=$BUILD:$BUILD/math:$BUILD/elf:$BUILD/dlfcn:$BUILD/nss:$BUILD/nis:$BUILD/rt:$BUILD/resolv:$BUILD/crypt:$BUILD/nptl -o $BUILD/malloc/libmemusage.so $BUILD/csu/abi-note.o -Wl,--whole-archive $BUILD/malloc/libmemusage_pic.a -Wl,--no-whole-archive $BUILD/elf/interp.os $BUILD/dlfcn/libdl.so $BUILD/elf/ld.so  \
+    -Wl,-Map,$BUILD/malloc/libmemusage.so.map
+
+echo - libpthread.so
+nacl-gcc -L$BUILD/../ld   -shared -static-libgcc -Wl,-O1  -Wl,-z,defs -Wl,-dynamic-linker=/work/nacl/3/googleclient/native_client/install/lib/ld-linux.so.2 -B$BUILD/nptl/ -B$BUILD/csu/ -B$BUILD/nptl/ -Wl,--version-script=$BUILD/libpthread.map -Wl,-soname=libpthread.so.0 -Wl,-z,relro -Wl,--hash-style=both -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst -e __nptl_main -L$BUILD -L$BUILD/math -L$BUILD/elf -L$BUILD/dlfcn -L$BUILD/nss -L$BUILD/nis -L$BUILD/rt -L$BUILD/resolv -L$BUILD/crypt -L$BUILD/nptl -Wl,-rpath-link=$BUILD:$BUILD/math:$BUILD/elf:$BUILD/dlfcn:$BUILD/nss:$BUILD/nis:$BUILD/rt:$BUILD/resolv:$BUILD/crypt:$BUILD/nptl -o $BUILD/nptl/libpthread.so $BUILD/csu/abi-note.o -Wl,--whole-archive $BUILD/nptl/libpthread_pic.a -Wl,--no-whole-archive $BUILD/elf/interp.os $BUILD/libc.so $BUILD/libc_nonshared.a $BUILD/elf/ld.so 
index 3546c79..510d7b0 100755 (executable)
@@ -2,7 +2,7 @@
 
 BUILDDIR=build
 DEST=hellow-dyn
-../tools_bin/linux/sdk/nacl-sdk/bin/nacl-gcc \
+nacl-gcc \
     -B$BUILDDIR/csu/ -L$BUILDDIR -Lld \
     $BUILDDIR/elf/ld.so $BUILDDIR/libc_nonshared.a \
     -g hellow.c -o $DEST \
index 0bd9d06..9beef08 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 BUILDDIR=build
-../tools_bin/linux/sdk/nacl-sdk/bin/nacl-gcc \
+nacl-gcc \
     -B$BUILDDIR/csu/ -L$BUILDDIR -static -Wl,-T,elf_i386.x \
     -g hellow.c -o hellow \
     -Wl,-print-map > hellow.map
index 6329951..5188b62 100755 (executable)
@@ -10,12 +10,17 @@ mkdir kernel-headers
 cp -a /usr/include/asm /usr/include/asm-generic /usr/include/linux \
     kernel-headers/
 
+if ! which nacl-gcc >/dev/null; then
+  echo Error: nacl-gcc not found on PATH
+  exit 1
+fi
+
 BUILDDIR=build
 mkdir -p $BUILDDIR
 PREFIX=$(cd .. && pwd)/install
 cd $BUILDDIR
 ../configure --prefix=$PREFIX --host=i486-linux-gnu \
-    CC="`pwd`/../../tools_bin/linux/sdk/nacl-sdk/bin/nacl-gcc -L`pwd`/../ld" \
+    CC="`which nacl-gcc` -L`pwd`/../ld" \
     CFLAGS="-march=i486 -pipe -fstrict-aliasing -O2 -g -mno-tls-direct-seg-refs" \
     --with-headers=`pwd`/../kernel-headers --enable-kernel=2.2.0
 #    --disable-shared