mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-20 20:39:04 +02:00
pkgsStatic.glib: fix build
Since 9f309c8792
("stdenv: mesonFlags: use canExecute in needs_exe_wrapper"),
glib's tests are built (but not run by default) in pkgsStatic. This
broke the build because some of the tests required shared libraries.
This patch (which is awaiting review upstream) disables building those
libraries and any tests that depend on them in a static-only build.
This commit is contained in:
parent
2e552f28f1
commit
4610260d99
|
@ -96,6 +96,8 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
url = "https://gitlab.gnome.org/qyliss/glib/-/commit/339a06d66685107280ca6bdca5da5d96b8222fb5.patch";
|
||||
sha256 = "sha256-/NdFkuiJvyass3jTDEJPeciA2Lwe53IUd3kAnKAvTaw=";
|
||||
})
|
||||
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2867
|
||||
./tests-skip-shared-libs-if-default_library-static.patch
|
||||
|
||||
./skip-timer-test.patch
|
||||
];
|
||||
|
|
|
@ -0,0 +1,141 @@
|
|||
From b804e4b82cd8e85631112d935543c62ef56783e5 Mon Sep 17 00:00:00 2001
|
||||
From: Alyssa Ross <hi@alyssa.is>
|
||||
Date: Tue, 23 Aug 2022 13:13:44 +0000
|
||||
Subject: [PATCH] tests: skip shared libs if default_library=static
|
||||
|
||||
Otherwise, the build will fail when the toolchain is static-only, even
|
||||
with -Ddefault_library=static. I talked to a Meson developer in their
|
||||
IRC channel, who told me that the correct fix was to ensure that
|
||||
shared_library is only used if default_library != static.
|
||||
|
||||
Part-of: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2867
|
||||
[Backported to 2.72.3]
|
||||
---
|
||||
gio/tests/meson.build | 43 +++++++++++++++++++++++-------------------
|
||||
glib/tests/meson.build | 2 +-
|
||||
tests/meson.build | 30 +++++++++++++++--------------
|
||||
3 files changed, 41 insertions(+), 34 deletions(-)
|
||||
|
||||
diff --git a/gio/tests/meson.build b/gio/tests/meson.build
|
||||
index 3ed23a5f2..7b1aba80d 100644
|
||||
--- a/gio/tests/meson.build
|
||||
+++ b/gio/tests/meson.build
|
||||
@@ -203,7 +203,7 @@ if host_machine.system() != 'windows'
|
||||
}
|
||||
|
||||
# LD_PRELOAD modules don't work so well with AddressSanitizer
|
||||
- if have_rtld_next and get_option('b_sanitize') == 'none'
|
||||
+ if have_rtld_next and get_option('default_library') != 'static' and get_option('b_sanitize') == 'none'
|
||||
gio_tests += {
|
||||
'gsocketclient-slow' : {
|
||||
'depends' : [
|
||||
@@ -607,24 +607,26 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
|
||||
|
||||
compiler_type = '--compiler=@0@'.format(cc.get_id())
|
||||
|
||||
- plugin_resources_c = custom_target('plugin-resources.c',
|
||||
- input : 'test4.gresource.xml',
|
||||
- output : 'plugin-resources.c',
|
||||
- command : [glib_compile_resources,
|
||||
- compiler_type,
|
||||
- '--target=@OUTPUT@',
|
||||
- '--sourcedir=' + meson.current_source_dir(),
|
||||
- '--internal',
|
||||
- '--generate-source',
|
||||
- '--c-name', '_g_plugin',
|
||||
- '@INPUT@'])
|
||||
+ if get_option('default_library') != 'static'
|
||||
+ plugin_resources_c = custom_target('plugin-resources.c',
|
||||
+ input : 'test4.gresource.xml',
|
||||
+ output : 'plugin-resources.c',
|
||||
+ command : [glib_compile_resources,
|
||||
+ compiler_type,
|
||||
+ '--target=@OUTPUT@',
|
||||
+ '--sourcedir=' + meson.current_source_dir(),
|
||||
+ '--internal',
|
||||
+ '--generate-source',
|
||||
+ '--c-name', '_g_plugin',
|
||||
+ '@INPUT@'])
|
||||
|
||||
- shared_module('resourceplugin', 'resourceplugin.c', plugin_resources_c,
|
||||
- link_args : export_dynamic_ldflags,
|
||||
- dependencies : common_gio_tests_deps,
|
||||
- install_dir : installed_tests_execdir,
|
||||
- install : installed_tests_enabled
|
||||
- )
|
||||
+ shared_module('resourceplugin', 'resourceplugin.c', plugin_resources_c,
|
||||
+ link_args : export_dynamic_ldflags,
|
||||
+ dependencies : common_gio_tests_deps,
|
||||
+ install_dir : installed_tests_execdir,
|
||||
+ install : installed_tests_enabled
|
||||
+ )
|
||||
+ endif
|
||||
|
||||
# referenced by test2.gresource.xml
|
||||
big_test_resource = custom_target(
|
||||
@@ -917,4 +919,7 @@ if installed_tests_enabled
|
||||
endif
|
||||
|
||||
subdir('services')
|
||||
-subdir('modules')
|
||||
+
|
||||
+if get_option('default_library') != 'static'
|
||||
+ subdir('modules')
|
||||
+endif
|
||||
diff --git a/glib/tests/meson.build b/glib/tests/meson.build
|
||||
index 301158e0f..6203ff45e 100644
|
||||
--- a/glib/tests/meson.build
|
||||
+++ b/glib/tests/meson.build
|
||||
@@ -172,7 +172,7 @@ else
|
||||
'include' : {},
|
||||
'unix' : {},
|
||||
}
|
||||
- if have_rtld_next
|
||||
+ if have_rtld_next and get_option('default_library') != 'static'
|
||||
glib_tests += {
|
||||
'gutils-user-database' : {
|
||||
'depends' : [
|
||||
diff --git a/tests/meson.build b/tests/meson.build
|
||||
index c95fa1d00..25144c941 100644
|
||||
--- a/tests/meson.build
|
||||
+++ b/tests/meson.build
|
||||
@@ -72,20 +72,22 @@ if ['darwin', 'ios'].contains(host_machine.system())
|
||||
module_suffix = 'so'
|
||||
endif
|
||||
|
||||
-foreach module : ['moduletestplugin_a', 'moduletestplugin_b']
|
||||
- shared_module(module + '_plugin', 'lib@0@.c'.format(module),
|
||||
- dependencies : [libglib_dep, libgmodule_dep],
|
||||
- install_dir : installed_tests_execdir,
|
||||
- install : installed_tests_enabled,
|
||||
- name_suffix : module_suffix
|
||||
- )
|
||||
- shared_library(module + '_library', 'lib@0@.c'.format(module),
|
||||
- dependencies : [libglib_dep, libgmodule_dep],
|
||||
- install_dir : installed_tests_execdir,
|
||||
- install : installed_tests_enabled,
|
||||
- name_suffix : module_suffix
|
||||
- )
|
||||
-endforeach
|
||||
+if get_option('default_library') != 'static'
|
||||
+ foreach module : ['moduletestplugin_a', 'moduletestplugin_b']
|
||||
+ shared_module(module + '_plugin', 'lib@0@.c'.format(module),
|
||||
+ dependencies : [libglib_dep, libgmodule_dep],
|
||||
+ install_dir : installed_tests_execdir,
|
||||
+ install : installed_tests_enabled,
|
||||
+ name_suffix : module_suffix
|
||||
+ )
|
||||
+ shared_library(module + '_library', 'lib@0@.c'.format(module),
|
||||
+ dependencies : [libglib_dep, libgmodule_dep],
|
||||
+ install_dir : installed_tests_execdir,
|
||||
+ install : installed_tests_enabled,
|
||||
+ name_suffix : module_suffix
|
||||
+ )
|
||||
+ endforeach
|
||||
+endif
|
||||
|
||||
common_c_args = test_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS']
|
||||
common_deps = [libm, thread_dep, libglib_dep]
|
||||
--
|
||||
2.37.1
|
||||
|
Loading…
Reference in a new issue