Skip to content

Commit 95e894d

Browse files
author
Sam Bingner
committed
Add code to generate notarized dmg and zip
1 parent 236711d commit 95e894d

File tree

3 files changed

+78
-1
lines changed

3 files changed

+78
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ USBFlux/build
4040
USBFlux/USBFlux.xcodeproj/project.xcworkspace/xcshareddata/
4141
USBFlux/USBFlux.xcodeproj/project.xcworkspace/xcuserdata/
4242
USBFlux/USBFlux.xcodeproj/xcuserdata/
43+
build/
4344
*.zip
4445
*.dmg
4546
create-dmg

Makefile.notarize

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
COMMIT=$(shell git rev-parse HEAD || echo nogit)
2+
APPLE_ID := id@corellium.com
3+
TEAM_ID := TTAVJYQ72B
4+
APP_PASSWORD := ""
5+
VER := $(shell grep AC_INIT configure.ac |cut -d "[" -f3 |cut -d "]" -f 1)
6+
7+
.PHONY: all clean
8+
all: build/USBFlux-$(COMMIT).dmg build/USBFlux-onsite-$(COMMIT).dmg build/USBFlux-$(COMMIT).zip build/USBFlux-onsite-$(COMMIT).zip
9+
10+
create-dmg/create-dmg:
11+
rm -rf create-dmg
12+
curl -L https://github.com/nikias/create-dmg/archive/master.zip > create-dmg.zip
13+
unzip create-dmg.zip
14+
mv create-dmg-master create-dmg
15+
rm -f create-dmg.zip
16+
chmod 755 create-dmg/create-dmg
17+
18+
build/onsite build/cloud:
19+
mkdir -p $@
20+
21+
build/%/README: README | build/%
22+
cp $^ $@
23+
24+
build/%/README.md: README.md | build/%
25+
cp $^ $@
26+
27+
build/%/Applications: | build/%
28+
ln -s /Applications $@
29+
30+
USBFlux/build/usbflux/Release/USBFlux.app: tools/usbfluxctl usbfluxd/usbfluxd USBFlux/USBFlux.xcodeproj $(wildcard USBFlux/USBFlux/*)
31+
xcodebuild -project USBFlux/USBFlux.xcodeproj -target USBFlux -configuration Release OBJROOT=build/usbflux SYMROOT=build/usbflux
32+
33+
build/onsite/USBFlux.app build/cloud/USBFlux.app: USBFlux/build/usbflux/Release/USBFlux.app | build/onsite build/cloud
34+
rm -rf "$(dir $@)/tmp"
35+
mkdir -p "$(dir $@)/tmp"
36+
cp -a $< "$(dir $@)/tmp"
37+
if [ "$@" == build/onsite/USBFlux.app ]; then touch "$(dir $@)"/tmp/USBFlux.app/Contents/Resources/domain.conf; fi
38+
codesign --options runtime --timestamp --force --sign "Developer ID Application: Corellium, Inc (TTAVJYQ72B)" --requirements "=designated => anchor apple generic and identifier \"$$self.identifier\" and ((cert leaf[field.1.2.840.113635.100.6.1.9] exists) or ( certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists and certificate leaf[subject.OU] = \"TTAVJYQ72B\" ))" "$(dir $@)/tmp/$(notdir $@)"/Contents/Resources/usbfluxctl "$(dir $@)/tmp/$(notdir $@)"/Contents/Resources/usbfluxd
39+
codesign --options runtime --timestamp --force --sign "Developer ID Application: Corellium, Inc (TTAVJYQ72B)" --requirements "=designated => anchor apple generic and identifier \"$$self.identifier\" and ((cert leaf[field.1.2.840.113635.100.6.1.9] exists) or ( certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists and certificate leaf[subject.OU] = \"TTAVJYQ72B\" ))" "$(dir $@)/tmp/$(notdir $@)"
40+
cd "$(dir $@)"/tmp; zip -r USBFlux.zip USBFlux.app
41+
xcrun notarytool submit --wait --apple-id $(APPLE_ID) --team-id $(TEAM_ID) --password "$(APP_PASSWORD)" "$(dir $@)"/tmp/USBFlux.zip
42+
xcrun stapler staple "$(dir $@)"/tmp/USBFlux.app
43+
mv "$(dir $@)"/tmp/USBFlux.app $@
44+
rm -rf "$(dir $@)"/tmp
45+
46+
build/USBFlux.dmg: build/cloud/USBFlux.app build/cloud/README build/cloud/README.md build/cloud/Applications | create-dmg/create-dmg
47+
./create-dmg/create-dmg --no-internet-enable --volname "USBFlux $(VER)" --volicon USBFlux/VolumeIcon.icns --background USBFlux/background.png --window-size 800 421 --icon-size 128 --icon USBFlux.app 0 0 --icon "Applications" 340 0 --icon USBFlux.pdf 0 200 $@ $(dir $^)
48+
49+
build/USBFlux-onsite.dmg: build/onsite/USBFlux.app build/onsite/README build/onsite/README.md build/onsite/Applications | create-dmg/create-dmg
50+
./create-dmg/create-dmg --no-internet-enable --volname "USBFlux $(VER)" --volicon USBFlux/VolumeIcon.icns --background USBFlux/background.png --window-size 800 421 --icon-size 128 --icon USBFlux.app 0 0 --icon "Applications" 340 0 --icon USBFlux.pdf 0 200 $@ $(dir $^)
51+
52+
build/USBFlux.zip: build/cloud/USBFlux.app build/cloud/README build/cloud/README.md | create-dmg/create-dmg
53+
rm -f $@
54+
cd build/cloud; zip -r ../$(notdir $@) $(notdir $^)
55+
56+
build/USBFlux-onsite.zip: build/onsite/USBFlux.app build/onsite/README build/onsite/README.md | create-dmg/create-dmg
57+
rm -f $@
58+
cd build/onsite; zip -r ../$(notdir $@) $(notdir $^)
59+
60+
build/%-$(COMMIT).dmg: build/%.dmg
61+
ln $^ $@
62+
63+
build/%-$(COMMIT).zip: build/%.zip
64+
ln $^ $@
65+
66+
clean:
67+
rm -rf USBFlux/build/usbflux build/

USBFlux/USBFlux.xcodeproj/project.pbxproj

+10-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
04D7270C215BD74000B29E2E /* Corellium.m in Sources */ = {isa = PBXBuildFile; fileRef = 04D7270B215BD74000B29E2E /* Corellium.m */; };
1818
04D7270F215C13E800B29E2E /* PasswordEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 04D7270E215C13E800B29E2E /* PasswordEntry.m */; };
1919
04D72717215C53DB00B29E2E /* SimpleTextInput.m in Sources */ = {isa = PBXBuildFile; fileRef = 04D72716215C53DB00B29E2E /* SimpleTextInput.m */; };
20+
22D9900629DD6228006728CF /* usbfluxctl in Resources */ = {isa = PBXBuildFile; fileRef = 22D9900529DD6228006728CF /* usbfluxctl */; };
2021
DB0E4FBB223588E0003C07CF /* STHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = DB0E4FB9223588E0003C07CF /* STHTTPRequest.m */; };
2122
/* End PBXBuildFile section */
2223

