From f88e9b013e2daa68c8e40b1c6b008a48ae5faa10 Mon Sep 17 00:00:00 2001 From: YZBruh Date: Thu, 3 Oct 2024 22:00:12 +0300 Subject: [PATCH] pmt: fix all build issues etc (ndk) --- jni/Android.mk | 8 +++----- jni/Application.mk | 5 ++--- jni/PartitionManager/Tools.cpp | 4 ++++ pmt-termux.sh | 32 +++++++++++++++++++------------- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/jni/Android.mk b/jni/Android.mk index 705ba6b..0a81da3 100755 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -15,7 +15,7 @@ # limitations under the License. ######## -# 2.9.0 +# 2.9.1 ######## LOCAL_PATH := $(call my-dir) @@ -32,7 +32,7 @@ PMT_CXXFLAGS = \ -Wno-nullability-extension \ -Wno-reorder-init-list \ -Wno-gnu-zero-variadic-macro-arguments \ - -D__NDK_BUILD \ + -static \ $(PMT_EXTRA_CXXFLAGS) E2FSPROGS_DEFAULT_CFLAGS = \ -Werror \ @@ -258,6 +258,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := libext2_quota LOCAL_SRC_FILES := \ + $(LIBEXT2_QUOTA)/devname.c \ $(LIBEXT2_QUOTA)/dict.c \ $(LIBEXT2_QUOTA)/mkquota.c \ $(LIBEXT2_QUOTA)/parse_qtype.c \ @@ -340,8 +341,5 @@ LOCAL_STATIC_LIBRARIES := \ libext2_quota \ libext2_misc \ libext2_com_err -LOCAL_SHARED_LIBRARIES := \ - liblog \ - libcutils include $(BUILD_EXECUTABLE) diff --git a/jni/Application.mk b/jni/Application.mk index c1f5419..ac3ede1 100755 --- a/jni/Application.mk +++ b/jni/Application.mk @@ -15,7 +15,7 @@ # limitations under the License. ######## -# 2.9.0 +# 2.9.1 ######## # architecture @@ -23,9 +23,8 @@ APP_ABI := \ arm64-v8a \ armeabi-v7a -APP_PLATFORM := android-21 +APP_PLATFORM := android-29 APP_OPTIM := release APP_STL := c++_static -APP_ALLOW_MISSING_DEPS := true # end diff --git a/jni/PartitionManager/Tools.cpp b/jni/PartitionManager/Tools.cpp index c68f70c..16a5f7f 100755 --- a/jni/PartitionManager/Tools.cpp +++ b/jni/PartitionManager/Tools.cpp @@ -265,7 +265,11 @@ int Functions::Start(ushort_t progress_code) /* generate mke2fs argument list */ VLOGD("PartitionManager: generating mke2fs argument list...\n"); char bsize[25] = ""; +#ifdef __LP64__ sprintf(bsize, "%lu", file_sys_inf.f_bsize); +#else + sprintf(bsize, "%u", file_sys_inf.f_bsize); +#endif char* arguments[] = { "mke2fs-static", "-Fq", diff --git a/pmt-termux.sh b/pmt-termux.sh index 1b9c742..70b2249 100755 --- a/pmt-termux.sh +++ b/pmt-termux.sh @@ -4,7 +4,7 @@ # Variables LOCAL_VERSION="2.9.1" -LOCAL_RELDATE="20241002" +LOCAL_RELDATE="20241003" LOCAL_OWNER="ShawkTeam" LOCAL_REPO="pmt" LOCAL_RELEASE_TAG="${LOCAL_VERSION}" @@ -12,6 +12,7 @@ LOCAL_PREFIX="${PREFIX}" [ -d "${LOCAL_PREFIX}" ] \ || LOCAL_PREFIX="/data/data/com.termux/files/usr" LOCAL_TMPDIR="${LOCAL_PREFIX}/tmp/pmt-termux-helper" +SILENT=false # Colors RESET="\033[0m" @@ -20,13 +21,13 @@ GREEN="\033[0;32m" YELLOW="\033[0;33m" # Printer functions -function printc() { echo -e "$*" >&2; } +function printc() { ${SILENT} || echo -e "$*" >&2; } function print() { if echo "$*" | grep "Success" &>/dev/null; then - echo -e " - ${GREEN}${1:0:7}${RESET}." >&2 + ${SILENT} || echo -e " - ${GREEN}${1:0:7}${RESET}." >&2 else - echo -e " - $*" >&2 + ${SILENT} || echo -e " - $*" >&2 fi } @@ -47,7 +48,7 @@ function script_head() { printc " --- Partition Manager Termux Helper Script --- # For display help message function view_help() { - echo -n "Usage: " + echo ${SILENT} -n "Usage: " if echo "${0}" | grep "./" >&/dev/null; then printc "${0} [OPTIONS]..." else @@ -59,11 +60,10 @@ function view_help() printc " install, -i [OPTS] Download and install Partition Manager." printc " uninstall, -u Uninstall Partition Manager." printc " status, -s Display install/uninstall status." + printc " --quiet, -q Silent mode. No output." printc " --setup, -S Setup required packages." printc " --package If you already have a pmt package, make\n setup by specifying this way." printc "Report bugs to " - - exit 0 } # Script really operated termux proclamation? @@ -196,7 +196,7 @@ function install_fn() print "Installing..." cp pmt "${LOCAL_PREFIX}/bin/pmt" &>/dev/null \ || abort "Installing failed!" - + if ${HAVE_MANDOC}; then print "Installing mandoc (force)..." cp -f pmt.8.gz ${LOCAL_PREFIX}/share/man/man8 &>/dev/null @@ -246,6 +246,9 @@ while (($# >= 1)); do script_head check_status y ;; + --quiet|-q) + SILENT=true + ;; --setup|-S) script_head print "Starting package setupper..." @@ -261,11 +264,12 @@ while (($# >= 1)); do ;; --help) view_help + exit 0 ;; *) if echo ${1} | grep "-" &>/dev/null; then if ! echo ${1} | grep ".xz" &>/dev/null; then - printc "Unknown option: ${1}" \ + printc "Unknown option: ${1}" exit 1 else break; @@ -280,11 +284,13 @@ while (($# >= 1)); do done ### Main ### -[ -z "${1}" -a "${SOME_SPEC}" != 1 ] && view_help +[ -z "${1}" -a "${SOME_SPEC}" != 1 ] && view_help && exit 1 -script_head -really_termux -gen_tempdir +if [ "${PROCESS}" -le 2 ]; then + script_head + really_termux + gen_tempdir +fi if [ "${PROCESS}" = 1 ]; then [ -f "${LOCAL_PREFIX}/bin/pmt" ] \