cross-compile.env: print usage info
[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         local OE_ENV=" \
23                 BUILD_SYS=\"${BUILD_SYS}\" \
24                 HOST_SYS=\"${HOST_SYS}\" \
25                 STAGING_LIBDIR=\"${STAGING_LIBDIR}\" \
26                 STAGING_INCDIR=\"${STAGING_INCDIR}\" \
27                 PATH=\"${PATH}\" \
28                 CC=\"${CC}\" \
29                 CXX=\"${CXX}\" \
30                 F77=\"${F77}\" \
31                 CPP=\"${CPP}\" \
32                 LD=\"${LD}\" \
33                 CCLD=\"${CCLD}\" \
34                 AR=\"${AR}\" \
35                 AS=\"${AS}\" \
36                 RANLIB=\"${RANLIB}\" \
37                 STRIP=\"${STRIP}\" \
38                 OBJCOPY=\"${OBJCOPY}\" \
39                 OBJDUMP=\"${OBJDUMP}\" \
40                 NM=\"${NM}\" \
41                 PKG_CONFIG_DIR=\"${PKG_CONFIG_DIR}\" \
42                 PKG_CONFIG_PATH=\"${PKG_CONFIG_PATH}\" \
43                 PKG_CONFIG_LIBDIR=\"${PKG_CONFIG_LIBDIR}\" \
44                 PKG_CONFIG_SYSROOT_DIR=\"${PKG_CONFIG_SYSROOT_DIR}\" \
45                 PKG_CONFIG_DISABLE_UNINSTALLED=\"${PKG_CONFIG_DISABLE_UNINSTALLED}\" \
46         "
47
48         local OE_ENV_KERNEL=" \
49                 PATH=\"${PATH}\" \
50                 CROSS_COMPILE=\"${HOST_PREFIX}\" \
51         "
52
53         echo "Creating shell command aliases:"
54         echo "* oe_autoreconf"
55         alias oe_autoreconf="${OE_ENV} autoreconf -Wcross --verbose --install --force --exclude=autopoint"
56
57         echo "* oe_runconf"
58         alias oe_runconf=" \
59                 ./configure \
60                         --build=${BUILD_SYS} \
61                         --host=${HOST_SYS} \
62                         --target=${TARGET_SYS} \
63                         --prefix=${prefix} \
64                         --exec_prefix=${exec_prefix} \
65                         --bindir=${bindir} \
66                         --sbindir=${sbindir} \
67                         --libexecdir=${libexecdir} \
68                         --datadir=${datadir} \
69                         --sysconfdir=${sysconfdir} \
70                         --sharedstatedir=${sharedstatedir} \
71                         --localstatedir=${localstatedir} \
72                         --libdir=${libdir} \
73                         --includedir=${includedir} \
74                         --oldincludedir=${oldincludedir} \
75                         --infodir=${infodir} \
76                         --mandir=${mandir} \
77                         --with-libtool-sysroot=${STAGING_DIR_HOST} \
78                         ${OE_ENV} \
79         "
80
81         echo "* oe_runmake"
82         alias oe_runmake="${MAKE} ${PARALLEL_MAKE} ${OE_ENV}"
83
84         echo "* oe_runmake_kernel"
85         alias oe_runmake_kernel="${MAKE} ${PARALLEL_MAKE} ${OE_ENV_KERNEL}"
86
87         echo "* oe_env"
88         alias oe_env="${OE_ENV}"
89
90         echo "* oe_setenv"
91         alias oe_setenv="export ${OE_ENV}"
92 }
93
94 if [ $# -ne 1 ]; then
95         echo "usage: . ${BASH_SOURCE[0]} \${MACHINE}"
96 else
97         oe_set_aliases $1
98 fi