Testing #195 ยป cross.sh
1 |
#!/bin/bash -p
|
---|---|
2 |
|
3 |
# Note: STAGING_DIR is the <buildroot>/output/staging generated from the "make buildroot" for PiBox.
|
4 |
if [ "$STAGING" != "" ] |
5 |
then
|
6 |
export STAGING_DIR=$STAGING |
7 |
else
|
8 |
if [ "$BR" != "" ] |
9 |
then
|
10 |
export STAGING_DIR=$BR/output/staging |
11 |
else
|
12 |
echo "You must set BR to the top of your buildroot tree or STAGING to where the staging tree lives." |
13 |
exit 1
|
14 |
fi
|
15 |
fi
|
16 |
|
17 |
# Toolchain should be the toolchain built with PiBox and installed as an RPM.
|
18 |
if [ "$TC" != "" ] |
19 |
then
|
20 |
export TOOLCHAIN=$TC |
21 |
else
|
22 |
echo "You must set TC to where the cross toolchain lives." |
23 |
exit 1
|
24 |
fi
|
25 |
|
26 |
# Need to specify where the opkg tools are installed.
|
27 |
# if [ "$OPKG_DIR" = "" ]
|
28 |
# then
|
29 |
# echo "You must set OPKG_DIR to where the opkg-build program lives."
|
30 |
# exit 1
|
31 |
# fi
|
32 |
|
33 |
# if [ -f config.log ]
|
34 |
# then
|
35 |
# make distclean
|
36 |
# fi
|
37 |
|
38 |
PREFIX=arm-unknown-linux-gnueabi |
39 |
|
40 |
echo "Toolchain : $TOOLCHAIN" |
41 |
echo "Staging tree: $STAGING_DIR" |
42 |
echo "Prefix : $PREFIX" |
43 |
|
44 |
# autoreconf -i
|
45 |
|
46 |
export PATH=$TOOLCHAIN/bin:$TOOLCHAIN/$PREFIX/bin:$PATH |
47 |
|
48 |
CFLAGS=-I$STAGING_DIR/usr/include \ |
49 |
LDFLAGS="-L$STAGING_DIR/usr/lib -L$STAGING_DIR/lib --sysroot=$STAGING_DIR/" \ |
50 |
CC=$PREFIX-gcc \ |
51 |
./configure \
|
52 |
--with-path=$TOOLCHAIN/bin:$TOOLCHAIN/$PREFIX/bin:$PATH \ |
53 |
--enable-force-shutdown \ |
54 |
--enable-ignore-busy \ |
55 |
--host=arm-unknown-linux-gnueabi \ |
56 |
--build=`uname -m` |
57 |
|
58 |
PATH=$TOOLCHAIN/bin:$PATH \ |
59 |
CFLAGS=-I$STAGING_DIR/usr/include \ |
60 |
LDFLAGS="-L$STAGING_DIR/usr/lib -L$STAGING_DIR/lib --sysroot=$STAGING_DIR/" \ |
61 |
make |
62 |
|
63 |
exit 0
|
64 |
|
65 |
OPKG_DIR=$OPKG_DIR DESTDIR=`pwd`/install make install pkg |
66 |
|
67 |
echo
|
68 |
echo "----------------------------------------------" |
69 |
echo "opkg has been built under the opkg directory:" |
70 |
echo "----------------------------------------------" |
71 |
echo
|
72 |
ls -l opkg/*.opk |