From 7754bd07114e16f3c266d1c5febb1181bfaa006d Mon Sep 17 00:00:00 2001 From: Ryo Aoyama Date: Mon, 8 Apr 2019 15:19:30 +0900 Subject: [PATCH] Use static stdlib --- .gitignore | 3 +++ Makefile | 18 ++++++++++++++++-- Package.swift | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 972cb81..b7365c2 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,6 @@ Carthage/ ## Tests !/Tests/AcknowledgementsPlistTests/Dummy/pcProject/Carthage + +## Builds +portable_acknowledgementsplist.zip diff --git a/Makefile b/Makefile index ab7a01f..79afa6f 100644 --- a/Makefile +++ b/Makefile @@ -2,17 +2,31 @@ TEMP_ZIP_DIR=./tmp/portable_zip SWIFT_BIN_DIR=$(shell swift build -c release --show-bin-path) BIN_NAME=acknowledgementsplist +# refer: https://github.com/realm/SwiftLint/pull/2682 +SWIFT_BUILD_FLAGS=-c release +UNAME=$(shell uname) +ifeq ($(UNAME), Darwin) +USE_SWIFT_STATIC_STDLIB:=$(shell test -d $$(dirname $$(xcrun --find swift))/../lib/swift_static/macosx && echo yes) +ifeq ($(USE_SWIFT_STATIC_STDLIB), yes) +SWIFT_BUILD_FLAGS+= -Xswiftc -static-stdlib +endif +endif + +TEMP_ZIP_DIR=./tmp/portable_zip +SWIFT_BIN_DIR=$(shell swift build $(SWIFT_BUILD_FLAGS) --show-bin-path) +BIN_NAME=acknowledgementsplist + .PHONY: project release_build portable_zip project: swift package generate-xcodeproj release_build: - swift build -c release + swift build $(SWIFT_BUILD_FLAGS) portable_zip: release_build mkdir -p $(TEMP_ZIP_DIR) cp -f $(SWIFT_BIN_DIR)/$(BIN_NAME) $(TEMP_ZIP_DIR) cp -f LICENSE $(TEMP_ZIP_DIR) (cd $(TEMP_ZIP_DIR); zip -yr - $(BIN_NAME) LICENSE) > ./portable_acknowledgementsplist.zip - rm -rf $(TEMP_ZIP_DIR) \ No newline at end of file + rm -rf $(TEMP_ZIP_DIR) diff --git a/Package.swift b/Package.swift index 9360392..142804c 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.0 +// swift-tools-version:4.2 import PackageDescription