forked from signalapp/libsignal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SignalClient.podspec
85 lines (73 loc) · 3.65 KB
/
SignalClient.podspec
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
#
# Copyright 2020-2021 Signal Messenger, LLC.
# SPDX-License-Identifier: AGPL-3.0-only
#
Pod::Spec.new do |s|
s.name = 'SignalClient'
s.version = '0.11.1'
s.summary = 'A Swift wrapper library for communicating with the Signal messaging service.'
s.homepage = 'https://github.com/signalapp/libsignal-client'
s.license = 'AGPL-3.0-only'
s.author = { 'Jack Lloyd' => '[email protected]', 'Jordan Rose' => '[email protected]' }
s.source = { :git => 'https://github.com/signalapp/libsignal-client.git', :tag => "swift-#{s.version}" }
s.swift_version = '5'
s.platform = :ios, '10'
s.dependency 'SignalCoreKit'
s.source_files = ['swift/Sources/**/*.swift', 'swift/Sources/**/*.m']
s.preserve_paths = [
'target/*/release/libsignal_ffi.a',
'swift/Sources/SignalFfi',
]
s.pod_target_xcconfig = {
'HEADER_SEARCH_PATHS' => '$(PODS_TARGET_SRCROOT)/swift/Sources/SignalFfi',
# Duplicate this here to make sure the search path is passed on to Swift dependencies.
'SWIFT_INCLUDE_PATHS' => '$(HEADER_SEARCH_PATHS)',
# Make sure we link the static library, not a dynamic one.
# Use an extra level of indirection because CocoaPods messes with OTHER_LDFLAGS too.
'LIBSIGNAL_FFI_LIB_IF_NEEDED' => '$(PODS_TARGET_SRCROOT)/target/$(CARGO_BUILD_TARGET)/release/libsignal_ffi.a',
'OTHER_LDFLAGS' => '$(LIBSIGNAL_FFI_LIB_IF_NEEDED)',
'CARGO_BUILD_TARGET[sdk=iphonesimulator*][arch=arm64]' => 'aarch64-apple-ios-sim',
'CARGO_BUILD_TARGET[sdk=iphonesimulator*][arch=*]' => 'x86_64-apple-ios',
'CARGO_BUILD_TARGET[sdk=iphoneos*]' => 'aarch64-apple-ios',
# Presently, there's no special SDK or arch for maccatalyst,
# so we need to hackily use the "IS_MACCATALYST" build flag
# to set the appropriate cargo target
'CARGO_BUILD_TARGET_MAC_CATALYST_ARM_' => 'aarch64-apple-darwin',
'CARGO_BUILD_TARGET_MAC_CATALYST_ARM_YES' => 'aarch64-apple-ios-macabi',
'CARGO_BUILD_TARGET[sdk=macosx*][arch=arm64]' => '$(CARGO_BUILD_TARGET_MAC_CATALYST_ARM_$(IS_MACCATALYST))',
'CARGO_BUILD_TARGET_MAC_CATALYST_X86_' => 'x86_64-apple-darwin',
'CARGO_BUILD_TARGET_MAC_CATALYST_X86_YES' => 'x86_64-apple-ios-macabi',
'CARGO_BUILD_TARGET[sdk=macosx*][arch=*]' => '$(CARGO_BUILD_TARGET_MAC_CATALYST_X86_$(IS_MACCATALYST))',
'ARCHS[sdk=iphonesimulator*]' => 'x86_64 arm64',
'ARCHS[sdk=iphoneos*]' => 'arm64',
}
s.script_phases = [
{ :name => 'Check libsignal-ffi',
:execution_position => :before_compile,
:script => %q(
test -e "${LIBSIGNAL_FFI_LIB_IF_NEEDED}" && exit 0
if test -e "${PODS_TARGET_SRCROOT}/swift/build_ffi.sh"; then
echo 'error: libsignal_ffi.a not built; run the following to build it:' >&2
echo "CARGO_BUILD_TARGET=${CARGO_BUILD_TARGET} \"${PODS_TARGET_SRCROOT}/swift/build_ffi.sh\" --release" >&2
else
echo 'error: libsignal_ffi.a not built; try re-running `pod install`' >&2
fi
false
),
}
]
s.prepare_command = %q(
set -euo pipefail
CARGO_BUILD_TARGET=aarch64-apple-ios swift/build_ffi.sh --release
CARGO_BUILD_TARGET=x86_64-apple-ios swift/build_ffi.sh --release
CARGO_BUILD_TARGET=aarch64-apple-ios-sim swift/build_ffi.sh --release
CARGO_BUILD_TARGET=x86_64-apple-ios-macabi swift/build_ffi.sh --release --build-std
CARGO_BUILD_TARGET=aarch64-apple-ios-macabi swift/build_ffi.sh --release --build-std
)
s.test_spec 'Tests' do |test_spec|
test_spec.source_files = 'swift/Tests/*/*.swift'
test_spec.pod_target_xcconfig = {
'LIBSIGNAL_FFI_LIB_IF_NEEDED' => '',
}
end
end