Fix breakage for newer pkg-config versions
[qi-bootmenu-system.git] / sources / include.sh
blob7596f76659f9b5ffe8998c8ded4de26fc005c2fb
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/configs"
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"
30 CFLAGS="$CFLAGS_HEADERS -pipe -march=armv4t -mtune=arm920t"
32 if [ -z "$DEBUG" ]; then
33 CFLAGS="$CFLAGS -Os"
34 else
35 CFLAGS="$CFLAGS -O0 -g -ggdb"
38 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
40 LDFLAGS="-Wl,--gc-section"
42 # Make sure that pkg-config uses the right paths and doesn't pull
43 # in depencies from the host system.
44 export PKG_CONFIG_PATH="${STAGING_DIR}/usr/lib/pkgconfig"
45 export PKG_CONFIG_LIBDIR="${STAGING_DIR}/usr/lib/pkgconfig"
46 # only works with pkg-config >= 0.23 but because we have a hack
47 # in place to make it work with older pkg-config versions disable
48 # it here for now
49 #export PKG_CONFIG_SYSROOT_DIR="${STAGING_DIR}"
51 # check if we are building natively or if we are cross compiling
53 if [[ ! $(uname -m) == arm* ]]
54 then
55 STAGE_NAME="cross"
56 CROSS_CONFIGURE_FLAGS="--build=`$SCRIPTS/config.guess` \
57 --target=armv4tl-unknown-linux-gnueabi \
58 --host=armv4tl-unknown-linux-gnueabi"
59 # cross compiler prefix used by kernel, uclibc and busybox
60 # build system
61 [ -z "$CROSS" ] && CROSS="armv4tl-"
64 STRIP="${CROSS}strip"
65 [ -z "$CC" ] && export CC="${CROSS}gcc"
67 # tell the compiler wrapper to link against the libc from
68 # $STAGING_DIR and not against the one from the toolchain
70 export CCWRAP_TOPDIR="$STAGING_DIR/usr"
72 umask 022
74 # Tell bash not to cache the $PATH because we modify it. Without
75 # this, bash won't find new executables added after startup.
76 set +h
78 [ -e config ] && source config
79 source sources/functions-fwl.sh
80 source sources/functions.sh
82 # How many processors should make -j use?
84 if [ -z "$CPUS" ]
85 then
86 export CPUS=$(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w)
87 [ "$CPUS" -lt 1 ] && CPUS=1
90 export MAKEFLAGS="-j $CPUS"
92 # This is an if instead of && so the exit code of include.sh is reliably 0
93 if [ ! -z "$BUILD_VERBOSE" ]
94 then
95 VERBOSITY="V=1"