-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (49 loc) · 2.56 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
BINARIES=InputMethodHinter-console InputMethodHinter-launch
X86_TARGET=x86_64-apple-macos10.11
ARM_TARGET=arm64-apple-macos10.15
all: $(BINARIES) app zip
# https://stackoverflow.com/questions/71084674/hot-to-compile-a-swift-script-to-a-universal-binary
InputMethodHinter-console: InputMethodHinter.swift
swiftc $< -target $(X86_TARGET) -o $@--$(X86_TARGET)
xattr -cr . ; codesign -fs codesign $@--$(X86_TARGET)
swiftc $< -target $(ARM_TARGET) -o $@--$(ARM_TARGET)
xattr -cr . ; codesign -fs codesign $@--$(ARM_TARGET)
lipo -create $@--$(X86_TARGET) $@--$(ARM_TARGET) -output $@
xattr -cr . ; codesign -fs codesign $@
InputMethodHinter-launch: InputMethodHinter-launch.c
$(CC) -o3 $< -target $(X86_TARGET) -o $@--$(X86_TARGET)
xattr -cr . ; codesign -fs codesign $@--$(X86_TARGET)
$(CC) -o3 $< -target $(ARM_TARGET) -o $@--$(ARM_TARGET)
xattr -cr . ; codesign -fs codesign $@--$(ARM_TARGET)
lipo -create $@--$(X86_TARGET) $@--$(ARM_TARGET) -output $@
xattr -cr . ; codesign -fs codesign $@
# https://stackoverflow.com/questions/1596945/building-osx-app-bundle
# https://stackoverflow.com/questions/27474751/how-can-i-codesign-an-app-without-being-in-the-mac-developer-program
app: $(BINARIES)
rm -rf InputMethodHinter.app
cp -a InputMethodHinter.app-template InputMethodHinter.app
mkdir -p InputMethodHinter.app/Contents/{Resources,MacOS,Frameworks}
cp $(BINARIES) InputMethodHinter.app/Contents/MacOS/
#ln -s InputMethodHinter-launch InputMethodHinter.app/Contents/MacOS/InputMethodHinter
cp InputMethodHinter-launch InputMethodHinter.app/Contents/MacOS/InputMethodHinter
#install_name_tool -add_rpath "@executable_path" InputMethodHinter.app/Contents/MacOS/InputMethodHinter-console
install_name_tool -add_rpath "@loader_path" InputMethodHinter.app/Contents/MacOS/InputMethodHinter-console
cp /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/macosx/* InputMethodHinter.app/Contents/MacOS/
cp /Library/Developer/CommandLineTools/usr/lib/swift-5.0/macosx/* InputMethodHinter.app/Contents/MacOS/
./make-icon.sh
xattr -cr .
codesign -fs codesign --deep InputMethodHinter.app/Contents/MacOS/InputMethodHinter-console # have to do it after adding rpath
codesign -fs codesign InputMethodHinter.app # --deep?
#codesign -dvv --req - InputMethodHinter.app
touch InputMethodHinter.app
zip: app
rm -f InputMethodHinter.zip; zip -qr InputMethodHinter.zip InputMethodHinter.app
clean:
rm -rf \
$(BINARIES) \
InputMethodHinter-{console,launch}--* \
InputMethodHinter.app \
.ccls-cache \
icon.iconset \
#
.PHONY: all clean app zip