libgweather: enable introspection on cross builds (#251956)

This commit is contained in:
Artturin 2024-11-13 21:47:26 +02:00 committed by GitHub
commit d13c9db8c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,8 @@
{ lib { lib
, stdenv , stdenv
, buildPackages
, fetchurl , fetchurl
, makeWrapper
, meson , meson
, ninja , ninja
, pkg-config , pkg-config
@ -16,7 +18,7 @@
, geocode-glib_2 , geocode-glib_2
, vala , vala
, gnome , gnome
, withIntrospection ? stdenv.buildPlatform == stdenv.hostPlatform , withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -38,6 +40,7 @@ stdenv.mkDerivation rec {
]; ];
depsBuildBuild = [ depsBuildBuild = [
makeWrapper
pkg-config pkg-config
]; ];
@ -70,19 +73,25 @@ stdenv.mkDerivation rec {
]; ];
postPatch = '' postPatch = ''
patchShebangs build-aux/meson/gen_locations_variant.py patchShebangs --build build-aux/meson/gen_locations_variant.py
wrapProgram $PWD/build-aux/meson/gen_locations_variant.py \
--prefix GI_TYPELIB_PATH : ${lib.getLib buildPackages.glib}/lib/girepository-1.0 \
# Run-time dependency gi-docgen found: NO (tried pkgconfig and cmake) # Run-time dependency gi-docgen found: NO (tried pkgconfig and cmake)
# it should be a build-time dep for build # it should be a build-time dep for build
# TODO: send upstream # TODO: send upstream
substituteInPlace doc/meson.build \ substituteInPlace doc/meson.build \
--replace "'gi-docgen', ver" "'gi-docgen', native:true, ver" \ --replace-fail "'gi-docgen', ver" "'gi-docgen', native:true, ver" \
--replace "'gi-docgen', req" "'gi-docgen', native:true, req" --replace-fail "'gi-docgen', req" "'gi-docgen', native:true, req"
# gir works for us even when cross-compiling # gir works for us even when cross-compiling
# TODO: send upstream because downstream users can use the option to disable gir if they don't have it working # TODO: send upstream because downstream users can use the option to disable gir if they don't have it working
substituteInPlace libgweather/meson.build \ substituteInPlace meson.build \
--replace "g_ir_scanner.found() and not meson.is_cross_build()" "g_ir_scanner.found()" --replace-fail "g_ir_scanner.found() and not meson.is_cross_build()" "g_ir_scanner.found()"
substituteInPlace libgweather/meson.build --replace-fail \
"dependency('vapigen', required: enable_vala == 'true')" \
"dependency('vapigen', native: true, required: enable_vala == 'true')"
''; '';
postFixup = '' postFixup = ''
@ -90,6 +99,8 @@ stdenv.mkDerivation rec {
moveToOutput "share/doc" "$devdoc" moveToOutput "share/doc" "$devdoc"
''; '';
strictDeps = true;
passthru = { passthru = {
updateScript = gnome.updateScript { updateScript = gnome.updateScript {
packageName = pname; packageName = pname;