2022-06-07 20:51:59 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPackages
|
|
|
|
, targetPackages
|
2022-07-22 05:21:40 +02:00
|
|
|
, gobject-introspection-unwrapped
|
|
|
|
, ...
|
|
|
|
}@_args:
|
2022-06-07 20:51:59 +02:00
|
|
|
|
|
|
|
# to build, run
|
|
|
|
# `nix build ".#pkgsCross.aarch64-multiplatform.buildPackages.gobject-introspection"`
|
2022-07-22 05:21:40 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
# ensure that `.override` works when gobject-introspection == gobject-introspection-wrapped
|
|
|
|
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" ];
|
|
|
|
in
|
|
|
|
|
2022-07-22 17:23:16 +02:00
|
|
|
(gobject-introspection-unwrapped.override args).overrideAttrs (previousAttrs: {
|
2022-06-07 20:51:59 +02:00
|
|
|
pname = "gobject-introspection-wrapped";
|
gobject-introspection: cross improvements
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
2022-06-13 23:12:53 +02:00
|
|
|
postFixup = (previousAttrs.postFixup or "") + ''
|
2022-06-07 20:51:59 +02:00
|
|
|
mv $dev/bin/g-ir-compiler $dev/bin/.g-ir-compiler-wrapped
|
|
|
|
mv $dev/bin/g-ir-scanner $dev/bin/.g-ir-scanner-wrapped
|
|
|
|
|
|
|
|
(
|
2022-07-27 22:41:52 +02:00
|
|
|
export bash="${buildPackages.bash}"
|
2022-06-07 20:51:59 +02:00
|
|
|
export emulator=${lib.escapeShellArg (stdenv.targetPlatform.emulator buildPackages)}
|
2022-07-27 22:41:52 +02:00
|
|
|
export buildobjdump="${buildPackages.stdenv.cc.bintools}/bin/objdump"
|
2022-06-07 20:51:59 +02:00
|
|
|
|
2022-07-22 05:21:40 +02:00
|
|
|
export targetgir="${lib.getDev (targetPackages.gobject-introspection-unwrapped.override argsForTarget)}"
|
2022-06-07 20:51:59 +02:00
|
|
|
|
|
|
|
substituteAll "${./wrappers/g-ir-compiler.sh}" "$dev/bin/g-ir-compiler"
|
|
|
|
substituteAll "${./wrappers/g-ir-scanner.sh}" "$dev/bin/g-ir-scanner"
|
2022-07-27 22:41:52 +02:00
|
|
|
substituteAll "${./wrappers/g-ir-scanner-lddwrapper.sh}" "$dev/bin/g-ir-scanner-lddwrapper"
|
2022-06-07 20:51:59 +02:00
|
|
|
chmod +x "$dev/bin/g-ir-compiler"
|
|
|
|
chmod +x "$dev/bin/g-ir-scanner"
|
2022-07-27 22:41:52 +02:00
|
|
|
chmod +x "$dev/bin/g-ir-scanner-lddwrapper"
|
2022-06-07 20:51:59 +02:00
|
|
|
)
|
2022-07-14 01:10:16 +02:00
|
|
|
''
|
|
|
|
# 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
|
2022-06-07 20:51:59 +02:00
|
|
|
'';
|
|
|
|
})
|