aapt: Update to 8.1.0.81

This commit is contained in:
Tee KOBAYASHI 2022-02-05 14:17:26 +09:00 committed by xtkoba
parent 75b65002eb
commit 32dadeb22f
11 changed files with 461 additions and 505 deletions

View File

@ -1,7 +1,6 @@
diff -u -r ../../src-pristine/aapt/Main.cpp ./Main.cpp
--- ../../src-pristine/aapt/Main.cpp 2016-10-07 15:12:44.322248606 -0400
+++ ./Main.cpp 2016-10-07 15:18:50.708065085 -0400
@@ -268,6 +268,9 @@
--- a/base/tools/aapt/Main.cpp
+++ b/base/tools/aapt/Main.cpp
@@ -270,6 +270,9 @@
/* default to compression */
bundle.setCompressionMethod(ZipEntry::kCompressDeflated);

View File

@ -0,0 +1,11 @@
--- a/base/tools/aapt2/ResourcesInternal.proto
+++ b/base/tools/aapt2/ResourcesInternal.proto
@@ -19,7 +19,7 @@
option java_package = "android.aapt.pb.internal";
option optimize_for = LITE_RUNTIME;
-import "frameworks/base/tools/aapt2/Resources.proto";
+import "Resources.proto";
package aapt.pb.internal;

View File

@ -0,0 +1,11 @@
--- a/base/libs/androidfw/ResourceTypes.cpp
+++ b/base/libs/androidfw/ResourceTypes.cpp
@@ -39,7 +39,7 @@
#include <utils/String16.h>
#include <utils/String8.h>
-#ifdef __ANDROID__
+#if defined __ANDROID__ && !defined __TERMUX__
#include <binder/TextOutput.h>
#endif

View File

