Fredrik Fornwall
8 years ago
5 changed files with 274 additions and 479 deletions
@ -1,284 +0,0 @@ |
|||
TERMUX_PKG_HOMEPAGE=http://elinux.org/Android_aapt |
|||
TERMUX_PKG_DESCRIPTION="Android Asset Packaging Tool" |
|||
TERMUX_PKG_VERSION=7.0.0 |
|||
TERMUX_PKG_BUILD_IN_SRC=yes |
|||
TERMUX_PKG_DEPENDS="libexpat, libpng, libzopfli" |
|||
TERMUX_PKG_CLANG=yes |
|||
|
|||
termux_step_make_install () { |
|||
local _TAGNAME=${TERMUX_PKG_VERSION}_r1 |
|||
|
|||
SYSTEM_CORE_INCLUDE_TARFILE=$TERMUX_PKG_CACHEDIR/system_core_include_${_TAGNAME}.tar.gz |
|||
test ! -f $SYSTEM_CORE_INCLUDE_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/include.tar.gz" \ |
|||
$SYSTEM_CORE_INCLUDE_TARFILE |
|||
|
|||
ANDROIDFW_INCLUDE_TARFILE=$TERMUX_PKG_CACHEDIR/androidfw_include_${_TAGNAME}.tar.gz |
|||
test ! -f $ANDROIDFW_INCLUDE_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/frameworks/base/+archive/android-$_TAGNAME/include/androidfw.tar.gz" \ |
|||
$ANDROIDFW_INCLUDE_TARFILE |
|||
|
|||
ANDROID_BASE_INCLUDE_TARFILE=$TERMUX_PKG_CACHEDIR/android_base_include_${_TAGNAME}.tar.gz |
|||
test ! -f $ANDROID_BASE_INCLUDE_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/base/include/android-base.tar.gz" \ |
|||
$ANDROID_BASE_INCLUDE_TARFILE |
|||
|
|||
local AOSP_INCLUDE_DIR=$TERMUX_PREFIX/include/aosp |
|||
mkdir -p $AOSP_INCLUDE_DIR |
|||
cd $AOSP_INCLUDE_DIR |
|||
rm -Rf * |
|||
tar xf $SYSTEM_CORE_INCLUDE_TARFILE |
|||
mkdir -p androidfw |
|||
cd androidfw |
|||
tar xf $ANDROIDFW_INCLUDE_TARFILE |
|||
cd .. |
|||
mkdir -p android-base |
|||
cd android-base |
|||
tar xf $ANDROID_BASE_INCLUDE_TARFILE |
|||
|
|||
|
|||
|
|||
# Build libcutils: |
|||
mkdir -p $TERMUX_PKG_SRCDIR/{libcutils,androidfw} |
|||
cd $TERMUX_PKG_SRCDIR/libcutils |
|||
LIBCUTILS_TARFILE=$TERMUX_PKG_CACHEDIR/libcutils_${_TAGNAME}.tar.gz |
|||
test ! -f $LIBCUTILS_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/libcutils.tar.gz" \ |
|||
$LIBCUTILS_TARFILE |
|||
tar xf $LIBCUTILS_TARFILE |
|||
$CXX -isystem $AOSP_INCLUDE_DIR -c -o sockets.o sockets.cpp |
|||
$CXX -isystem $AOSP_INCLUDE_DIR -c -o sockets_unix.o sockets_unix.cpp |
|||
sed -i 's%include <sys/_system_properties.h>%include <sys/system_properties.h>%' properties.c |
|||
# From Android.mk: |
|||
libcutils_common_sources="\ |
|||
config_utils.c \ |
|||
fs_config.c \ |
|||
canned_fs_config.c \ |
|||
hashmap.c \ |
|||
iosched_policy.c \ |
|||
load_file.c \ |
|||
native_handle.c \ |
|||
open_memstream.c \ |
|||
process_name.c \ |
|||
record_stream.c \ |
|||
sched_policy.c \ |
|||
sockets.o \ |
|||
strdup16to8.c \ |
|||
strdup8to16.c \ |
|||
strlcpy.c \ |
|||
threads.c" |
|||
libcutils_nonwindows_sources="\ |
|||
fs.c \ |
|||
multiuser.c \ |
|||
socket_inaddr_any_server_unix.c \ |
|||
socket_local_client_unix.c \ |
|||
socket_local_server_unix.c \ |
|||
socket_loopback_client_unix.c \ |
|||
socket_loopback_server_unix.c \ |
|||
socket_network_client_unix.c \ |
|||
sockets_unix.o \ |
|||
str_parms.c" |
|||
$CC \ |
|||
-Dchar16_t=uint16_t \ |
|||
-std=c11 \ |
|||
-isystem $AOSP_INCLUDE_DIR \ |
|||
$libcutils_common_sources \ |
|||
$libcutils_nonwindows_sources \ |
|||
trace-host.c \ |
|||
properties.c \ |
|||
-shared \ |
|||
-o $TERMUX_PREFIX/lib/libandroid-cutils.so |
|||
|
|||
|
|||
|
|||
# Build libutil: |
|||
local LIBUTILS_TARFILE=$TERMUX_PKG_CACHEDIR/libutils_${_TAGNAME}.tar.gz |
|||
test ! -f $LIBUTILS_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/libutils.tar.gz" \ |
|||
$LIBUTILS_TARFILE |
|||
|
|||
local SAFE_IOP_TARFILE=$TERMUX_PKG_CACHEDIR/safe_iop.tar.gz |
|||
test ! -f $SAFE_IOP_TARFILE && termux_download \ |
|||
https://android.googlesource.com/platform/external/safe-iop/+archive/cd76f998688d145235de78ecd5b340d0eac9239d.tar.gz \ |
|||
$SAFE_IOP_TARFILE |
|||
local SAFE_IOP_DIR=$TERMUX_PKG_TMPDIR/safe-iop |
|||
mkdir -p $SAFE_IOP_DIR |
|||
cd $SAFE_IOP_DIR |
|||
tar xf $SAFE_IOP_TARFILE |
|||
mv src/safe_iop.c src/safe_iop.cpp |
|||
|
|||
mkdir $TERMUX_PKG_SRCDIR/libutils |
|||
cd $TERMUX_PKG_SRCDIR/libutils |
|||
tar xf $LIBUTILS_TARFILE |
|||
# From Android.mk: |
|||
#CallStack.cpp \ |
|||
commonSources="\ |
|||
FileMap.cpp \ |
|||
JenkinsHash.cpp \ |
|||
LinearTransform.cpp \ |
|||
Log.cpp \ |
|||
NativeHandle.cpp \ |
|||
Printer.cpp \ |
|||
PropertyMap.cpp \ |
|||
RefBase.cpp \ |
|||
SharedBuffer.cpp \ |
|||
Static.cpp \ |
|||
StopWatch.cpp \ |
|||
String8.cpp \ |
|||
String16.cpp \ |
|||
SystemClock.cpp \ |
|||
Threads.cpp \ |
|||
Timers.cpp \ |
|||
Tokenizer.cpp \ |
|||
Unicode.cpp \ |
|||
VectorImpl.cpp \ |
|||
misc.cpp" |
|||
$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS \ |
|||
-std=c++11 \ |
|||
-Dtypeof=decltype \ |
|||
-isystem $TERMUX_PREFIX/include/aosp \ |
|||
-isystem $SAFE_IOP_DIR/include \ |
|||
$SAFE_IOP_DIR/src/safe_iop.cpp \ |
|||
$commonSources \ |
|||
-landroid-cutils \ |
|||
-shared \ |
|||
-o $TERMUX_PREFIX/lib/libandroid-utils.so |
|||
|
|||
|
|||
|
|||
# Build libbase: |
|||
local LIBBASE_TARFILE=$TERMUX_PKG_CACHEDIR/libbase_${_TAGNAME}.tar.gz |
|||
test ! -f $LIBBASE_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/system/core/+archive/android-${_TAGNAME}/base.tar.gz" \ |
|||
$LIBBASE_TARFILE |
|||
mkdir -p $TERMUX_PKG_SRCDIR/libbase |
|||
cd $TERMUX_PKG_SRCDIR/libbase |
|||
tar xf $LIBBASE_TARFILE |
|||
rm -Rf $TERMUX_PREFIX/include/aosp/android-base |
|||
mv include/android-base $TERMUX_PREFIX/include/aosp |
|||
patch -p1 < $TERMUX_PKG_BUILDER_DIR/libbase-patch.txt |
|||
libbase_src_files="\ |
|||
file.cpp \ |
|||
logging.cpp \ |
|||
parsenetaddress.cpp \ |
|||
stringprintf.cpp \ |
|||
strings.cpp \ |
|||
test_utils.cpp" |
|||
libbase_linux_src_files="\ |
|||
errors_unix.cpp" |
|||
# __USE_BSD for DEFFILEMODE to be defined by <sys/stat.h>. |
|||
$CXX $CPPFLAGS -std=c++11 \ |
|||
-D__USE_BSD \ |
|||
-isystem $AOSP_INCLUDE_DIR \ |
|||
$libbase_src_files $libbase_linux_src_files \ |
|||
-shared \ |
|||
-o $TERMUX_PREFIX/lib/libandroid-base.so |
|||
|
|||
|
|||
# Build libziparchive: |
|||
LIBZIPARCHIVE_TARFILE=$TERMUX_PKG_CACHEDIR/libziparchive_${_TAGNAME}.tar.gz |
|||
test ! -f $LIBZIPARCHIVE_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/libziparchive.tar.gz" \ |
|||
$LIBZIPARCHIVE_TARFILE |
|||
mkdir -p $TERMUX_PKG_SRCDIR/libziparchive |
|||
cd $TERMUX_PKG_SRCDIR/libziparchive |
|||
tar xf $LIBZIPARCHIVE_TARFILE |
|||
libziparchive_source_files="\ |
|||
zip_archive.cc \ |
|||
zip_archive_stream_entry.cc \ |
|||
zip_writer.cc" |
|||
sed -i 's%next_in = reinterpret_cast<const uint8_t\*>(data)%next_in = const_cast<uint8_t\*>(reinterpret_cast<const uint8_t\*>(data))%' zip_writer.cc |
|||
$CXX $CXXFLAGS $LDFLAGS -std=c++11 \ |
|||
-DZLIB_CONST \ |
|||
-isystem $AOSP_INCLUDE_DIR \ |
|||
$libziparchive_source_files \ |
|||
-landroid-base \ |
|||
-shared \ |
|||
-o $TERMUX_PREFIX/lib/libandroid-ziparchive.so |
|||
|
|||
|
|||
|
|||
# Build libandroidfw: |
|||
ANDROIDFW_TARFILE=$TERMUX_PKG_CACHEDIR/androidfw_${_TAGNAME}.tar.gz |
|||
test ! -f $ANDROIDFW_TARFILE && termux_download \ |
|||
https://android.googlesource.com/platform/frameworks/base/+archive/android-$_TAGNAME/libs/androidfw.tar.gz \ |
|||
$ANDROIDFW_TARFILE |
|||
mkdir -p $TERMUX_PKG_SRCDIR/androidfw |
|||
cd $TERMUX_PKG_SRCDIR/androidfw |
|||
tar xf $ANDROIDFW_TARFILE |
|||
commonSources="\ |
|||
Asset.cpp \ |
|||
AssetDir.cpp \ |
|||
AssetManager.cpp \ |
|||
LocaleData.cpp \ |
|||
misc.cpp \ |
|||
ObbFile.cpp \ |
|||
ResourceTypes.cpp \ |
|||
StreamingZipInflater.cpp \ |
|||
TypeWrappers.cpp \ |
|||
ZipFileRO.cpp \ |
|||
ZipUtils.cpp" |
|||
sed -i 's%#include <binder/TextOutput.h>%%' ResourceTypes.cpp |
|||
$CXX $CXXFLAGS $LDFLAGS -isystem $AOSP_INCLUDE_DIR \ |
|||
-std=c++11 \ |
|||
$commonSources \ |
|||
-DACONFIGURATION_SCREENROUND_ANY=0x00 \ |
|||
-DACONFIGURATION_SCREENROUND_NO=0x1 \ |
|||
-DACONFIGURATION_SCREENROUND_YES=0x2 \ |
|||
-DACONFIGURATION_SCREEN_ROUND=0x8000 \ |
|||
-landroid-cutils -landroid-ziparchive \ |
|||
-shared \ |
|||
-o $TERMUX_PREFIX/lib/libandroid-fw.so |
|||
|
|||
|
|||
|
|||
# Build aapt: |
|||
AAPT_TARFILE=$TERMUX_PKG_CACHEDIR/aapt_${_TAGNAME}.tar.gz |
|||
test ! -f $AAPT_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/frameworks/base/+archive/android-$_TAGNAME/tools/aapt.tar.gz" \ |
|||
$AAPT_TARFILE |
|||
mkdir $TERMUX_PKG_SRCDIR/aapt |
|||
cd $TERMUX_PKG_SRCDIR/aapt |
|||
tar xf $AAPT_TARFILE |
|||
$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS \ |
|||
-std=c++11 \ |
|||
-DANDROID_SMP=1 \ |
|||
-DNDEBUG=1 \ |
|||
-DHAVE_ENDIAN_H=1 -DHAVE_POSIX_FILEMAP=1 -DHAVE_OFF64_T=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_PTHREADS=1 \ |
|||
-DACONFIGURATION_SCREENROUND_ANY=0x00 \ |
|||
-DACONFIGURATION_SCREENROUND_NO=0x1 \ |
|||
-DACONFIGURATION_SCREENROUND_YES=0x2 \ |
|||
-DACONFIGURATION_SCREEN_ROUND=0x8000 \ |
|||
-isystem $AOSP_INCLUDE_DIR \ |
|||
*.cpp \ |
|||
-landroid-cutils -landroid-utils -landroid-fw -landroid-ziparchive \ |
|||
-llog \ |
|||
-lm -lz -lpng -lexpat \ |
|||
-pie \ |
|||
-o $TERMUX_PREFIX/bin/aapt |
|||
|
|||
|
|||
|
|||
# Build zipalign: |
|||
ZIPALIGN_TARFILE=$TERMUX_PKG_CACHEDIR/zipalign_${_TAGNAME}.tar.gz |
|||
test ! -f $ZIPALIGN_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/build.git/+archive/android-$_TAGNAME/tools/zipalign.tar.gz" \ |
|||
$ZIPALIGN_TARFILE |
|||
mkdir $TERMUX_PKG_SRCDIR/zipalign |
|||
cd $TERMUX_PKG_SRCDIR/zipalign |
|||
tar xf $ZIPALIGN_TARFILE |
|||
$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS \ |
|||
-isystem $AOSP_INCLUDE_DIR \ |
|||
-std=c++11 \ |
|||
ZipAlign.cpp ZipEntry.cpp ZipFile.cpp \ |
|||
-landroid-cutils -landroid-utils -landroid-fw \ |
|||
-lm -lz -llog \ |
|||
-lzopfli \ |
|||
-pie \ |
|||
-o $TERMUX_PREFIX/bin/zipalign |
|||
|
|||
|
|||
|
|||
# Remove this one for now: |
|||
rm -Rf $AOSP_INCLUDE_DIR |
|||
} |
@ -1,96 +1,284 @@ |
|||
TERMUX_PKG_HOMEPAGE=https://android.googlesource.com/platform/system/core/+/android-4.4.4_r2/libutils |
|||
TERMUX_PKG_HOMEPAGE=http://elinux.org/Android_aapt |
|||
TERMUX_PKG_DESCRIPTION="Android Asset Packaging Tool" |
|||
TERMUX_PKG_VERSION=5.1.1 |
|||
TERMUX_PKG_BUILD_REVISION=2 |
|||
TERMUX_PKG_VERSION=7.0.0 |
|||
TERMUX_PKG_BUILD_IN_SRC=yes |
|||
TERMUX_PKG_DEPENDS="libexpat, libpng" |
|||
TERMUX_PKG_DEPENDS="libexpat, libpng, libzopfli" |
|||
TERMUX_PKG_CLANG=yes |
|||
|
|||
termux_step_make_install () { |
|||
local _TAGNAME=${TERMUX_PKG_VERSION}_r8 |
|||
local _TAGNAME=${TERMUX_PKG_VERSION}_r1 |
|||
|
|||
SYSTEM_CORE_INCLUDE_TARFILE=$TERMUX_PKG_CACHEDIR/system_core_include_${_TAGNAME}.tar.gz |
|||
test ! -f $SYSTEM_CORE_INCLUDE_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/include.tar.gz" \ |
|||
$SYSTEM_CORE_INCLUDE_TARFILE |
|||
|
|||
ANDROIDFW_INCLUDE_TARFILE=$TERMUX_PKG_CACHEDIR/androidfw_include_${_TAGNAME}.tar.gz |
|||
test ! -f $ANDROIDFW_INCLUDE_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/frameworks/base/+archive/android-$_TAGNAME/include/androidfw.tar.gz" \ |
|||
$ANDROIDFW_INCLUDE_TARFILE |
|||
|
|||
ANDROID_BASE_INCLUDE_TARFILE=$TERMUX_PKG_CACHEDIR/android_base_include_${_TAGNAME}.tar.gz |
|||
test ! -f $ANDROID_BASE_INCLUDE_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/base/include/android-base.tar.gz" \ |
|||
$ANDROID_BASE_INCLUDE_TARFILE |
|||
|
|||
local AOSP_INCLUDE_DIR=$TERMUX_PREFIX/include/aosp |
|||
mkdir -p $AOSP_INCLUDE_DIR |
|||
cd $AOSP_INCLUDE_DIR |
|||
rm -Rf * |
|||
tar xf $SYSTEM_CORE_INCLUDE_TARFILE |
|||
mkdir -p androidfw |
|||
cd androidfw |
|||
tar xf $ANDROIDFW_INCLUDE_TARFILE |
|||
cd .. |
|||
mkdir -p android-base |
|||
cd android-base |
|||
tar xf $ANDROID_BASE_INCLUDE_TARFILE |
|||
|
|||
|
|||
|
|||
# Build libcutils: |
|||
mkdir -p $TERMUX_PKG_SRCDIR/{libcutils,androidfw} |
|||
cd $TERMUX_PKG_SRCDIR/libcutils |
|||
LIBCUTILS_TARFILE=$TERMUX_PKG_CACHEDIR/libcutils_${_TAGNAME}.tar.gz |
|||
LIBUTILS_TARFILE=$TERMUX_PKG_CACHEDIR/libutils_${_TAGNAME}.tar.gz |
|||
ANDROIDFW_TARFILE=$TERMUX_PKG_CACHEDIR/androidfw_${_TAGNAME}.tar.gz |
|||
AAPT_TARFILE=$TERMUX_PKG_CACHEDIR/aapt_${_TAGNAME}.tar.gz |
|||
test ! -f $LIBCUTILS_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/libcutils.tar.gz" \ |
|||
$LIBCUTILS_TARFILE |
|||
tar xf $LIBCUTILS_TARFILE |
|||
$CXX -isystem $AOSP_INCLUDE_DIR -c -o sockets.o sockets.cpp |
|||
$CXX -isystem $AOSP_INCLUDE_DIR -c -o sockets_unix.o sockets_unix.cpp |
|||
sed -i 's%include <sys/_system_properties.h>%include <sys/system_properties.h>%' properties.c |
|||
# From Android.mk: |
|||
libcutils_common_sources="\ |
|||
config_utils.c \ |
|||
fs_config.c \ |
|||
canned_fs_config.c \ |
|||
hashmap.c \ |
|||
iosched_policy.c \ |
|||
load_file.c \ |
|||
native_handle.c \ |
|||
open_memstream.c \ |
|||
process_name.c \ |
|||
record_stream.c \ |
|||
sched_policy.c \ |
|||
sockets.o \ |
|||
strdup16to8.c \ |
|||
strdup8to16.c \ |
|||
strlcpy.c \ |
|||
threads.c" |
|||
libcutils_nonwindows_sources="\ |
|||
fs.c \ |
|||
multiuser.c \ |
|||
socket_inaddr_any_server_unix.c \ |
|||
socket_local_client_unix.c \ |
|||
socket_local_server_unix.c \ |
|||
socket_loopback_client_unix.c \ |
|||
socket_loopback_server_unix.c \ |
|||
socket_network_client_unix.c \ |
|||
sockets_unix.o \ |
|||
str_parms.c" |
|||
$CC \ |
|||
-Dchar16_t=uint16_t \ |
|||
-std=c11 \ |
|||
-isystem $AOSP_INCLUDE_DIR \ |
|||
$libcutils_common_sources \ |
|||
$libcutils_nonwindows_sources \ |
|||
trace-host.c \ |
|||
properties.c \ |
|||
-shared \ |
|||
-o $TERMUX_PREFIX/lib/libandroid-cutils.so |
|||
|
|||
|
|||
|
|||
# Build libutil: |
|||
local LIBUTILS_TARFILE=$TERMUX_PKG_CACHEDIR/libutils_${_TAGNAME}.tar.gz |
|||
test ! -f $LIBUTILS_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/libutils.tar.gz" \ |
|||
$LIBUTILS_TARFILE |
|||
|
|||
local SAFE_IOP_TARFILE=$TERMUX_PKG_CACHEDIR/safe_iop.tar.gz |
|||
test ! -f $SAFE_IOP_TARFILE && termux_download \ |
|||
https://android.googlesource.com/platform/external/safe-iop/+archive/cd76f998688d145235de78ecd5b340d0eac9239d.tar.gz \ |
|||
$SAFE_IOP_TARFILE |
|||
local SAFE_IOP_DIR=$TERMUX_PKG_TMPDIR/safe-iop |
|||
mkdir -p $SAFE_IOP_DIR |
|||
cd $SAFE_IOP_DIR |
|||
tar xf $SAFE_IOP_TARFILE |
|||
mv src/safe_iop.c src/safe_iop.cpp |
|||
|
|||
mkdir $TERMUX_PKG_SRCDIR/libutils |
|||
cd $TERMUX_PKG_SRCDIR/libutils |
|||
tar xf $LIBUTILS_TARFILE |
|||
# From Android.mk: |
|||
#CallStack.cpp \ |
|||
commonSources="\ |
|||
FileMap.cpp \ |
|||
JenkinsHash.cpp \ |
|||
LinearTransform.cpp \ |
|||
Log.cpp \ |
|||
NativeHandle.cpp \ |
|||
Printer.cpp \ |
|||
PropertyMap.cpp \ |
|||
RefBase.cpp \ |
|||
SharedBuffer.cpp \ |
|||
Static.cpp \ |
|||
StopWatch.cpp \ |
|||
String8.cpp \ |
|||
String16.cpp \ |
|||
SystemClock.cpp \ |
|||
Threads.cpp \ |
|||
Timers.cpp \ |
|||
Tokenizer.cpp \ |
|||
Unicode.cpp \ |
|||
VectorImpl.cpp \ |
|||
misc.cpp" |
|||
$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS \ |
|||
-std=c++11 \ |
|||
-Dtypeof=decltype \ |
|||
-isystem $TERMUX_PREFIX/include/aosp \ |
|||
-isystem $SAFE_IOP_DIR/include \ |
|||
$SAFE_IOP_DIR/src/safe_iop.cpp \ |
|||
$commonSources \ |
|||
-landroid-cutils \ |
|||
-shared \ |
|||
-o $TERMUX_PREFIX/lib/libandroid-utils.so |
|||
|
|||
|
|||
|
|||
# Build libbase: |
|||
local LIBBASE_TARFILE=$TERMUX_PKG_CACHEDIR/libbase_${_TAGNAME}.tar.gz |
|||
test ! -f $LIBBASE_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/system/core/+archive/android-${_TAGNAME}/base.tar.gz" \ |
|||
$LIBBASE_TARFILE |
|||
mkdir -p $TERMUX_PKG_SRCDIR/libbase |
|||
cd $TERMUX_PKG_SRCDIR/libbase |
|||
tar xf $LIBBASE_TARFILE |
|||
rm -Rf $TERMUX_PREFIX/include/aosp/android-base |
|||
mv include/android-base $TERMUX_PREFIX/include/aosp |
|||
patch -p1 < $TERMUX_PKG_BUILDER_DIR/libbase-patch.txt |
|||
libbase_src_files="\ |
|||
file.cpp \ |
|||
logging.cpp \ |
|||
parsenetaddress.cpp \ |
|||
stringprintf.cpp \ |
|||
strings.cpp \ |
|||
test_utils.cpp" |
|||
libbase_linux_src_files="\ |
|||
errors_unix.cpp" |
|||
# __USE_BSD for DEFFILEMODE to be defined by <sys/stat.h>. |
|||
$CXX $CPPFLAGS -std=c++11 \ |
|||
-D__USE_BSD \ |
|||
-isystem $AOSP_INCLUDE_DIR \ |
|||
$libbase_src_files $libbase_linux_src_files \ |
|||
-shared \ |
|||
-o $TERMUX_PREFIX/lib/libandroid-base.so |
|||
|
|||
|
|||
# Build libziparchive: |
|||
LIBZIPARCHIVE_TARFILE=$TERMUX_PKG_CACHEDIR/libziparchive_${_TAGNAME}.tar.gz |
|||
ZIPALIGN_TARFILE=$TERMUX_PKG_CACHEDIR/zipalign_${_TAGNAME}.tar.gz |
|||
|
|||
test ! -f $LIBCUTILS_TARFILE && curl -o $LIBCUTILS_TARFILE "https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/libcutils.tar.gz" |
|||
test ! -f $LIBUTILS_TARFILE && curl -o $LIBUTILS_TARFILE "https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/libutils.tar.gz" |
|||
test ! -f $ANDROIDFW_TARFILE && curl -o $ANDROIDFW_TARFILE "https://android.googlesource.com/platform/frameworks/base/+archive/android-$_TAGNAME/libs/androidfw.tar.gz" |
|||
test ! -f $AAPT_TARFILE && curl -o $AAPT_TARFILE "https://android.googlesource.com/platform/frameworks/base/+archive/android-$_TAGNAME/tools/aapt.tar.gz" |
|||
test ! -f $ZIPALIGN_TARFILE && curl -o $ZIPALIGN_TARFILE "https://android.googlesource.com/platform/build.git/+archive/android-$_TAGNAME/tools/zipalign.tar.gz" |
|||
test ! -f $LIBZIPARCHIVE_TARFILE && curl -o $LIBZIPARCHIVE_TARFILE "https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/libziparchive.tar.gz" |
|||
|
|||
# https://android.googlesource.com/platform/system/core/+/android-4.4.4_r2/include/cutils/ |
|||
LIBCUTILS_INCLUDE_TARFILE=$TERMUX_PKG_CACHEDIR/libcutils_include_${_TAGNAME}.tar.gz |
|||
test ! -f $LIBCUTILS_INCLUDE_TARFILE && curl -o $LIBCUTILS_INCLUDE_TARFILE \ |
|||
"https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/include/cutils.tar.gz" |
|||
# https://android.googlesource.com/platform/system/core/+/android-4.4.4_r2/include/utils/ |
|||
LIBUTILS_INCLUDE_TARFILE=$TERMUX_PKG_CACHEDIR/libutils_include_${_TAGNAME}.tar.gz |
|||
test ! -f $LIBUTILS_INCLUDE_TARFILE && curl -o $LIBUTILS_INCLUDE_TARFILE \ |
|||
"https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/include/utils.tar.gz" |
|||
# https://android.googlesource.com/platform/frameworks/base/+/android-4.4.4_r2/include/androidfw/ |
|||
ANDROIDFW_INCLUDE_TARFILE=$TERMUX_PKG_CACHEDIR/androidfw_include_${_TAGNAME}.tar.gz |
|||
test ! -f $ANDROIDFW_INCLUDE_TARFILE && curl -o $ANDROIDFW_INCLUDE_TARFILE \ |
|||
"https://android.googlesource.com/platform/frameworks/base/+archive/android-$_TAGNAME/include/androidfw.tar.gz" |
|||
LIBZIPARCHIVE_INCLUDE_TARFILE=$TERMUX_PKG_CACHEDIR/libziparchive_include_${_TAGNAME}.tar.gz |
|||
test ! -f $LIBZIPARCHIVE_INCLUDE_TARFILE && curl -o $LIBZIPARCHIVE_INCLUDE_TARFILE \ |
|||
"https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/include/ziparchive.tar.gz" |
|||
|
|||
mkdir -p include/{cutils,utils,androidfw,log,system,ziparchive} libcutils libutils androidfw aapt zipalign ziparchive |
|||
|
|||
(cd include/cutils; tar xf $LIBCUTILS_INCLUDE_TARFILE) |
|||
(cd include/utils; tar xf $LIBUTILS_INCLUDE_TARFILE; rm CallStack.h; touch CallStack.h) |
|||
(cd include/androidfw; tar xf $ANDROIDFW_INCLUDE_TARFILE) |
|||
(cd include/ziparchive; tar xf $LIBZIPARCHIVE_INCLUDE_TARFILE) |
|||
touch include/system/graphics.h |
|||
cp $TERMUX_PKG_BUILDER_DIR/log.h include/log/ |
|||
cp $TERMUX_PKG_BUILDER_DIR/thread_defs.h include/system/ |
|||
# to satisfy <libexpat/expat.h> include: |
|||
ln -s "$TERMUX_PREFIX/include" include/libexpat |
|||
|
|||
cd libcutils |
|||
tar xf $LIBCUTILS_TARFILE |
|||
rm trace.c dlmalloc_stubs.c ashmem-host.c dir_hash.c |
|||
|
|||
cd ../libutils |
|||
tar xf $LIBUTILS_TARFILE |
|||
rm CallStack.cpp ProcessCallStack.cpp Trace.cpp |
|||
perl -p -i -e 's/__android_log_print\(mPriority, mLogTag,/printf(/' Printer.cpp |
|||
|
|||
cd ../androidfw |
|||
tar xf $ANDROIDFW_TARFILE |
|||
rm BackupData.cpp BackupHelpers.cpp CursorWindow.cpp |
|||
|
|||
cd ../ziparchive |
|||
test ! -f $LIBZIPARCHIVE_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/libziparchive.tar.gz" \ |
|||
$LIBZIPARCHIVE_TARFILE |
|||
mkdir -p $TERMUX_PKG_SRCDIR/libziparchive |
|||
cd $TERMUX_PKG_SRCDIR/libziparchive |
|||
tar xf $LIBZIPARCHIVE_TARFILE |
|||
rm zip_archive_test.cc |
|||
# Remove include no longer needed: |
|||
perl -p -i -e 's|#include <JNIHelp.h>||' zip_archive.cc |
|||
|
|||
# png_set_expand_gray_1_2_4_to_8(png_ptr) is the newer name instead of png_set_gray_1_2_4_to_8(png_ptr): |
|||
# libpng no longer defines "#define png_sizeof(x) (sizeof (x))" |
|||
# -include <zlib.h> since png.h no longer includes zlib.h |
|||
COMPILE_FLAGS="$CC $CFLAGS \ |
|||
-DANDROID_SMP=1 \ |
|||
-DHAVE_ENDIAN_H=1 -DHAVE_POSIX_FILEMAP=1 -DHAVE_OFF64_T=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_PTHREADS=1 \ |
|||
libziparchive_source_files="\ |
|||
zip_archive.cc \ |
|||
zip_archive_stream_entry.cc \ |
|||
zip_writer.cc" |
|||
sed -i 's%next_in = reinterpret_cast<const uint8_t\*>(data)%next_in = const_cast<uint8_t\*>(reinterpret_cast<const uint8_t\*>(data))%' zip_writer.cc |
|||
$CXX $CXXFLAGS $LDFLAGS -std=c++11 \ |
|||
-DZLIB_CONST \ |
|||
-isystem $AOSP_INCLUDE_DIR \ |
|||
$libziparchive_source_files \ |
|||
-landroid-base \ |
|||
-shared \ |
|||
-o $TERMUX_PREFIX/lib/libandroid-ziparchive.so |
|||
|
|||
|
|||
|
|||
# Build libandroidfw: |
|||
ANDROIDFW_TARFILE=$TERMUX_PKG_CACHEDIR/androidfw_${_TAGNAME}.tar.gz |
|||
test ! -f $ANDROIDFW_TARFILE && termux_download \ |
|||
https://android.googlesource.com/platform/frameworks/base/+archive/android-$_TAGNAME/libs/androidfw.tar.gz \ |
|||
$ANDROIDFW_TARFILE |
|||
mkdir -p $TERMUX_PKG_SRCDIR/androidfw |
|||
cd $TERMUX_PKG_SRCDIR/androidfw |
|||
tar xf $ANDROIDFW_TARFILE |
|||
commonSources="\ |
|||
Asset.cpp \ |
|||
AssetDir.cpp \ |
|||
AssetManager.cpp \ |
|||
LocaleData.cpp \ |
|||
misc.cpp \ |
|||
ObbFile.cpp \ |
|||
ResourceTypes.cpp \ |
|||
StreamingZipInflater.cpp \ |
|||
TypeWrappers.cpp \ |
|||
ZipFileRO.cpp \ |
|||
ZipUtils.cpp" |
|||
sed -i 's%#include <binder/TextOutput.h>%%' ResourceTypes.cpp |
|||
$CXX $CXXFLAGS $LDFLAGS -isystem $AOSP_INCLUDE_DIR \ |
|||
-std=c++11 \ |
|||
$commonSources \ |
|||
-DACONFIGURATION_SCREENROUND_ANY=0x00 \ |
|||
-DACONFIGURATION_SCREENROUND_NO=0x1 \ |
|||
-DACONFIGURATION_SCREENROUND_YES=0x2 \ |
|||
-DACONFIGURATION_SCREEN_ROUND=0x8000 \ |
|||
-landroid-cutils -landroid-ziparchive \ |
|||
-shared \ |
|||
-o $TERMUX_PREFIX/lib/libandroid-fw.so |
|||
|
|||
|
|||
|
|||
# Build aapt: |
|||
AAPT_TARFILE=$TERMUX_PKG_CACHEDIR/aapt_${_TAGNAME}.tar.gz |
|||
test ! -f $AAPT_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/frameworks/base/+archive/android-$_TAGNAME/tools/aapt.tar.gz" \ |
|||
$AAPT_TARFILE |
|||
mkdir $TERMUX_PKG_SRCDIR/aapt |
|||
cd $TERMUX_PKG_SRCDIR/aapt |
|||
tar xf $AAPT_TARFILE |
|||
$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS \ |
|||
-std=c++11 \ |
|||
-DANDROID_SMP=1 \ |
|||
-DNDEBUG=1 \ |
|||
-Dpng_set_gray_1_2_4_to_8=png_set_expand_gray_1_2_4_to_8 -Dpng_sizeof=sizeof -include zlib.h \ |
|||
-I $TERMUX_PKG_SRCDIR/include \ |
|||
-I $TERMUX_PREFIX/include \ |
|||
$LDFLAGS \ |
|||
-lm -lz -lpng -lexpat -lgnustl_shared \ |
|||
../libcutils/*.c ../ziparchive/*.cc ../libutils/*.cpp ../androidfw/*.cpp *.cpp" |
|||
|
|||
cd ../aapt |
|||
tar xf $AAPT_TARFILE |
|||
rm printapk.cpp |
|||
perl -p -i -e 's/png_ptr->io_ptr/png_get_io_ptr(png_ptr)/' Images.cpp |
|||
$COMPILE_FLAGS *.c -o $TERMUX_PREFIX/bin/aapt |
|||
|
|||
# zipalign needs "zopfli/deflate.h", so disable for now: |
|||
#cd ../zipalign |
|||
#tar xf $ZIPALIGN_TARFILE |
|||
#$COMPILE_FLAGS -o $TERMUX_PREFIX/bin/zipalign |
|||
-DHAVE_ENDIAN_H=1 -DHAVE_POSIX_FILEMAP=1 -DHAVE_OFF64_T=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_PTHREADS=1 \ |
|||
-DACONFIGURATION_SCREENROUND_ANY=0x00 \ |
|||
-DACONFIGURATION_SCREENROUND_NO=0x1 \ |
|||
-DACONFIGURATION_SCREENROUND_YES=0x2 \ |
|||
-DACONFIGURATION_SCREEN_ROUND=0x8000 \ |
|||
-isystem $AOSP_INCLUDE_DIR \ |
|||
*.cpp \ |
|||
-landroid-cutils -landroid-utils -landroid-fw -landroid-ziparchive \ |
|||
-llog \ |
|||
-lm -lz -lpng -lexpat \ |
|||
-pie \ |
|||
-o $TERMUX_PREFIX/bin/aapt |
|||
|
|||
|
|||
|
|||
# Build zipalign: |
|||
ZIPALIGN_TARFILE=$TERMUX_PKG_CACHEDIR/zipalign_${_TAGNAME}.tar.gz |
|||
test ! -f $ZIPALIGN_TARFILE && termux_download \ |
|||
"https://android.googlesource.com/platform/build.git/+archive/android-$_TAGNAME/tools/zipalign.tar.gz" \ |
|||
$ZIPALIGN_TARFILE |
|||
mkdir $TERMUX_PKG_SRCDIR/zipalign |
|||
cd $TERMUX_PKG_SRCDIR/zipalign |
|||
tar xf $ZIPALIGN_TARFILE |
|||
$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS \ |
|||
-isystem $AOSP_INCLUDE_DIR \ |
|||
-std=c++11 \ |
|||
ZipAlign.cpp ZipEntry.cpp ZipFile.cpp \ |
|||
-landroid-cutils -landroid-utils -landroid-fw \ |
|||
-lm -lz -llog \ |
|||
-lzopfli \ |
|||
-pie \ |
|||
-o $TERMUX_PREFIX/bin/zipalign |
|||
|
|||
|
|||
|
|||
# Remove this one for now: |
|||
rm -Rf $AOSP_INCLUDE_DIR |
|||
} |
|||
|
@ -1,31 +0,0 @@ |
|||
#include <stdio.h> |
|||
#include <time.h> |
|||
#include <unistd.h> |
|||
#include <android/log.h> |
|||
|
|||
/* https://android.googlesource.com/platform/system/core/+/android-4.4.4_r2/include/log/log.h */ |
|||
|
|||
#define QUOTEME_(x) #x |
|||
#define QUOTEME(x) QUOTEME_(x) |
|||
|
|||
#define ALOGV(...) printf("VERBOSE (" __FILE__ ":" QUOTEME(__LINE__) "): " __VA_ARGS__) |
|||
#define ALOGD(...) printf("DEBUG (" __FILE__ ":" QUOTEME(__LINE__) "): " __VA_ARGS__) |
|||
#define ALOGI(...) printf("INFO (" __FILE__ ":" QUOTEME(__LINE__) "): " __VA_ARGS__) |
|||
#define ALOGW(...) printf("WARNING (" __FILE__ ":" QUOTEME(__LINE__) "): " __VA_ARGS__) |
|||
#define ALOGE(...) printf("ERROR (" __FILE__ ":" QUOTEME(__LINE__) "): " __VA_ARGS__) |
|||
|
|||
#define HAL_PRIORITY_URGENT_DISPLAY ANDROID_LOG_INFO |
|||
|
|||
#define LOG_FATAL_IF(...) |
|||
#define LOG_ALWAYS_FATAL(...) |
|||
#define LOG_ALWAYS_FATAL_IF(...) |
|||
#define LOG_PRI(...) |
|||
|
|||
#define ALOGW_IF(...) |
|||
|
|||
#define android_printAssert(cond, tag, fmt...) |
|||
#define ALOG_ASSERT(...) |
|||
|
|||
#define CONDITION(cond) (__builtin_expect((cond)!=0, 0)) |
|||
|
|||
#define OS_PATH_SEPARATOR '/' |
@ -1,78 +0,0 @@ |
|||
/*
|
|||
* Copyright (C) 2013 The Android Open Source Project |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
|
|||
#ifndef ANDROID_THREAD_DEFS_H |
|||
#define ANDROID_THREAD_DEFS_H |
|||
|
|||
/* FREDRIK */ |
|||
/* #include "graphics.h" */ |
|||
|
|||
#if defined(__cplusplus) |
|||
extern "C" { |
|||
#endif |
|||
|
|||
enum { |
|||
/*
|
|||
* *********************************************** |
|||
* ** Keep in sync with android.os.Process.java ** |
|||
* *********************************************** |
|||
* |
|||
* This maps directly to the "nice" priorities we use in Android. |
|||
* A thread priority should be chosen inverse-proportionally to |
|||
* the amount of work the thread is expected to do. The more work |
|||
* a thread will do, the less favorable priority it should get so that |
|||
* it doesn't starve the system. Threads not behaving properly might |
|||
* be "punished" by the kernel. |
|||
* Use the levels below when appropriate. Intermediate values are |
|||
* acceptable, preferably use the {MORE|LESS}_FAVORABLE constants below. |
|||
*/ |
|||
ANDROID_PRIORITY_LOWEST = 19, |
|||
|
|||
/* use for background tasks */ |
|||
ANDROID_PRIORITY_BACKGROUND = 10, |
|||
|
|||
/* most threads run at normal priority */ |
|||
ANDROID_PRIORITY_NORMAL = 0, |
|||
|
|||
/* threads currently running a UI that the user is interacting with */ |
|||
ANDROID_PRIORITY_FOREGROUND = -2, |
|||
|
|||
/* the main UI thread has a slightly more favorable priority */ |
|||
ANDROID_PRIORITY_DISPLAY = -4, |
|||
|
|||
/* ui service treads might want to run at a urgent display (uncommon) */ |
|||
ANDROID_PRIORITY_URGENT_DISPLAY = ANDROID_PRIORITY_DISPLAY /* FREDRIK */, |
|||
|
|||
/* all normal audio threads */ |
|||
ANDROID_PRIORITY_AUDIO = -16, |
|||
|
|||
/* service audio threads (uncommon) */ |
|||
ANDROID_PRIORITY_URGENT_AUDIO = -19, |
|||
|
|||
/* should never be used in practice. regular process might not
|
|||
* be allowed to use this level */ |
|||
ANDROID_PRIORITY_HIGHEST = -20, |
|||
|
|||
ANDROID_PRIORITY_DEFAULT = ANDROID_PRIORITY_NORMAL, |
|||
ANDROID_PRIORITY_MORE_FAVORABLE = -1, |
|||
ANDROID_PRIORITY_LESS_FAVORABLE = +1, |
|||
}; |
|||
|
|||
#if defined(__cplusplus) |
|||
} |
|||
#endif |
|||
|
|||
#endif /* ANDROID_THREAD_DEFS_H */ |
Loading…
Reference in new issue