-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
140 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,5 @@ compile_commands.json | |
/test/share | ||
default.profraw | ||
/test/include | ||
/pkg | ||
/fakeroot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
MACOS_VER_NUM ?=$(shell vtool -show-build $(shell brew --prefix)/lib/libgetargv.dylib | awk '/minos/{print $$2}') | ||
MACOS_VER_MAJOR := $(shell echo $(MACOS_VER_NUM) | cut -f1 -d.) | ||
MACOS_VER_MINOR := $(shell echo $(MACOS_VER_NUM) | cut -f2 -d.) | ||
MACOS_LT_10_11 := $(shell [ $(MACOS_VER_MAJOR) -eq 10 -a $(MACOS_VER_MINOR) -lt 11 ] && echo true) | ||
MACOS_LT_10_13 := $(shell [ $(MACOS_VER_MAJOR) -eq 10 -a $(MACOS_VER_MINOR) -lt 13 ] && echo true) | ||
MACOS_LT_11 := $(shell [ $(MACOS_VER_MAJOR) -eq 10 -a $(MACOS_VER_MINOR) -lt 15 ] || [ $(MACOS_VER_MAJOR) -lt 11 ] && echo true) | ||
export MACOSX_DEPLOYMENT_TARGET := $(MACOS_VER_MAJOR).$(MACOS_VER_MINOR) | ||
VERSION=0.1 | ||
COMPAT_VERSION := $(shell echo $(VERSION) | cut -f1 -d.).0 | ||
ARCH := $(shell uname -m) | ||
CODESIGN_PREFIX := cam.narzt. | ||
KEYCHAIN := ~/Library/Keychains/login.keychain-db | ||
CERT_IDENTITY := $(shell security find-identity -v -p codesigning | sed -Ee 's/.*"([^"]+)".*/\1/g' | grep -Fve ' valid identit' -e ' CA') | ||
|
||
SRC_DIR = src | ||
INCLUDE_DIR = include | ||
OBJ_DIR = obj | ||
LIB_DIR = lib | ||
PKG_DIR = pkg | ||
FAKE_ROOT = fakeroot | ||
PREFIX ?= /usr/local | ||
CXX = clang++ | ||
CPPFLAGS += -MMD -MP | ||
|
||
COMPILER_VERSION := $(shell $(CXX) --version | grep version | grep -o -m 1 "[0-9]\+\.[0-9]\+\.*[0-9]*" | head -n 1) | ||
COMPILER_VERSION_NUMBER := $(shell echo $(COMPILER_VERSION) | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/') | ||
CLANG_13_OR_MORE := $(shell expr $(COMPILER_VERSION_NUMBER) \>= 130106) | ||
ifneq ($(CLANG_13_OR_MORE),0) | ||
# supported: c++11, c++14, c++17, c++20 | ||
# future: c++2b | ||
CXXFLAGS := --std=c++20 -O3 -Iinclude | ||
else | ||
CXXFLAGS := --std=c++17 -O3 -Iinclude | ||
endif | ||
|
||
EXTRA_CXXFLAGS := -pedantic-errors -Weverything -Wno-c++98-compat -Wno-pre-c++20-compat-pedantic -Wno-poison-system-directories | ||
LDFLAGS += -Llib -fvisibility=default -fPIC | ||
LDLIBS += -lgetargv | ||
|
||
LIB_SHORT_NAME = getargv++ | ||
LIB_NAME = lib$(LIB_SHORT_NAME) | ||
DYLIB_FILENAME = $(LIB_NAME).$(VERSION).dylib | ||
DYLIB = lib/$(DYLIB_FILENAME) | ||
SOURCES = $(wildcard $(SRC_DIR)/*.cpp) | ||
HEADERS = $(wildcard $(INCLUDE_DIR)/*.hpp) | ||
OBJECTS = $(SOURCES:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o) | ||
|
||
DMG_VOLUME_NAME := $(LIB_NAME) Installer | ||
DMG := $(PKG_DIR)/$(LIB_NAME).dmg | ||
PRODUCT_BUNDLE_PACKAGE_TYPE := APPL | ||
LIB_BUNDLE_IDENTIFIER := $(CODESIGN_PREFIX)$(LIB_NAME) | ||
PRODUCT_BUNDLE_IDENTIFIER := $(LIB_BUNDLE_IDENTIFIER) | ||
PRODUCT := $(PKG_DIR)/$(LIB_NAME)-$(VERSION)-macOS-$(MACOS_VER_NUM)-$(ARCH).pkg | ||
LIB_PKG := $(PKG_DIR)/$(LIB_NAME)-$(VERSION)-macOS-$(MACOS_VER_NUM)-$(ARCH)-package.pkg | ||
DISTRIBUTION := $(OBJ_DIR)/dist.xml | ||
|
||
ifeq ($(MACOS_LT_10_11),true) | ||
DMG_FORMAT := UDZO | ||
else ifeq ($(MACOS_LT_11),true) | ||
DMG_FORMAT := ULFO | ||
else | ||
DMG_FORMAT := ULMO | ||
endif | ||
|
||
ifeq ($(MACOS_LT_10_13),true) | ||
DMG_FS := HFS+ | ||
else | ||
DMG_FS := APFS | ||
endif | ||
|
||
ifeq ($(MACOS_LT_12),true) | ||
PKG_VERSION_FLAG := | ||
else | ||
PKG_VERSION_FLAG := --min-os-version $(MACOSX_DEPLOYMENT_TARGET) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<installer-gui-script minSpecVersion="2"> | ||
<volume-check> | ||
<allowed-os-versions> | ||
<os-version min="OS_VERSION" /> | ||
</allowed-os-versions> | ||
</volume-check> | ||
|
||
<license file="LICENSE" mime-type="text/plain" /> | ||
|
||
<options customize="allow" require-scripts="false" hostArchitectures="ARCH" /> | ||
|
||
<choices-outline> | ||
<line choice="LIB_ID" /> | ||
</choices-outline> | ||
<choice title="LIB_NAME library" id="LIB_ID" customLocation="/usr/local" customLocationAllowAlternateVolumes="true"> | ||
<pkg-ref id="LIB_ID" /> | ||
</choice> | ||
<pkg-ref id="LIB_ID" version="VERSION" onConclusion="none">LIB_PKG_NAME</pkg-ref> | ||
</installer-gui-script> |