-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
118 lines (101 loc) · 3.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
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
OUT=$(PWD)/dist
CASPIAN=$(PWD)/../caspian
linux-x86_64:
CGO_ENABLED=1 \
GOOS=linux \
GOARCH=amd64 \
go build -buildmode=c-shared -tags linux -o $(OUT)/linux/libsafepool.so
linux: linux-x86_64
windows:
CGO_ENABLED=1 \
CC=x86_64-w64-mingw32-gcc \
GOOS=windows \
GOARCH=amd64 \
go build -buildmode=c-shared -tags windows -o $(OUT)/windows/safepool.dll
macos-x86_64:
CGO_ENABLED=1 \
GOOS=darwin \
GOARCH=amd64 \
go build -buildmode=c-shared -tags macos -o $(OUT)/macos/x86/libsafepool.dylib
macos-arm_64:
CGO_ENABLED=1 \
GOOS=darwin \
GOARCH=arm64 \
go build -buildmode=c-shared -tags macos -o $(OUT)/macos/arm64/libsafepool.dylib
macos: macos-x86_64 macos-arm_64
lipo $(OUT)/macos/x86/libsafepool.dylib $(OUT)/macos/arm64/libsafepool.dylib -create -output $(OUT)/macos/libsafepool.dylib
rm -rf $(OUT)/macos/x86 $(OUT)/macos/arm64
test -e $(CASPIAN) && cp -rf $(OUT)/macos $(CASPIAN)
ios-arm64:
CGO_ENABLED=1 \
GOOS=ios \
GOARCH=arm64 \
SDK=iphoneos \
SDK_PATH=`xcrun --sdk iphoneos --show-sdk-path` \
CC=$(shell go env GOROOT)/misc/ios/clangwrap.sh \
CGO_CFLAGS="-fembed-bitcode" \
CLANG=`xcrun --sdk iphoneos --find clang` \
go build -buildmode=c-archive -tags ios -o $(OUT)/ios/arm64/safepool.a
ios-x86_64:
CGO_ENABLED=1 \
GOOS=ios \
GOARCH=amd64 \
SDK=iphonesimulator \
SDK_PATH=`xcrun --sdk iphonesimulator --show-sdk-path` \
CC=$(PWD)/clangwrap.sh \
CLANG=`xcrun --sdk iphonesimulator --find clang` \
go build -buildmode=c-archive -tags ios -o $(OUT)/ios/x86/safepool.a
ios: ios-arm64 ios-x86_64
# lipo $(OUT)/ios/arm64/libsafepool.a $(OUT)/ios/x86/libsafepool.a -create -output $(OUT)/ios/libsafepool.a
rm -rf $(OUT)/ios/Safepool.xcframework
xcodebuild -create-xcframework \
-output $(OUT)/ios/Safepool.xcframework \
-library $(OUT)/ios/arm64/safepool.a \
-headers $(OUT)/ios/arm64/safepool.h \
-library $(OUT)/ios/x86/safepool.a \
-headers $(OUT)/ios/x86/safepool.h
rm -r $(OUT)/ios/arm64
rm -r $(OUT)/ios/x86
test -e $(CASPIAN) && cp -rf $(OUT)/ios $(CASPIAN)
apple: macos ios
ANDROID_OUT=../caspian/android/app/src/main/jniLibs
ANDROID_SDK=$(HOME)/Android/Sdk
NDK_VERSION=25.1.8937393
NDK_BUILD=linux-x86_64
NDK_BIN=$(ANDROID_SDK)/ndk/$(NDK_VERSION)/toolchains/llvm/prebuilt/$(NDK_BUILD)/bin
# android-armv7a:
# CGO_ENABLED=1 \
# GOOS=android \
# GOARCH=arm \
# GOARM=7 \
# CC=$(NDK_BIN)/armv7a-linux-androideabi21-clang \
# go build -v -buildmode=c-shared -o $(ANDROID_OUT)/armeabi-v7a/libsafepool.so
android-arm64:
CGO_ENABLED=1 \
GOOS=android \
GOARCH=arm64 \
CC=$(NDK_BIN)/aarch64-linux-android21-clang \
go build -v -buildmode=c-shared -o $(OUT)/android/arm64-v8a/libsafepool.so
# android-x86:
# CGO_ENABLED=1 \
# GOOS=android \
# GOARCH=386 \
# CC=$(NDK_BIN)/i686-linux-android21-clang \
# go build -v -buildmode=c-shared -o $(ANDROID_OUT)/x86/libsafepool.so
android-x86_64:
CGO_ENABLED=1 \
GOOS=android \
GOARCH=amd64 \
CC=$(NDK_BIN)/x86_64-linux-android21-clang \
go build -v -buildmode=c-shared -o $(OUT)/android/x86_64/libsafepool.so
#android: android-armv7a android-arm64 android-x86 android-x86_64
android: android-arm64 android-x86_64
SNAP_OUT=$(CASPIAN)/snap/local
snap:
go mod tidy
CGO_ENABLED=1 \
GOOS=linux \
GOARCH=amd64 \
go build -buildmode=c-shared -tags linux -o $(PREFIX)/libsafepool.so
caspian:
test -e $(CASPIAN) && cp -rf $(OUT)/* $(CASPIAN)