pmt: NDK build fixes

This commit is contained in:
2024-12-14 11:53:48 +03:00
parent 84e0a02268
commit e117efd641
10 changed files with 240 additions and 974 deletions

View File

@@ -1,219 +0,0 @@
# 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 parted (built-in parted)
#####
# Include required files
include ../../build/config/env.mk
ifeq ($(INC_OLDENV),true)
include ../../build/config/oldenv.mk
endif
# Some flags etc
E := @ echo
INCLUDE_DIRS := \
$(CURDIR)/../../include \
$(CURDIR)/../../include/libgnulib \
$(CURDIR)/parted \
$(CURDIR)/libparted \
$(CURDIR)/libparted/labels \
$(CURDIR)/lib
CFLAGS := \
-Wall \
-Wextra \
-fPIC \
-Wno-pointer-sign \
-Wno-sign-compare \
-Wno-gnu-designator \
-Wno-unused-variable \
-Wno-unused-parameter \
-Wno-unused-command-line-argument \
-Wno-missing-field-initializers \
-Wno-single-bit-bitfield-constant-conversion \
$(foreach dir,$(INCLUDE_DIRS),$(shell echo -I$(dir)))
AR_FLAGS := rcs
OUT := $(realpath ../../out/parted)
LIBPARTED := libparted
PARTED := parted
PATH := $(shell echo $$PREFIX)/bin
LIBPARTED_SRCS := \
$(LIBPARTED)/architecture.c \
$(LIBPARTED)/debug.c \
$(LIBPARTED)/device.c \
$(LIBPARTED)/disk.c \
$(LIBPARTED)/exception.c \
$(LIBPARTED)/filesys.c \
$(LIBPARTED)/libparted.c \
$(LIBPARTED)/timer.c \
$(LIBPARTED)/unit.c \
$(LIBPARTED)/arch/linux.c \
$(LIBPARTED)/cs/constraint.c \
$(LIBPARTED)/cs/geom.c \
$(LIBPARTED)/cs/natmath.c \
$(LIBPARTED)/fs/amiga/a-interface.c \
$(LIBPARTED)/fs/amiga/affs.c \
$(LIBPARTED)/fs/amiga/amiga.c \
$(LIBPARTED)/fs/amiga/apfs.c \
$(LIBPARTED)/fs/amiga/asfs.c \
$(LIBPARTED)/fs/btrfs/btrfs.c \
$(LIBPARTED)/fs/ext2/interface.c \
$(LIBPARTED)/fs/f2fs/f2fs.c \
$(LIBPARTED)/fs/fat/bootsector.c \
$(LIBPARTED)/fs/fat/fat.c \
$(LIBPARTED)/fs/hfs/hfs.c \
$(LIBPARTED)/fs/hfs/probe.c \
$(LIBPARTED)/fs/jfs/jfs.c \
$(LIBPARTED)/fs/linux_swap/linux_swap.c \
$(LIBPARTED)/fs/nilfs2/nilfs2.c \
$(LIBPARTED)/fs/ntfs/ntfs.c \
$(LIBPARTED)/fs/r/filesys.c \
$(LIBPARTED)/fs/r/fat/bootsector.c \
$(LIBPARTED)/fs/r/fat/calc.c \
$(LIBPARTED)/fs/r/fat/clstdup.c \
$(LIBPARTED)/fs/r/fat/context.c \
$(LIBPARTED)/fs/r/fat/count.c \
$(LIBPARTED)/fs/r/fat/fat.c \
$(LIBPARTED)/fs/r/fat/fatio.c \
$(LIBPARTED)/fs/r/fat/resize.c \
$(LIBPARTED)/fs/r/fat/table.c \
$(LIBPARTED)/fs/r/fat/traverse.c \
$(LIBPARTED)/fs/r/hfs/advfs.c \
$(LIBPARTED)/fs/r/hfs/advfs_plus.c \
$(LIBPARTED)/fs/r/hfs/cache.c \
$(LIBPARTED)/fs/r/hfs/file.c \
$(LIBPARTED)/fs/r/hfs/file_plus.c \
$(LIBPARTED)/fs/r/hfs/hfs.c \
$(LIBPARTED)/fs/r/hfs/journal.c \
$(LIBPARTED)/fs/r/hfs/probe.c \
$(LIBPARTED)/fs/r/hfs/reloc.c \
$(LIBPARTED)/fs/r/hfs/reloc_plus.c \
$(LIBPARTED)/fs/reiserfs/reiserfs.c \
$(LIBPARTED)/fs/udf/udf.c \
$(LIBPARTED)/fs/ufs/ufs.c \
$(LIBPARTED)/fs/xfs/xfs.c \
$(LIBPARTED)/labels/aix.c \
$(LIBPARTED)/labels/atari.c \
$(LIBPARTED)/labels/bsd.c \
$(LIBPARTED)/labels/dos.c \
$(LIBPARTED)/labels/dvh.c \
$(LIBPARTED)/labels/efi_crc32.c \
$(LIBPARTED)/labels/fdasd.c \
$(LIBPARTED)/labels/gpt.c \
$(LIBPARTED)/labels/loop.c \
$(LIBPARTED)/labels/mac.c \
$(LIBPARTED)/labels/pt-tools.c \
$(LIBPARTED)/labels/rdb.c \
$(LIBPARTED)/labels/sun.c \
$(LIBPARTED)/labels/vtoc.c
PARTED_SRCS := \
$(PARTED)/command.c \
$(PARTED)/jsonwrt.c \
$(PARTED)/parted.c \
$(PARTED)/strlist.c \
$(PARTED)/table.c \
$(PARTED)/ui.c \
$(PARTED)/version.c
LIBPARTED_OBJS := $(LIBPARTED_SRCS:.c=.o)
PARTED_OBJS := $(PARTED_SRCS:.c=.o)
OBJS_ALL := \
$(LIBPARTED_OBJS) \
$(PARTED_OBJS)
PROGRESS_LIST := \
make_outdir \
build_libgnulib \
build_libcharset \
build_libiconv_and_libicrt \
print_libparted \
$(LIBPARTED_OBJS) \
libparted_ar \
print_parted \
$(PARTED_OBJS) \
dummy_parted
.PHONY: all
all: $(PROGRESS_LIST)
.PHONY: clean
clean:
@ rm -rf $(OBJS_ALL) $(OUT) *.a
@ $(MAKE) -C $(CURDIR)/libgnulib -s clean
@ $(MAKE) -C $(CURDIR)/libiconv -s clean
@ $(MAKE) -C $(CURDIR)/libcharset -s clean
.PHONY: install
install:
@ abort() { \
echo "$1"; \
exit 1; \
}; \
[ -f $(PATH)/parted-test ] && \
abort "Already installed."; \
cp $(OUT)/parted $(PATH)/parted-test || \
abort "Copying failed!"; \
chmod 777 $(PATH)/parted-test || \
abort "Cannot set permissions!"
.PHONY: uninstall
uninstall:
@ if [ ! -f $(PATH)/parted-test ]; then echo "Already uninstalled"; exit 1; fi
@ rm -f $(PATH)/parted-test &>/dev/null
.PHONY:
reinstall:
@ $(MAKE) -s uninstall
@ $(MAKE) -s install
$(LIBPARTED)/%.o: $(LIBPARTED)/%.c
$(E) " CC $@"
@ $(CC) -c $(CFLAGS) -o $@ $^ || exit 1
$(PARTED)/%.o: $(PARTED)/%.c
$(E) " CC $@"
@ $(CC) -c $(CFLAGS) -o $@ $^ || exit 1
libparted_ar: $(LIBPARTED_OBJS)
$(E) " AR out/parted/libparted.a"
@ $(AR) $(AR_FLAGS) $(OUT)/libparted.a $(LIBPARTED_OBJS)
build_libgnulib:
@ $(MAKE) -C $(CURDIR)/libgnulib -s
build_libcharset:
$(E) " ----------- libcharset ----------- "
@ $(MAKE) -C $(CURDIR)/libcharset -s
build_libiconv_and_libicrt:
$(E) " ----------- libicrt ----------- "
@ $(MAKE) -C $(CURDIR)/libiconv -s
make_outdir:
@ if [ ! -d $(OUT) ]; then mkdir -p $(OUT); fi
print_libparted:
$(E) " ----------- libparted ----------- "
print_parted:
$(E) " ----------- parted ----------- "
dummy_parted:
$(E) " DMY parted"

