Repository navigation
Expand file tree
/
Copy pathPackage.swift
More file actions
151 lines (131 loc) · 5.55 KB
/
Copy pathPackage.swift
File metadata and controls
151 lines (131 loc) · 5.55 KB
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
148
149
150
151
// swift-tools-version:5.9
import PackageDescription
let package = Package(
name: "AltSign",
platforms: [
.iOS(.v14),
.macOS(.v11)
],
products: [
.library(
name: "AltSign-Static",
type: .static,
targets: ["AltSign"]
),
.library(
name: "AltSign-Dynamic",
type: .dynamic,
targets: ["AltSign"]
),
.library(
name: "OpenSSL",
targets: ["OpenSSL"]
)
],
targets: [
.binaryTarget(
name: "OpenSSL",
url: "https://github.com/krzyzanowskim/OpenSSL/releases/download/3.6.2000/OpenSSL.xcframework.zip",
checksum: "37846a8bd302cb2443eff47f1045ab844d0cd40bf82cc6159cfad9aa5c3eff9e"
),
// ─────────────────────────
// C / C++ bridge
// ─────────────────────────
.target(
name: "NativeBridge",
dependencies: [
],
path: ".",
sources: [
"NativeBridge/Sources",
"Dependencies/minizip-ng/mz_crypt.c",
"Dependencies/minizip-ng/mz_crypt_apple.c",
"Dependencies/minizip-ng/mz_os.c",
"Dependencies/minizip-ng/mz_os_posix.c",
"Dependencies/minizip-ng/mz_strm.c",
"Dependencies/minizip-ng/mz_strm_buf.c",
"Dependencies/minizip-ng/mz_strm_mem.c",
"Dependencies/minizip-ng/mz_strm_os_posix.c",
"Dependencies/minizip-ng/mz_strm_pkcrypt.c",
"Dependencies/minizip-ng/mz_strm_split.c",
"Dependencies/minizip-ng/mz_strm_wzaes.c",
"Dependencies/minizip-ng/mz_strm_zlib.c",
"Dependencies/minizip-ng/mz_zip.c",
"Dependencies/minizip-ng/mz_zip_rw.c",
"Dependencies/ldid/lookup2.c",
"Dependencies/ldid/libplist/src/base64.c",
"Dependencies/ldid/libplist/src/bplist.c",
"Dependencies/ldid/libplist/src/bytearray.c",
"Dependencies/ldid/libplist/src/common.c",
"Dependencies/ldid/libplist/src/hashtable.c",
"Dependencies/ldid/libplist/src/jplist.c",
"Dependencies/ldid/libplist/src/jsmn.c",
"Dependencies/ldid/libplist/src/oplist.c",
"Dependencies/ldid/libplist/src/out-default.c",
"Dependencies/ldid/libplist/src/out-limd.c",
"Dependencies/ldid/libplist/src/out-plutil.c",
"Dependencies/ldid/libplist/src/plist.c",
"Dependencies/ldid/libplist/src/ptrarray.c",
"Dependencies/ldid/libplist/src/time64.c",
"Dependencies/ldid/libplist/src/xplist.c",
"Dependencies/ldid/libplist/libcnary/node.c",
"Dependencies/ldid/libplist/libcnary/node_list.c",
"Dependencies/corecrypto/Sources/ccsrp.m"
],
publicHeadersPath: "NativeBridge/include",
cSettings: [
.headerSearchPath("NativeBridge/include"),
.headerSearchPath("Dependencies/minizip-ng"),
.headerSearchPath("ldid"),
.headerSearchPath("Dependencies/ldid"),
.headerSearchPath("Dependencies/ldid/libplist/include"),
.headerSearchPath("Dependencies/ldid/libplist/src"),
.headerSearchPath("Dependencies/ldid/libplist/libcnary/include"),
.headerSearchPath("Dependencies/corecrypto/include"),
.headerSearchPath("Dependencies/corecrypto/include/corecrypto"),
.define("unix", to: "1"),
.define("HAVE_ZLIB", to: "1"),
.define("ZLIB_COMPAT", to: "1"),
.define("HAVE_WZAES", to: "1"),
.define("HAVE_PKCRYPT", to: "1"),
.define("CORECRYPTO_DONOT_USE_TRANSPARENT_UNION", to: "1"),
.define("NOCRYPT"),
.define("NOUNCRYPT"),
.unsafeFlags(["-w", "-fvisibility=hidden"])
],
cxxSettings: [
.headerSearchPath("NativeBridge/include"),
.headerSearchPath("Dependencies/corecrypto/include"),
.unsafeFlags(["-w", "-fvisibility=hidden"])
],
linkerSettings: [
.linkedLibrary("z"),
.linkedFramework("Security"),
// .linkedFramework("CommonCrypto"),
// .linkedFramework("OpenSSL")
]
),
// ─────────────────────────
// Swift-safe bridge
// ─────────────────────────
.target(
name: "SwiftBridge",
dependencies: ["NativeBridge", "OpenSSL"],
path: "SwiftBridge",
sources: [ "." ],
linkerSettings: [
.linkedFramework("CryptoKit"), // AES-GCM, HMAC-SHA256, SHA256
]
),
// ─────────────────────────
// Main Swift target
// ─────────────────────────
.target(
name: "AltSign",
dependencies: ["SwiftBridge"],
path: "Sources"
)
],
cLanguageStandard: .gnu11,
cxxLanguageStandard: .cxx14
)