mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[build] macOS and iOS can now build any binary
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
TOOLCHAIN = apple
|
||||
EXE = bin
|
||||
|
||||
APPLE_PLATFORM ?= ios
|
||||
APPLE_PLATFORM_MIN_VERSION = 8.0
|
||||
EPSILON_TELEMETRY ?= 1
|
||||
|
||||
ifeq ($(APPLE_PLATFORM),ios)
|
||||
ARCHS ?= arm64 armv7
|
||||
ARCHS = arm64 armv7
|
||||
UI_REQUIRED_CAPABILITIES += armv7
|
||||
else ifeq ($(APPLE_PLATFORM),ios-simulator)
|
||||
ARCHS = x86_64
|
||||
@@ -15,5 +14,8 @@ endif
|
||||
BUILD_DIR := $(subst $(TARGET),$(APPLE_PLATFORM),$(BUILD_DIR))
|
||||
|
||||
ifdef ARCH
|
||||
EXE = bin
|
||||
BUILD_DIR := $(BUILD_DIR)/$(ARCH)
|
||||
else
|
||||
HANDY_TARGETS_EXTENSIONS = ipa
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
TOOLCHAIN = apple
|
||||
EXE = bin
|
||||
|
||||
APPLE_PLATFORM = macos
|
||||
APPLE_PLATFORM_MIN_VERSION = 10.10
|
||||
@@ -9,5 +8,8 @@ ARCHS = x86_64
|
||||
EPSILON_SIMULATOR_HAS_LIBPNG = 1
|
||||
|
||||
ifdef ARCH
|
||||
EXE = bin
|
||||
BUILD_DIR := $(BUILD_DIR)/$(ARCH)
|
||||
else
|
||||
HANDY_TARGETS_EXTENSIONS = app
|
||||
endif
|
||||
|
||||
@@ -26,6 +26,8 @@ LDFLAGS += -framework CoreData
|
||||
LDFLAGS += -Lion/src/simulator/ios/GoogleAnalyticsServices
|
||||
endif
|
||||
|
||||
ifndef ARCH
|
||||
|
||||
# App resources
|
||||
|
||||
SIMULATOR_ICON_SIZES = 20x20 29x29 40x40 40x40 40x40 58x58 58x58 60x60 76x76 \
|
||||
@@ -35,7 +37,7 @@ SIMULATOR_ICONSET = $(SIMULATOR_ASSETS_PATH)/AppIcon.appiconset
|
||||
|
||||
include ion/src/simulator/shared/apple/Makefile
|
||||
|
||||
$(call simulator_app_plist,%,Info.plist): ion/src/simulator/ios/Info.plist $(call simulator_app_resource,%,Assets.car)
|
||||
$(call simulator_app_plist,Info.plist): ion/src/simulator/ios/Info.plist $(call simulator_app_resource,Assets.car)
|
||||
$(call rule_label,PLUTIL)
|
||||
$(Q) cp $< $@
|
||||
$(Q) plutil -insert "BuildMachineOSBuild" -string "$(IOS_BUILD_MACHINE_OS_BUILD)" $@
|
||||
@@ -54,12 +56,12 @@ $(call simulator_app_plist,%,Info.plist): ion/src/simulator/ios/Info.plist $(cal
|
||||
$(Q) plutil -replace CFBundleIcons -json `plutil -extract CFBundleIcons json -o - $(BUILD_DIR)/app/assets/partial.plist` $@
|
||||
$(Q) plutil -replace CFBundleIcons~ipad -json `plutil -extract CFBundleIcons~ipad json -o - $(BUILD_DIR)/app/assets/partial.plist` $@
|
||||
|
||||
$(call simulator_app_resource,%,launch.storyboardc): ion/src/simulator/ios/launch.storyboard | $$(@D)/.
|
||||
$(call simulator_app_resource,launch.storyboardc): ion/src/simulator/ios/launch.storyboard | $$(@D)/.
|
||||
$(call rule_label,IBTOOL)
|
||||
$(Q) $(IBTOOL) --minimum-deployment-target $(APPLE_PLATFORM_MIN_VERSION) --compile $@ $^
|
||||
|
||||
ifdef IOS_PROVISIONNING_PROFILE
|
||||
$(call simulator_app_resource,%,embedded.mobileprovision): $(IOS_PROVISIONNING_PROFILE) | $$(@D)/.
|
||||
$(call simulator_app_resource,embedded.mobileprovision): $(IOS_PROVISIONNING_PROFILE) | $$(@D)/.
|
||||
$(call rule_label,COPY)
|
||||
$(Q) cp $^ $@
|
||||
|
||||
@@ -68,9 +70,9 @@ $(BUILD_DIR)/app/entitlements.plist: $(IOS_PROVISIONNING_PROFILE)
|
||||
$(Q) security cms -D -i $(IOS_PROVISIONNING_PROFILE) | plutil -extract Entitlements xml1 - -o $@
|
||||
|
||||
simulator_app_deps += $(BUILD_DIR)/app/entitlements.plist
|
||||
simulator_app_deps += $(call simulator_app_resource,$1,embedded.mobileprovision)
|
||||
simulator_app_deps += $(call simulator_app_resource,embedded.mobileprovision)
|
||||
else
|
||||
$(call simulator_app_resource,%,embedded.mobileprovision):
|
||||
$(call simulator_app_resource,embedded.mobileprovision):
|
||||
$(warning Building without a provisionning profile. Please define IOS_PROVISIONNING_PROFILE to point to the .mobileprovision file you want to use.)
|
||||
endif
|
||||
|
||||
@@ -78,29 +80,33 @@ $(SIMULATOR_ICONSET)/Contents.json: ion/src/simulator/ios/icon_assets.json $(SIM
|
||||
$(call rule_label,COPY)
|
||||
$(Q) cp $< $@
|
||||
|
||||
$(call simulator_app_resource,%,Assets.car): $(SIMULATOR_ICONSET)/Contents.json | $$(@D)/.
|
||||
$(call simulator_app_resource,Assets.car): $(SIMULATOR_ICONSET)/Contents.json | $$(@D)/.
|
||||
$(call rule_label,ACTOOL)
|
||||
$(Q) $(ACTOOL) --compile $(BUILD_DIR)/app/Payload/$*.app --minimum-deployment-target $(APPLE_PLATFORM_MIN_VERSION) --platform $(APPLE_SDK) --app-icon AppIcon --output-partial-info-plist $(BUILD_DIR)/app/assets/partial.plist $(SIMULATOR_ASSETS_PATH) > /dev/null
|
||||
$(Q) $(ACTOOL) --compile $(BUILD_DIR)/$*.app --minimum-deployment-target $(APPLE_PLATFORM_MIN_VERSION) --platform $(APPLE_SDK) --app-icon AppIcon --output-partial-info-plist $(BUILD_DIR)/app/assets/partial.plist $(SIMULATOR_ASSETS_PATH) > /dev/null
|
||||
|
||||
simulator_app_deps += $(call simulator_app_resource,$(1), \
|
||||
Assets.car \
|
||||
launch.storyboardc \
|
||||
)
|
||||
simulator_app_deps += $(call simulator_app_resource,Assets.car)
|
||||
simulator_app_deps += $(call simulator_app_resource,launch.storyboardc)
|
||||
|
||||
$(BUILD_DIR)/app/epsilon%ipa: $$(subst ..,.,$$(call simulator_app_deps,Epsilon$$*))
|
||||
.PRECIOUS: $(simulator_app_deps)
|
||||
|
||||
.PRECIOUS: $(BUILD_DIR)/%.app
|
||||
.PHONY: $(BUILD_DIR)/%.app
|
||||
$(BUILD_DIR)/%.app: $(simulator_app_deps)
|
||||
|
||||
$(BUILD_DIR)/%.ipa: $(BUILD_DIR)/%.app
|
||||
ifdef IOS_PROVISIONNING_PROFILE
|
||||
$(call rule_label,SIGN)
|
||||
$(Q) codesign --force --entitlements $(BUILD_DIR)/app/entitlements.plist --sign "Apple Distribution: NumWorks" $(BUILD_DIR)/app/Payload/Epsilon$*app
|
||||
$(Q) codesign --force --entitlements $(BUILD_DIR)/app/entitlements.plist --sign "Apple Distribution: NumWorks" $(BUILD_DIR)/$*.app
|
||||
endif
|
||||
$(call rule_label,ZIP)
|
||||
$(Q) cd $(dir $@) ; zip -qr9 $(notdir $@) Payload
|
||||
$(Q) cd $(dir $@) ; zip -qr9 $(notdir $@) $*.app
|
||||
|
||||
ifndef ARCH
|
||||
DEFAULT := $(BUILD_DIR)/app/epsilon.ipa
|
||||
endif
|
||||
DEFAULT = epsilon.ipa
|
||||
|
||||
ifeq ($(APPLE_PLATFORM),ios-simulator)
|
||||
.PHONY: epsilon%run
|
||||
epsilon%run: $(subst _.,.,$(call simulator_app_deps,Epsilon$*))
|
||||
xcrun simctl install booted $(BUILD_DIR)/app/Payload/Epsilon$(subst _,.,$*)app
|
||||
.PHONY: %_run
|
||||
%_run: $(BUILD_DIR)/%.app
|
||||
xcrun simctl install booted $^
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
@@ -12,6 +12,8 @@ ion_src += ion/src/simulator/shared/dummy/telemetry_init.cpp
|
||||
ion_src += ion/src/shared/telemetry_console.cpp
|
||||
endif
|
||||
|
||||
ifndef ARCH
|
||||
|
||||
# App resources
|
||||
|
||||
SIMULATOR_ICON_SIZES = 16x16 32x32 64x64 128x128 256x256 512x512 1024x1024
|
||||
@@ -22,7 +24,7 @@ SIMULATOR_ICONSET = $(BUILD_DIR)/app/assets/app.iconset
|
||||
|
||||
include ion/src/simulator/shared/apple/Makefile
|
||||
|
||||
$(call simulator_app_plist,%,Info.plist): ion/src/simulator/macos/Info.plist
|
||||
$(call simulator_app_plist,Info.plist): ion/src/simulator/macos/Info.plist | $$(@D)/.
|
||||
$(call rule_label,PLUTIL)
|
||||
$(Q) cp $< $@
|
||||
$(Q) plutil -insert "LSMinimumSystemVersion" -string "$(MACOS_MIN_VERSION)" $@
|
||||
@@ -33,19 +35,21 @@ $(call simulator_app_plist,%,Info.plist): ion/src/simulator/macos/Info.plist
|
||||
|
||||
.SECONDARY: $(SIMULATOR_ICONS) | $$(@D)/.
|
||||
|
||||
$(call simulator_app_resource,%,app.icns): $(SIMULATOR_ICONS) | $$(@D)/.
|
||||
$(call simulator_app_resource,app.icns): $(SIMULATOR_ICONS) | $$(@D)/.
|
||||
$(call rule_label,ICNUTIL)
|
||||
$(Q) iconutil --convert icns --output $@ $(SIMULATOR_ICONSET)
|
||||
|
||||
simulator_app_deps += $(call simulator_app_resource,$(1),app.icns)
|
||||
simulator_app_deps += $(call simulator_app_resource,app.icns)
|
||||
|
||||
simulator_app_deps_unofficial = $(call simulator_app_deps,Epsilon)
|
||||
simulator_app_deps_official = $(call simulator_app_deps,Epsilon.official)
|
||||
.PRECIOUS: $(simulator_app_deps)
|
||||
|
||||
.PHONY: Epsilon.app Epsilon.official.app
|
||||
Epsilon.app: $(simulator_app_deps_unofficial)
|
||||
Epsilon.official.app: $(simulator_app_deps_official)
|
||||
$(BUILD_DIR)/%.app: $(simulator_app_deps)
|
||||
$(Q) echo "DONE"
|
||||
|
||||
#.PHONY: Epsilon.app Epsilon.official.app
|
||||
#Epsilon.app: $(simulator_app_deps_unofficial)
|
||||
#Epsilon.official.app: $(simulator_app_deps_official)
|
||||
|
||||
DEFAULT = epsilon.app
|
||||
|
||||
ifndef ARCH
|
||||
DEFAULT := Epsilon.app
|
||||
endif
|
||||
|
||||
@@ -2,37 +2,31 @@
|
||||
# The only things that have to be customized per platform are the icons and the
|
||||
# Info.plist.
|
||||
|
||||
SIMULATOR_APP_PATH = $(BUILD_DIR)/app/Payload
|
||||
SIMULATOR_APP_PATH = $(BUILD_DIR)
|
||||
|
||||
simulator_app_binary = $(addprefix $(SIMULATOR_APP_PATH)/$(1).app/$(SIMULATOR_APP_BINARY_PATH),$(2))
|
||||
simulator_app_resource = $(addprefix $(SIMULATOR_APP_PATH)/$(1).app/$(SIMULATOR_APP_RESOURCE_PATH),$(2))
|
||||
simulator_app_plist = $(addprefix $(SIMULATOR_APP_PATH)/$(1).app/$(SIMULATOR_APP_PLIST_PATH),$(2))
|
||||
simulator_app_binary = $(SIMULATOR_APP_PATH)/%.app/$(SIMULATOR_APP_BINARY_PATH)Epsilon
|
||||
simulator_app_resource = $(SIMULATOR_APP_PATH)/%.app/$(SIMULATOR_APP_RESOURCE_PATH)$(1)
|
||||
simulator_app_plist = $(SIMULATOR_APP_PATH)/%.app/$(SIMULATOR_APP_PLIST_PATH)$(1)
|
||||
|
||||
# Epsilon binary
|
||||
|
||||
.PHONY: force_remake
|
||||
|
||||
define rule_for_epsilon
|
||||
$$(BUILD_DIR)/%/$(1): force_remake
|
||||
$(Q) echo "MAKE ARCH=$$*"
|
||||
$(Q) $$(MAKE) ARCH=$$* $(1)
|
||||
define rule_for_arch_executable
|
||||
.PRECIOUS: $$(BUILD_DIR)/$(1)/%.bin
|
||||
$$(BUILD_DIR)/$(1)/%.bin: force_remake
|
||||
$(Q) echo "MAKE ARCH=$(1)"
|
||||
$(Q) $$(MAKE) ARCH=$(1) --silent $$*.bin
|
||||
endef
|
||||
|
||||
$(eval $(call rule_for_epsilon,epsilon.bin))
|
||||
$(eval $(call rule_for_epsilon,epsilon.official.bin))
|
||||
$(foreach ARCH,$(ARCHS),$(eval $(call rule_for_arch_executable,$(ARCH))))
|
||||
|
||||
define rule_for_lipo
|
||||
$$(call simulator_app_binary,$1,Epsilon): $$(patsubst %,$(BUILD_DIR)/%/$2.bin,$$(ARCHS)) | $$$$(@D)/.
|
||||
$$(call rule_label,LIPO)
|
||||
$(Q) $$(LIPO) -create $$^ -output $$@
|
||||
endef
|
||||
|
||||
$(eval $(call rule_for_lipo,Epsilon,epsilon))
|
||||
$(eval $(call rule_for_lipo,Epsilon.official,epsilon.official))
|
||||
$(simulator_app_binary): $(foreach arch,$(ARCHS),$(BUILD_DIR)/$(arch)/%.bin) | $$(@D)/.
|
||||
$(call rule_label,LIPO)
|
||||
$(Q) $(LIPO) -create $^ -output $@
|
||||
|
||||
# Background image
|
||||
|
||||
$(call simulator_app_resource,%,background.jpg): ion/src/simulator/assets/background.jpg | $$(@D)/.
|
||||
$(call simulator_app_resource,background.jpg): ion/src/simulator/assets/background.jpg | $$(@D)/.
|
||||
$(call rule_label,COPY)
|
||||
$(Q) cp $^ $@
|
||||
|
||||
@@ -54,6 +48,6 @@ $(addprefix $(SIMULATOR_ICONSET)/,icon_%.png): ion/src/simulator/assets/logo.svg
|
||||
|
||||
# Export simulator app dependencies
|
||||
|
||||
simulator_app_deps += $(call simulator_app_binary,$(1),Epsilon)
|
||||
simulator_app_deps += $(call simulator_app_plist,$(1),Info.plist)
|
||||
simulator_app_deps += $(call simulator_app_resource,$(1),background.jpg)
|
||||
simulator_app_deps += $(simulator_app_binary)
|
||||
simulator_app_deps += $(call simulator_app_plist,Info.plist)
|
||||
simulator_app_deps += $(call simulator_app_resource,background.jpg)
|
||||
|
||||
Reference in New Issue
Block a user