Skip to content

Commit

Permalink
Update Makefile (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
majd authored Jul 2, 2022
1 parent 9cfd72d commit 07a0f33
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 70 deletions.
38 changes: 3 additions & 35 deletions .github/workflows/distribute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Inject version
run: ./Scripts/version
- name: Build
run: make build
run: make build-macos
- name: Upload binary
uses: actions/upload-artifact@v2
with:
Expand All @@ -77,40 +77,8 @@ jobs:
run: ./Scripts/version
- name: Install dependencies
run: brew install xcodegen ldid
- name: Generate Xcode project
run: xcodegen -s ios-project.yml
- name: Build archive
run: |
xcodebuild archive -scheme CLI \
-sdk iphoneos \
-configuration Release \
-derivedDataPath .build \
-archivePath .build/ipatool.xcarchive \
CODE_SIGN_IDENTITY='' \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGN_ENTITLEMENTS='' \
CODE_SIGNING_ALLOWED=NO
cp .build/ipatool.xcarchive/Products/Applications/CLI.app/CLI .build/ipatool
- name: Fakesign executable
run: |
cat <<EOF >"$PWD/.build/entitlements.xml"
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>keychain-access-groups</key>
<array>
<string>ipatool</string>
</array>
<key>application-identifier</key>
<string>ipatool</string>
<key>platform-application</key>
<true />
<key>com.apple.private.security.container-required</key>
<false />
</dict>
</plist>
EOF
ldid -S.build/entitlements.xml ./.build/ipatool
- name: Build
run: make build-ios
- name: Upload binary
uses: actions/upload-artifact@v2
with:
Expand Down
35 changes: 5 additions & 30 deletions .github/workflows/dry-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,14 @@ jobs:
restore-keys: |
${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
${{ runner.os }}-spm-
- name: Inject version
run: ./Scripts/version
- name: Install dependencies
run: brew install xcodegen ldid
- name: Generate Xcode project
run: xcodegen -s ios-project.yml
- name: Build archive
- name: Inject version
run: ./Scripts/version
- name: Build
run: |
xcodebuild archive -scheme CLI \
-sdk iphoneos \
-configuration Release \
-derivedDataPath .build \
-archivePath .build/ipatool.xcarchive \
CODE_SIGN_IDENTITY='' \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGN_ENTITLEMENTS='' \
CODE_SIGNING_ALLOWED=NO
cp .build/ipatool.xcarchive/Products/Applications/CLI.app/CLI .build/ipatool
make build-ios
file .build/ipatool
- name: Fakesign executable
run: |
cat <<EOF >"$PWD/.build/entitlements.xml"
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>platform-application</key>
<true />
<key>com.apple.private.security.container-required</key>
<false />
</dict>
</plist>
EOF
ldid -S.build/entitlements.xml ./.build/ipatool
build_macos:
name: Dry build (macOS)
runs-on: macos-12
Expand All @@ -71,5 +46,5 @@ jobs:
run: ./Scripts/version
- name: Build
run: |
make build
make build-macos
file .build/ipatool
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Inject version
run: ./Scripts/version
- name: Build
run: make build
run: make build-macos
- name: Upload binary
uses: actions/upload-artifact@v2
with:
Expand Down
43 changes: 39 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,57 @@
prefix ?= /usr/local
bindir = $(prefix)/bin

define ios_entitlements
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>keychain-access-groups</key>
<array>
<string>ipatool</string>
</array>
<key>application-identifier</key>
<string>ipatool</string>
<key>platform-application</key>
<true />
<key>com.apple.private.security.container-required</key>
<false />
</dict>
</plist>
endef

lint:
swiftlint lint --config .swiftlint.yml --path Sources/ Tests/m Plugins/

build: lint
build-macos: lint
swift build -c release --arch arm64
swift build -c release --arch x86_64
lipo -create -output .build/ipatool .build/arm64-apple-macosx/release/ipatool .build/x86_64-apple-macosx/release/ipatool

install: build
build-ios: lint
xcodegen -s ios-project.yml
xcodebuild archive -scheme CLI \
-sdk iphoneos \
-configuration Release \
-derivedDataPath .build \
-archivePath .build/ipatool.xcarchive \
CODE_SIGN_IDENTITY='' \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGN_ENTITLEMENTS='' \
CODE_SIGNING_ALLOWED=NO
cp .build/ipatool.xcarchive/Products/Applications/CLI.app/CLI .build/ipatool
echo "$$ios_entitlements" > "${PWD}/.build/entitlements.xml"
ldid -S.build/entitlements.xml ./.build/ipatool

install-macos: build
install -d "$(bindir)"
install ".build/ipatool" "$(bindir)"

uninstall:
uninstall-macos:
rm -rf "$(bindir)/ipatool"

clean:
rm -rf .build

.PHONY: build install uninstall clean
.PHONY: build-macos install-macos uninstall-macos clean

export ios_entitlements

0 comments on commit 07a0f33

Please sign in to comment.