Skip to content

Commit d13c9db

Browse files
authored
libgweather: enable introspection on cross builds (#251956)
2 parents d029f39 + 8acd397 commit d13c9db

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

pkgs/by-name/li/libgweather/package.nix

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{ lib
22
, stdenv
3+
, buildPackages
34
, fetchurl
5+
, makeWrapper
46
, meson
57
, ninja
68
, pkg-config
@@ -16,7 +18,7 @@
1618
, geocode-glib_2
1719
, vala
1820
, gnome
19-
, withIntrospection ? stdenv.buildPlatform == stdenv.hostPlatform
21+
, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages
2022
}:
2123

2224
stdenv.mkDerivation rec {
@@ -38,6 +40,7 @@ stdenv.mkDerivation rec {
3840
];
3941

4042
depsBuildBuild = [
43+
makeWrapper
4144
pkg-config
4245
];
4346

@@ -70,26 +73,34 @@ stdenv.mkDerivation rec {
7073
];
7174

7275
postPatch = ''
73-
patchShebangs build-aux/meson/gen_locations_variant.py
76+
patchShebangs --build build-aux/meson/gen_locations_variant.py
77+
wrapProgram $PWD/build-aux/meson/gen_locations_variant.py \
78+
--prefix GI_TYPELIB_PATH : ${lib.getLib buildPackages.glib}/lib/girepository-1.0 \
7479
7580
# Run-time dependency gi-docgen found: NO (tried pkgconfig and cmake)
7681
# it should be a build-time dep for build
7782
# TODO: send upstream
7883
substituteInPlace doc/meson.build \
79-
--replace "'gi-docgen', ver" "'gi-docgen', native:true, ver" \
80-
--replace "'gi-docgen', req" "'gi-docgen', native:true, req"
84+
--replace-fail "'gi-docgen', ver" "'gi-docgen', native:true, ver" \
85+
--replace-fail "'gi-docgen', req" "'gi-docgen', native:true, req"
8186
8287
# gir works for us even when cross-compiling
8388
# TODO: send upstream because downstream users can use the option to disable gir if they don't have it working
84-
substituteInPlace libgweather/meson.build \
85-
--replace "g_ir_scanner.found() and not meson.is_cross_build()" "g_ir_scanner.found()"
89+
substituteInPlace meson.build \
90+
--replace-fail "g_ir_scanner.found() and not meson.is_cross_build()" "g_ir_scanner.found()"
91+
92+
substituteInPlace libgweather/meson.build --replace-fail \
93+
"dependency('vapigen', required: enable_vala == 'true')" \
94+
"dependency('vapigen', native: true, required: enable_vala == 'true')"
8695
'';
8796

8897
postFixup = ''
8998
# Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
9099
moveToOutput "share/doc" "$devdoc"
91100
'';
92101

102+
strictDeps = true;
103+
93104
passthru = {
94105
updateScript = gnome.updateScript {
95106
packageName = pname;

0 commit comments

Comments
 (0)