From 5859f749c9d48e5bbff9d78881bf80bdbf14aebb Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Thu, 1 Sep 2016 12:57:09 -0400 Subject: [PATCH] Some work on an update aapt package --- disabled-packages/aapt-updated/build.sh | 246 ++++++++++++++++++ .../aapt-updated/libbase-patch.txt | 21 ++ disabled-packages/android-libbase/build.sh | 16 -- disabled-packages/android-libcutils/build.sh | 30 --- disabled-packages/android-libcutils/log.h | 31 --- disabled-packages/android-libutils/build.sh | 36 --- 6 files changed, 267 insertions(+), 113 deletions(-) create mode 100644 disabled-packages/aapt-updated/build.sh create mode 100644 disabled-packages/aapt-updated/libbase-patch.txt delete mode 100644 disabled-packages/android-libbase/build.sh delete mode 100644 disabled-packages/android-libcutils/build.sh delete mode 100644 disabled-packages/android-libcutils/log.h delete mode 100644 disabled-packages/android-libutils/build.sh diff --git a/disabled-packages/aapt-updated/build.sh b/disabled-packages/aapt-updated/build.sh new file mode 100644 index 000000000..fba4d7679 --- /dev/null +++ b/disabled-packages/aapt-updated/build.sh @@ -0,0 +1,246 @@ +# NOTE: Needs to be built with clang. +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" + +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 && curl -o $ANDROIDFW_INCLUDE_TARFILE \ + "https://android.googlesource.com/platform/frameworks/base/+archive/android-$_TAGNAME/include/androidfw.tar.gz" + + 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 + + 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 && curl -o $LIBCUTILS_TARFILE "https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/libcutils.tar.gz" + 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 %include %' 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/libcutils.so + + 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 %%' 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 \ + -lcutils \ + -shared \ + -o $TERMUX_PREFIX/lib/libandroidfw.so + + + + # Build libutil: + local LIBUTILS_TARFILE=$TERMUX_PKG_CACHEDIR/libutils_${_TAGNAME}.tar.gz + test ! -f $LIBUTILS_TARFILE && curl -o $LIBUTILS_TARFILE "https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/libutils.tar.gz" + + 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 \ + -lcutils \ + -shared \ + -o $TERMUX_PREFIX/lib/libutils.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 . + $CXX $CPPFLAGS -std=c++11 \ + -D__USE_BSD \ + -isystem $AOSP_INCLUDE_DIR \ + $libbase_src_files $libbase_linux_src_files \ + -shared \ + -o $TERMUX_PREFIX/lib/libbase.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(data)%next_in = const_cast(reinterpret_cast(data))%' zip_writer.cc + $CXX $CXXFLAGS $LDFLAGS -std=c++11 \ + -DZLIB_CONST \ + -isystem $AOSP_INCLUDE_DIR \ + $libziparchive_source_files \ + -lbase \ + -shared \ + -o $TERMUX_PREFIX/lib/libziparchive.so + + + + # Build aapt: + AAPT_TARFILE=$TERMUX_PKG_CACHEDIR/aapt_${_TAGNAME}.tar.gz + test ! -f $AAPT_TARFILE && curl -o $AAPT_TARFILE "https://android.googlesource.com/platform/frameworks/base/+archive/android-$_TAGNAME/tools/aapt.tar.gz" + 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 \ + -lcutils -lutils -landroidfw -lziparchive \ + -llog \ + -lm -lz -lpng -lexpat \ + -lgnustl_shared \ + -o $TERMUX_PREFIX/bin/aapt +} diff --git a/disabled-packages/aapt-updated/libbase-patch.txt b/disabled-packages/aapt-updated/libbase-patch.txt new file mode 100644 index 000000000..909346687 --- /dev/null +++ b/disabled-packages/aapt-updated/libbase-patch.txt @@ -0,0 +1,21 @@ +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 + #include "cutils/log.h" + #else + #include +@@ -398,9 +397,6 @@ + + // Abort if necessary. + if (data_->GetSeverity() == FATAL) { +-#ifdef __ANDROID__ +- android_set_abort_message(msg.c_str()); +-#endif + abort(); + } + } diff --git a/disabled-packages/android-libbase/build.sh b/disabled-packages/android-libbase/build.sh deleted file mode 100644 index 90899ccc5..000000000 --- a/disabled-packages/android-libbase/build.sh +++ /dev/null @@ -1,16 +0,0 @@ -TERMUX_PKG_HOMEPAGE=http://elinux.org/Android_aapt -TERMUX_PKG_DESCRIPTION="Library providing common functionalities for Android related tools" -TERMUX_PKG_VERSION=6.0.1 -TERMUX_PKG_BUILD_IN_SRC=yes - -termux_step_make_install () { - local _TAGNAME=${TERMUX_PKG_VERSION}_r5 - - BASE_TARFILE=$TERMUX_PKG_CACHEDIR/base_${_TAGNAME}.tar.gz - - test ! -f $BASE_TARFILE && curl -o $BASE_TARFILE "https://android.googlesource.com/platform/system/core/+archive/android-${_TAGNAME}/base.tar.gz" - - tar xf $BASE_TARFILE - rm test_*.cpp *_test.cpp - $CXX $CPPFLAGS -std=c++11 -isystem $TERMUX_PKG_SRCDIR/include *.cpp -shared -o $TERMUX_PREFIX/lib/libbase.so -} diff --git a/disabled-packages/android-libcutils/build.sh b/disabled-packages/android-libcutils/build.sh deleted file mode 100644 index 714a12ebe..000000000 --- a/disabled-packages/android-libcutils/build.sh +++ /dev/null @@ -1,30 +0,0 @@ -TERMUX_PKG_HOMEPAGE=http://elinux.org/Android_aapt -TERMUX_PKG_DESCRIPTION="Library providing common functionalities for Android related tools" -TERMUX_PKG_VERSION=6.0.1 -TERMUX_PKG_BUILD_IN_SRC=yes - -termux_step_make_install () { - local _TAGNAME=${TERMUX_PKG_VERSION}_r5 - - LIBCUTILS_TARFILE=$TERMUX_PKG_CACHEDIR/libcutils_${_TAGNAME}.tar.gz - - test ! -f $LIBCUTILS_TARFILE && curl -o $LIBCUTILS_TARFILE "https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/libcutils.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" - - mkdir -p libcutils include/{cutils,log} - tar xf $LIBCUTILS_INCLUDE_TARFILE -C include/cutils - - cp $TERMUX_PKG_BUILDER_DIR/log.h include/log/ - cp $TERMUX_PKG_BUILDER_DIR/log.h include/cutils/ - - cp -Rf include/cutils $TERMUX_PREFIX/include/cutils - - cd libcutils - tar xf $LIBCUTILS_TARFILE - rm dlmalloc_stubs.c ashmem-host.c properties.c fs_config.c trace-*.c - $CC -isystem $TERMUX_PKG_SRCDIR/include *.c -shared -o $TERMUX_PREFIX/lib/libcutils.so -} diff --git a/disabled-packages/android-libcutils/log.h b/disabled-packages/android-libcutils/log.h deleted file mode 100644 index d6385a789..000000000 --- a/disabled-packages/android-libcutils/log.h +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include -#include -#include - -/* 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 '/' diff --git a/disabled-packages/android-libutils/build.sh b/disabled-packages/android-libutils/build.sh deleted file mode 100644 index 4f754780c..000000000 --- a/disabled-packages/android-libutils/build.sh +++ /dev/null @@ -1,36 +0,0 @@ -TERMUX_PKG_HOMEPAGE=http://elinux.org/Android_aapt -TERMUX_PKG_DESCRIPTION="Library providing common functionalities for Android related tools" -TERMUX_PKG_VERSION=6.0.1 -TERMUX_PKG_BUILD_IN_SRC=yes -TERMUX_PKG_DEPENDS="android-libcutils" - -termux_step_make_install () { - local _TAGNAME=${TERMUX_PKG_VERSION}_r5 - - LIBUTILS_TARFILE=$TERMUX_PKG_CACHEDIR/libutils_${_TAGNAME}.tar.gz - - test ! -f $LIBUTILS_TARFILE && curl -o $LIBUTILS_TARFILE "https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/libutils.tar.gz" - - # https://android.googlesource.com/platform/system/core/+/android-4.4.4_r2/include/cutils/ - LIBUTILS_INCLUDE_TARFILE=$TERMUX_PKG_CACHEDIR/libcutils_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" - - - SYSTEM_INCLUDE_TARFILE=$TERMUX_PKG_CACHEDIR/system_include_${_TAGNAME}.tar.gz - test ! -f $SYSTEM_INCLUDE_TARFILE && curl -o $SYSTEM_INCLUDE_TARFILE \ - "https://android.googlesource.com/platform/system/core/+archive/android-$_TAGNAME/include/system.tar.gz" - - - mkdir -p libutils include/{utils,log,system} - tar xf $LIBUTILS_INCLUDE_TARFILE -C include/utils - tar xf $SYSTEM_INCLUDE_TARFILE -C include/system - - #cp $TERMUX_PKG_BUILDER_DIR/log.h include/log/ - - cd libutils - tar xf $LIBUTILS_TARFILE - #rm dlmalloc_stubs.c ashmem-host.c properties.c fs_config.c trace-*.c - rm BlobCache.cpp Looper.cpp Trace.cpp CallStack.cpp - $CXX $CPPFLAGS -std=c++11 -isystem $TERMUX_PKG_SRCDIR/include *.cpp -shared -o $TERMUX_PREFIX/lib/libutils.so -}