pmt: initial 2.7.0 update

This commit is contained in:
2024-08-02 17:44:31 +03:00
parent ed745369fa
commit 5d51e44a2c
31 changed files with 223 additions and 191 deletions

View File

@@ -1,6 +0,0 @@
NDK_PROG=false
FORCE_GEN=false
THIS_IS=main
UPDATE_MAKEFILES=false
SOURCE_DIRNAME=src
OUT_DIRNAME=out

View File

@@ -14,7 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
[ ! "${THIS_IS}" = "main" ] && abort "The caller is not the main makefile. Something's wrong."
[ ! "${THIS_IS}" = "main" ] \
&& abort "The caller is not the main makefile. Something's wrong."
try_with="Try with force mode (FORCE_GEN=true)."
@@ -24,7 +25,7 @@ else
mfiles=("${OUT_DIR}/Makefile" "${SOURCE_DIR}/Makefile")
fi
for mfile in ${mfiles[0]} ${mfiles[1]}; do
for mfile in ${mfiles[@]}; do
[ -f "${mfile}" ] && \
if [ "${FORCE_GEN}" = "true" ]; then

View File

@@ -17,25 +17,27 @@
. build/bash/vars
. build/bash/functions
[ ! "${THIS_IS}" = "main" ] && abort "The caller is not the main makefile. Something's wrong."
[ ! "${THIS_IS}" = "main" ] \
&& abort "The caller is not the main makefile. Something's wrong."
if [ "${NDK_PROG}" = "true" ]; then
[ "${UPDATE_MAKEFILES}" = "true" ] || print " - Removing Android.mk..."
rm -f ${SOURCE_DIR}/Android.mk
[ "${UPDATE_MAKEFILES}" = "true" ] \
|| print " - Removing Android.mk..." \
&& print " - Removing Application.mk..."
[ "${UPDATE_MAKEFILES}" = "true" ] || print " - Removing Application.mk..."
rm -f ${SOURCE_DIR}/Application.mk
rm -f ${SOURCE_DIR}/Application.mk \
${SOURCE_DIR}/Android.mk
else
[ "${UPDATE_MAKEFILES}" = "true" ] || print " - Info: Main makefile won't be deleted."
[ "${UPDATE_MAKEFILES}" = "true" ] \
|| print " - Info: Main makefile won't be deleted." \
&& print " - Removing output directory makefile..." \
&& print " - Removing source directory makefile..."
[ "${UPDATE_MAKEFILES}" = "true" ] || print " - Removing output directory makefile..."
rm -f ${OUT_DIR}/Makefile
[ "${UPDATE_MAKEFILES}" = "true" ] || print " - Removing source directory makefile"
rm -f ${SOURCE_DIR}/Makefile
rm -f ${SOURCE_DIR}/Makefile \
${OUT_DIR}/Makefile
fi

View File

@@ -16,22 +16,22 @@
function abort()
{
[ -n "$1" ] && echo -e " - ${RED}${BOLD}Error:${BOLD_RESET}${RESET} $1"
[ -n "${1}" ] \
&& echo -e " - ${RED}${BOLD}Error:${BOLD_RESET}${RESET} ${1}"
exit 1
}
function read_file()
{
cat "$1" >> "$2" || abort "failed to read/write $1/$2"
cat "${1}" >> "${2}" \
|| abort "failed to read/write ${1}/${2}"
}
function gen()
{
[ "${FORCE_GEN}" = "true" -a "${UPDATE_MAKEFILES}" = "true" ] && rm -f "$1"
touch "$1" || abort "failed to generate: $1"
[ "${FORCE_GEN}" = "true" -a "${UPDATE_MAKEFILES}" = "true" ] \
&& rm -f "${1}"
touch "${1}" || abort "failed to generate: ${1}"
}
function print()
{
echo -e "$1"
}
function print() { echo -e "${1}"; }

View File

@@ -14,13 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
[ -z ${NDK_ROOT_DIR} ] && \
echo "Please set NDK_ROOT_DIR variable!" && \
exit 1
[ -z ${NDK_ROOT_DIR} ] \
&& echo "Please set NDK_ROOT_DIR variable!" \
&& exit 1
[ -z ${NDK_PROJECT_PATH} ] && \
echo "Please set NDK_PROJECT_PATH variable!" && \
exit 1
[ -z ${NDK_PROJECT_PATH} ] \
&& echo "Please set NDK_PROJECT_PATH variable!" \
&& exit 1
CC_IS="${NDK_ROOT_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang"
CC_VERS=$(${CC_IS} --version | head -n 1)

