-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild
79 lines (59 loc) · 1.94 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
# Bomb out on any errors
set -e
# Setup the environment
export HOME=/home/admin
export PATH=$PATH:$HOME/droid/bin
export ANDROID_NDK=~/droid/android-ndk
export TARGET=/target
# Update from our repo
cd $HOME/droid/bin && git pull https://github.com/sonelli/android-ports-tools.git master
# Download the latest version of coreutils
if [ ! -f ~/coreutils-8.22.tar.xz ]; then
wget -O ~/coreutils-8.22.tar.xz http://ftp.gnu.org/gnu/coreutils/coreutils-8.22.tar.xz
fi
for ARCH_NAME in x86 arm mips; do
export ARCH_NAME
for BIN_TYPE in pie nopie; do
# Start each build with a fresh source copy
cd ~
rm -rf ~/coreutils-8.22
tar xvf ~/coreutils-8.22.tar.xz
cd ~/coreutils-8.22
patch -p0 < ~/coreutils-android.patch
case "$ARCH_NAME" in
x86)
echo "Compiling for x86"
HOST=i686-linux-android
;;
arm)
echo "Compiling for ARM"
HOST=arm-linux
;;
mips)
echo "Compiling for MIPS"
HOST=mipsel-linux-android
;;
esac
export CC=~/droid/bin/agcc
if [ $BIN_TYPE == "pie" ]; then
export CFLAGS="-g -O2 -pie -fPIE"
# Use default target for pie binaries (currently 15/ICS)
unset GOOGLE_PLATFORM
else
export CFLAGS="-g -O2"
export GOOGLE_PLATFORM=9
fi
export FORCE_UNSAFE_CONFIGURE=1
./configure --host=$HOST --with-gnu-ld=ald
echo "#define HAVE_MKFIFO 1" >> lib/config.h
sed -i 's/^MANS = .*//g' Makefile
make
for MODULE in $(cat ~/modules); do
echo "Processing $MODULE"
astrip src/$MODULE
mkdir -p $TARGET/$ARCH_NAME/$BIN_TYPE
cp src/$MODULE $TARGET/$ARCH_NAME/$BIN_TYPE/$MODULE
done
done
done