mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-17 18:34:38 +00:00
a83d2f7c91
gobject-introspection: copy $dev/share/gobj.../tests when cross-compiling gobject-introspection: add giscanner-ignore-error-return-codes-from-ldd-wrapper patch polkit-aarch64-unknown-linux-gnu> [102/104] Generating src/polkitagent/PolkitAgent-1.0.gir with a custom command polkit-aarch64-unknown-linux-gnu> FAILED: src/polkitagent/PolkitAgent-1.0.gir polkit-aarch64-unknown-linux-gnu> <storepath>-gobject-introspection-wrapped-1.72.0-dev/bin/g-ir-scanner --no-libtool --namespace=PolkitAgent --nsversion=1.0 --warn-all --output src/polkitagent/PolkitAgent-1.0.gir --c-include=polkitagent/polkitagent.h - D_POLKIT_AGENT_COMPILATION -D_POLKIT_COMPILATION -I/build/source/src/polkitagent -I/build/source/build/src/polkitagent -I/build/source/. -I/build/source/build/. -I/build/source/src/. -I/build/source/build/src/. --filelist=/build/source/build/src/polkitagent/libpolkit-agent-1.so.0.0.0 .p/PolkitAgent_1.0_gir_filelist --include=Gio-2.0 --include-uninstalled=src/polkit/Polkit-1.0.gir --pkg-export=polkit-agent-1 --cflags-begin -DHAVE_CONFIG_H -I/build/source/. -I/build/source/build/. -I/build/source/src/. -I/build/source/build/src/. -I/nix/store/lqncny8acp6hkclsgbfnrb 65i9hscsmn-expat-aarch64-unknown-linux-gnu-2.4.8-dev/include -I<storepath>-glib-aarch64-unknown-linux-gnu-2.72.2-dev/include/gio-unix-2.0 -I<storepath>-glib-aarch64-unknown-linux-gnu-2.72.2-dev/include -I/nix/store/qm1wa x4c7sgf5h3b6dhspxb5miayjyc9-glib-aarch64-unknown-linux-gnu-2.72.2-dev/include/glib-2.0 -I<storepath>-glib-aarch64-unknown-linux-gnu-2.72.2/lib/glib-2.0/include -I<storepath>-gobject-introspection-aarch64-unknown-linux-gn u-1.72.0-dev/include/gobject-introspection-1.0 --cflags-end --add-include-path=<storepath>-gobject-introspection-aarch64-unknown-linux-gnu-1.72.0-dev/share/gir-1.0 --add-include-path=/build/source/build/src/polkit -L/build/source/build/src/polkitagent --library polkit-agent-1 -L/build/source/build/src/polkit -L<storepath>-expat-aarch64-unknown-linux-gnu-2.4.8/lib --extra-library=expat -L<storepath>-glib-aarch64-unknown-linux-gnu-2.72.2/lib --extra-library=gio-2.0 --ex tra-library=gobject-2.0 --extra-library=glib-2.0 -L<storepath>-gobject-introspection-aarch64-unknown-linux-gnu-1.72.0/lib --extra-library=girepository-1.0 --sources-top-dirs /build/source/subprojects/ --sources-top-dirs /build/source/build/subprojects/ polkit-aarch64-unknown-linux-gnu> g-ir-scanner: link: aarch64-unknown-linux-gnu-gcc -o /build/source/build/tmp-introspectzp2ldkyk/PolkitAgent-1.0 /build/source/build/tmp-introspectzp2ldkyk/PolkitAgent-1.0.o -L. -Wl,-rpath,. -Wl,--no-as-needed -L/build/source/build/src/polkitagent -Wl ,-rpath,/build/source/build/src/polkitagent -L/build/source/build/src/polkit -Wl,-rpath,/build/source/build/src/polkit -L<storepath>-expat-aarch64-unknown-linux-gnu-2.4.8/lib -Wl,-rpath,<storepath>-expat-aarch64-unknown- linux-gnu-2.4.8/lib -L<storepath>-glib-aarch64-unknown-linux-gnu-2.72.2/lib -Wl,-rpath,<storepath>-glib-aarch64-unknown-linux-gnu-2.72.2/lib -L<storepath>-gobject-introspection-aarch64-unk nown-linux-gnu-1.72.0/lib -Wl,-rpath,<storepath>-gobject-introspection-aarch64-unknown-linux-gnu-1.72.0/lib -lpolkit-agent-1 -lexpat -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lgirepository-1.0 -L<storepath>-glib-aarch64-unknow n-linux-gnu-2.72.2/lib -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 polkit-aarch64-unknown-linux-gnu> Traceback (most recent call last): polkit-aarch64-unknown-linux-gnu> File "<storepath>-gobject-introspection-wrapped-1.72.0-dev/bin/.g-ir-scanner-wrapped", line 99, in <module> polkit-aarch64-unknown-linux-gnu> sys.exit(scanner_main(sys.argv)) polkit-aarch64-unknown-linux-gnu> File "<storepath>-gobject-introspection-wrapped-1.72.0/lib/gobject-introspection/giscanner/scannermain.py", line 646, in scanner_main polkit-aarch64-unknown-linux-gnu> shlibs = create_binary(transformer, options, args) polkit-aarch64-unknown-linux-gnu> File "<storepath>-gobject-introspection-wrapped-1.72.0/lib/gobject-introspection/giscanner/scannermain.py", line 471, in create_binary polkit-aarch64-unknown-linux-gnu> shlibs = resolve_shlibs(options, binary, options.libraries) polkit-aarch64-unknown-linux-gnu> File "<storepath>-gobject-introspection-wrapped-1.72.0/lib/gobject-introspection/giscanner/shlibs.py", line 179, in resolve_shlibs polkit-aarch64-unknown-linux-gnu> _resolve_non_libtool(options, binary, non_libtool)) polkit-aarch64-unknown-linux-gnu> File "<storepath>-gobject-introspection-wrapped-1.72.0/lib/go bject-introspection/giscanner/shlibs.py", line 112, in _resolve_non_libtool polkit-aarch64-unknown-linux-gnu> output = subprocess.check_output(args) polkit-aarch64-unknown-linux-gnu> File "<storepath>-python3-3.10.5/lib/python3.10/subprocess.py", line 420, in check_output polkit-aarch64-unknown-linux-gnu> return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, polkit-aarch64-unknown-linux-gnu> File "<storepath>-python3-3.10.5/lib/python3.10/subprocess.py", line 524, in run polkit-aarch64-unknown-linux-gnu> raise CalledProcessError(retcode, process.args, polkit-aarch64-unknown-linux-gnu> subprocess.CalledProcessError: Command '['<storepath>-prelink-unstable-2019-06-24/bin/prelink-rtld', '/build/source/build/tmp-introspectzp2ldkyk/PolkitAgent-1.0']' returned non-zero exit status 127. polkit-aarch64-unknown-linux-gnu> [103/104] Generating src/polkit/Polkit-1.0.typelib with a custom command polkit-aarch64-unknown-linux-gnu> ninja: build stopped: subcommand failed. exit status 127 gobject-introspection: this should fix pkgsMusl pkgsStatic by not putting `/nix/store/iw35xj69w190w7vw17l8mac8srg0vpyz-gobject-introspection-static-x86_64-unknown-linux-musl-1.72.0.drv` in their dependency tree when gobject-introspection is in nativeBuildInputs ex .#pkgsStatic.libjxl gobject-introspection: pc file: use binaries from path instead of a abs path to them fixes issues in networkmanager and some other packages ``` gi._error.GError: g-invoke-error-quark: Could not locate g_option_error_quark: /nix/store/...-glib-aarch64-unknown-linux-gnu-2.72.2/lib/libglib-2.0.so.0: cannot open shared object file: No such file or directory (1) ``` see comment gobject-introspection: propagate gobject-introspection-unwrapped in wrapper with this it is no longer needed to put gobject-introspection in buildInputs in addition to nativeBuildInputs
162 lines
5.2 KiB
Nix
162 lines
5.2 KiB
Nix
{ stdenv
|
|
, lib
|
|
, fetchurl
|
|
, glib
|
|
, flex
|
|
, bison
|
|
, meson
|
|
, ninja
|
|
, gtk-doc
|
|
, docbook-xsl-nons
|
|
, docbook_xml_dtd_43
|
|
, docbook_xml_dtd_45
|
|
, pkg-config
|
|
, libffi
|
|
, python3
|
|
, cctools
|
|
, cairo
|
|
, gnome
|
|
, substituteAll
|
|
, buildPackages
|
|
, gobject-introspection-unwrapped
|
|
, nixStoreDir ? builtins.storeDir
|
|
, x11Support ? true
|
|
}:
|
|
|
|
# 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
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "gobject-introspection";
|
|
version = "1.72.0";
|
|
|
|
# outputs TODO: share/gobject-introspection-1.0/tests is needed during build
|
|
# by pygobject3 (and maybe others), but it's only searched in $out
|
|
outputs = [ "out" "dev" "devdoc" "man" ];
|
|
outputBin = "dev";
|
|
|
|
src = fetchurl {
|
|
url = "mirror://gnome/sources/gobject-introspection/${lib.versions.majorMinor finalAttrs.version}/gobject-introspection-${finalAttrs.version}.tar.xz";
|
|
sha256 = "Av6OWQhh2I+DBg3TnNpcyqYLLaHSHQ+VSZMBsYa+qrw=";
|
|
};
|
|
|
|
patches = [
|
|
# Make g-ir-scanner put absolute path to GIR files it generates
|
|
# so that programs can just dlopen them without having to muck
|
|
# with LD_LIBRARY_PATH environment variable.
|
|
(substituteAll {
|
|
src = ./absolute_shlib_path.patch;
|
|
inherit nixStoreDir;
|
|
})
|
|
] ++ lib.optionals x11Support [
|
|
# Hardcode the cairo shared library path in the Cairo gir shipped with this package.
|
|
# https://github.com/NixOS/nixpkgs/issues/34080
|
|
(substituteAll {
|
|
src = ./absolute_gir_path.patch;
|
|
cairoLib = "${lib.getLib cairo}/lib";
|
|
})
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
meson
|
|
ninja
|
|
pkg-config
|
|
flex
|
|
bison
|
|
gtk-doc
|
|
docbook-xsl-nons
|
|
docbook_xml_dtd_45
|
|
python3
|
|
finalAttrs.setupHook # move .gir files
|
|
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ gobject-introspection-unwrapped ];
|
|
|
|
buildInputs = [
|
|
python3
|
|
];
|
|
|
|
checkInputs = lib.optionals stdenv.isDarwin [
|
|
cctools # for otool
|
|
];
|
|
|
|
propagatedBuildInputs = [
|
|
libffi
|
|
glib
|
|
];
|
|
|
|
mesonFlags = [
|
|
"--datadir=${placeholder "dev"}/share"
|
|
"-Ddoctool=disabled"
|
|
"-Dcairo=disabled"
|
|
"-Dgtk_doc=${lib.boolToString (stdenv.hostPlatform == stdenv.buildPlatform)}"
|
|
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
"-Dgi_cross_ldd_wrapper=${buildPackages.prelink}/bin/prelink-rtld"
|
|
"-Dgi_cross_use_prebuilt_gi=true"
|
|
"-Dgi_cross_binary_wrapper=${stdenv.hostPlatform.emulator buildPackages}"
|
|
];
|
|
|
|
doCheck = !stdenv.isAarch64;
|
|
|
|
# During configurePhase, two python scripts are generated and need this. See
|
|
# https://github.com/NixOS/nixpkgs/pull/98316#issuecomment-695785692
|
|
postConfigure = ''
|
|
patchShebangs tools/*
|
|
'';
|
|
|
|
postInstall = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
|
cp -r ${buildPackages.gobject-introspection-unwrapped.devdoc} $devdoc
|
|
# these are uncompiled c and header files which aren't installed when cross-compiling because
|
|
# code that installs them is in tests/meson.build which is only run when not cross-compiling
|
|
# pygobject3 needs them
|
|
cp -r ${buildPackages.gobject-introspection-unwrapped.dev}/share/gobject-introspection-1.0/tests $dev/share/gobject-introspection-1.0/tests
|
|
'';
|
|
|
|
preCheck = ''
|
|
# Our gobject-introspection patches make the shared library paths absolute
|
|
# in the GIR files. When running tests, the library is not yet installed,
|
|
# though, so we need to replace the absolute path with a local one during build.
|
|
# We are using a symlink that we will delete before installation.
|
|
mkdir -p $out/lib
|
|
ln -s $PWD/tests/scanner/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary} $out/lib/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary}
|
|
'';
|
|
|
|
postCheck = ''
|
|
rm $out/lib/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary}
|
|
'';
|
|
|
|
# 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
|
|
# switch the variables to use g_ir_X from path instead of an absolute path
|
|
postFixup = lib.optionalString (!lib.hasSuffix "wrapped" finalAttrs.pname) ''
|
|
find "''${!outputDev}/lib/pkgconfig" -name '*.pc' | while read pc; do
|
|
substituteInPlace "$pc" \
|
|
--replace '=''${bindir}/g-ir' '=g-ir'
|
|
done
|
|
'';
|
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
passthru = {
|
|
updateScript = gnome.updateScript {
|
|
packageName = "gobject-introspection";
|
|
versionPolicy = "odd-unstable";
|
|
};
|
|
};
|
|
|
|
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 ]);
|
|
platforms = platforms.unix;
|
|
license = with licenses; [ gpl2 lgpl2 ];
|
|
|
|
longDescription = ''
|
|
GObject introspection is a middleware layer between C libraries (using
|
|
GObject) and language bindings. The C library can be scanned at compile
|
|
time and generate a metadata file, in addition to the actual native C
|
|
library. Then at runtime, language bindings can read this metadata and
|
|
automatically provide bindings to call into the C library.
|
|
'';
|
|
};
|
|
})
|