dialog: use $CFLAGS and add support for static compilation
[qi-bootmenu-system.git] / sources / include.sh
blob9ff02f368c969d58fb295217cbec595487a8ab03
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 SRCDIR="${TOP}/packages"
14 export ROOT_DIR="${TOP}/rootfs"
15 export ROOT_OVERLAY="${TOP}/rootfs-overlay"
16 export BUILD="${TOP}/build"
17 export CONFIG_DIR="${TOP}/sources"
18 export WORK="${BUILD}/temp-${ARCH}"
19 export STAGING_DIR="${TOP}/staging-dir"
21 # Default flags to point the compiler to the right libraries and
22 # include files. In the case of cross compiling this assumes that
23 # the compiler doesn't add system directories to it's search paths.
24 # This is taken care of by a gcc wrapper script which passes things
25 # like -nostdinc -nostdlibs -nodefaultlibs to gcc.
27 CFLAGS="-I$STAGING_DIR/usr/include -Os -pipe -march=armv4t -mtune=arm9tdmi"
28 LDFLAGS="-L$STAGING_DIR/usr/lib"
30 # Make sure that pkg-config uses the right paths and doesn't pull
31 # in depencies from the host system.
32 export PKG_CONFIG_PATH="${STAGING_DIR}/usr/lib/pkgconfig"
33 export PKG_CONFIG_LIBDIR="${STAGING_DIR}/usr/lib/pkgconfig"
34 export PKG_CONFIG_SYSROOT_DIR="${STAGING_DIR}"
36 # check if we are building natively or if we are cross compiling
38 if [[ ! $(uname -m) == arm* ]]
39 then
40 STAGE_NAME="cross"
41 CROSS_LDFLAGS=
42 CROSS_CFLAGS=
43 # XXX: --build=`config.guess`
44 CROSS_CONFIGURE_FLAGS="--build=i686-pc-linux-gnu \
45 --target=armv4tl-unknown-linux-gnueabi \
46 --host=armv4tl-unknown-linux-gnueabi"
47 # cross compiler prefix used by kernel, uclibc and busybox
48 # build system
49 export CROSS="armv4tl-unknown-linux-gnueabi-"
52 STRIP="${CROSS}strip"
54 umask 022
56 # Tell bash not to cache the $PATH because we modify it. Without
57 # this, bash won't find new executables added after startup.
58 set +h
60 [ -e config ] && source config
61 source sources/functions-fwl.sh
62 source sources/functions.sh
64 # How many processors should make -j use?
66 if [ -z "$CPUS" ]
67 then
68 export CPUS=$(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w)
69 [ "$CPUS" -lt 1 ] && CPUS=1
72 # This is an if instead of && so the exit code of include.sh is reliably 0
73 if [ ! -z "$BUILD_VERBOSE" ]
74 then
75 VERBOSITY="V=1"