Skip to content

Commit f429580

Browse files
committed
Improve cross-platform build compatibility
- Add proper platform-specific symbol visibility handling - Support macOS builds by skipping unsupported linker flags - Improve FreeBSD and Linux build logic - Better error handling for version script linking
1 parent ce3caef commit f429580

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

lib/meson.build

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
1-
flags = '-Wl,--version-script=' + meson.current_source_dir() + '/libjose.map'
1+
flags = []
22
code = 'int main() { return 0; }'
33
cc = meson.get_compiler('c')
44

5-
if build_machine.system() == 'freebsd'
6-
if not cc.links(code, args: flags + ',--undefined-version' , name: '-Wl,--version-script=...')
5+
# Handle symbol visibility per platform
6+
if build_machine.system() == 'darwin'
7+
# macOS: Skip symbol visibility restrictions for now
8+
# macOS linker doesn't support the same flags as GNU ld
9+
flags = []
10+
elif build_machine.system() == 'freebsd'
11+
version_script_flags = '-Wl,--version-script=' + meson.current_source_dir() + '/libjose.map'
12+
if not cc.links(code, args: version_script_flags + ',--undefined-version' , name: '-Wl,--version-script=...')
713
flags = [ '-export-symbols-regex=^jose_.*' ]
14+
else
15+
flags = [version_script_flags]
816
endif
917
else
10-
if not cc.links(code, args: flags, name: '-Wl,--version-script=...')
18+
# Linux and other systems
19+
version_script_flags = '-Wl,--version-script=' + meson.current_source_dir() + '/libjose.map'
20+
if not cc.links(code, args: version_script_flags, name: '-Wl,--version-script=...')
1121
flags = [ '-export-symbols-regex=^jose_.*' ]
22+
else
23+
flags = [version_script_flags]
1224
endif
1325
endif
1426

0 commit comments

Comments
 (0)