Add network support to initscripts
[qi-bootmenu-system.git] / sources / include.sh
blobdf14744b86feb8abae260b2e96c67073a11e0ad1
1 #!/bin/bash
3 # Architecture
5 ARCH=armv4tl
6 KARCH=arm
7 ARCH_NAME="$ARCH"
8 STAGE_NAME="native"
10 # Directory layout
11 TOP=`pwd`
12 export SOURCES="${TOP}/sources"
13 export SCRIPTS="${SOURCES}/scripts"
14 export SRCDIR="${TOP}/packages"
15 export ROOT_DIR="${TOP}/rootfs"
16 export ROOT_OVERLAY="${TOP}/rootfs-overlay"
17 export BUILD="${TOP}/build"
18 export CONFIG_DIR="${TOP}/sources"
19 export WORK="${BUILD}/temp-${ARCH}"
20 export STAGING_DIR="${TOP}/staging-dir"
22 # Default flags to point the compiler to the right libraries and
23 # include files. In the case of cross compiling this assumes that
24 # the compiler doesn't add system directories to it's search paths.
25 # This is taken care of by a gcc wrapper script which passes things
26 # like -nostdinc -nostdlibs -nodefaultlibs to gcc.
28 CFLAGS_HEADERS="-I$STAGING_DIR/usr/include"
29 CFLAGS="$CFLAGS_HEADERS -Os -pipe -march=armv4t -mtune=arm9tdmi"
30 LDFLAGS_LIBS="-L$STAGING_DIR/usr/lib"
31 LDFLAGS="$LDFLAGS_LIBS"
33 # Make sure that pkg-config uses the right paths and doesn't pull
34 # in depencies from the host system.
35 export PKG_CONFIG_PATH="${STAGING_DIR}/usr/lib/pkgconfig"
36 export PKG_CONFIG_LIBDIR="${STAGING_DIR}/usr/lib/pkgconfig"
37 export PKG_CONFIG_SYSROOT_DIR="${STAGING_DIR}"
39 # check if we are building natively or if we are cross compiling
41 if [[ ! $(uname -m) == arm* ]]
42 then
43 STAGE_NAME="cross"
44 CROSS_LDFLAGS=
45 CROSS_CFLAGS=
46 CROSS_CONFIGURE_FLAGS="--build=`$SCRIPTS/config.guess` \
47 --target=armv4tl-unknown-linux-gnueabi \
48 --host=armv4tl-unknown-linux-gnueabi"
49 # cross compiler prefix used by kernel, uclibc and busybox
50 # build system
51 export CROSS="armv4tl-unknown-linux-gnueabi-"
54 STRIP="${CROSS}strip"
56 umask 022
58 # Tell bash not to cache the $PATH because we modify it. Without
59 # this, bash won't find new executables added after startup.
60 set +h
62 [ -e config ] && source config
63 source sources/functions-fwl.sh
64 source sources/functions.sh
66 # How many processors should make -j use?
68 if [ -z "$CPUS" ]
69 then
70 export CPUS=$(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w)
71 [ "$CPUS" -lt 1 ] && CPUS=1
74 # This is an if instead of && so the exit code of include.sh is reliably 0
75 if [ ! -z "$BUILD_VERBOSE" ]
76 then
77 VERBOSITY="V=1"