View File

@@ -17,8 +17,10 @@
. build/bash/vars
. build/bash/functions
[ ! "${UPDATE_MAKEFILES}" = "true" ] && . build/bash/check-makefiles
[ ! "${THIS_IS}" = "main" ] && abort "The caller is not the main makefile. Something's wrong."
[ ! "${UPDATE_MAKEFILES}" = "true" ] \
&& . build/bash/check-makefiles
[ ! "${THIS_IS}" = "main" ] \
&& abort "The caller is not the main makefile. Something's wrong."
if [ "${UPDATE_MAKEFILES}" = "true" ]; then
GENR="Re-generating"

Binary file not shown.

View File

@@ -15,6 +15,7 @@
# limitations under the License.
UPDATE_MAKEFILES = false
CLS_ADTS := "rm -f $(BUILD)/bash/additional-vars"
all:
$(MAKE_HIDE) $(SILENT) -C $(BUILD)/config || exit 1
@@ -46,7 +47,8 @@ clean:
# helper function
.PHONY: help
help:
$(E) " ------- Partition Manager help ------- " && $(E_NS)
$(E) " ------- Partition Manager help ------- " \
&& $(E_NS)
$(E) " Commands:"
$(E) " $(MAKE) ==> Build Partition Manager."
$(E) " $(MAKE) deb ==> Generate debian package for termux."
@@ -85,13 +87,13 @@ gen-ndk-makefiles:
$(eval NDK_PROG = true)
$(call save-gen-vars)
$(call gen-ndk-mfiles)
@ $(P) ""
@ $(CLS_ADTS)
.PHONY: gen-makefiles
gen-makefiles:
$(call save-gen-vars)
$(call gen-mfiles)
@ $(P) ""
@ $(CLS_ADTS)
.PHONY: update-ndk-makefiles
update-ndk-makefiles:
@@ -101,6 +103,7 @@ update-ndk-makefiles:
$(call save-gen-vars)
$(call clean-ndk-mfiles)
$(call gen-ndk-mfiles)
@ $(CLS_ADTS)
.PHONY: update-makefiles
update-makefiles:
@@ -109,18 +112,19 @@ update-makefiles:
$(call save-gen-vars)
$(call clean-ndk-mfiles)
$(call gen-mfiles)
@ $(CLS_ADTS)
.PHONY: clean-ndk-makefiles
clean-ndk-makefiles:
$(eval NDK_PROG = true)
$(call save-gen-vars)
$(call clean-ndk-mfiles)
@ $(P) ""
@ $(CLS_ADTS)
.PHONY: clean-makefiles
clean-makefiles:
$(call save-gen-vars)
$(call clean-mfiles)
@ $(P) ""
@ $(CLS_ADTS)
# end

View File

@@ -15,7 +15,7 @@
# limitations under the License.
########
# 2.6.0
# 2.7.0
########
LOCAL_PATH := $(call my-dir)
@@ -49,8 +49,8 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libpmt_debugging
LOCAL_SRC_FILES := debugging.c
LOCAL_MODULE := libpmt_debug
LOCAL_SRC_FILES := debug.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include
LOCAL_CFLAGS := $(PMT_CFLAGS)
@@ -79,7 +79,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE := pmt
LOCAL_SRC_FILES := \
pmt.c \
versioning.c \
version.c \
get_stat.c \
tools.c \
lang_tools.c \
@@ -88,7 +88,7 @@ LOCAL_SRC_FILES := \
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include
LOCAL_STATIC_LIBRARIES := \
libpmt_root \
libpmt_debugging \
libpmt_debug \
libpmt_partitiontool \
libpmt_list
LOCAL_CFLAGS := $(PMT_CFLAGS)

View File

@@ -15,7 +15,7 @@
# limitations under the License.
########
# 2.6.0
# 2.7.0
########
# architecture

View File