View File

@@ -1,40 +0,0 @@
# 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.
########
# 3.0.2
########
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libcharset
LOCAL_SRC_FILES := \
$(LOCAL_PATH)/lib/localcharset.c \
$(LOCAL_PATH)/lib/relocatable-stub.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../include/libcharset
LOCAL_CFLAGS := \
-Wall \
-Wextra \
-Wno-sign-compare \
-Wno-unused-const-variable \
-Wno-unused-parameter \
-fPIC \
-g \
-fvisibility=hidden
include $(BUILD_STATIC_LIBRARY)

View File

@@ -1,68 +0,0 @@
# 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 libcharset (built-in lib)
#####
include ../../../build/config/env.mk
ifeq ($(INC_OLDENV),true)
include ../../../build/config/oldenv.mk
endif
E := @ echo
INCLUDE_DIR := $(CURDIR)/../../../include/libcharset
CFLAGS := \
-Wall \
-Wextra \
-Wno-sign-compare \
-Wno-unused-const-variable \
-Wno-unused-parameter \
-fPIC \
-g \
-fvisibility=hidden \
-I$(INCLUDE_DIR)
AR_FLAGS := rcs
OUT := $(realpath ../../../out/parted)
LIB := $(CURDIR)/lib
LIBCHARSET_SRCS := \
$(LIB)/localcharset.c \
$(LIB)/relocatable-stub.c
LIBCHARSET_OBJS := $(LIBCHARSET_SRCS:.c=.o)
PROGRESS_LIST := \
outctrl \
$(LIBCHARSET_OBJS) \
libcharset_ar
.PHONY: all
all: $(PROGRESS_LIST)
.PHONY: clean
clean:
@ rm -f $(LIBCHARSET_OBJS) $(OUT)/libcharset.a
outctrl:
@ if [ ! -d $(OUT) ]; then mkdir -p $(OUT); fi
$(LIB)/%.o: $(LIB)/%.c
$(E) " CC libcharset/lib/`basename $@`"
@ $(CC) -c $(CFLAGS) -o $@ $^ || exit 1
libcharset_ar: $(LIBCHARSET_OBJS)
$(E) " AR out/parted/libcharset.a"
@ $(AR) $(AR_FLAGS) $(OUT)/libcharset.a $(LIBCHARSET_OBJS)

