diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-06-16 06:56:35 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-06-16 06:56:35 +0000 |
commit | 99fcaeccb89621dd492203ce1f2d551c06f228ed (patch) | |
tree | 41cb730ae07383004789779b0f6e11cb3f4642a3 /nixpkgs/pkgs/development/libraries/gobject-introspection | |
parent | 59c5f5ac8682acc13bb22bc29c7cf02f7d75f01f (diff) | |
parent | 75a5ebf473cd60148ba9aec0d219f72e5cf52519 (diff) | |
download | nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.gz nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.bz2 nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.lz nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.xz nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.zst nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.zip |
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts: nixpkgs/nixos/modules/config/console.nix nixpkgs/nixos/modules/services/mail/mailman.nix nixpkgs/nixos/modules/services/mail/public-inbox.nix nixpkgs/nixos/modules/services/mail/rss2email.nix nixpkgs/nixos/modules/services/networking/ssh/sshd.nix nixpkgs/pkgs/applications/networking/instant-messengers/dino/default.nix nixpkgs/pkgs/applications/networking/irc/weechat/default.nix nixpkgs/pkgs/applications/window-managers/sway/default.nix nixpkgs/pkgs/build-support/go/module.nix nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix nixpkgs/pkgs/development/interpreters/python/default.nix nixpkgs/pkgs/development/node-packages/overrides.nix nixpkgs/pkgs/development/tools/b4/default.nix nixpkgs/pkgs/servers/dict/dictd-db.nix nixpkgs/pkgs/servers/mail/public-inbox/default.nix nixpkgs/pkgs/tools/security/pinentry/default.nix nixpkgs/pkgs/tools/text/unoconv/default.nix nixpkgs/pkgs/top-level/all-packages.nix
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/gobject-introspection')
6 files changed, 138 insertions, 53 deletions
diff --git a/nixpkgs/pkgs/development/libraries/gobject-introspection/default.nix b/nixpkgs/pkgs/development/libraries/gobject-introspection/default.nix index bb07d8c792ce..4050f3e4d123 100644 --- a/nixpkgs/pkgs/development/libraries/gobject-introspection/default.nix +++ b/nixpkgs/pkgs/development/libraries/gobject-introspection/default.nix @@ -21,15 +21,22 @@ , gobject-introspection-unwrapped , nixStoreDir ? builtins.storeDir , x11Support ? true +, testers }: # now that gobject-introspection creates large .gir files (eg gtk3 case) # it may be worth thinking about using multiple derivation outputs # In that case its about 6MB which could be separated +let + pythonModules = pp: [ + pp.mako + pp.markdown + ]; +in stdenv.mkDerivation (finalAttrs: { pname = "gobject-introspection"; - version = "1.72.0"; + version = "1.76.1"; # outputs TODO: share/gobject-introspection-1.0/tests is needed during build # by pygobject3 (and maybe others), but it's only searched in $out @@ -38,7 +45,7 @@ stdenv.mkDerivation (finalAttrs: { src = fetchurl { url = "mirror://gnome/sources/gobject-introspection/${lib.versions.majorMinor finalAttrs.version}/gobject-introspection-${finalAttrs.version}.tar.xz"; - sha256 = "Av6OWQhh2I+DBg3TnNpcyqYLLaHSHQ+VSZMBsYa+qrw="; + sha256 = "GWF4v2Q0VQHc3E2EabNqpv6ASJNU7+cct8uKuCo3OL8="; }; patches = [ @@ -58,6 +65,8 @@ stdenv.mkDerivation (finalAttrs: { }) ]; + strictDeps = true; + nativeBuildInputs = [ meson ninja @@ -67,15 +76,17 @@ stdenv.mkDerivation (finalAttrs: { gtk-doc docbook-xsl-nons docbook_xml_dtd_45 - python3 + # Build definition checks for the Python modules needed at runtime by importing them. + (buildPackages.python3.withPackages pythonModules) finalAttrs.setupHook # move .gir files - ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ gobject-introspection-unwrapped ]; + # can't use canExecute, we need prebuilt when cross + ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ gobject-introspection-unwrapped ]; buildInputs = [ - python3 + (python3.withPackages pythonModules) ]; - checkInputs = lib.optionals stdenv.isDarwin [ + nativeCheckInputs = lib.optionals stdenv.isDarwin [ cctools # for otool ]; @@ -86,19 +97,20 @@ stdenv.mkDerivation (finalAttrs: { mesonFlags = [ "--datadir=${placeholder "dev"}/share" - "-Ddoctool=disabled" "-Dcairo=disabled" "-Dgtk_doc=${lib.boolToString (stdenv.hostPlatform == stdenv.buildPlatform)}" - ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ "-Dgi_cross_ldd_wrapper=${substituteAll { name = "g-ir-scanner-lddwrapper"; isExecutable = true; src = ./wrappers/g-ir-scanner-lddwrapper.sh; inherit (buildPackages) bash; - buildobjdump = "${buildPackages.stdenv.cc.bintools}/bin/objdump"; + buildlddtree = "${buildPackages.pax-utils}/bin/lddtree"; }}" - "-Dgi_cross_use_prebuilt_gi=true" "-Dgi_cross_binary_wrapper=${stdenv.hostPlatform.emulator buildPackages}" + # can't use canExecute, we need prebuilt when cross + ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ + "-Dgi_cross_use_prebuilt_gi=true" ]; doCheck = !stdenv.isAarch64; @@ -137,12 +149,14 @@ stdenv.mkDerivation (finalAttrs: { packageName = "gobject-introspection"; versionPolicy = "odd-unstable"; }; + tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; }; meta = with lib; { description = "A middleware layer between C libraries and language bindings"; homepage = "https://gi.readthedocs.io/"; maintainers = teams.gnome.members ++ (with maintainers; [ lovek323 artturin ]); + pkgConfigModules = [ "gobject-introspection-1.0" ]; platforms = platforms.unix; license = with licenses; [ gpl2 lgpl2 ]; diff --git a/nixpkgs/pkgs/development/libraries/gobject-introspection/wrapper.nix b/nixpkgs/pkgs/development/libraries/gobject-introspection/wrapper.nix index 4b3fa1a19819..53b1a35f8212 100644 --- a/nixpkgs/pkgs/development/libraries/gobject-introspection/wrapper.nix +++ b/nixpkgs/pkgs/development/libraries/gobject-introspection/wrapper.nix @@ -9,49 +9,97 @@ # to build, run # `nix build ".#pkgsCross.aarch64-multiplatform.buildPackages.gobject-introspection"` +# a comment for both depsTargetTargetPropagated's +# add self to buildInputs to avoid needing to add gobject-introspection to buildInputs in addition to nativeBuildInputs +# builds use target-pkg-config to look for gobject-introspection instead of just looking for binaries in $PATH + let - # ensure that `.override` works when gobject-introspection == gobject-introspection-wrapped + # ensure that `.override` works args = builtins.removeAttrs _args [ "buildPackages" "targetPackages" "gobject-introspection-unwrapped" ]; # passing this stdenv to `targetPackages...` breaks due to splicing not working in `.override`` argsForTarget = builtins.removeAttrs args [ "stdenv" ]; + + overriddenUnwrappedGir = gobject-introspection-unwrapped.override args; + # if we have targetPackages.gobject-introspection then propagate that + overridenTargetUnwrappedGir = + if targetPackages ? gobject-introspection-unwrapped + then targetPackages.gobject-introspection-unwrapped.override argsForTarget + else overriddenUnwrappedGir; in -(gobject-introspection-unwrapped.override args).overrideAttrs (previousAttrs: { - pname = "gobject-introspection-wrapped"; - postFixup = (previousAttrs.postFixup or "") + '' - mv $dev/bin/g-ir-compiler $dev/bin/.g-ir-compiler-wrapped - mv $dev/bin/g-ir-scanner $dev/bin/.g-ir-scanner-wrapped - - ( - export bash="${buildPackages.bash}" - export emulator=${lib.escapeShellArg (stdenv.targetPlatform.emulator buildPackages)} - export buildobjdump="${buildPackages.stdenv.cc.bintools}/bin/objdump" - - export targetgir="${lib.getDev (targetPackages.gobject-introspection-unwrapped.override argsForTarget)}" - - substituteAll "${./wrappers/g-ir-compiler.sh}" "$dev/bin/g-ir-compiler" - substituteAll "${./wrappers/g-ir-scanner.sh}" "$dev/bin/g-ir-scanner" - substituteAll "${./wrappers/g-ir-scanner-lddwrapper.sh}" "$dev/bin/g-ir-scanner-lddwrapper" - chmod +x "$dev/bin/g-ir-compiler" - chmod +x "$dev/bin/g-ir-scanner" - chmod +x "$dev/bin/g-ir-scanner-lddwrapper" - ) - '' - # when cross-compiling and using the wrapper then when a package looks up the g_ir_X - # variable with pkg-config they'll get the host version which can't be run - # override the variable to use the absolute path to g_ir_X in PATH which can be run - + '' - cat >> $dev/nix-support/setup-hook <<-'EOF' - override-pkg-config-gir-variables() { - PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_G_IR_SCANNER="$(type -p g-ir-scanner)" - PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_G_IR_COMPILER="$(type -p g-ir-compiler)" - PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_G_IR_GENERATE="$(type -p g-ir-generate)" - export PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_G_IR_SCANNER - export PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_G_IR_COMPILER - export PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_G_IR_GENERATE - } - - preConfigureHooks+=(override-pkg-config-gir-variables) - EOF - ''; -}) +# wrap both pkgsCrossX.buildPackages.gobject-introspection and {pkgs,pkgsSomethingExecutableOnBuildSystem).buildPackages.gobject-introspection +if (!stdenv.hostPlatform.canExecute stdenv.targetPlatform) && stdenv.targetPlatform.emulatorAvailable buildPackages +then + overriddenUnwrappedGir.overrideAttrs + (previousAttrs: + { + + pname = "gobject-introspection-wrapped"; + passthru = previousAttrs.passthru // { + unwrapped = overriddenUnwrappedGir; + }; + dontStrip = true; + depsTargetTargetPropagated = [ overridenTargetUnwrappedGir ]; + buildCommand = '' + eval fixupPhase + ${lib.concatMapStrings (output: '' + mkdir -p ${"$" + "${output}"} + ${lib.getExe buildPackages.xorg.lndir} ${overriddenUnwrappedGir.${output}} ${"$" + "${output}"} + '') overriddenUnwrappedGir.outputs} + + cp $dev/bin/g-ir-compiler $dev/bin/.g-ir-compiler-wrapped + cp $dev/bin/g-ir-scanner $dev/bin/.g-ir-scanner-wrapped + + ( + rm "$dev/bin/g-ir-compiler" + rm "$dev/bin/g-ir-scanner" + export bash="${buildPackages.bash}" + export emulator=${lib.escapeShellArg (stdenv.targetPlatform.emulator buildPackages)} + export emulatorwrapper="$dev/bin/g-ir-scanner-qemuwrapper" + export buildlddtree="${buildPackages.pax-utils}/bin/lddtree" + + export targetgir="${lib.getDev overridenTargetUnwrappedGir}" + + substituteAll "${./wrappers/g-ir-compiler.sh}" "$dev/bin/g-ir-compiler" + substituteAll "${./wrappers/g-ir-scanner.sh}" "$dev/bin/g-ir-scanner" + substituteAll "${./wrappers/g-ir-scanner-lddwrapper.sh}" "$dev/bin/g-ir-scanner-lddwrapper" + substituteAll "${./wrappers/g-ir-scanner-qemuwrapper.sh}" "$dev/bin/g-ir-scanner-qemuwrapper" + chmod +x $dev/bin/g-ir-compiler + chmod +x $dev/bin/g-ir-scanner* + ) + '' + # when cross-compiling and using the wrapper then when a package looks up the g_ir_X + # variable with pkg-config they'll get the host version which can't be run + # override the variable to use the absolute path to g_ir_X in PATH which can be run + + '' + cat >> $dev/nix-support/setup-hook <<-'EOF' + override-pkg-config-gir-variables() { + PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_G_IR_SCANNER="$(type -p g-ir-scanner)" + PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_G_IR_COMPILER="$(type -p g-ir-compiler)" + PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_G_IR_GENERATE="$(type -p g-ir-generate)" + export PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_G_IR_SCANNER + export PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_G_IR_COMPILER + export PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_G_IR_GENERATE + } + + preConfigureHooks+=(override-pkg-config-gir-variables) + EOF + ''; + }) +else + overriddenUnwrappedGir.overrideAttrs (previousAttrs: + { + pname = "gobject-introspection-wrapped"; + passthru = previousAttrs.passthru // { + unwrapped = overriddenUnwrappedGir; + }; + dontStrip = true; + depsTargetTargetPropagated = [ overridenTargetUnwrappedGir ]; + buildCommand = '' + eval fixupPhase + ${lib.concatMapStrings (output: '' + mkdir -p ${"$" + "${output}"} + ${lib.getExe buildPackages.xorg.lndir} ${overriddenUnwrappedGir.${output}} ${"$" + "${output}"} + '') overriddenUnwrappedGir.outputs} + ''; + }) diff --git a/nixpkgs/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-compiler.sh b/nixpkgs/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-compiler.sh index 69642831c8a0..e82de18cae3d 100644 --- a/nixpkgs/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-compiler.sh +++ b/nixpkgs/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-compiler.sh @@ -1,4 +1,4 @@ #! @bash@/bin/bash # shellcheck shell=bash -exec @emulator@ @targetgir@/bin/g-ir-compiler "$@" +exec @emulatorwrapper@ @targetgir@/bin/g-ir-compiler "$@" diff --git a/nixpkgs/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner-lddwrapper.sh b/nixpkgs/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner-lddwrapper.sh index 1bf9c3659dc5..f9c2a29f1442 100644 --- a/nixpkgs/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner-lddwrapper.sh +++ b/nixpkgs/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner-lddwrapper.sh @@ -1,4 +1,4 @@ #! @bash@/bin/bash # shellcheck shell=bash -exec @buildobjdump@ -p "$@" +exec @buildlddtree@ "$@" diff --git a/nixpkgs/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner-qemuwrapper.sh b/nixpkgs/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner-qemuwrapper.sh new file mode 100644 index 000000000000..9b407bc4144a --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner-qemuwrapper.sh @@ -0,0 +1,23 @@ +#! @bash@/bin/bash +# shellcheck shell=bash + +# fixes issues like +# libdbusmenu-gtk3-aarch64-unknown-linux-gnu> /build/libdbusmenu-16.04.0/libdbusmenu-gtk/tmp-introspect2jhtiwwn/.libs/DbusmenuGtk3-0.4: +# error while loading shared libraries: libdbusmenu-glib.so.4: cannot open shared object file: No such file or directory +# in non-meson builds + +# see: https://github.com/void-linux/void-packages/blob/master/srcpkgs/gobject-introspection/files/g-ir-scanner-qemuwrapper +# https://github.com/openembedded/openembedded-core/blob/c5a14f39a6717a99b510cb97aa2fb403d4b98d99/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.72.0.bb#L74 +while read -r d; do \ + # some meson projects may have subprojects which use makefiles for docs(e.g. gi-docgen), ignore those as they will never be needed + if [[ -f "$d/Makefile" && "$d" != *"subproject"* ]]; then + GIR_EXTRA_LIBS_PATH="$(readlink -f "$d/.libs"):$GIR_EXTRA_LIBS_PATH" + export GIR_EXTRA_LIBS_PATH + fi +done < <(find "$NIX_BUILD_TOP" -type d) + +# quoting broke the build of atk +# shellcheck disable=2086 +exec @emulator@ ${GIR_EXTRA_OPTIONS:-} \ + ${GIR_EXTRA_LIBS_PATH:+-E LD_LIBRARY_PATH="${GIR_EXTRA_LIBS_PATH}"} \ + "$@" diff --git a/nixpkgs/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner.sh b/nixpkgs/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner.sh index 6a222191c7b2..7843bb91db97 100644 --- a/nixpkgs/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner.sh +++ b/nixpkgs/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner.sh @@ -2,6 +2,6 @@ # shellcheck shell=bash exec @dev@/bin/.g-ir-scanner-wrapped \ - --use-binary-wrapper=@emulator@ \ + --use-binary-wrapper=@emulatorwrapper@ \ --use-ldd-wrapper=@dev@/bin/g-ir-scanner-lddwrapper \ "$@" |