@ -2,14 +2,45 @@ TERMUX_PKG_HOMEPAGE=https://elinux.org/Android_aapt
TERMUX_PKG_DESCRIPTION="Android Asset Packaging Tool"
TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_MAINTAINER="@termux"
_TAG_VERSION=7.1.2
_TAG_REVISION=33
_TAG_VERSION=8.1.0
_TAG_REVISION=81
TERMUX_PKG_VERSION=${_TAG_VERSION}.${_TAG_REVISION}
TERMUX_PKG_REVISION=17
TERMUX_PKG_SRCURL=(https://android.googlesource.com/platform/frameworks/base
https://android.googlesource.com/platform/system/core
https://android.googlesource.com/platform/build
https://android.googlesource.com/platform/external/safe-iop)
TERMUX_PKG_GIT_BRANCH=android-${_TAG_VERSION}_r${_TAG_REVISION}
TERMUX_PKG_SHA256=(SKIP_CHECKSUM
SKIP_CHECKSUM
SKIP_CHECKSUM
SKIP_CHECKSUM)
TERMUX_PKG_SKIP_SRC_EXTRACT=true
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_DEPENDS="libc++, libexpat, libpng, libzopfli, zlib"
termux_step_post_get_source() {
# FIXME: We would like to enable checksums when downloading
# tar files, but they change each time as the tar metadata
# differs: https://github.com/google/gitiles/issues/84
for i in $(seq 0 $(( ${#TERMUX_PKG_SRCURL[@]}-1 ))); do
git clone --depth 1 --single-branch \
--branch $TERMUX_PKG_GIT_BRANCH \
${TERMUX_PKG_SRCURL[$i]}
done
# Get zopfli source:
local ZOPFLI_VER=$(bash -c ". $TERMUX_SCRIPTDIR/packages/libzopfli/build.sh; echo \$TERMUX_PKG_VERSION")
local ZOPFLI_SHA256=$(bash -c ". $TERMUX_SCRIPTDIR/packages/libzopfli/build.sh; echo \$TERMUX_PKG_SHA256")
local ZOPFLI_TARFILE=$TERMUX_PKG_CACHEDIR/zopfli-${ZOPFLI_VER}.tar.gz
termux_download \
"https://github.com/google/zopfli/archive/zopfli-${ZOPFLI_VER}.tar.gz" \
$ZOPFLI_TARFILE \
$ZOPFLI_SHA256
tar xf $ZOPFLI_TARFILE
mv zopfli-zopfli-$ZOPFLI_VER zopfli
}
termux_step_pre_configure() {
# Certain packages are not safe to build on device because their
# build.sh script deletes specific files in $TERMUX_PREFIX.
@ -18,349 +49,176 @@ termux_step_pre_configure() {
fi
termux_setup_protobuf
CFLAGS+=" -fPIC"
CXXFLAGS+=" -fPIC"
_TMP_LIBDIR=$TERMUX_PKG_SRCDIR/_lib
rm -rf $_TMP_LIBDIR
mkdir -p $_TMP_LIBDIR
_TMP_BINDIR=$TERMUX_PKG_SRCDIR/_bin
rm -rf $_TMP_BINDIR
mkdir -p $_TMP_BINDIR
LDFLAGS+=" -L$_TMP_LIBDIR"
}
termux_step_make() {
. $TERMUX_PKG_BUILDER_DIR/sources.sh
local CORE_INCDIR=$TERMUX_PKG_SRCDIR/core/include
local LIBBASE_SRCDIR=$TERMUX_PKG_SRCDIR/core/base
local LIBCUTILS_SRCDIR=$TERMUX_PKG_SRCDIR/core/libcutils
local SAFE_IOP_SRCDIR=$TERMUX_PKG_SRCDIR/safe-iop
local LIBUTILS_SRCDIR=$TERMUX_PKG_SRCDIR/core/libutils
local LIBZIPARCHIVE_SRCDIR=$TERMUX_PKG_SRCDIR/core/libziparchive
local ANDROIDFW_SRCDIR=$TERMUX_PKG_SRCDIR/base/libs/androidfw
local AAPT_SRCDIR=$TERMUX_PKG_SRCDIR/base/tools/aapt
local AAPT2_SRCDIR=$TERMUX_PKG_SRCDIR/base/tools/aapt2
local ZIPALIGN_SRCDIR=$TERMUX_PKG_SRCDIR/build/tools/zipalign
# Build libcutils:
cd $LIBCUTILS_SRCDIR
local LIBCUTILS_CPPFLAGS="$CPPFLAGS \
-I. \
-I./include \
-I$CORE_INCDIR"
for f in $libcutils_sources_cpp; do
$CXX $CXXFLAGS $LIBCUTILS_CPPFLAGS $f -c
done
for f in $libcutils_sources_c; do
$CC $CFLAGS $LIBCUTILS_CPPFLAGS -Dchar16_t=uint16_t $f -c
done
$CC $CFLAGS *.o -shared $LDFLAGS \
-llog \
-o $_TMP_LIBDIR/libandroid-cutils.so
# Build libutils:
cd $LIBUTILS_SRCDIR
$CC $CFLAGS $CPPFLAGS -I$SAFE_IOP_SRCDIR/include \
$SAFE_IOP_SRCDIR/src/safe_iop.c -c -o safe_iop.o
local LIBUTILS_CPPFLAGS="$CPPFLAGS \
-I. \
-I$SAFE_IOP_SRCDIR/include \
-I$CORE_INCDIR"
for f in $libutils_sources; do
$CXX $CXXFLAGS $LIBUTILS_CPPFLAGS $f -c
done
$CXX $CXXFLAGS *.o -shared $LDFLAGS \
-landroid-cutils \
-llog \
-o $_TMP_LIBDIR/libandroid-utils.so
# Build libbase:
cd $LIBBASE_SRCDIR
local LIBBASE_CPPFLAGS="$CPPFLAGS \
-I./include \
-I$CORE_INCDIR"
for f in $libbase_sources; do
$CXX $CXXFLAGS $LIBBASE_CPPFLAGS $f -c
done
$CXX $CXXFLAGS *.o -shared $LDFLAGS \
-llog \
-o $_TMP_LIBDIR/libandroid-base.so
# Build libziparchive:
cd $LIBZIPARCHIVE_SRCDIR
local LIBZIPARCHIVE_CPPFLAGS="$CPPFLAGS \
-I./include \
-I$LIBBASE_SRCDIR/include \
-I$CORE_INCDIR"
for f in $libziparchive_sources; do
$CXX $CXXFLAGS $LIBZIPARCHIVE_CPPFLAGS $f -c
done
$CXX $CXXFLAGS *.o -shared $LDFLAGS \
-landroid-base \
-llog \
-o $_TMP_LIBDIR/libandroid-ziparchive.so
# Build libandroidfw:
cd $ANDROIDFW_SRCDIR
local ANDROIDFW_CPPFLAGS="$CPPFLAGS \
-I./include \
-I$LIBBASE_SRCDIR/include \
-I$LIBZIPARCHIVE_SRCDIR/include \
-I$CORE_INCDIR"
for f in $androidfw_sources; do
$CXX $CXXFLAGS $ANDROIDFW_CPPFLAGS $f -c
done
$CXX $CXXFLAGS *.o -shared $LDFLAGS \
-landroid-base \
-landroid-ziparchive \
-llog \
-o $_TMP_LIBDIR/libandroid-fw.so
# Build aapt:
cd $AAPT_SRCDIR
local AAPT_CPPFLAGS="$CPPFLAGS \
-I./include \
-I$LIBBASE_SRCDIR/include \
-I$ANDROIDFW_SRCDIR/include \
-I$CORE_INCDIR"
for f in *.cpp; do
$CXX $CXXFLAGS $AAPT_CPPFLAGS $f -c
done
$CXX $CXXFLAGS *.o $LDFLAGS \
-landroid-fw \
-landroid-utils \
-llog \
-lexpat \
-lpng \
-lz \
-o $_TMP_BINDIR/aapt
# Build aapt2:
cd $AAPT2_SRCDIR
local AAPT2_CPPFLAGS="$CPPFLAGS \
-I. \
-I./include \
-I$LIBBASE_SRCDIR/include \
-I$LIBZIPARCHIVE_SRCDIR/include \
-I$ANDROIDFW_SRCDIR/include \
-I$CORE_INCDIR"
for f in $libaapt2_sources_proto; do
protoc --cpp_out=. $f
done
for f in $aapt2_sources_cpp; do
$CXX $CXXFLAGS $AAPT2_CPPFLAGS $f -c -o ${f%.*}.o
done
$CXX $CXXFLAGS *.o */*.o $LDFLAGS \
-landroid-base \
-landroid-fw \
-landroid-utils \
-landroid-ziparchive \
-llog \
-lexpat \
-lpng \
-lprotobuf \
-o $_TMP_BINDIR/aapt2
# Build zipalign:
cd $ZIPALIGN_SRCDIR
local ZIPALIGN_CPPFLAGS="$CPPFLAGS \
-I$TERMUX_PKG_SRCDIR/zopfli/src \
-I$ANDROIDFW_SRCDIR/include \
-I$CORE_INCDIR"
for f in *.cpp; do
$CXX $CXXFLAGS $ZIPALIGN_CPPFLAGS $f -c
done
$CXX $CXXFLAGS *.o $LDFLAGS \
-landroid-fw \
-landroid-utils \
-llog \
-lzopfli \
-lz \
-o $_TMP_BINDIR/zipalign
}
termux_step_make_install() {
# FIXME: We would like to enable checksums when downloading
# tar files, but they change each time as the tar metadata
# differs: https://github.com/google/gitiles/issues/84
local _TAGNAME=${_TAG_VERSION}_r${_TAG_REVISION}
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 \
SKIP_CHECKSUM
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 \
SKIP_CHECKSUM
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 \
SKIP_CHECKSUM
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
cd ../log
patch -p0 < $TERMUX_PKG_BUILDER_DIR/log.h.patch.txt
CXXFLAGS+=" -fPIC"
# 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 \
SKIP_CHECKSUM
tar xf $LIBCUTILS_TARFILE
patch -p0 < $TERMUX_PKG_BUILDER_DIR/libcutils-patch.txt
$CXX $CXXFLAGS -isystem $AOSP_INCLUDE_DIR -c -o sockets.o sockets.cpp
$CXX $CXXFLAGS -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 -fPIC $CPPFLAGS $LDFLAGS \
-Dchar16_t=uint16_t \
-std=c11 \
-isystem $AOSP_INCLUDE_DIR \
$libcutils_common_sources \
$libcutils_nonwindows_sources \
trace-host.c \
properties.c \
-llog \
-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 \
SKIP_CHECKSUM
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 \
SKIP_CHECKSUM
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 \
#SystemClock.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 \
Threads.cpp \
Timers.cpp \
Tokenizer.cpp \
Unicode.cpp \
VectorImpl.cpp \
misc.cpp"
$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS \
-std=c++11 \
'-DALOG_ASSERT(a,...)=' \
-Dtypeof=decltype \
-isystem $TERMUX_PREFIX/include/aosp \
-isystem $SAFE_IOP_DIR/include \
$SAFE_IOP_DIR/src/safe_iop.cpp \
$commonSources \
-landroid-cutils \
-llog \
-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 \
SKIP_CHECKSUM
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
#logging.cpp \
libbase_src_files="\
file.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 $CXXFLAGS $CPPFLAGS \
$LDFLAGS \
-std=c++11 \
-include memory \
-D__USE_BSD \
-isystem $AOSP_INCLUDE_DIR \
$libbase_src_files $libbase_linux_src_files \
-llog \
-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 \
SKIP_CHECKSUM
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"
patch -p0 < $TERMUX_PKG_BUILDER_DIR/libziparchive.patch.txt
$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -std=c++11 \
-DZLIB_CONST \
-isystem $AOSP_INCLUDE_DIR \
$libziparchive_source_files \
-landroid-base \
-landroid-utils \
-lz \
-llog \
-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 \
SKIP_CHECKSUM
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 $CPPFLAGS $LDFLAGS -isystem $AOSP_INCLUDE_DIR \
-std=c++11 \
-include memory \
$commonSources \
-landroid-cutils \
-landroid-utils \
-landroid-ziparchive \
-llog \
-lz \
-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 \
SKIP_CHECKSUM
mkdir $TERMUX_PKG_SRCDIR/aapt
cd $TERMUX_PKG_SRCDIR/aapt
tar xf $AAPT_TARFILE
sed "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" $TERMUX_PKG_BUILDER_DIR/aapt-Main.cpp.patch.txt | patch -p1
$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS \
-std=c++11 \
-include memory \
-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 \
-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 aapt2:
AAPT2_TARFILE=$TERMUX_PKG_CACHEDIR/aapt2_${_TAGNAME}.tar.gz
test ! -f $AAPT2_TARFILE && termux_download \
"https://android.googlesource.com/platform/frameworks/base/+archive/android-$_TAGNAME/tools/aapt2.tar.gz" \
$AAPT2_TARFILE \
SKIP_CHECKSUM
mkdir $TERMUX_PKG_SRCDIR/aapt2
cd $TERMUX_PKG_SRCDIR/aapt2
tar xf $AAPT2_TARFILE
sed -i 's:proto/frameworks/base/tools/aapt2/::g' proto/ProtoHelpers.h
protoc --cpp_out=. Format.proto
$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS \
-std=c++11 \
-include memory \
-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 \
-isystem $AOSP_INCLUDE_DIR \
-I. \
$(find . -name '*.cpp' -a ! -name '*_test.cpp') \
Format.pb.cc \
-landroid-base \
-landroid-cutils \
-landroid-utils \
-landroid-fw \
-landroid-ziparchive \
-llog \
-lm -lz -lpng -lexpat \
-lprotobuf \
-pie \
-o $TERMUX_PREFIX/bin/aapt2
# Build zipalign:
ZIPALIGN_TARFILE=$TERMUX_PKG_CACHEDIR/zipalign_${_TAGNAME}.tar.gz
ZOPFLI_VER=$(bash -c ". $TERMUX_SCRIPTDIR/packages/libzopfli/build.sh; echo \$TERMUX_PKG_VERSION")
ZOPFLI_SHA256=$(bash -c ". $TERMUX_SCRIPTDIR/packages/libzopfli/build.sh; echo \$TERMUX_PKG_SHA256")
ZOPFLI_TARFILE=$TERMUX_PKG_CACHEDIR/zopfli-${ZOPFLI_VER}.tar.gz
termux_download \
"https://github.com/google/zopfli/archive/zopfli-${ZOPFLI_VER}.tar.gz" \
$ZOPFLI_TARFILE \
$ZOPFLI_SHA256
test ! -f $ZIPALIGN_TARFILE && termux_download \
"https://android.googlesource.com/platform/build.git/+archive/android-$_TAGNAME/tools/zipalign.tar.gz" \
$ZIPALIGN_TARFILE \
SKIP_CHECKSUM
mkdir $TERMUX_PKG_SRCDIR/zipalign
cd $TERMUX_PKG_SRCDIR/zipalign
tar xf $ZIPALIGN_TARFILE
tar xf $ZOPFLI_TARFILE
mv zopfli-zopfli-$ZOPFLI_VER zopfli
$CXX $CXXFLAGS $CPPFLAGS -Izopfli/src $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
install -Dm600 -t $TERMUX_PREFIX/lib \
$_TMP_LIBDIR/libandroid-{cutils,utils,base,ziparchive,fw}.so
install -Dm700 -t $TERMUX_PREFIX/bin \
$_TMP_BINDIR/{aapt,aapt2,zipalign}
# Create an android.jar with AndroidManifest.xml and resources.arsc:
cd $TERMUX_PKG_TMPDIR

View File

@ -1,21 +0,0 @@
diff -u -r ../../libbase/logging.cpp ./logging.cpp
--- ../../libbase/logging.cpp 2016-09-01 11:56:01.000000000 -0400
+++ ./logging.cpp 2016-09-01 12:17:04.405086704 -0400
@@ -46,7 +46,6 @@
// Headers for LogMessage::LogLine.
#ifdef __ANDROID__
-#include <android/set_abort_message.h>
#include "cutils/log.h"
#else
#include <sys/types.h>
@@ -398,9 +397,6 @@
// Abort if necessary.
if (data_->GetSeverity() == FATAL) {
-#ifdef __ANDROID__
- android_set_abort_message(msg.c_str());
-#endif
abort();
}
}

View File

@ -1,23 +0,0 @@
https://android.googlesource.com/platform/system/core/+/84421d8475ca8262a914b3875ed110fc6187ee74
Add ioprio values directly.
The ioprio.h header is not a uapi header, so remove it's use and
add the two values that this code needs to use.
Bug: 30072483
Change-Id: I5c8b6f40bd60a43f50ac26792f96d2fa3f6db020
diff -u -r ../libcutils-orig/iosched_policy.c ./iosched_policy.c
--- ../libcutils-orig/iosched_policy.c 2017-06-28 13:45:36.296011839 +0200
+++ ./iosched_policy.c 2017-06-28 13:45:47.307888245 +0200
@@ -24,7 +24,8 @@
#include <cutils/iosched_policy.h>
#if defined(__ANDROID__)
-#include <linux/ioprio.h>
+#define IOPRIO_WHO_PROCESS (1)
+#define IOPRIO_CLASS_SHIFT (13)
#include <sys/syscall.h>
#define __android_unused
#else

View File

@ -0,0 +1,29 @@
--- a/core/libutils/misc.cpp
+++ b/core/libutils/misc.cpp
@@ -23,7 +23,7 @@
#include <utils/Log.h>
#include <utils/Vector.h>
-#if defined(__ANDROID__)
+#if defined(__ANDROID__) && !defined(__TERMUX__)
#include <dlfcn.h>
#include <vndksupport/linker.h>
#endif
@@ -68,7 +68,7 @@
#endif
}
-#if defined(__ANDROID__)
+#if defined(__ANDROID__) && !defined(__TERMUX__)
void (*get_report_sysprop_change_func())() {
void (*func)() = nullptr;
void* handle = android_load_sphal_library("libutils.so", RTLD_NOW);
@@ -83,7 +83,7 @@
void report_sysprop_change() {
do_report_sysprop_change();
-#if defined(__ANDROID__)
+#if defined(__ANDROID__) && !defined(__TERMUX__)
// libutils.so is double loaded; from the default namespace and from the
// 'sphal' namespace. Redirect the sysprop change event to the other instance
// of libutils.so loaded in the 'sphal' namespace so that listeners attached

View File

@ -0,0 +1,11 @@
--- a/core/libziparchive/zip_writer.cc
+++ b/core/libziparchive/zip_writer.cc
@@ -356,7 +356,7 @@
CHECK(z_stream_->avail_out != 0);
// Prepare the input.
- z_stream_->next_in = reinterpret_cast<const uint8_t*>(data);
+ z_stream_->next_in = const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(data));
z_stream_->avail_in = len;
while (z_stream_->avail_in > 0) {

View File

@ -1,30 +0,0 @@
Remove reference to __android_log_error_write which does not exist
on Android 5. See:
https://github.com/termux/termux-packages/issues/1306
diff -u -r ../../pristine-src/libziparchive/zip_archive.cc ./zip_archive.cc
--- ../../pristine-src/libziparchive/zip_archive.cc 2017-08-23 21:25:26.492287975 +0200
+++ ./zip_archive.cc 2017-08-23 21:31:15.904280978 +0200
@@ -272,11 +272,6 @@
if (static_cast<off64_t>(eocd->cd_start_offset) + eocd->cd_size > eocd_offset) {
ALOGW("Zip: bad offsets (dir %" PRIu32 ", size %" PRIu32 ", eocd %" PRId64 ")",
eocd->cd_start_offset, eocd->cd_size, static_cast<int64_t>(eocd_offset));
-#if defined(__ANDROID__)
- if (eocd->cd_start_offset + eocd->cd_size <= eocd_offset) {
- android_errorWriteLog(0x534e4554, "31251826");
- }
-#endif
return kInvalidOffset;
}
if (eocd->num_records == 0) {
@@ -388,9 +383,6 @@
for (uint16_t i = 0; i < num_entries; i++) {
if (ptr > cd_end - sizeof(CentralDirectoryRecord)) {
ALOGW("Zip: ran off the end (at %" PRIu16 ")", i);
-#if defined(__ANDROID__)
- android_errorWriteLog(0x534e4554, "36392138");
-#endif
return -1;
}

View File

@ -1,84 +0,0 @@
--- log-orig.h 2017-03-04 02:11:04.589477520 +0100
+++ log.h 2017-03-04 02:11:54.556875283 +0100
@@ -217,7 +217,7 @@
*/
#ifndef SLOGV
#define __SLOGV(...) \
- ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
+ ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
#if LOG_NDEBUG
#define SLOGV(...) do { if (0) { __SLOGV(__VA_ARGS__); } } while (0)
#else
@@ -231,7 +231,7 @@
#else
#define SLOGV_IF(cond, ...) \
( (__predict_false(cond)) \
- ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
+ ? ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
: (void)0 )
#endif
#endif
@@ -241,13 +241,13 @@
*/
#ifndef SLOGD
#define SLOGD(...) \
- ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
+ ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
#endif
#ifndef SLOGD_IF
#define SLOGD_IF(cond, ...) \
( (__predict_false(cond)) \
- ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
+ ? ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
: (void)0 )
#endif
@@ -256,13 +256,13 @@
*/
#ifndef SLOGI
#define SLOGI(...) \
- ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
+ ((void)__android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
#endif
#ifndef SLOGI_IF
#define SLOGI_IF(cond, ...) \
( (__predict_false(cond)) \
- ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)) \
+ ? ((void)__android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)) \
: (void)0 )
#endif
@@ -271,13 +271,13 @@
*/
#ifndef SLOGW
#define SLOGW(...) \
- ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__))
+ ((void)__android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__))
#endif
#ifndef SLOGW_IF
#define SLOGW_IF(cond, ...) \
( (__predict_false(cond)) \
- ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)) \
+ ? ((void)__android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)) \
: (void)0 )
#endif
@@ -286,13 +286,13 @@
*/
#ifndef SLOGE
#define SLOGE(...) \
- ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
+ ((void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
#endif
#ifndef SLOGE_IF
#define SLOGE_IF(cond, ...) \
( (__predict_false(cond)) \
- ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
+ ? ((void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
: (void)0 )
#endif

195
packages/aapt/sources.sh Normal file
View File

@ -0,0 +1,195 @@
# libcutils
local libcutils_nonwindows_sources_cpp="
android_get_control_file.cpp
sockets_unix.cpp
"
local libcutils_sources_cpp="
$libcutils_nonwindows_sources_cpp
fs_config.cpp
sched_policy.cpp
sockets.cpp
"
local libcutils_nonwindows_sources_c="
fs.c
multiuser.c
socket_inaddr_any_server_unix.c
socket_local_client_unix.c
socket_local_server_unix.c
socket_network_client_unix.c
str_parms.c
"
libcutils_nonwindows_sources_c+="
ashmem-host.c
trace-host.c
"
local libcutils_sources_c="
$libcutils_nonwindows_sources_c
config_utils.c
canned_fs_config.c
hashmap.c
iosched_policy.c
load_file.c
native_handle.c
open_memstream.c
record_stream.c
strdup16to8.c
strdup8to16.c
strlcpy.c
threads.c
"
# libutils
#CallStack.cpp
local libutils_sources="
FileMap.cpp
JenkinsHash.cpp
NativeHandle.cpp
Printer.cpp
PropertyMap.cpp
RefBase.cpp
SharedBuffer.cpp
Static.cpp
StopWatch.cpp
String8.cpp
String16.cpp
StrongPointer.cpp
SystemClock.cpp
Threads.cpp
Timers.cpp
Tokenizer.cpp
Unicode.cpp
VectorImpl.cpp
misc.cpp
"
# libbase
local libbase_linux_sources="
errors_unix.cpp
chrono_utils.cpp
"
local libbase_sources="
$libbase_linux_sources
file.cpp
logging.cpp
parsenetaddress.cpp
quick_exit.cpp
stringprintf.cpp
strings.cpp
test_utils.cpp
"
# libziparchive
local libziparchive_sources="
zip_archive.cc
zip_archive_stream_entry.cc
zip_writer.cc
"
# androidfw
local androidfw_sources="
ApkAssets.cpp
Asset.cpp
AssetDir.cpp
AssetManager.cpp
AssetManager2.cpp
AttributeResolution.cpp
ChunkIterator.cpp
LoadedArsc.cpp
LocaleData.cpp
misc.cpp
ObbFile.cpp
ResourceTypes.cpp
ResourceUtils.cpp
StreamingZipInflater.cpp
TypeWrappers.cpp
Util.cpp
ZipFileRO.cpp
ZipUtils.cpp
"
# aapt2
local libaapt2_sources_proto="
Resources.proto
ResourcesInternal.proto
"
local libaapt2_sources_cpp="
${libaapt2_sources_proto//.proto/.pb.cc}
compile/IdAssigner.cpp
compile/InlineXmlFormatParser.cpp
compile/NinePatch.cpp
compile/Png.cpp
compile/PngChunkFilter.cpp
compile/PngCrunch.cpp
compile/PseudolocaleGenerator.cpp
compile/Pseudolocalizer.cpp
compile/XmlIdCollector.cpp
configuration/ConfigurationParser.cpp
filter/AbiFilter.cpp
filter/ConfigFilter.cpp
flatten/Archive.cpp
flatten/TableFlattener.cpp
flatten/XmlFlattener.cpp
io/BigBufferStreams.cpp
io/File.cpp
io/FileInputStream.cpp
io/FileSystem.cpp
io/StringInputStream.cpp
io/Util.cpp
io/ZipArchive.cpp
link/AutoVersioner.cpp
link/ManifestFixer.cpp
link/ProductFilter.cpp
link/PrivateAttributeMover.cpp
link/ReferenceLinker.cpp
link/TableMerger.cpp
link/XmlCompatVersioner.cpp
link/XmlNamespaceRemover.cpp
link/XmlReferenceLinker.cpp
optimize/ResourceDeduper.cpp
optimize/VersionCollapser.cpp
process/SymbolTable.cpp
proto/ProtoHelpers.cpp
proto/TableProtoDeserializer.cpp
proto/TableProtoSerializer.cpp
split/TableSplitter.cpp
text/Unicode.cpp
text/Utf8Iterator.cpp
unflatten/BinaryResourceParser.cpp
unflatten/ResChunkPullParser.cpp
util/BigBuffer.cpp
util/Files.cpp
util/Util.cpp
ConfigDescription.cpp
Debug.cpp
DominatorTree.cpp
Flags.cpp
java/AnnotationProcessor.cpp
java/ClassDefinition.cpp
java/JavaClassGenerator.cpp
java/ManifestClassGenerator.cpp
java/ProguardRules.cpp
LoadedApk.cpp
Locale.cpp
Resource.cpp
ResourceParser.cpp
ResourceTable.cpp
ResourceUtils.cpp
ResourceValues.cpp
SdkConstants.cpp
StringPool.cpp
xml/XmlActionExecutor.cpp
xml/XmlDom.cpp
xml/XmlPullParser.cpp
xml/XmlUtil.cpp
"
local aapt2_sources_cpp="
$libaapt2_sources_cpp
cmd/Compile.cpp
cmd/Diff.cpp
cmd/Dump.cpp
cmd/Link.cpp
cmd/Optimize.cpp
cmd/Util.cpp
Main.cpp
"