View File

@@ -1,97 +0,0 @@
# 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.
########
# 3.0.2
########
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libgnulib
LOCAL_SRC_FILES := \
$(LOCAL_PATH)/lib/argmatch.c \
$(LOCAL_PATH)/lib/basename-lgpl.c \
$(LOCAL_PATH)/lib/basename.c \
$(LOCAL_PATH)/lib/btowc.c \
$(LOCAL_PATH)/lib/c-ctype.c \
$(LOCAL_PATH)/lib/c-strcasecmp.c \
$(LOCAL_PATH)/lib/c-strncasecmp.c \
$(LOCAL_PATH)/lib/c32isprint.c \
$(LOCAL_PATH)/lib/canonicalize-lgpl.c \
$(LOCAL_PATH)/lib/cloexec.c \
$(LOCAL_PATH)/lib/close-stream.c \
$(LOCAL_PATH)/lib/closeout.c \
$(LOCAL_PATH)/lib/dirname-lgpl.c \
$(LOCAL_PATH)/lib/dirname.c \
$(LOCAL_PATH)/lib/error.c \
$(LOCAL_PATH)/lib/exitfail.c \
$(LOCAL_PATH)/lib/fcntl.c \
$(LOCAL_PATH)/lib/free.c \
$(LOCAL_PATH)/lib/getdtablesize.c \
$(LOCAL_PATH)/lib/hard-locale.c \
$(LOCAL_PATH)/lib/ialloc.c \
$(LOCAL_PATH)/lib/iswctype.c \
$(LOCAL_PATH)/lib/iswdigit.c \
$(LOCAL_PATH)/lib/iswpunct.c \
$(LOCAL_PATH)/lib/iswxdigit.c \
$(LOCAL_PATH)/lib/localcharset.c \
$(LOCAL_PATH)/lib/long-options.c \
$(LOCAL_PATH)/lib/malloca.c \
$(LOCAL_PATH)/lib/mbrtoc32.c \
$(LOCAL_PATH)/lib/mbrtowc.c \
$(LOCAL_PATH)/lib/mbszero.c \
$(LOCAL_PATH)/lib/nl_langinfo.c \
$(LOCAL_PATH)/lib/progname.c \
$(LOCAL_PATH)/lib/quotearg.c \
$(LOCAL_PATH)/lib/rawmemchr.c \
$(LOCAL_PATH)/lib/regex.c \
$(LOCAL_PATH)/lib/rpmatch.c \
$(LOCAL_PATH)/lib/safe-read.c \
$(LOCAL_PATH)/lib/setlocale-lock.c \
$(LOCAL_PATH)/lib/setlocale_null-unlocked.c \
$(LOCAL_PATH)/lib/setlocale_null.c \
$(LOCAL_PATH)/lib/stat-time.c \
$(LOCAL_PATH)/lib/stripslash.c \
$(LOCAL_PATH)/lib/tempname.c \
$(LOCAL_PATH)/lib/version-etc-fsf.c \
$(LOCAL_PATH)/lib/version-etc.c \
$(LOCAL_PATH)/lib/wctype.c \
$(LOCAL_PATH)/lib/unictype/ctype_print.c \
$(LOCAL_PATH)/lib/xalloc-die.c \
$(LOCAL_PATH)/lib/xmalloc.c \
$(LOCAL_PATH)/lib/xstrtol.c \
$(LOCAL_PATH)/lib/xstrtoll.c \
$(LOCAL_PATH)/lib/xstrtoul.c \
$(LOCAL_PATH)/lib/xstrtoull.c
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../../include/libgnulib \
$(LOCAL_PATH)/../../../include \
$(LOCAL_PATH)/../lib \
$(LOCAL_PATH)/lib
LOCAL_CFLAGS := \
-Wall \
-Wextra \
-Wno-sign-compare \
-Wno-unused-const-variable \
-Wno-unused-parameter \
-Wno-nullability-completeness \
-Wno-macro-redefined \
-fPIC \
-include $(LOCAL_PATH)/../../include/PartitionManager/Alternatives.h
include $(BUILD_STATIC_LIBRARY)

