-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathembed-libbitcoinkernel.sh
More file actions
executable file
·84 lines (68 loc) · 2.38 KB
/
embed-libbitcoinkernel.sh
File metadata and controls
executable file
·84 lines (68 loc) · 2.38 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
#!/usr/bin/env bash
set -euo pipefail
step="initializing"
on_error() {
local status="$1"
echo "error: libbitcoinkernel ${step} failed for ${platform:-unknown platform} (exit ${status})." >&2
echo "error: Inspect the 'Embed libbitcoinkernel' build phase log for details." >&2
exit "${status}"
}
trap 'on_error $?' ERR
platform="${1:-${PLATFORM_NAME:-}}"
srcroot="${2:-${SRCROOT:-}}"
target_build_dir="${3:-${TARGET_BUILD_DIR:-}}"
frameworks_folder_path="${4:-${FRAMEWORKS_FOLDER_PATH:-}}"
code_sign_identity="${5:-${EXPANDED_CODE_SIGN_IDENTITY:-}}"
derived_file_dir="${6:-${DERIVED_FILE_DIR:-}}"
target_temp_dir="${7:-${TARGET_TEMP_DIR:-}}"
require_value() {
local name="$1"
local value="$2"
if [[ -z "${value}" ]]; then
echo "error: Missing required build setting '${name}'." >&2
exit 1
fi
}
require_value "PLATFORM_NAME" "${platform}"
require_value "SRCROOT" "${srcroot}"
require_value "TARGET_BUILD_DIR" "${target_build_dir}"
require_value "FRAMEWORKS_FOLDER_PATH" "${frameworks_folder_path}"
require_value "DERIVED_FILE_DIR" "${derived_file_dir}"
require_value "TARGET_TEMP_DIR" "${target_temp_dir}"
kernel_build_root="${target_temp_dir}/libbitcoinkernel"
kernel_install_root="${derived_file_dir}/libbitcoinkernel"
case "${platform}" in
macosx)
platform_slug="macos"
;;
iphonesimulator)
platform_slug="iossim"
;;
iphoneos)
platform_slug="ios"
;;
*)
echo "note: Skipping libbitcoinkernel embed for ${platform}; kernel sync is currently unsupported on this platform."
exit 0
;;
esac
build_dir="${kernel_build_root}/${platform_slug}"
install_prefix="${kernel_install_root}/${platform_slug}"
source_lib="${install_prefix}/lib/libbitcoinkernel.dylib"
step="building libbitcoinkernel"
/bin/bash "${srcroot}/scripts/build-libbitcoinkernel.sh" "${platform}" "${srcroot}" "${build_dir}" "${install_prefix}"
dest_dir="${target_build_dir}/${frameworks_folder_path}"
dest_lib="${dest_dir}/libbitcoinkernel.dylib"
step="verifying libbitcoinkernel output"
if [[ ! -f "${source_lib}" ]]; then
echo "error: Missing libbitcoinkernel at ${source_lib} after build." >&2
exit 1
fi
step="embedding libbitcoinkernel"
mkdir -p "${dest_dir}"
cp -f "${source_lib}" "${dest_lib}"
chmod 755 "${dest_lib}"
if [[ -n "${code_sign_identity}" ]]; then
step="codesigning libbitcoinkernel"
/usr/bin/codesign --force --sign "${code_sign_identity}" --timestamp=none "${dest_lib}"
fi