From 79e16f68e41ce0280caf5e3d60ed66d11bbcb024 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Wed, 23 Aug 2017 21:59:09 +0200 Subject: [PATCH] aapt: Remove __android_log_error_write reference Removing a reference to __android_log_error_write hopefully fixes an issue on Android 5 (see #1306). --- packages/aapt/build.sh | 3 ++- packages/aapt/libziparchive.patch.txt | 30 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 packages/aapt/libziparchive.patch.txt diff --git a/packages/aapt/build.sh b/packages/aapt/build.sh index ea80ef73b..e93040f6f 100644 --- a/packages/aapt/build.sh +++ b/packages/aapt/build.sh @@ -6,6 +6,7 @@ TERMUX_PKG_DESCRIPTION="Android Asset Packaging Tool" _TAG_VERSION=7.1.2 _TAG_REVISION=33 TERMUX_PKG_VERSION=${_TAG_VERSION}.${_TAG_REVISION} +TERMUX_PKG_REVISION=1 TERMUX_PKG_BUILD_IN_SRC=yes TERMUX_PKG_DEPENDS="libexpat, libpng, libzopfli" @@ -198,7 +199,7 @@ termux_step_make_install () { 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 + patch -p0 < $TERMUX_PKG_BUILDER_DIR/libziparchive.patch.txt $CXX $CXXFLAGS $LDFLAGS -std=c++11 \ -DZLIB_CONST \ -isystem $AOSP_INCLUDE_DIR \ diff --git a/packages/aapt/libziparchive.patch.txt b/packages/aapt/libziparchive.patch.txt new file mode 100644 index 000000000..3334719f0 --- /dev/null +++ b/packages/aapt/libziparchive.patch.txt @@ -0,0 +1,30 @@ +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(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(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; + } +