diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2023-03-13 22:54:02 +0100 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2023-03-13 22:54:02 +0100 |
commit | 0a56fee9959458b99f1935ad27e150ef7a30b799 (patch) | |
tree | 7a5c0485d1c17a866da19654a58a38e74b357cba | |
parent | 00c2f86a2afff9a5e1ed4d05b8a0d252a95ca213 (diff) |
Packaging support for third party libraries.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r-- | Makefile.inc | 26 | ||||
-rw-r--r-- | README.md | 8 |
2 files changed, 32 insertions, 2 deletions
diff --git a/Makefile.inc b/Makefile.inc index bb564c5..39e456d 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -18,6 +18,7 @@ LOCAL_MINGW64_BUILD_SCRIPT := $(DPP_ROOT)/mingw-w64-build/mingw-w64-build LOCAL_MINGW64_BUILD_DIR := $(DPP_ROOT)/mingw-w64-sysroot/x86_64 LOCAL_MINGW64_CC := $(LOCAL_MINGW64_BUILD_DIR)/bin/x86_64-w64-mingw32-gcc LOCAL_MINGW64_CXX := $(LOCAL_MINGW64_BUILD_DIR)/bin/x86_64-w64-mingw32-g++ +LOCAL_MINGW64_AR := $(LOCAL_MINGW64_BUILD_DIR)/bin/x86_64-w64-mingw32-ar LOCAL_MINGW64_RC := $(LOCAL_MINGW64_BUILD_DIR)/bin/x86_64-w64-mingw32-windres else ifeq ($(LOCAL_MINGW64_CXX),) @@ -36,12 +37,13 @@ ifeq ($(SIGNTOOL_PREFIX),) SIGNTOOL_PREFIX := codesign endif -DDK_GLOBAL_DEPS := deps $(LOCAL_MINGW64_BUILD_SCRIPT) $(LOCAL_MINGW64_BUILD_DIR) $(LOCAL_MINGW64_CC) $(LOCAL_MINGW64_CXX) $(LOCAL_MINGW64_RC) +DDK_GLOBAL_DEPS := deps $(LOCAL_MINGW64_BUILD_SCRIPT) $(LOCAL_MINGW64_BUILD_DIR) $(LOCAL_MINGW64_CC) $(LOCAL_MINGW64_CXX) $(LOCAL_MINGW64_AR) $(LOCAL_MINGW64_RC) INSTALL = install CMAKE = cmake CC = $(LOCAL_MINGW64_CC) CXX = $(LOCAL_MINGW64_CXX) +AR = $(LOCAL_MINGW64_AR) RC = $(LOCAL_MINGW64_RC) DDK_INCLUDE_DIR = $(dir $(CC))../x86_64-w64-mingw32/include/ddk CFLAGS := -Wall -Wextra -Wno-sign-compare -Wno-strict-aliasing \ @@ -222,13 +224,33 @@ define INSTALL_EXEC_SIGN rm -f "$(DESTDIR)/$$target"; \ $(dir $(CC))/x86_64-w64-mingw32-strip -s "$$target"; \ $(SIGNTOOL) sign -pkcs12 '$(DPP_ROOT)/$(SIGNTOOL_PREFIX)-code.p12' \ - -ac '$(DPP_ROOT)/$(SIGNTOOL_PREFIX)-ca-cert.pem' \ -in "$$target" \ -out "$(DESTDIR)/$$target"; \ done $(INSTALL) "$(DPP_ROOT)/$(SIGNTOOL_PREFIX)-ca-cert.pem" '$(DESTDIR)/$(SIGNTOOL_PREFIX)-ca-cert.crt' endef +define INSTALL_HEADERS + $(call is_set,$(1),First argument: Header subdirectory missing) + $(call is_set,$(2),Second argument: Header files missing) + $(call is_set,$(3),Third argument: Output directory missing) + for header in $(2); do \ + mkdir -p '$(3)/include/$(1)/'; \ + $(INSTALL) -m0644 "$$header" '$(3)/include/$(1)/'; \ + done +endef + +ifneq ($(LOCAL_MINGW64_AR),) +define PACKAGE + $(call is_set,$(1),First argument: Library name missing) + $(call is_set,$(2),Second argument: Object files missing) + $(call is_set,$(3),Third argument: Output directory missing) + mkdir -p '$(3)/lib' + $(AR) -rsv '$(3)/lib/lib$(1).a' $(2) + tar --no-acls --no-selinux --no-xattrs --transform 's,^$(3),deps,' -cvjf '$(1).dpp' '$(3)' +endef +endif + define HELP_MAKE_OPTIONS @echo 'Common make options for Makefile.inc:' @echo -e '\tBUILD_NATIVE = no' @@ -74,6 +74,14 @@ make -C [path-to-this-repo] -f Makefile.deps all source [path-to-this-repo]/mingw-w64-sysroot/x86_64/activate.sh ``` +### Packaging + +It is possible to create `*.dpp` archives ready to get shipped. +To do this you need to call the `PACKAGE` macro. +But before you should install public header files with the `INSTALL_HEADERS` macro. + +See the `Makefile` of [mingw-w64-ksocket](https://github.com/utoni/mingw-w64-ksocket.git) for an example. + ## The CRT and CRT++ This project uses a very very rudimentary CRT for C and C++ projects. |