2011-09-25 04:57:13 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2012-10-02 02:15:00 +00:00
|
|
|
BUILD=1
|
2015-04-22 00:58:19 +00:00
|
|
|
PREFIX="/data/data/org.radare2.installer/radare2"
|
2012-02-17 12:23:58 +00:00
|
|
|
|
2015-01-24 23:02:27 +00:00
|
|
|
type pax
|
|
|
|
[ $? != 0 ] && exit 1
|
|
|
|
|
2011-09-25 04:57:13 +00:00
|
|
|
cd `dirname $PWD/$0` ; cd ..
|
|
|
|
|
2011-09-25 19:07:34 +00:00
|
|
|
case "$1" in
|
2012-03-30 11:33:38 +00:00
|
|
|
"mips")
|
|
|
|
NDK_ARCH=mips
|
|
|
|
STATIC_BUILD=0
|
|
|
|
STRIP=mips-linux-android-strip
|
|
|
|
;;
|
2014-11-11 00:26:05 +00:00
|
|
|
"mips64")
|
|
|
|
NDK_ARCH=mips64
|
|
|
|
STATIC_BUILD=0
|
|
|
|
STRIP=mips64el-linux-android-strip
|
|
|
|
;;
|
2011-09-25 19:07:34 +00:00
|
|
|
"arm")
|
|
|
|
NDK_ARCH=arm
|
|
|
|
STATIC_BUILD=0
|
2012-02-17 12:55:54 +00:00
|
|
|
STRIP=arm-eabi-strip
|
2011-09-25 19:07:34 +00:00
|
|
|
;;
|
2014-11-10 00:09:38 +00:00
|
|
|
"aarch64")
|
|
|
|
NDK_ARCH=aarch64
|
|
|
|
STATIC_BUILD=0
|
|
|
|
STRIP=aarch64-linux-android-strip
|
|
|
|
;;
|
2011-09-25 19:07:34 +00:00
|
|
|
"x86")
|
|
|
|
NDK_ARCH=x86
|
|
|
|
STATIC_BUILD=0
|
2012-02-17 12:55:54 +00:00
|
|
|
STRIP=strip
|
2011-09-25 19:07:34 +00:00
|
|
|
;;
|
2014-11-10 00:09:38 +00:00
|
|
|
aarch64-static|static-aarch64)
|
|
|
|
NDK_ARCH=aarch64
|
|
|
|
STATIC_BUILD=1
|
|
|
|
;;
|
2011-09-25 19:07:34 +00:00
|
|
|
arm-static|static-arm)
|
|
|
|
NDK_ARCH=arm
|
|
|
|
STATIC_BUILD=1
|
|
|
|
;;
|
|
|
|
x86-static|static-x86)
|
|
|
|
NDK_ARCH=x86
|
|
|
|
STATIC_BUILD=1
|
|
|
|
;;
|
2012-03-30 11:33:38 +00:00
|
|
|
mips-static|static-mips)
|
|
|
|
NDK_ARCH=mips
|
2012-03-31 01:54:44 +00:00
|
|
|
# XXX: by default we should build all libs as .a but link binary dinamically
|
2012-03-30 11:33:38 +00:00
|
|
|
STATIC_BUILD=1
|
2012-03-31 01:54:44 +00:00
|
|
|
STRIP=mips-linux-android-strip
|
2012-03-30 11:33:38 +00:00
|
|
|
;;
|
2014-11-11 01:14:19 +00:00
|
|
|
mips64-static|static-mips64)
|
2014-11-11 00:26:05 +00:00
|
|
|
NDK_ARCH=mips64
|
|
|
|
# XXX: by default we should build all libs as .a but link binary dinamically
|
|
|
|
STATIC_BUILD=1
|
|
|
|
STRIP=mips64el-linux-android-strip
|
|
|
|
;;
|
2015-01-24 02:30:07 +00:00
|
|
|
local)
|
|
|
|
BUILD=0
|
|
|
|
sys/static.sh ${PREFIX}
|
|
|
|
NDK_ARCH=local
|
|
|
|
;;
|
2012-02-18 00:49:59 +00:00
|
|
|
""|"-h")
|
2015-01-24 02:30:07 +00:00
|
|
|
echo "Usage: android-build.sh [local|arm|aarch64|x86|mips|mips64][-static]"
|
2011-09-25 19:07:34 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
2012-02-18 00:49:59 +00:00
|
|
|
*)
|
|
|
|
echo "Unknown argument"
|
|
|
|
exit 1
|
|
|
|
;;
|
2011-09-25 19:07:34 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
[ -z "${NDK_ARCH}" ] && NDK_ARCH=arm
|
2011-09-25 04:57:13 +00:00
|
|
|
[ -z "${STATIC_BUILD}" ] && STATIC_BUILD=0
|
2012-06-26 14:20:30 +00:00
|
|
|
|
|
|
|
# ow yeah
|
|
|
|
STATIC_BUILD=1
|
2011-09-25 04:57:13 +00:00
|
|
|
export NDK_ARCH
|
|
|
|
export STATIC_BUILD
|
2012-09-02 23:27:52 +00:00
|
|
|
PKG=`./configure --version|head -n1 |cut -d ' ' -f 1`
|
|
|
|
D=${PKG}-android-${NDK_ARCH}
|
2012-03-30 11:33:38 +00:00
|
|
|
echo NDK_ARCH: ${NDK_ARCH}
|
2011-09-25 04:57:13 +00:00
|
|
|
|
2011-09-25 19:07:34 +00:00
|
|
|
echo "Using NDK_ARCH: ${NDK_ARCH}"
|
|
|
|
echo "Using STATIC_BUILD: ${STATIC_BUILD}"
|
2012-09-02 23:27:52 +00:00
|
|
|
|
2012-10-02 02:15:00 +00:00
|
|
|
if [ "${BUILD}" = 1 ]; then
|
2015-01-24 02:30:07 +00:00
|
|
|
if [ -z "${NDK}" ]; then
|
|
|
|
echo "Missing NDK env var. Use ./android-{arm|aarch64|mips|mips64|x86}.sh"
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-01-24 22:17:55 +00:00
|
|
|
export ANDROID=1
|
2015-01-24 02:30:07 +00:00
|
|
|
# start build
|
2015-01-24 22:17:55 +00:00
|
|
|
sleep 1
|
2015-01-24 02:30:07 +00:00
|
|
|
|
|
|
|
make mrproper
|
|
|
|
if [ $STATIC_BUILD = 1 ]; then
|
|
|
|
CFGFLAGS="--without-pic --with-nonpic"
|
|
|
|
fi
|
|
|
|
# dup
|
|
|
|
echo ./configure --with-compiler=android \
|
|
|
|
--with-ostype=android --without-ewf \
|
|
|
|
--prefix=${PREFIX} ${CFGFLAGS}
|
|
|
|
|
|
|
|
./configure --with-compiler=android --with-ostype=android \
|
|
|
|
--prefix=${PREFIX} ${CFGFLAGS} || exit 1
|
|
|
|
make -s -j 4 || exit 1
|
2012-10-02 02:15:00 +00:00
|
|
|
fi
|
2011-09-25 04:57:13 +00:00
|
|
|
rm -rf $D
|
|
|
|
mkdir -p $D
|
2011-09-25 19:07:34 +00:00
|
|
|
|
|
|
|
INSTALL_PROGRAM=`grep INSTALL_DATA config-user.mk|cut -d = -f 2`
|
|
|
|
|
|
|
|
make install INSTALL_PROGRAM="${INSTALL_PROGRAM}" DESTDIR=$PWD/$D || exit 1
|
2012-02-17 12:23:58 +00:00
|
|
|
|
2012-02-17 12:55:54 +00:00
|
|
|
make purge-dev DESTDIR=${PWD}/${D} STRIP="${STRIP}"
|
2015-01-24 20:45:32 +00:00
|
|
|
#make purge-doc DESTDIR=${PWD}/${D} STRIP="${STRIP}"
|
2012-03-31 01:54:44 +00:00
|
|
|
rm -rf ${PWD}/${D}/share
|
|
|
|
rm -rf ${PWD}/${D}/include
|
|
|
|
rm -rf ${PWD}/${D}/lib/pkgconfig
|
|
|
|
rm -rf ${PWD}/${D}/lib/libsdb.a
|
2012-02-17 12:23:58 +00:00
|
|
|
|
2012-03-31 23:40:04 +00:00
|
|
|
echo rm -rf ${PWD}/${D}/${PREFIX}/bin/*
|
2014-07-22 00:20:14 +00:00
|
|
|
rm -rf "${PWD}/${D}/${PREFIX}/bin/"*
|
2012-03-31 23:40:04 +00:00
|
|
|
|
2012-09-02 23:27:52 +00:00
|
|
|
#end build
|
|
|
|
|
2012-03-31 21:56:13 +00:00
|
|
|
# use busybox style symlinkz
|
2012-03-31 23:40:04 +00:00
|
|
|
HERE=${PWD}
|
2012-03-31 21:56:13 +00:00
|
|
|
cd binr/blob
|
2014-01-04 23:52:54 +00:00
|
|
|
make STATIC_BUILD=1 || exit 1
|
|
|
|
make install PREFIX="${PREFIX}" DESTDIR="${HERE}/${D}" || exit 1
|
2015-01-24 20:45:32 +00:00
|
|
|
mkdir -p ${HERE}/${D}/${PREFIX}/projects
|
|
|
|
:> ${HERE}/${D}/${PREFIX}/projects/.empty
|
|
|
|
mkdir -p ${HERE}/${D}/${PREFIX}/tmp
|
|
|
|
:> ${HERE}/${D}/${PREFIX}/tmp/.empty
|
2012-03-31 21:56:13 +00:00
|
|
|
cd ../..
|
|
|
|
|
2014-07-22 00:20:14 +00:00
|
|
|
chmod +x "${HERE}/${D}/${PREFIX}/bin/"*
|
2015-01-24 02:30:07 +00:00
|
|
|
find ${D}/${PREFIX}/share/radare2/*/www
|
2015-01-24 20:18:26 +00:00
|
|
|
# Remove development files
|
2014-07-22 00:20:14 +00:00
|
|
|
rm -f ${HERE}/${D}/${PREFIX}/lib/radare2/*/*.so
|
|
|
|
rm -f ${HERE}/${D}/${PREFIX}/lib/*.a
|
2015-01-24 02:30:07 +00:00
|
|
|
rm -rf ${HERE}/${D}/${PREFIX}/share/radare2/*/www/*/node_modules
|
2014-07-22 00:20:14 +00:00
|
|
|
rm -rf ${HERE}/${D}/${PREFIX}/include
|
|
|
|
eval `grep ^VERSION= ${HERE}/config-user.mk`
|
2015-04-22 02:50:37 +00:00
|
|
|
#WWWROOT="/data/data/org.radare2.installer/radare2/share/radare2/${VERSION}/www"
|
|
|
|
#ln -fs ${WWWROOT} ${HERE}/${D}/data/data/org.radare2.installer/www
|
|
|
|
#cp -rf ${WWWROOT} ${HERE}/${D}/data/data/org.radare2.installer/www
|
|
|
|
#chmod -R o+rx ${HERE}/${D}/data/data/org.radare2.installer/www
|
2014-07-22 00:20:14 +00:00
|
|
|
cd ${D}
|
2015-01-24 23:02:27 +00:00
|
|
|
#sltar -c data | gzip > ../$D.tar.gz
|
2015-01-25 02:23:30 +00:00
|
|
|
pax -w data | gzip > ../$D.tar.gz
|
2015-01-24 23:02:27 +00:00
|
|
|
|
|
|
|
# tar --help| grep -q GNU
|
|
|
|
# if [ $? = 0 ]; then
|
|
|
|
# echo tar -czv -H oldgnu -f ../$D.tar.gz data
|
|
|
|
# tar -czv -H oldgnu -f ../$D.tar.gz data
|
|
|
|
# else
|
|
|
|
# echo tar -czovf ../$D.tar.gz data
|
|
|
|
# tar -czovf ../$D.tar.gz data
|
|
|
|
# fi
|
|
|
|
|
2012-03-31 23:40:04 +00:00
|
|
|
cd ..
|
2012-09-07 08:07:41 +00:00
|
|
|
D2=`git log HEAD 2>/dev/null|head -n1|awk '{print $2}'|cut -c 1-8`
|
|
|
|
if [ -n "$D2" ]; then
|
2013-12-29 03:12:28 +00:00
|
|
|
ln -fs $D.tar.gz "${D}-${D2}".tar.gz
|
2012-09-07 08:07:41 +00:00
|
|
|
fi
|
2012-03-31 23:40:04 +00:00
|
|
|
echo `pwd`"/${D}.tar.gz"
|
2014-07-22 00:20:14 +00:00
|
|
|
echo `pwd`"/${D}-${D2}.tar.gz"
|
2015-04-22 09:09:51 +00:00
|
|
|
|
|
|
|
adb push `pwd`"/${D}-${D2}.tar.gz" /sdcard/radare2-android.tar.gz || true
|