2014-12-24 23:11:05 +01:00
|
|
|
#!/bin/sh
|
2014-12-27 01:41:44 +01:00
|
|
|
#
|
2014-12-24 23:11:05 +01:00
|
|
|
# Slackware build script for android-tools
|
|
|
|
# Thanks to the Arch linux maintainers for the makefiles
|
|
|
|
|
2015-04-08 07:36:22 +02:00
|
|
|
# Copyright 2015 Philip van der Hoeven, Almere, NL
|
2014-12-24 23:11:05 +01:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use of this script, with or without modification, is
|
|
|
|
# permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of this script must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
|
|
|
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
|
|
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
|
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
|
|
|
|
PRGNAM=android-tools
|
2015-06-09 14:49:05 +02:00
|
|
|
VERSION=${VERSION:-5.1.1_r4}
|
|
|
|
SRC1=core-5b3aa21bc70d42b3fcb1764a1be04ab8db5ebfb9.tar.gz
|
2015-04-08 07:36:22 +02:00
|
|
|
SRC2=extras-8e9fa76016a34ec53b83157032e38fad06af1135.tar.gz
|
2015-06-09 14:49:05 +02:00
|
|
|
SRC3=libselinux-6608a1875b07370733d0f93f3a52febcef3442bf.tar.gz
|
2015-04-08 07:36:22 +02:00
|
|
|
SRC4=f2fs-tools-3f4408b13665bd82dd7edf5c76ed9dccc3a3fce7.tar.gz
|
2014-12-24 23:11:05 +01:00
|
|
|
|
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=${TAG:-_SBo}
|
|
|
|
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
|
|
|
i?86) ARCH=i486 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
CWD=$(pwd)
|
2014-12-31 23:22:17 +01:00
|
|
|
TMP=${TMP:-/tmp/SBo}
|
2014-12-24 23:11:05 +01:00
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
|
|
|
LIBDIRSUFFIX="64"
|
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2014-12-27 01:41:44 +01:00
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
|
|
|
rm -rf $TMP/android-tools
|
|
|
|
mkdir $TMP/android-tools
|
|
|
|
cd $TMP/android-tools
|
|
|
|
|
|
|
|
mkdir core
|
2015-04-08 07:36:22 +02:00
|
|
|
tar -xvf $CWD/$SRC1 -C core
|
2014-12-27 01:41:44 +01:00
|
|
|
mkdir extras
|
2015-04-08 07:36:22 +02:00
|
|
|
tar -xvf $CWD/$SRC2 -C extras
|
2014-12-27 01:41:44 +01:00
|
|
|
mkdir libselinux
|
2015-04-08 07:36:22 +02:00
|
|
|
tar -xvf $CWD/$SRC3 -C libselinux
|
2014-12-27 01:41:44 +01:00
|
|
|
mkdir f2fs-tools
|
2015-04-08 07:36:22 +02:00
|
|
|
tar -xvf $CWD/$SRC4 -C f2fs-tools
|
2014-12-24 23:11:05 +01:00
|
|
|
|
|
|
|
#git clone --branch android-$VERSION --depth 1 https://android.googlesource.com/platform/system/core
|
|
|
|
#git clone --branch android-$VERSION --depth 1 https://android.googlesource.com/platform/system/extras
|
|
|
|
#git clone --branch android-$VERSION --depth 1 https://android.googlesource.com/platform/external/libselinux
|
|
|
|
#git clone --branch android-$VERSION --depth 1 https://android.googlesource.com/platform/external/f2fs-tools
|
|
|
|
|
|
|
|
cp -p $CWD/adbMakefile $CWD/fastbootMakefile .
|
|
|
|
|
|
|
|
chown -R root:root .
|
|
|
|
find . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
|
|
|
|
-o -perm 511 \) -exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
|
|
|
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
|
|
|
|
|
|
|
sed -e 's/f2fs_sparse_file = NULL/f2fs_sparse_file = 0/g' -i extras/f2fs_utils/f2fs_utils.c
|
|
|
|
|
|
|
|
make -C core/adb -f $TMP/android-tools/adbMakefile
|
|
|
|
make -C core/fastboot -f $TMP/android-tools/fastbootMakefile
|
|
|
|
|
|
|
|
mkdir -p $PKG/usr/bin
|
2014-12-27 01:41:44 +01:00
|
|
|
install -Dm 755 core/adb/adb $PKG/usr/bin/adb
|
|
|
|
install -Dm 755 core/fastboot/fastboot $PKG/usr/bin/fastboot
|
2014-12-24 23:11:05 +01:00
|
|
|
|
|
|
|
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
|
|
|
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
|
|
|
|
cd $PKG
|
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|