@@ -31,7 +31,7 @@ PMT_INCDIR := $(INCLUDE_DIR)/pmt
# the presence of all source files that are on this list will be checked
SRCS_REQ := \
place-holder/debugging.c \
place-holder/debug.c \
place-holder/help.c \
place-holder/get_stat.c \
place-holder/lang_tools.c \
@@ -40,34 +40,38 @@ SRCS_REQ := \
place-holder/pmt.c \
place-holder/root.c \
place-holder/tools.c \
place-holder/versioning.c
place-holder/version.c
# objects to be used when executable file is created
OBJS_EXEC := \
$(SOURCE_DIR)/$(TARGET).o \
$(SOURCE_DIR)/help.o \
$(SOURCE_DIR)/versioning.o \
$(SOURCE_DIR)/version.o \
$(SOURCE_DIR)/get_stat.o \
$(SOURCE_DIR)/tools.o \
$(SOURCE_DIR)/lang_tools.o \
$(SOURCE_DIR)/languages.o
HEADERS_REQ := \
$(PMT_INCDIR)/pmt/deprecates.h \
$(PMT_INCDIR)/pmt/help_msgs.h \
$(PMT_INCDIR)/pmt/ExternC.h \
$(PMT_INCDIR)/pmt/Deprecates.h \
$(PMT_INCDIR)/pmt/HelpMessages.h \
$(PMT_INCDIR)/pmt/pmt.h \
$(PMT_INCDIR)/pmt/stringkeys.h \
$(PMT_INCDIR)/pmt/versioning.h
$(PMT_INCDIR)/pmt/StringKeys.h \
$(PMT_INCDIR)/pmt/VersionVars.h
PROGRESS_LIST := \
welcome \
wait \
$(SRCS_REQ) \
$(HEADERS_REQ) \
pr_obj \
$(OBJS) \
make_outdirs \
pr_sts \
$(STATIC_LIBS) \
make_executable \
wait \
end_progress
define check_hf
@@ -88,17 +92,22 @@ welcome:
&& $(E_NS)
$(E) " -------------------------------- " \
&& $(E_NS)
@ if [ -f $(SOURCE_DIR)/debugging.o ]; then \
@ if [ -f $(SOURCE_DIR)/debug.o ]; then \
$(E_NS) " - Please clean up before you build it." && echo; \
$(E_NS) " ----------------------------------- "; \
exit 1; \
fi
$(E) " - Checking required source files..."
@ sleep 1
pr_obj:
$(E) " - Building objects..."
pr_sts:
$(E) " - Making static libraries..."
wait:
@ sleep 2
make_outdirs:
@ rm -rf $(IN_OUT_DIR)
@ mkdir $(BINARY_DIR)
@@ -122,31 +131,15 @@ $(PMT_INCDIR)/%.h:
$(SOURCE_DIR)/%.o: $(SOURCE_DIR)/%.c
$(E) " CC $(SOURCE_DIRNAME)/`basename $@`"
@ $(CC) $(CFLAGS) -c "$<" || exit 1
$(eval GEN_OBJS_MSG = )
lib$(TARGET)_root.a:
$(E) " - Making static libraries..."
$(E) " AR $@"
@ $(AR) rcs "$@" "$(SOURCE_DIR)/root.o" || exit 1
lib$(TARGET)_debugging.a:
$(E) " AR $@"
@ $(AR) rcs "$@" "$(SOURCE_DIR)/debugging.o"
lib$(TARGET)_listpart.a:
$(E) " AR $@"
@ $(AR) rcs "$@" "$(SOURCE_DIR)/listpart.o"
lib$(TARGET)_partitiontool.a:
$(E) " AR $@"
@ $(AR) rcs "$@" "$(SOURCE_DIR)/partitiontool.o"
@ sleep 1
$(TARGET)_%:
$(E) " AR lib$@.a"
@ $(AR) rcs "lib$@.a" "$(SOURCE_DIR)/$$(echo "$@" | cut -d'_' -f2).o"
make_executable:
$(E) " - Making executable file..."
$(E) " LD $(TARGET)"
@ $(CC) $(CFLAGS) -L$(SOURCE_DIR) -l$(TARGET)_root -l$(TARGET)_debugging -l$(TARGET)_listpart -l$(TARGET)_partitiontool -o $(TARGET) $(OBJS_EXEC) || exit 1
@ sleep 1
@ $(CC) $(CFLAGS) -L$(SOURCE_DIR) $(foreach st,$(STATIC_LIBS),$(shell echo -n -l$(st) )) -o $(TARGET) $(OBJS_EXEC) || exit 1
end_progress:
@ abort_build() { \

View File

@@ -1,5 +1,5 @@
export PMT_VERSION="2.6.0"
export PMT_VERSION_CODE=260
export PMT_VERSION="2.7.0"
export PMT_VERSION_CODE=270
export NDK_LINK="https://dl.google.com/android/repository/android-ndk-r27-linux.zip"
export NDK_VERSION="r27"
export NDK_IS="android-ndk"