forked from Stremio/stremio-core-kotlin
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
73 lines (63 loc) · 3 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
LIBRARY_NAME := libstremio_core_swift
FRAMEWORK_NAME := StremioCore
SWIFT_FILE := Package.swift
.PHONY: all
all: macos ios iossim tvossim tvos visionossim package
macos:
@cargo +nightly build -Z build-std --release --lib --target aarch64-apple-ios-macabi
@cargo +nightly build -Z build-std --release --lib --target x86_64-apple-ios-macabi
@$(RM) -rf target/universal/$(LIBRARY_NAME)-macabi.a
@mkdir -p target/universal/
@lipo -create -output target/universal/$(LIBRARY_NAME)-macabi.a \
target/aarch64-apple-ios-macabi/release/$(LIBRARY_NAME).a \
target/x86_64-apple-ios-macabi/release/$(LIBRARY_NAME).a
ios:
@cargo build --release --lib --target aarch64-apple-ios
@$(RM) -rf target/universal/$(LIBRARY_NAME)-ios.a
@mkdir -p target/universal/
@cp target/aarch64-apple-ios/release/$(LIBRARY_NAME).a target/universal/$(LIBRARY_NAME)-ios.a
iossim:
@cargo build --release --lib --target aarch64-apple-ios-sim
@cargo build --release --lib --target x86_64-apple-ios
@$(RM) -rf target/universal/$(LIBRARY_NAME)-ios-sim.a
@mkdir -p target/universal/
@lipo -create -output target/universal/$(LIBRARY_NAME)-ios-sim.a \
target/aarch64-apple-ios-sim/release/$(LIBRARY_NAME).a \
target/x86_64-apple-ios/release/$(LIBRARY_NAME).a
tvossim:
@cargo build -Z build-std --release --lib --target aarch64-apple-tvos-sim
@cargo build -Z build-std --release --lib --target x86_64-apple-tvos
@$(RM) -rf target/universal/$(LIBRARY_NAME)-tvos-sim.a
@mkdir -p target/universal/
@lipo -create -output target/universal/$(LIBRARY_NAME)-tvos-sim.a \
target/aarch64-apple-tvos-sim/release/$(LIBRARY_NAME).a \
target/x86_64-apple-tvos/release/$(LIBRARY_NAME).a
tvos:
@cargo build -Z build-std --release --lib --target aarch64-apple-tvos
@$(RM) -rf target/universal/$(LIBRARY_NAME)-tvos.a
@mkdir -p target/universal/
@cp target/aarch64-apple-tvos/release/$(LIBRARY_NAME).a target/universal/$(LIBRARY_NAME)-tvos.a
visionossim:
@cargo +nightly build -Z build-std --release --lib --target aarch64-apple-visionos-sim
@$(RM) -rf target/universal/$(LIBRARY_NAME)-visionos-sim.a
@mkdir -p target/universal/
@cp target/aarch64-apple-visionos-sim/release/$(LIBRARY_NAME).a target/universal/$(LIBRARY_NAME)-visionos-sim.a
framework:
@mkdir -p .build/
@$(RM) -rf .build/$(FRAMEWORK_NAME).xcframework
@xcodebuild -create-xcframework \
-library target/universal/$(LIBRARY_NAME)-ios.a \
-library target/universal/$(LIBRARY_NAME)-ios-sim.a \
-library target/universal/$(LIBRARY_NAME)-macabi.a \
-library target/universal/$(LIBRARY_NAME)-visionos-sim.a \
-library target/universal/$(LIBRARY_NAME)-tvos-sim.a \
-library target/universal/$(LIBRARY_NAME)-tvos.a \
-output .build/$(FRAMEWORK_NAME).xcframework
package: framework
@$(RM) -rf Sources/StremioCore/stremio
@cbindgen --config Support/cbindgen.toml -o Sources/Wrapper/include/wrapper.h
manifest:
@echo "Updating URL and SHA256 in $(SWIFT_FILE)..."
@sed -i '' 's|let url = .*|let url = "$(url)";|' $(SWIFT_FILE)
@sed -i '' 's|let sha256 = .*|let sha256 = "$(sha256)";|' $(SWIFT_FILE)
@echo "Done."