View File

@@ -1,44 +0,0 @@
# 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.
########
# 3.0.2
########
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libiconv
LOCAL_SRC_FILES := \
$(LOCAL_PATH)/lib/iconv.c \
$(LOCAL_PATH)/lib/relocatable.c
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../../../include/libiconv \
$(LOCAL_PATH)/lib \
$(LOCAL_PATH)/srclib
LOCAL_CFLAGS := \
-Wall \
-Wextra \
-Wno-sign-compare \
-Wno-unused-const-variable \
-Wno-unused-parameter \
-Wno-unused-function \
-Wno-unused-but-set-variable \
-Wno-missing-field-initializers \
-fPIC
include $(BUILD_STATIC_LIBRARY)

View File

@@ -1,107 +0,0 @@
# 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 libiconv and libicrt (built-in libs)
#####
# Include required files
include ../../../build/config/env.mk
ifeq ($(INC_OLDENV),true)
include ../../../build/config/oldenv.mk
endif
E := @ echo
INCLUDE_DIRS := \
$(CURDIR)/../../../include/libiconv \
$(CURDIR)/lib \
$(CURDIR)/srclib
CFLAGS := \
-Wall \
-Wextra \
-Wno-sign-compare \
-Wno-unused-const-variable \
-Wno-unused-parameter \
-Wno-unused-function \
-Wno-unused-but-set-variable \
-Wno-missing-field-initializers \
-fPIC \
$(foreach dir,$(INCLUDE_DIRS),$(shell echo "-I$(dir)"))
AR_FLAGS := rcs
OUT := $(realpath ../../../out/parted)
LIB := $(CURDIR)/lib
SRC := $(CURDIR)/src
SRCLIB := $(CURDIR)/srclib
LIBICRT := $(CURDIR)/icrt
LIBICRT_SRCS := \
$(LIBICRT)/allocator.c \
$(LIBICRT)/areadlink.c \
$(LIBICRT)/binary-io.c \
$(LIBICRT)/careadlinkat.c \
$(LIBICRT)/fd-hook.c \
$(LIBICRT)/getprogname.c \
$(LIBICRT)/unistd.c \
$(LIBICRT)/xreadlink.c
LIBICRT_OBJS := $(LIBICRT_SRCS:.c=.o)
LIBICONV_SRCS := \
$(LIB)/iconv.c \
$(LIB)/relocatable.c
LIBICONV_OBJS := $(LIBICONV_SRCS:.c=.o)
PROGRESS_LIST := \
outctrl \
$(LIBICRT_OBJS) \
libicrt_ar \
print_iconv \
$(LIBICONV_OBJS) \
libiconv_ar
.PHONY: all
all: $(PROGRESS_LIST)
.PHONY: clean
clean:
@ rm -rf $(LIBICONV_OBJS) $(LIBICRT_OBJS) $(OUT)/libicrt.a $(OUT)/libiconv.a
outctrl:
@ if [ ! -d $(OUT) ]; then mkdir -p $(OUT); fi
$(LIBICRT)/%.o: $(LIBICRT)/%.c
$(E) " CC libiconv/icrt/`basename $@`"
@ $(CC) -c $(CFLAGS) -o $@ $^ || exit 1
$(LIB)/%.o: $(LIB)/%.c
$(E) " CC libiconv/lib/`basename $@`"
@ $(CC) -c $(CFLAGS) -o $@ $^ || exit 1
$(SRC)/%.o: $(SRC)/%.c
$(E) " CC libiconv/src/`basename $@`"
@ $(CC) -c $(CFLAGS) -o $@ $^ || exit 1
libicrt_ar: $(LIBICRT_OBJS)
$(E) " AR out/parted/libicrt.a"
@ $(AR) $(AR_FLAGS) $(OUT)/libicrt.a $(LIBICRT_OBJS)
libiconv_ar: $(LIBICONV_OBJS)
$(E) " AR out/parted/libiconv.a"
@ $(AR) $(AR_FLAGS) $(OUT)/libiconv.a $(LIBICONV_OBJS)
print_iconv:
$(E) " ----------- libiconv ----------- "