@@ -38,6 +39,7 @@
3839
04D7270E215C13E800B29E2E /* PasswordEntry.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PasswordEntry.m; sourceTree = "<group>"; };
3940
04D72715215C53DB00B29E2E /* SimpleTextInput.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SimpleTextInput.h; sourceTree = "<group>"; };
4041
04D72716215C53DB00B29E2E /* SimpleTextInput.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SimpleTextInput.m; sourceTree = "<group>"; };
42+
22D9900529DD6228006728CF /* usbfluxctl */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = usbfluxctl; path = ../tools/usbfluxctl; sourceTree = "<group>"; };
4143
DB0E4FB9223588E0003C07CF /* STHTTPRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STHTTPRequest.m; sourceTree = "<group>"; };
4244
DB0E4FBA223588E0003C07CF /* STHTTPRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STHTTPRequest.h; sourceTree = "<group>"; };
4345
/* End PBXFileReference section */
@@ -56,6 +58,7 @@
5658
0430E92920BEF9F00047F28C = {
5759
isa = PBXGroup;
5860
children = (
61+
22D9900529DD6228006728CF /* usbfluxctl */,
5962
047357A320DB2A9F0089445A /* terminate.sh */,
6063
0430E95320C02E5B0047F28C /* usbfluxd */,
6164
0430E93420BEF9F00047F28C /* USBFlux */,
@@ -120,7 +123,7 @@
120123
0430E92A20BEF9F00047F28C /* Project object */ = {
121124
isa = PBXProject;
122125
attributes = {
123-
LastUpgradeCheck = 0930;
126+
LastUpgradeCheck = 1330;
124127
ORGANIZATIONNAME = Corellium;
125128
TargetAttributes = {
126129
0430E93120BEF9F00047F28C = {
@@ -160,6 +163,7 @@
160163
0430E95220C00CA30047F28C /* AuthIcon.png in Resources */,
161164
0430E93C20BEF9F10047F28C /* MainMenu.xib in Resources */,
162165
0430E95420C02E5B0047F28C /* usbfluxd in Resources */,
166+
22D9900629DD6228006728CF /* usbfluxctl in Resources */,
163167
047357A420DB2A9F0089445A /* terminate.sh in Resources */,
164168
);
165169
runOnlyForDeploymentPostprocessing = 0;
@@ -220,6 +224,7 @@
220224
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
221225
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
222226
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
227+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
223228
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
224229
CLANG_WARN_STRICT_PROTOTYPES = YES;
225230
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -280,13 +285,15 @@
280285
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
281286
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
282287
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
288+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
283289
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
284290
CLANG_WARN_STRICT_PROTOTYPES = YES;
285291
CLANG_WARN_SUSPICIOUS_MOVE = YES;
286292
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
287293
CLANG_WARN_UNREACHABLE_CODE = YES;
288294
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
289295
CODE_SIGN_IDENTITY = "Mac Developer";
296+
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
290297
CODE_SIGN_STYLE = Automatic;
291298
COPY_PHASE_STRIP = NO;
292299
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
@@ -315,6 +322,7 @@
315322
CODE_SIGN_STYLE = Manual;
316323
COMBINE_HIDPI_IMAGES = YES;
317324
DEVELOPMENT_TEAM = TTAVJYQ72B;
325+
ENABLE_HARDENED_RUNTIME = YES;
318326
INFOPLIST_FILE = USBFlux/Info.plist;
319327
LD_RUNPATH_SEARCH_PATHS = (
320328
"$(inherited)",
@@ -335,6 +343,7 @@
335343
CODE_SIGN_STYLE = Manual;
336344
COMBINE_HIDPI_IMAGES = YES;
337345
DEVELOPMENT_TEAM = TTAVJYQ72B;
346+
ENABLE_HARDENED_RUNTIME = YES;
338347
INFOPLIST_FILE = USBFlux/Info.plist;
339348
LD_RUNPATH_SEARCH_PATHS = (
340349
"$(inherited)",

0 commit comments

Comments
 (0)