1 # Build and install uClibc.
5 # We need to unset the environment variable for ccwrap from include.sh
6 # because there is no libc to link against we are building it here.
7 # The reason why it is set in include.sh is that it works for manual
8 # package builds ala ./build.sh qi-bootmenu
10 OLD_CCWRAP_TOPDIR
=$CCWRAP_TOPDIR
13 make CROSS
="$CROSS" KCONFIG_ALLCONFIG
="$CONFIG_DIR/miniconfig-uClibc" allnoconfig
&&
14 cp .config
"$CONFIG_DIR/config-uClibc" || dienow
16 UCLIBC_MAKE_FLAGS
="CROSS=$CROSS KERNEL_HEADERS=$STAGING_DIR/usr/include \
17 RUNTIME_PREFIX=/ UCLIBC_LDSO_NAME=ld-uClibc $VERBOSITY"
19 # build and install into $STAGING_DIR
21 make $UCLIBC_MAKE_FLAGS PREFIX
="$STAGING_DIR/usr" DEVEL_PREFIX
="/" -j $CPUS install &&
22 make $UCLIBC_MAKE_FLAGS PREFIX
="$STAGING_DIR/usr" DEVEL_PREFIX
="/" -j $CPUS install_utils
24 [ $?
-ne 0 ] && dienow
26 # install into $ROOT_DIR
28 make $UCLIBC_MAKE_FLAGS PREFIX
="$ROOT_DIR" install_runtime
30 [ -e "$STAGING_DIR/usr/lib/libc.so" ] && cp "$STAGING_DIR/usr/lib/libc.so" \
31 "$ROOT_DIR/lib/libc.so"
33 # remove some hardwired paths from libc.so linker script
34 # which point to / because of RUNTIME_PREFIX which would
35 # try to leak in bits from the host system. Maybe we should
36 # install uClibc twice with different RUNTIME_PREFIX one
37 # for the STAGING_DIR and one for the rootfs /.
39 [ -e "$STAGING_DIR/usr/lib/libc.so" ] && \
40 sed -i 's,/lib/,,g' "$STAGING_DIR/usr/lib/libc.so"
42 # copy compiler related include files and libraries into
43 # $STAGING_DIR so that the compiler wrapper (ccwrap) will
44 # find it were it expects them.
46 cp -r "$(dirname $(which $CC))/../cc" "$STAGING_DIR/usr" || dienow
47 cp -P $
(dirname $
(which $CC))/..
/lib
/libgcc
* "$STAGING_DIR/usr/lib" || dienow
49 # tell the compiler wrapper to link all further packages
50 # against the newly built libc
52 export CCWRAP_TOPDIR
=$OLD_CCWRAP_TOPDIR