pmt: initial 2.5.0 update
This commit is contained in:
98
build/others/makefile.androidmk
Executable file
98
build/others/makefile.androidmk
Executable file
@@ -0,0 +1,98 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
########
|
||||
# 2.5.0
|
||||
########
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(LOCAL_PATH)/../build/config/env.mk
|
||||
|
||||
PMT_CFLAGS = \
|
||||
-O3 \
|
||||
-std=c11 \
|
||||
-pedantic \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Werror \
|
||||
-Wno-nullability-extension \
|
||||
-Wno-gnu-zero-variadic-macro-arguments \
|
||||
-D__NDK_BUILD \
|
||||
$(EXTRA_COMPILER_FLAGS)
|
||||
|
||||
ifneq ($(PMT_ENABLE_DEBUG),)
|
||||
PMT_CFLAGS += -gdwarf-5 -fsanitize=address
|
||||
endif
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libpmt_root
|
||||
LOCAL_SRC_FILES := root.c
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include
|
||||
LOCAL_CFLAGS := $(PMT_CFLAGS)
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libpmt_debugging
|
||||
LOCAL_SRC_FILES := debugging.c
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include
|
||||
LOCAL_CFLAGS := $(PMT_CFLAGS)
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libpmt_partitiontool
|
||||
LOCAL_SRC_FILES := partitiontool.c
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include
|
||||
LOCAL_CFLAGS := $(PMT_CFLAGS)
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libpmt_list
|
||||
LOCAL_SRC_FILES := listpart.c
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include
|
||||
LOCAL_CFLAGS := $(PMT_CFLAGS)
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := pmt
|
||||
LOCAL_SRC_FILES := \
|
||||
pmt.c \
|
||||
versioner.c \
|
||||
get_stat.c \
|
||||
tools.c \
|
||||
lang_tools.c \
|
||||
languages.c \
|
||||
docs.c
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include
|
||||
LOCAL_STATIC_LIBRARIES := \
|
||||
libpmt_root \
|
||||
libpmt_debugging \
|
||||
libpmt_partitiontool \
|
||||
libpmt_list
|
||||
LOCAL_CFLAGS := $(PMT_CFLAGS)
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
# end
|
||||
30
build/others/makefile.applicationmk
Executable file
30
build/others/makefile.applicationmk
Executable file
@@ -0,0 +1,30 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
########
|
||||
# 2.5.0
|
||||
########
|
||||
|
||||
# architecture
|
||||
APP_ABI := \
|
||||
arm64-v8a \
|
||||
armeabi-v7a
|
||||
|
||||
APP_PLATFORM := android-21
|
||||
|
||||
APP_OPTIM := release
|
||||
|
||||
# end
|
||||
26
build/others/makefile.main
Executable file
26
build/others/makefile.main
Executable file
@@ -0,0 +1,26 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
THIS_IS = main
|
||||
NDK_PROG ?= false
|
||||
FORCE_GEN ?= false
|
||||
|
||||
# include needed variables
|
||||
include Makefile.inc
|
||||
include $(TOOLS)/gen-makefiles.mk
|
||||
include $(TOOLS)/clean-makefiles.mk
|
||||
|
||||
include $(BUILD)/main.mk
|
||||
126
build/others/makefile.outdir
Executable file
126
build/others/makefile.outdir
Executable file
@@ -0,0 +1,126 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#####
|
||||
# sub-make for installing-uninstalling
|
||||
#####
|
||||
|
||||
THIS_IS := out
|
||||
|
||||
# include needed variables
|
||||
include ../Makefile.inc
|
||||
-include $(BUILD)/config/INS_STAT.mk
|
||||
-include $(BUILD)/config/UNINS_STAT.mk
|
||||
|
||||
# create an empty target
|
||||
all:
|
||||
$(hide)printf ""
|
||||
|
||||
# installer
|
||||
.PHONY: install
|
||||
install:
|
||||
# really termux?
|
||||
$(hide)if [ -f $(TERMUX_BIN)/termux-open ]; then \
|
||||
printf " ------------ $(TARGET) installer ------------ \n"; \
|
||||
if [ -f $(TERMUX_BIN)/$(TARGET) ]; then \
|
||||
printf " - $(TARGET) already installed\n"; \
|
||||
exit; \
|
||||
fi; \
|
||||
if [ ! "$(INSTALL_SUCCESS)" = "true" ] && [ ! "$(INSTALL_SUCCESS)" = "" ]; then \
|
||||
printf " - $(YELLOW)$(BOLD)Warning:$(BOLD_RESET)$(RESET) a previously-stayed failed installation process found\n"; \
|
||||
fi; \
|
||||
if [ -f $(DEB_DIR)/*.deb ]; then \
|
||||
printf " - The created deb pack was found. It's setup...\n"; \
|
||||
cd $(DEB_DIR) || exit 1; \
|
||||
apt install ./*.deb || exit 1; \
|
||||
if [ ! "$?" = "0" ]; then \
|
||||
cd $(CUR_DIR); \
|
||||
printf " - Success.\n\n"; \
|
||||
echo "INSTALL_SUCCESS := true" > $(BUILD)/config/INS_STAT.mk; \
|
||||
echo "UNINSTALLED_SUCCESS := " > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
cd ..; \
|
||||
exit 0; \
|
||||
else \
|
||||
cd $(CUR_DIR); \
|
||||
printf " - $(RED)$(BOLD)Error:$(BOLD_RESET)$(RESET) installing failed!\n"; \
|
||||
echo "INSTALL_SUCCESS := false" > $(BUILD)/config/INS_STAT.mk; \
|
||||
cd ..; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi; \
|
||||
if [ ! -f $(BINARY_DIR)/$(TARGET) ]; then \
|
||||
printf " - $(RED)$(BOLD)Error:$(BOLD_RESET)$(RESET) Package not builded! Please build package and try again \n"; \
|
||||
echo "INSTALL_SUCCESS := false" > $(BUILD)/config/INS_STAT.mk; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
printf " - Installing binary...\n"; \
|
||||
if [ "`cp $(BINARY_DIR)/$(TARGET) /data/data/com.termux/files/usr/bin/$(TARGET)`" = "" ]; then \
|
||||
printf " - Setting up permissions...\n"; \
|
||||
else \
|
||||
echo "INSTALL_SUCCESS := false" > $(BUILD)/config/INS_STAT.mk; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [ "`chmod 777 $(TERMUX_BIN)/$(TARGET)`" = "" ]; then \
|
||||
printf " - Saving current status...\n"; \
|
||||
echo "INSTALL_SUCCESS := true" > $(BUILD)/config/INS_STAT.mk; \
|
||||
else \
|
||||
echo "INSTALL_SUCCESS := false" > $(BUILD)/config/INS_STAT.mk; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
printf " - Success.\n\n"; \
|
||||
echo "INSTALL_SUCCESS := true" > $(BUILD)/config/INS_STAT.mk; \
|
||||
echo "UNINSTALLED_SUCCESS := " > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
else \
|
||||
printf " - $(RED)$(BOLD)Error:$(BOLD_RESET)$(RESET) This function is only available on Termux.\n"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# uninstaller
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
# really termux?
|
||||
$(hide)if [ -f $(TERMUX_BIN)/termux-open ]; then \
|
||||
printf " ----------- $(TARGET) uninstaller ----------- \n"; \
|
||||
if [ ! -f $(TERMUX_BIN)/$(TARGET) ]; then \
|
||||
printf " - $(TARGET) already uninstalled\n"; \
|
||||
exit; \
|
||||
fi; \
|
||||
if [ ! "$(UNINSTALL_SUCCESS)" = "true" ] && [ ! "$(UNINSTALL_SUCCESS)" = "" ]; then \
|
||||
printf " - $(YELLOW)$(BOLD)Warning:$(BOLD_RESET)$(RESET) a previously-stayed failed uninstallation process found\n"; \
|
||||
fi; \
|
||||
if [ -f $(TERMUX_USR)/share/man/man8/$(TARGET).8.gz ]; then \
|
||||
printf " - It was found to be established by $(TARGET)'s deb pack. It's removed with apt...\n"; \
|
||||
apt remove -y $(TARGET) || exit 1; \
|
||||
printf " - Success.\n\n"; \
|
||||
echo "UNINSTALLED_SUCCESS := true" > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
echo "INSTALL_SUCCESS := " > $(BUILD)/config/INS_STAT.mk; \
|
||||
else \
|
||||
printf " - It was found that pmt was manually established (with this makefile or copying). Manually removed...\n"; \
|
||||
if [ "`rm $(TERMUX_BIN)/$(TARGET)`" = "" ]; then \
|
||||
printf " - Success.\n\n"; \
|
||||
echo "UNINSTALLED_SUCCESS := true" > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
echo "INSTALL_SUCCESS := " > $(BUILD)/config/INS_STAT.mk; \
|
||||
else \
|
||||
echo "UNINSTALLED_SUCCESS := false" > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi; \
|
||||
else \
|
||||
printf "$(RED)$(BOLD)Error:$(BOLD_RESET)$(RESET) This function is only available on Termux.\n"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# end
|
||||
161
build/others/makefile.sourcedir
Executable file
161
build/others/makefile.sourcedir
Executable file
@@ -0,0 +1,161 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#####
|
||||
# sub-make for building package
|
||||
#####
|
||||
|
||||
THIS_IS = src
|
||||
|
||||
include ../Makefile.inc
|
||||
|
||||
ifeq ($(INC_OLDENV),true)
|
||||
include $(BUILD)/config/oldenv.mk
|
||||
endif
|
||||
|
||||
# make objects. Usage $(call make_obj,<SRCFILE>)
|
||||
define make_obj
|
||||
$(eval OBJ := $(1:.c=.o))
|
||||
$(call m_stat,CC,`basename $(SOURCE_DIR)`/`basename $(OBJ)`,n)
|
||||
$(CC) $(CFLAGS) -c "$1" || exit 1;
|
||||
$(hide)printf "\n"
|
||||
endef
|
||||
|
||||
# make executable file with using static libraries and objects. Usage: $(call make_executable)
|
||||
define make_executable
|
||||
printf " - Making executable file...\n"; \
|
||||
printf " LD $(TARGET)"; \
|
||||
$(CC) $(CFLAGS) -L$(SOURCE_DIR) \
|
||||
$(foreach s_obj_b, \
|
||||
$(shell basename -a $(STATICLIB_OBJS)), \
|
||||
$(eval s_obj_t_b = $(s_obj_b:.o=)) \
|
||||
$(shell echo -lpmt_$(s_obj_t_b)) \
|
||||
) \
|
||||
-o $(TARGET) $(OBJS_EXEC) || exit 1;
|
||||
endef
|
||||
|
||||
# make static library. Usage $(call make_staticlib,<LIBRARY_NAME>,<OBJECT(S)>)
|
||||
define make_staticlib
|
||||
echo -n " AR $1"; \
|
||||
$(AR) rcs "$1" "$2" || exit 1; \
|
||||
echo;
|
||||
endef
|
||||
|
||||
# controls the presence of source file. usage: $(call check_cfile,<SOURCE_FILE>)
|
||||
define check_cfile
|
||||
# the first argument is taken and controlled by the file with -f option
|
||||
printf " CHK src/`basename $1`\n"; \
|
||||
if [ ! -f $1 ]; then \
|
||||
printf " ==> Couldn't found required source file: src/`basename $1`\n"; \
|
||||
if [ -d "$(TEMP_DIR)" ]; then \
|
||||
rm -rf $(TEMP_DIR); \
|
||||
fi; \
|
||||
exit 1; \
|
||||
fi;
|
||||
endef
|
||||
|
||||
# controls the presence of header file. usage: $(call check_hfile,<SOURCE_FILE>)
|
||||
define check_hfile
|
||||
# the first argument is taken and controlled by the file with -f option
|
||||
printf " CHK include/pmt/`basename $1`\n"; \
|
||||
if [ ! -f $1 ]; then \
|
||||
printf " ==> Couldn't found required header file: include/pmt/`basename $1`\n"; \
|
||||
if [ -d "$(TEMP_DIR)" ]; then \
|
||||
rm -rf $(TEMP_DIR); \
|
||||
fi; \
|
||||
exit 1; \
|
||||
fi;
|
||||
endef
|
||||
|
||||
# all target for building
|
||||
all:
|
||||
$(hide)rm -f $(BUILD)/config/oldenv.mk
|
||||
$(hide)printf " ---- Partition Manager Builder ---- \n\n"
|
||||
$(hide)printf " - Version: $(VERSION)\n"
|
||||
$(hide)printf " - Version code: $(VERSION_CODE)\n\n"
|
||||
$(hide)printf " -------------------------------- \n\n"
|
||||
$(hide)if [ -f $(SOURCE_DIR)/debugging.o ]; then \
|
||||
printf " - Please clean up before you build it.\n\n"; \
|
||||
printf " ----------------------------------- \n"; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(hide)printf " - Checking required source files...\n"
|
||||
$(hide)sleep 1
|
||||
$(foreach src_cf, \
|
||||
$(SRCS_REQ), \
|
||||
$(call check_cfile,$(src_cf)) \
|
||||
)
|
||||
$(foreach src_hf, \
|
||||
$(HEADERS_REQ), \
|
||||
$(call check_hfile,$(src_hf)) \
|
||||
)
|
||||
$(hide)printf " - Building objects...\n"
|
||||
$(hide)sleep 2
|
||||
$(foreach csrc, \
|
||||
$(SRCS), \
|
||||
$(call make_obj,$(csrc)) \
|
||||
)
|
||||
$(foreach reqdir,$(IN_OUT_DIR),$(call mdir,$(reqdir)))
|
||||
$(hide)printf " - Making static libraries...\n"
|
||||
$(foreach s_obj, \
|
||||
$(shell basename -a $(STATICLIB_OBJS)), \
|
||||
$(eval s_obj_t = $(s_obj:.o=.a)) \
|
||||
$(call make_staticlib,libpmt_$(s_obj_t),$(s_obj)) \
|
||||
)
|
||||
$(hide)sleep 1
|
||||
$(call make_executable)
|
||||
$(hide)sleep 1
|
||||
$(hide)abort_build() { \
|
||||
if [ -d "$(PACKAGE_DIR)" ]; then \
|
||||
rm -rf "$(PACKAGE_DIR)"; \
|
||||
fi; \
|
||||
if [ -d "$(BINARY_DIR)" ]; then \
|
||||
rm -rf "$(BINARY_DIR)"; \
|
||||
fi; \
|
||||
if [ -d "$(STATICLIB_DIR)" ]; then \
|
||||
rm -rf "$(STATICLIB_DIR)"; \
|
||||
fi; \
|
||||
exit 1; \
|
||||
}; \
|
||||
mv $(TARGET) $(BINARY_DIR) || abort_build; \
|
||||
mv *.a $(STATICLIB_DIR) || abort_build; \
|
||||
printf "\n - Generating package...\n"; \
|
||||
cp $(BINARY_DIR)/$(TARGET) $(PACKAGE_DIR) || abort_build; \
|
||||
printf " XZ $(OUT_DIRNAME)/package/$(TARGET)-$(ARCH).xz"
|
||||
xz $(PACKAGE_DIR)/$(TARGET) || abort_build; \
|
||||
sleep 1; \
|
||||
mv $(PACKAGE_DIR)/$(TARGET).xz $(PACKAGE_DIR)/$(TARGET)-$(ARCH).xz || abort_build; \
|
||||
printf "\n - Success"; \
|
||||
sleep 1; \
|
||||
printf "\n\n ----------------------------------- \n"
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(eval STATICLIBS = $(wildcard $(SOURCE_DIR)/*.a))
|
||||
$(eval OBJS = $(wildcard $(SOURCE_DIR)/*.o))
|
||||
$(info Cleaning files...)
|
||||
$(foreach obj, \
|
||||
$(OBJS), \
|
||||
$(call m_stat_nn,$(SOURCE_DIRNAME)/$(shell basename $(obj))) \
|
||||
$(call erase,$(obj)) \
|
||||
)
|
||||
$(foreach lib, \
|
||||
$(STATICLIBS), \
|
||||
$(call m_stat_nn,$(SOURCE_DIRNAME)/$(shell basename $(lib))) \
|
||||
$(call erase,$(lib)) \
|
||||
)
|
||||
|
||||
# end
|
||||
Reference in New Issue
Block a user