cross-compile.env: add oe_env_kernel and oe_setenv_kernel, set env in shell for oe_ru...
[opendreambox.git] / cross-compile.env
1 #!/bin/bash
2
3 oe_set_aliases()
4 {
5         local SCRIPT="${BASH_SOURCE[0]}"
6         if [ -z "${SCRIPT}" ]; then
7                 echo "Could not determine script location! Not using bash?"
8                 return
9         fi
10         while [ -h "${SCRIPT}" ]; do
11                 SCRIPT="$(readlink "${SCRIPT}")"
12         done
13
14         local SCRIPTDIR="$(cd -P `dirname "${SCRIPT}"` && pwd)"
15         local MACHINE="$1"
16         local MACHINE_ENV=".cross-compile-${MACHINE}.env"
17         local MAKE=${MAKE:-make}
18
19         ${MAKE} -C "${SCRIPTDIR}" -s MACHINE=${MACHINE} ${MACHINE_ENV} || return
20         . ${SCRIPTDIR}/${MACHINE_ENV} || return
21
22         PATH="${STAGING_BINDIR_NATIVE}/python-native:${PATH}"
23
24         local OE_ENV=" \
25                 BUILD_SYS=\"${BUILD_SYS}\" \
26                 HOST_SYS=\"${HOST_SYS}\" \
27                 STAGING_LIBDIR=\"${STAGING_LIBDIR}\" \
28                 STAGING_INCDIR=\"${STAGING_INCDIR}\" \
29                 PATH=\"${PATH}\" \
30                 CC=\"${CC}\" \
31                 CXX=\"${CXX}\" \
32                 F77=\"${F77}\" \
33                 CPP=\"${CPP}\" \
34                 LD=\"${LD}\" \
35                 CCLD=\"${CCLD}\" \
36                 AR=\"${AR}\" \
37                 AS=\"${AS}\" \
38                 RANLIB=\"${RANLIB}\" \
39                 STRIP=\"${STRIP}\" \
40                 OBJCOPY=\"${OBJCOPY}\" \
41                 OBJDUMP=\"${OBJDUMP}\" \
42                 NM=\"${NM}\" \
43                 PKG_CONFIG_DIR=\"${PKG_CONFIG_DIR}\" \
44                 PKG_CONFIG_PATH=\"${PKG_CONFIG_PATH}\" \
45                 PKG_CONFIG_LIBDIR=\"${PKG_CONFIG_LIBDIR}\" \
46                 PKG_CONFIG_SYSROOT_DIR=\"${PKG_CONFIG_SYSROOT_DIR}\" \
47                 PKG_CONFIG_DISABLE_UNINSTALLED=\"${PKG_CONFIG_DISABLE_UNINSTALLED}\" \
48         "
49
50         local OE_ENV_KERNEL=" \
51                 PATH=\"${PATH}\" \
52                 CROSS_COMPILE=\"${HOST_PREFIX}\" \
53         "
54
55         echo "Creating shell command aliases:"
56         echo "* oe_autoreconf"
57         alias oe_autoreconf="${OE_ENV} autoreconf -Wcross --verbose --install --force --exclude=autopoint"
58
59         echo "* oe_runconf"
60         alias oe_runconf=" \
61                 ./configure \
62                         --build=${BUILD_SYS} \
63                         --host=${HOST_SYS} \
64                         --target=${TARGET_SYS} \
65                         --prefix=${prefix} \
66                         --exec_prefix=${exec_prefix} \
67                         --bindir=${bindir} \
68                         --sbindir=${sbindir} \
69                         --libexecdir=${libexecdir} \
70                         --datadir=${datadir} \
71                         --sysconfdir=${sysconfdir} \
72                         --sharedstatedir=${sharedstatedir} \
73                         --localstatedir=${localstatedir} \
74                         --libdir=${libdir} \
75                         --includedir=${includedir} \
76                         --oldincludedir=${oldincludedir} \
77                         --infodir=${infodir} \
78                         --mandir=${mandir} \
79                         --with-libtool-sysroot=${STAGING_DIR_HOST} \
80                         ${OE_ENV} \
81         "
82
83         echo "* oe_runmake"
84         alias oe_runmake="${OE_ENV} ${MAKE} ${PARALLEL_MAKE}"
85
86         echo "* oe_runmake_kernel"
87         alias oe_runmake_kernel="${OE_ENV_KERNEL} ${MAKE} ${PARALLEL_MAKE}"
88
89         echo "* oe_env"
90         alias oe_env="${OE_ENV}"
91
92         echo "* oe_env_kernel"
93         alias oe_env_kernel="${OE_ENV_KERNEL}"
94
95         echo "* oe_setenv"
96         alias oe_setenv="export ${OE_ENV}"
97
98         echo "* oe_setenv_kernel"
99         alias oe_setenv_kernel="export ${OE_ENV_KERNEL}"
100 }
101
102 if [ $# -ne 1 ]; then
103         echo "usage: . ${BASH_SOURCE[0]} \${MACHINE}"
104 else
105         oe_set_aliases $1
106 fi