forked from jkcoxson/minimuxer
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
147 lines (124 loc) · 3.84 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
SIDESTORE_REPO ?= ../SideStore
SKIP_SIM ?= false
TARGET="minimuxer"
add_targets:
@echo "add_targets"
rustup target add aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios
build:
@echo "build aarch64-apple-ios"
@cargo build --release --target aarch64-apple-ios
@cp target/aarch64-apple-ios/release/lib$(TARGET).a target/lib$(TARGET)-ios.a
ifeq ($(SKIP_SIM),false)
@echo "build aarch64-apple-ios-sim"
@cargo build --release --target aarch64-apple-ios-sim
@echo "build x86_64-apple-ios"
@cargo build --release --target x86_64-apple-ios
@echo "lipo"
@lipo -create \
-output target/lib$(TARGET)-sim.a \
target/aarch64-apple-ios-sim/release/lib$(TARGET).a \
target/x86_64-apple-ios/release/lib$(TARGET).a
else
@echo "skipping sim builds"
endif
# TODO: remove/update once SPM gets merged
copy: build
@echo "SIDESTORE_REPO: $(SIDESTORE_REPO)"
@echo "copying libraries"
@cp target/libminimuxer-ios.a "$(SIDESTORE_REPO)/Dependencies/minimuxer"
@cp target/libminimuxer-sim.a "$(SIDESTORE_REPO)/Dependencies/minimuxer"
@echo "copying generated"
@cp generated/* "$(SIDESTORE_REPO)/Dependencies/minimuxer"
@touch "$(SIDESTORE_REPO)/Dependencies/.skip-prebuilt-fetch-minimuxer"
clean:
@echo "clean"
@if [ -d "include" ]; then \
echo "cleaning include"; \
rm -r include; \
fi
@if [ -d "target" ]; then \
echo "cleaning target"; \
rm -r target; \
fi
@if [ -d "$(TARGET).xcframework" ]; then \
echo "cleaning $(TARGET).xcframework"; \
rm -r $(TARGET).xcframework; \
fi
@if [ -f "$(TARGET).xcframework.zip" ]; then \
echo "cleaning $(TARGET).xcframework.zip"; \
rm $(TARGET).xcframework.zip; \
fi
xcframework: build
@echo "xcframework"
@if [ -d "include" ]; then \
echo "cleaning include"; \
rm -rf include; \
fi
@mkdir include
@mkdir include/$(TARGET)/
@cp generated/*.h include/$(TARGET)/
@cp module.modulemap include/$(TARGET)/
@if [ -d "$(TARGET).xcframework" ]; then \
echo "cleaning $(TARGET).xcframework"; \
rm -rf $(TARGET).xcframework; \
fi
@xcodebuild \
-create-xcframework \
-library target/lib$(TARGET)-ios.a \
-headers include/ \
-library target/lib$(TARGET)-sim.a \
-headers include/ \
-output $(TARGET).xcframework
xcframework_frameworks: build
@echo "xcframework_frameworks"
@if [ -d "include" ]; then \
echo "cleaning include"; \
rm -rf include; \
fi
@mkdir include
@mkdir include/$(TARGET)
@cp generated/*.h include/$(TARGET)
@cp module.modulemap include/$(TARGET)
@if [ -d "target/ios" ]; then \
echo "cleaning target/ios"; \
rm -rf target/ios; \
fi
@mkdir target/ios
@mkdir target/ios/$(TARGET).framework
@mkdir target/ios/$(TARGET).framework/Headers
@if [ -d "target/sim" ]; then \
echo "cleaning target/sim"; \
rm -rf target/sim; \
fi
@mkdir target/sim
@mkdir target/sim/$(TARGET).framework
@mkdir target/sim/$(TARGET).framework/Headers
@cp include/*.* target/ios/$(TARGET).framework/Headers
@libtool -static \
-o target/ios/$(TARGET).framework/$(TARGET) \
target/lib$(TARGET)-ios.a
@cp include/*.* target/sim/$(TARGET).framework/Headers
@xcrun \
-sdk iphonesimulator \
libtool -static \
-o target/sim/$(TARGET).framework/$(TARGET) \
target/lib$(TARGET)-sim.a
@if [ -d "$(TARGET).xcframework" ]; then \
echo "cleaning $(TARGET).xcframework"; \
rm -rf $(TARGET).xcframework; \
fi
@xcodebuild -create-xcframework \
-library target/sim/$(TARGET).framework \
-headers include/ \
-library target/ios/$(TARGET).framework \
-headers include/ \
-output $(TARGET).xcframework
zip: xcframework
@echo "zip xcframework"
@if [ -f "$(TARGET).xcframework.zip" ]; then \
echo "cleaning $(TARGET).xcframework.zip"; \
rm $(TARGET).xcframework.zip; \
fi
zip -r $(TARGET).xcframework.zip $(TARGET).xcframework
@echo "zip generated"
@zip -r generated.zip generated/