initial thumb ISA support
[busybox-power] / build.sh
1 #!/bin/sh
2 # Helper script to build busybox-power
3 # Please run me from within Scratchbox
4 #
5 # Run `sh build.sh thumb` to enable the thumb ISA. Make sure your Scratchbox
6 # target is properly set up to compile thumb binaries.
7 # Instructions to set up a Fremantle thumb target in Scratchbox:
8 # http://talk.maemo.org/showpost.php?p=1223814&postcount=164
9
10 BBVERSION="1.20.1"
11 MAKETHREADS="8"
12 SCRIPTDIR=`dirname $(readlink -f $0)`
13 BUILDDIR="$SCRIPTDIR/../busybox-power-build"
14 VERSION_DEBIAN=`cat $SCRIPTDIR/debian/changelog | awk -F'[()]' '{if(NR==1) print $2}'`
15
16 BUILD_OPTIONS="parallel=$MAKETHREADS"
17 THUMB=false
18
19 if [ "$1" == "thumb" ]; then
20   THUMB=true; fi
21
22 hash wget 2>&- || { 
23   echo >&2 "this script requires wget, exiting now"
24   exit 1 
25 }
26
27 mkdir -p $BUILDDIR
28 cd $BUILDDIR
29
30 if ! test -e busybox-$BBVERSION.tar.bz2; then
31   wget http://busybox.net/downloads/busybox-$BBVERSION.tar.bz2; fi
32
33 if test -d busybox-$BBVERSION/; then
34   echo "`pwd`/busybox-$BBVERSION already exists,"
35   echo "please (re)move it before rerunning this script"
36   exit 1
37 fi
38
39 tar -jxf busybox-$BBVERSION.tar.bz2
40 cp -af $SCRIPTDIR/debian/ busybox-$BBVERSION/
41
42 if $THUMB; then
43   # Append "~thumb" to the package's Debian version string
44   # NB: we feed sed directly with $VERSION_DEBIAN, it is not escaped in any way
45   sed -i "s/$VERSION_DEBIAN/$VERSION_DEBIAN~thumb/" busybox-$BBVERSION/debian/changelog
46   BUILD_OPTIONS="$BUILD_OPTIONS,thumb,vfp"
47 fi
48
49 # Build
50 cd busybox-$BBVERSION/ && DEB_BUILD_OPTIONS="$BUILD_OPTIONS" dpkg-buildpackage -r"fakeroot -u" -uc -us -nc