diff options
| author | 2024-12-03 21:03:38 -0600 | |
|---|---|---|
| committer | 2024-12-03 21:05:37 -0600 | |
| commit | 5b79b48ae02f5a4c95a8fa671a13bf37d63e37ed (patch) | |
| tree | cc09bb07342005120cad031b01fc70273dbb88e7 | |
| parent | Merge pull request #1526 from sogaiu/master (diff) | |
Address #1524 - fix meson cross compilation linking.
In the cross compilation case, we need to resolve our
dependencies on libc twice, once for the build machine and once for the
target machine. This includes pthreads, -libc, and android-spawn.
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | meson.build | 27 |
2 files changed, 20 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f5d0640..f128eee1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ All notable changes to this project will be documented in this file. ## ??? - Unreleased +- Fix meson cross compilation - Update timeout documentation for networking APIs: timeouts raise errors and do not return nil. - Add `janet_addtimeout_nil(double sec);` to the C API. - Change string hashing. diff --git a/meson.build b/meson.build index f17e8a59..0e829057 100644 --- a/meson.build +++ b/meson.build @@ -26,8 +26,17 @@ project('janet', 'c', janet_path = join_paths(get_option('prefix'), get_option('libdir'), 'janet') header_path = join_paths(get_option('prefix'), get_option('includedir'), 'janet') -# Link math library on all systems +# Compilers cc = meson.get_compiler('c') +native_cc = meson.get_compiler('c', native : true) + +# Native deps +native_m_dep = native_cc.find_library('m', required : false) +native_dl_dep = native_cc.find_library('dl', required : false) +native_android_spawn_dep = native_cc.find_library('android-spawn', required : false) +native_thread_dep = dependency('threads', native : true) + +# Deps m_dep = cc.find_library('m', required : false) dl_dep = cc.find_library('dl', required : false) android_spawn_dep = cc.find_library('android-spawn', required : false) @@ -164,11 +173,18 @@ mainclient_src = [ 'src/mainclient/shell.c' ] +janet_dependencies = [m_dep, dl_dep, android_spawn_dep] +janet_native_dependencies = [native_m_dep, native_dl_dep, native_android_spawn_dep] +if not get_option('single_threaded') + janet_dependencies += thread_dep + janet_native_dependencies += native_thread_dep +endif + # Build boot binary janet_boot = executable('janet-boot', core_src, boot_src, include_directories : incdir, c_args : '-DJANET_BOOTSTRAP', - dependencies : [m_dep, dl_dep, thread_dep, android_spawn_dep], + dependencies : janet_native_dependencies, native : true) # Build janet.c @@ -181,11 +197,6 @@ janetc = custom_target('janetc', 'JANET_PATH', janet_path ]) -janet_dependencies = [m_dep, dl_dep, android_spawn_dep] -if not get_option('single_threaded') - janet_dependencies += thread_dep -endif - # Allow building with no shared library if cc.has_argument('-fvisibility=hidden') lib_cflags = ['-fvisibility=hidden'] @@ -231,7 +242,7 @@ if meson.is_cross_build() endif janet_nativeclient = executable('janet-native', janetc, mainclient_src, include_directories : incdir, - dependencies : janet_dependencies, + dependencies : janet_native_dependencies, c_args : extra_native_cflags, native : true) else |
