File build_node_bridge-inject-options.patch of Package libsignal
Inject our options directly into upstream's script which builds up the cargo command line.
Less error-prone than replicating whatever the script does manually.
--- libsignal-0.72.1/node/build_node_bridge.py.orig 2025-05-15 01:52:18.000000000 +0200
+++ libsignal-0.72.1/node/build_node_bridge.py 2025-07-04 18:43:57.155417091 +0200
@@ -67,18 +67,13 @@ def main(args: Optional[List[str]] = Non
print("Invoked with '%s'" % (' '.join(args)))
parser = optparse.OptionParser()
- parser.add_option('--out-dir', '-o', default=None, metavar='DIR',
- help='specify destination dir (default build/$CONFIGURATION_NAME)')
parser.add_option('--configuration', default='Release', metavar='C',
help='specify build configuration (Release or Debug)')
- parser.add_option('--os-name', default=None, metavar='OS',
- help='specify Node OS name')
- parser.add_option('--cargo-build-dir', default='target', metavar='PATH',
- help='specify cargo build dir (default %default)')
- parser.add_option('--cargo-target', default=None,
- help='specify cargo target')
- parser.add_option('--node-arch', default=None,
- help='specify node arch (x64, ia32, arm64)')
+ parser.add_option('--auditable', action='store_true',
+ help='should we call cargo-auditable? Required by openSUSE policy but not available on Fedora')
+ parser.add_option('--check', action='store_true',
+ help='if true — check; if false — build')
+
(options, args) = parser.parse_args(args)
@@ -90,22 +85,7 @@ def main(args: Optional[List[str]] = Non
print("ERROR: Unknown value for --configuration '%s'" % (configuration_name))
return 1
- node_os_name = options.os_name
- if node_os_name is None:
- print('ERROR: --os-name is required')
- return 1
-
- cargo_target = options.cargo_target
- if cargo_target is None:
- print('ERROR: --cargo-target is required')
- return 1
-
- node_arch = options.node_arch
- if node_arch is None:
- print('ERROR: --node_arch is required')
- return 1
-
- out_dir = options.out_dir.strip('"') or os.path.join('build', configuration_name)
+ node_os_name = 'linux'
# Fetch all dependencies first, so we can check information about them in constructing our
# command lines.
@@ -118,7 +98,20 @@ def main(args: Optional[List[str]] = Non
else:
features.append('log/release_max_level_info')
- cmdline = ['cargo', 'build', '--target', cargo_target, '-p', 'libsignal-node', '--features', ','.join(features)]
+ cmdline = ['cargo' , '-vv']
+ if options.auditable:
+ cmdline+= ['auditable', '-vv']
+ if options.check:
+ cmdline+= ['test', '--no-fail-fast', '--workspace']
+ features+= ['node', 'signal-media']
+ else:
+ cmdline+= ['rustc', '-p', 'libsignal-node', '--lib', '--crate-type', 'cdylib']
+
+ cmdline += ['--features', ','.join(features)]
+ if options.check:
+ cmdline+= ['--exclude', 'signal-neon-futures']
+ cmdline+= ['--exclude', 'libsignal-bridge']
+ cmdline+= ['--exclude', 'attest']
if configuration_name == 'Release':
cmdline.append('--release')
else:
@@ -127,10 +120,8 @@ def main(args: Optional[List[str]] = Non
cargo_env = os.environ.copy()
cargo_env['RUSTFLAGS'] = cargo_env.get('RUSTFLAGS') or ''
- cargo_env['CARGO_BUILD_TARGET_DIR'] = options.cargo_build_dir
cargo_env['MACOSX_DEPLOYMENT_TARGET'] = '10.13'
# Build with debug line tables, but not full debug info.
- cargo_env['CARGO_PROFILE_RELEASE_DEBUG'] = '1'
# On Linux, cdylibs don't include public symbols from their dependencies,
# even if those symbols have been re-exported in the Rust source.
# Using LTO works around this at the cost of a slightly slower build.
@@ -138,9 +129,7 @@ def main(args: Optional[List[str]] = Non
cargo_env['CARGO_PROFILE_RELEASE_LTO'] = 'thin'
# Enable ARMv8 cryptography acceleration when available
cargo_env['RUSTFLAGS'] += ' --cfg aes_armv8'
- # Strip absolute paths
- for path in build_helpers.rust_paths_to_remap():
- cargo_env['RUSTFLAGS'] += f' --remap-path-prefix {path}='
+ # Do not strip absolute paths, it breaks debuginfo.
# If set (below), will post-process the build library using this instead of just `cp`-ing it.
objcopy = None
@@ -196,6 +185,7 @@ def main(args: Optional[List[str]] = Non
cargo_env['RUSTFLAGS'] += ' -Clink-arg=-Wl,-current_version,%s' % cargo_env['npm_package_version']
else:
+ os.execvpe('cargo', cmdline, env=cargo_env)
# Assume Linux-like.
# DWP files don't seem ready for everyday use.
# We'll just save the whole unstripped binary.