about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/pulseaudio/0007-Adapt-undefined-link-args-per-linker.patch
blob: 6893df8a7e2980ce7572a2a4008ed06605415536 (plain) (blame)
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
From 6f132be835d5acb5db4301ea1818601504e47fae Mon Sep 17 00:00:00 2001
From: Andrew Childs <andrew.childs@bibo.com.ph>
Date: Tue, 19 Apr 2022 17:41:34 +0900
Subject: [PATCH 7/8] Adapt undefined link args per linker

TODO: Why is this required? Isn't it default?
---
 src/modules/meson.build | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/modules/meson.build b/src/modules/meson.build
index be72c3b9b..0163b583f 100644
--- a/src/modules/meson.build
+++ b/src/modules/meson.build
@@ -293,6 +293,17 @@ all_modules += [
 # FIXME: meson doesn't support multiple RPATH arguments currently
 rpath_dirs = join_paths(privlibdir) + ':' + join_paths(modlibexecdir)
 
+if meson.get_compiler('c').get_linker_id().startswith('ld.')
+  no_undefined_link_args = [ '-Wl,--no-undefined' ]
+elif meson.get_compiler('c').get_linker_id() == 'ld64'
+  # TODO: is this required? is this not default?
+  no_undefined_link_args = [ '-Wl,-undefined,error' ]
+else
+  # TODO: what platforms is this? what flag do they use?
+  no_undefined_link_args = []
+endif
+
+
 foreach m : all_modules
   name = m[0]
   sources = m[1]
@@ -310,7 +321,7 @@ foreach m : all_modules
     install_rpath : rpath_dirs,
     install_dir : modlibexecdir,
     dependencies : [thread_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libintl_dep, platform_dep, platform_socket_dep] + extra_deps,
-    link_args : [nodelete_link_args, '-Wl,--no-undefined' ],
+    link_args : [nodelete_link_args, no_undefined_link_args ],
     link_with : extra_libs,
     name_prefix : '',
     implicit_include_directories : false)
-- 
2.35.1