Skip to content

Commit 81ff9eb

Browse files
committed
Force nightly-2022-06-24 and clang macabi triplet
1 parent f85bde1 commit 81ff9eb

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

scripts/build_individual_libldk.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
from script_config import ScriptConfig, BuildConfig
77

88
RUSTUP_PATH = os.getenv('HOME') + '/.cargo/bin/rustup'
9+
RUSTC_PATH = os.getenv('HOME') + '/.cargo/bin/rustc'
910
CARGO_PATH = os.getenv('HOME') + '/.cargo/bin/cargo'
1011

12+
# 1.62: nightly-2022-05-13
13+
NIGHTLY_TOOLCHAIN = 'nightly-2022-06-24' # 1.63
14+
1115

1216
def run(config: ScriptConfig):
1317
if len(config.LIBLDK_BUILD_CONFIGURATIONS) != 1:
@@ -55,7 +59,10 @@ def run(config: ScriptConfig):
5559
child_environment['RUSTFLAGS'] = '--cfg=c_bindings'
5660
child_environment['PATH'] = '/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
5761

58-
subprocess.check_call([RUSTUP_PATH, 'override', 'set', 'nightly-2022-05-13'], cwd=config.LDK_C_BINDINGS_DIRECTORY)
62+
# stop cargo's obsession with x86_64-apple-ios13.0-macabi when nobody asked for it
63+
child_environment['CFLAGS_x86_64_apple_ios_macabi'] = '--target=x86_64-apple-ios-macabi'
64+
65+
subprocess.check_call([RUSTUP_PATH, 'override', 'set', NIGHTLY_TOOLCHAIN], cwd=config.LDK_C_BINDINGS_DIRECTORY)
5966

6067
lipo_executables_input: [str] = []
6168

@@ -95,8 +102,16 @@ def run(config: ScriptConfig):
95102
shutil.rmtree(cargo_target_directory, ignore_errors=True)
96103
subprocess.check_call([CARGO_PATH, 'clean'], cwd=config.LDK_C_BINDINGS_DIRECTORY)
97104

105+
rust_target_triplet = f'{rust_architecture}-apple-{rust_target_os}'
106+
107+
print('Rust architecture:', rust_architecture)
108+
print('Rust target OS:', rust_target_os)
109+
print('Target:', rust_target_triplet)
110+
111+
subprocess.check_call([RUSTC_PATH, f'+{NIGHTLY_TOOLCHAIN}', '-Z', 'unstable-options', '--print', 'target-spec-json', '--target', rust_target_triplet])
112+
98113
# cargo build -Z build-std=panic_abort,std --features "std" --target "${RUST_ARCH}-apple-${RUST_TARGET_OS}" $RUST_CONFIGURATION_FLAG
99-
build_arguments = [CARGO_PATH, 'build', '-Z', 'build-std=panic_abort,std', '--features', 'std', '--target', f'{rust_architecture}-apple-{rust_target_os}']
114+
build_arguments = [CARGO_PATH, 'build', '-Z', 'build-std=panic_abort,std', '--features', 'std', '--target', rust_target_triplet]
100115
if config.RUST_CONFIGURATION_FLAG:
101116
build_arguments.append(config.RUST_CONFIGURATION_FLAG)
102117
subprocess.check_call(

0 commit comments

Comments
 (0)