various: enable gobject-introspection when cross-compiling

and fix cross in some
This commit is contained in:
Artturin 2022-07-07 21:34:37 +03:00
parent bf15263d1c
commit 1bd8727a4c
15 changed files with 116 additions and 90 deletions

View file

@ -44,10 +44,6 @@ stdenv.mkDerivation rec {
glib glib
]; ];
mesonFlags = [
"-Dintrospection=${lib.boolToString (stdenv.buildPlatform == stdenv.hostPlatform)}"
];
doCheck = true; doCheck = true;
passthru = { passthru = {

View file

@ -16,22 +16,18 @@
, libjpeg , libjpeg
, libpng , libpng
, gnome , gnome
, gobject-introspection
, buildPackages
, doCheck ? false , doCheck ? false
, makeWrapper , makeWrapper
, lib , lib
, withIntrospection ? (stdenv.buildPlatform == stdenv.hostPlatform)
, gobject-introspection
}: }:
let
withGtkDoc = stdenv.buildPlatform == stdenv.hostPlatform;
in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "gdk-pixbuf"; pname = "gdk-pixbuf";
version = "2.42.8"; version = "2.42.8";
outputs = [ "out" "dev" "man" ] outputs = [ "out" "dev" "man" "devdoc" ]
++ lib.optional withGtkDoc "devdoc"
++ lib.optional (stdenv.buildPlatform == stdenv.hostPlatform) "installedTests"; ++ lib.optional (stdenv.buildPlatform == stdenv.hostPlatform) "installedTests";
src = fetchurl { src = fetchurl {
@ -60,6 +56,7 @@ stdenv.mkDerivation rec {
makeWrapper makeWrapper
glib glib
gi-docgen gi-docgen
gobject-introspection
# for man pages # for man pages
libxslt libxslt
@ -67,8 +64,6 @@ stdenv.mkDerivation rec {
docbook_xml_dtd_43 docbook_xml_dtd_43
] ++ lib.optionals stdenv.isDarwin [ ] ++ lib.optionals stdenv.isDarwin [
fixDarwinDylibNames fixDarwinDylibNames
] ++ lib.optionals withIntrospection [
gobject-introspection
]; ];
propagatedBuildInputs = [ propagatedBuildInputs = [
@ -79,9 +74,8 @@ stdenv.mkDerivation rec {
]; ];
mesonFlags = [ mesonFlags = [
"-Dgtk_doc=${lib.boolToString withGtkDoc}"
"-Dintrospection=${if withIntrospection then "enabled" else "disabled"}"
"-Dgio_sniffing=false" "-Dgio_sniffing=false"
"-Dgtk_doc=true"
]; ];
postPatch = '' postPatch = ''
@ -89,10 +83,13 @@ stdenv.mkDerivation rec {
patchShebangs build-aux patchShebangs build-aux
substituteInPlace tests/meson.build --subst-var-by installedtestsprefix "$installedTests" substituteInPlace tests/meson.build --subst-var-by installedtestsprefix "$installedTests"
'';
preInstall = '' # Run-time dependency gi-docgen found: NO (tried pkgconfig and cmake)
PATH=$PATH:$out/bin # for install script # it should be a build-time dep for build
# TODO: send upstream
substituteInPlace docs/meson.build \
--replace "dependency('gi-docgen'," "dependency('gi-docgen', native:true," \
--replace "'gi-docgen', req" "'gi-docgen', native:true, req"
''; '';
postInstall = postInstall =
@ -108,9 +105,9 @@ stdenv.mkDerivation rec {
install_name_tool -change @rpath/libgdk_pixbuf-2.0.0.dylib $out/lib/libgdk_pixbuf-2.0.0.dylib $f install_name_tool -change @rpath/libgdk_pixbuf-2.0.0.dylib $out/lib/libgdk_pixbuf-2.0.0.dylib $f
mv $f ''${f%.dylib}.so mv $f ''${f%.dylib}.so
done done
'' + lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) '' '' + ''
# We need to install 'loaders.cache' in lib/gdk-pixbuf-2.0/2.10.0/ # We need to install 'loaders.cache' in lib/gdk-pixbuf-2.0/2.10.0/
$dev/bin/gdk-pixbuf-query-loaders --update-cache ${stdenv.hostPlatform.emulator buildPackages} $dev/bin/gdk-pixbuf-query-loaders --update-cache
''; '';
# The fixDarwinDylibNames hook doesn't patch binaries. # The fixDarwinDylibNames hook doesn't patch binaries.
@ -120,7 +117,7 @@ stdenv.mkDerivation rec {
done done
''; '';
postFixup = lib.optionalString withGtkDoc '' postFixup = ''
# Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
moveToOutput "share/doc" "$devdoc" moveToOutput "share/doc" "$devdoc"
''; '';

View file

@ -4,6 +4,7 @@
, fetchpatch , fetchpatch
, intltool , intltool
, meson , meson
, mesonEmulatorHook
, ninja , ninja
, pkg-config , pkg-config
, gtk-doc , gtk-doc
@ -74,6 +75,8 @@ stdenv.mkDerivation rec {
gtk-doc gtk-doc
docbook-xsl-nons docbook-xsl-nons
docbook_xml_dtd_412 docbook_xml_dtd_412
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
mesonEmulatorHook
]; ];
buildInputs = [ buildInputs = [

View file

@ -158,7 +158,6 @@ stdenv.mkDerivation rec {
"-Dbroadway_backend=${lib.boolToString broadwaySupport}" "-Dbroadway_backend=${lib.boolToString broadwaySupport}"
"-Dx11_backend=${lib.boolToString x11Support}" "-Dx11_backend=${lib.boolToString x11Support}"
"-Dquartz_backend=${lib.boolToString (stdenv.isDarwin && !x11Support)}" "-Dquartz_backend=${lib.boolToString (stdenv.isDarwin && !x11Support)}"
"-Dintrospection=${lib.boolToString (stdenv.buildPlatform == stdenv.hostPlatform)}"
]; ];
doCheck = false; # needs X11 doCheck = false; # needs X11

View file

@ -34,7 +34,6 @@ let
inherit (lib) optional optionals optionalString; inherit (lib) optional optionals optionalString;
mesonFeatureFlag = opt: b: mesonFeatureFlag = opt: b:
"-D${opt}=${if b then "enabled" else "disabled"}"; "-D${opt}=${if b then "enabled" else "disabled"}";
isNativeCompilation = stdenv.buildPlatform == stdenv.hostPlatform;
in in
stdenv.mkDerivation { stdenv.mkDerivation {
@ -70,7 +69,10 @@ stdenv.mkDerivation {
(mesonFeatureFlag "coretext" withCoreText) (mesonFeatureFlag "coretext" withCoreText)
(mesonFeatureFlag "graphite" withGraphite2) (mesonFeatureFlag "graphite" withGraphite2)
(mesonFeatureFlag "icu" withIcu) (mesonFeatureFlag "icu" withIcu)
(mesonFeatureFlag "introspection" isNativeCompilation) ];
depsBuildBuild = [
pkg-config
]; ];
nativeBuildInputs = [ nativeBuildInputs = [
@ -86,8 +88,7 @@ stdenv.mkDerivation {
]; ];
buildInputs = [ glib freetype ] buildInputs = [ glib freetype ]
++ lib.optionals withCoreText [ ApplicationServices CoreText ] ++ lib.optionals withCoreText [ ApplicationServices CoreText ];
++ lib.optionals isNativeCompilation [ gobject-introspection ];
propagatedBuildInputs = optional withGraphite2 graphite2 propagatedBuildInputs = optional withGraphite2 graphite2
++ optionals withIcu [ icu harfbuzz ]; ++ optionals withIcu [ icu harfbuzz ];

View file

@ -6,10 +6,10 @@
, ninja , ninja
, pkg-config , pkg-config
, gettext , gettext
, withIntrospection ? stdenv.buildPlatform == stdenv.hostPlatform
, gobject-introspection , gobject-introspection
, fixDarwinDylibNames
, gi-docgen , gi-docgen
, libxslt
, fixDarwinDylibNames
, gnome , gnome
}: }:
@ -17,8 +17,7 @@ stdenv.mkDerivation rec {
pname = "json-glib"; pname = "json-glib";
version = "1.6.6"; version = "1.6.6";
outputs = [ "out" "dev" ] outputs = [ "out" "dev" "devdoc" ];
++ lib.optional withIntrospection "devdoc";
src = fetchurl { src = fetchurl {
url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
@ -37,22 +36,26 @@ stdenv.mkDerivation rec {
pkg-config pkg-config
gettext gettext
glib glib
] ++ lib.optional stdenv.hostPlatform.isDarwin [ libxslt
fixDarwinDylibNames
] ++ lib.optionals withIntrospection [
gobject-introspection gobject-introspection
gi-docgen gi-docgen
] ++ lib.optional stdenv.hostPlatform.isDarwin [
fixDarwinDylibNames
]; ];
propagatedBuildInputs = [ propagatedBuildInputs = [
glib glib
]; ];
mesonFlags = lib.optionals (!withIntrospection) [
"-Dintrospection=disabled" # Run-time dependency gi-docgen found: NO (tried pkgconfig and cmake)
# gi-docgen relies on introspection data # it should be a build-time dep for build
"-Dgtk_doc=disabled" # TODO: send upstream
]; postPatch = ''
substituteInPlace doc/meson.build \
--replace "'gi-docgen', ver" "'gi-docgen', native:true, ver" \
--replace "'gi-docgen', req" "'gi-docgen', native:true, req"
'';
doCheck = true; doCheck = true;

View file

@ -13,7 +13,6 @@
, python3 , python3
, tzdata , tzdata
, fixDarwinDylibNames , fixDarwinDylibNames
, withIntrospection ? stdenv.buildPlatform == stdenv.hostPlatform
, gobject-introspection , gobject-introspection
, vala , vala
}: }:
@ -37,6 +36,8 @@ stdenv.mkDerivation rec {
ninja ninja
perl perl
pkg-config pkg-config
gobject-introspection
vala
# Docs building fails: # Docs building fails:
# https://github.com/NixOS/nixpkgs/pull/67204 # https://github.com/NixOS/nixpkgs/pull/67204
# previously with https://github.com/NixOS/nixpkgs/pull/61657#issuecomment-495579489 # previously with https://github.com/NixOS/nixpkgs/pull/61657#issuecomment-495579489
@ -44,15 +45,12 @@ stdenv.mkDerivation rec {
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
# provides ical-glib-src-generator that runs during build # provides ical-glib-src-generator that runs during build
libical libical
] ++ lib.optionals withIntrospection [
gobject-introspection
vala
] ++ lib.optionals stdenv.isDarwin [ ] ++ lib.optionals stdenv.isDarwin [
fixDarwinDylibNames fixDarwinDylibNames
]; ];
installCheckInputs = [ installCheckInputs = [
# running libical-glib tests # running libical-glib tests
(python3.withPackages (pkgs: with pkgs; [ (python3.pythonForBuild.withPackages (pkgs: with pkgs; [
pygobject3 pygobject3
])) ]))
]; ];
@ -61,14 +59,10 @@ stdenv.mkDerivation rec {
glib glib
libxml2 libxml2
icu icu
] ++ lib.optionals withIntrospection [
gobject-introspection
]; ];
cmakeFlags = [ cmakeFlags = [
"-DENABLE_GTK_DOC=False" "-DENABLE_GTK_DOC=False"
"-DGOBJECT_INTROSPECTION=${if withIntrospection then "True" else "False"}"
"-DICAL_GLIB_VAPI=${if withIntrospection then "True" else "False"}"
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DIMPORT_ICAL_GLIB_SRC_GENERATOR=${lib.getDev buildPackages.libical}/lib/cmake/LibIcal/IcalGlibSrcGenerator.cmake" "-DIMPORT_ICAL_GLIB_SRC_GENERATOR=${lib.getDev buildPackages.libical}/lib/cmake/LibIcal/IcalGlibSrcGenerator.cmake"
]; ];

View file

@ -2,6 +2,7 @@
, fetchurl , fetchurl
, ninja , ninja
, meson , meson
, mesonEmulatorHook
, pkg-config , pkg-config
, vala , vala
, gobject-introspection , gobject-introspection
@ -34,6 +35,8 @@ stdenv.mkDerivation rec {
gtk-doc gtk-doc
docbook-xsl-nons docbook-xsl-nons
docbook_xml_dtd_43 docbook_xml_dtd_43
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
mesonEmulatorHook
]; ];
buildInputs = [ buildInputs = [

View file

@ -31,6 +31,10 @@ stdenv.mkDerivation rec {
sha256 = "P7PONA/NfbVNh8iT5pv8Kx9uTUsnkGX/5m2snw/RK00="; sha256 = "P7PONA/NfbVNh8iT5pv8Kx9uTUsnkGX/5m2snw/RK00=";
}; };
depsBuildBuild = [
pkg-config
];
nativeBuildInputs = [ nativeBuildInputs = [
meson meson
ninja ninja

View file

@ -8,16 +8,13 @@
, pkg-config , pkg-config
, gnome , gnome
, libsysprof-capture , libsysprof-capture
, gobject-introspection
, vala
, libpsl
, brotli
, gnomeSupport ? true , gnomeSupport ? true
, sqlite , sqlite
, glib-networking , glib-networking
, gobject-introspection
, withIntrospection ? stdenv.buildPlatform == stdenv.hostPlatform
, vala
, withVala ? stdenv.buildPlatform == stdenv.hostPlatform
, libpsl
, python3
, brotli
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -31,19 +28,20 @@ stdenv.mkDerivation rec {
sha256 = "sha256-8KQnZW5f4Z4d9xwQfojfobLmc8JcVHt4I7YBi0DQEVk="; sha256 = "sha256-8KQnZW5f4Z4d9xwQfojfobLmc8JcVHt4I7YBi0DQEVk=";
}; };
depsBuildBuild = [
pkg-config
];
nativeBuildInputs = [ nativeBuildInputs = [
meson meson
ninja ninja
pkg-config pkg-config
glib glib
] ++ lib.optionals withIntrospection [
gobject-introspection gobject-introspection
] ++ lib.optionals withVala [
vala vala
]; ];
buildInputs = [ buildInputs = [
python3
sqlite sqlite
libpsl libpsl
glib.out glib.out
@ -60,8 +58,6 @@ stdenv.mkDerivation rec {
mesonFlags = [ mesonFlags = [
"-Dtls_check=false" # glib-networking is a runtime dependency, not a compile-time dependency "-Dtls_check=false" # glib-networking is a runtime dependency, not a compile-time dependency
"-Dgssapi=disabled" "-Dgssapi=disabled"
"-Dvapi=${if withVala then "enabled" else "disabled"}"
"-Dintrospection=${if withIntrospection then "enabled" else "disabled"}"
"-Dgnome=${lib.boolToString gnomeSupport}" "-Dgnome=${lib.boolToString gnomeSupport}"
"-Dntlm=disabled" "-Dntlm=disabled"
] ++ lib.optionals (!stdenv.isLinux) [ ] ++ lib.optionals (!stdenv.isLinux) [
@ -73,6 +69,12 @@ stdenv.mkDerivation rec {
doCheck = false; # ERROR:../tests/socket-test.c:37:do_unconnected_socket_test: assertion failed (res == SOUP_STATUS_OK): (2 == 200) doCheck = false; # ERROR:../tests/socket-test.c:37:do_unconnected_socket_test: assertion failed (res == SOUP_STATUS_OK): (2 == 200)
postPatch = '' postPatch = ''
# fixes finding vapigen when cross-compiling
# the commit is in 3.0.6
# https://gitlab.gnome.org/GNOME/libsoup/-/commit/5280e936d0a76f94dbc5d8489cfbdc0a06343f65
substituteInPlace meson.build \
--replace "required: vapi_opt)" "required: vapi_opt, native: false)"
patchShebangs libsoup/ patchShebangs libsoup/
''; '';

View file

@ -35,6 +35,10 @@ stdenv.mkDerivation rec {
(lib.withFeature sslSupport "ssl") (lib.withFeature sslSupport "ssl")
]; ];
preConfigure = ''
export PKG_CONFIG="$(command -v "$PKG_CONFIG")"
'';
passthru = {inherit compressionSupport sslSupport;}; passthru = {inherit compressionSupport sslSupport;};
meta = with lib; { meta = with lib; {

View file

@ -13,6 +13,7 @@
, protobuf , protobuf
, config , config
, ocl-icd , ocl-icd
, buildPackages
, enableJPEG ? true , enableJPEG ? true
, libjpeg , libjpeg
@ -291,11 +292,15 @@ stdenv.mkDerivation {
"-DOPENCV_GENERATE_PKGCONFIG=ON" "-DOPENCV_GENERATE_PKGCONFIG=ON"
"-DWITH_OPENMP=ON" "-DWITH_OPENMP=ON"
"-DBUILD_PROTOBUF=OFF" "-DBUILD_PROTOBUF=OFF"
"-DProtobuf_PROTOC_EXECUTABLE=${lib.getExe buildPackages.protobuf}"
"-DPROTOBUF_UPDATE_FILES=ON" "-DPROTOBUF_UPDATE_FILES=ON"
"-DOPENCV_ENABLE_NONFREE=${printEnabled enableUnfree}" "-DOPENCV_ENABLE_NONFREE=${printEnabled enableUnfree}"
"-DBUILD_TESTS=OFF" "-DBUILD_TESTS=OFF"
"-DBUILD_PERF_TESTS=OFF" "-DBUILD_PERF_TESTS=OFF"
"-DBUILD_DOCS=${printEnabled enableDocs}" "-DBUILD_DOCS=${printEnabled enableDocs}"
# "OpenCV disables pkg-config to avoid using of host libraries. Consider using PKG_CONFIG_LIBDIR to specify target SYSROOT"
# but we have proper separation of build and host libs :), fixes cross
"-DOPENCV_ENABLE_PKG_CONFIG=ON"
(opencvFlag "IPP" enableIpp) (opencvFlag "IPP" enableIpp)
(opencvFlag "TIFF" enableTIFF) (opencvFlag "TIFF" enableTIFF)
(opencvFlag "WEBP" enableWebP) (opencvFlag "WEBP" enableWebP)

View file

@ -16,26 +16,21 @@
, ninja , ninja
, glib , glib
, python3 , python3
, x11Support? !stdenv.isDarwin, libXft
, withIntrospection ? (stdenv.buildPlatform == stdenv.hostPlatform)
, gobject-introspection , gobject-introspection
, withDocs ? (stdenv.buildPlatform == stdenv.hostPlatform) , x11Support? !stdenv.isDarwin, libXft
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "pango"; pname = "pango";
version = "1.50.7"; version = "1.50.7";
outputs = [ "bin" "out" "dev" ] outputs = [ "bin" "out" "dev" "devdoc" ];
++ lib.optionals withDocs [ "devdoc" ];
src = fetchurl { src = fetchurl {
url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
sha256 = "BHfzaaPUxpXfcpmmmJ3ABHVqf03ifuysQFxnkLfjrTM="; sha256 = "BHfzaaPUxpXfcpmmmJ3ABHVqf03ifuysQFxnkLfjrTM=";
}; };
strictDeps = !withIntrospection;
depsBuildBuild = [ depsBuildBuild = [
pkg-config pkg-config
]; ];
@ -44,9 +39,7 @@ stdenv.mkDerivation rec {
meson ninja meson ninja
glib # for glib-mkenum glib # for glib-mkenum
pkg-config pkg-config
] ++ lib.optionals withIntrospection [
gobject-introspection gobject-introspection
] ++ lib.optionals withDocs [
gi-docgen gi-docgen
python3 python3
]; ];
@ -71,8 +64,7 @@ stdenv.mkDerivation rec {
]; ];
mesonFlags = [ mesonFlags = [
"-Dgtk_doc=${lib.boolToString withDocs}" "-Dgtk_doc=true"
"-Dintrospection=${if withIntrospection then "enabled" else "disabled"}"
] ++ lib.optionals (!x11Support) [ ] ++ lib.optionals (!x11Support) [
"-Dxft=disabled" # only works with x11 "-Dxft=disabled" # only works with x11
]; ];
@ -82,9 +74,20 @@ stdenv.mkDerivation rec {
fontDirectories = [ freefont_ttf ]; fontDirectories = [ freefont_ttf ];
}; };
# Run-time dependency gi-docgen found: NO (tried pkgconfig and cmake)
# it should be a build-time dep for build
# TODO: send upstream
postPatch = ''
substituteInPlace meson.build \
--replace "dependency('gi-docgen', ver" "dependency('gi-docgen', native:true, ver"
substituteInPlace docs/meson.build \
--replace "'gi-docgen', req" "'gi-docgen', native:true, req"
'';
doCheck = false; # test-font: FAIL doCheck = false; # test-font: FAIL
postFixup = lib.optionalString withDocs '' postFixup = ''
# Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
moveToOutput "share/doc" "$devdoc" moveToOutput "share/doc" "$devdoc"
''; '';

View file

@ -6,6 +6,7 @@
, expat , expat
, pam , pam
, meson , meson
, mesonEmulatorHook
, ninja , ninja
, perl , perl
, rsync , rsync
@ -23,10 +24,6 @@
, useSystemd ? stdenv.isLinux , useSystemd ? stdenv.isLinux
, systemd , systemd
, elogind , elogind
# needed until gobject-introspection does cross-compile (https://github.com/NixOS/nixpkgs/pull/88222)
, withIntrospection ? (stdenv.buildPlatform == stdenv.hostPlatform)
# cross build fails on polkit-1-scan (https://github.com/NixOS/nixpkgs/pull/152704)
, withGtkDoc ? (stdenv.buildPlatform == stdenv.hostPlatform)
# A few tests currently fail on musl (polkitunixusertest, polkitunixgrouptest, polkitidentitytest segfault). # A few tests currently fail on musl (polkitunixusertest, polkitunixgrouptest, polkitidentitytest segfault).
# Not yet investigated; it may be due to the "Make netgroup support optional" # Not yet investigated; it may be due to the "Make netgroup support optional"
# patch not updating the tests correctly yet, or doing something wrong, # patch not updating the tests correctly yet, or doing something wrong,
@ -88,6 +85,10 @@ stdenv.mkDerivation rec {
}) })
]; ];
depsBuildBuild = [
pkg-config
];
nativeBuildInputs = [ nativeBuildInputs = [
glib glib
gtk-doc gtk-doc
@ -97,7 +98,8 @@ stdenv.mkDerivation rec {
ninja ninja
perl perl
rsync rsync
(python3.withPackages (pp: with pp; [ gobject-introspection
(python3.pythonForBuild.withPackages (pp: with pp; [
dbus-python dbus-python
(python-dbusmock.overridePythonAttrs (attrs: { (python-dbusmock.overridePythonAttrs (attrs: {
# Avoid dependency cycle. # Avoid dependency cycle.
@ -109,17 +111,18 @@ stdenv.mkDerivation rec {
libxslt libxslt
docbook-xsl-nons docbook-xsl-nons
docbook_xml_dtd_412 docbook_xml_dtd_412
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
mesonEmulatorHook
]; ];
buildInputs = [ buildInputs = [
expat expat
pam pam
spidermonkey_78 spidermonkey_78
dbus
] ++ lib.optionals stdenv.isLinux [ ] ++ lib.optionals stdenv.isLinux [
# On Linux, fall back to elogind when systemd support is off. # On Linux, fall back to elogind when systemd support is off.
(if useSystemd then systemd else elogind) (if useSystemd then systemd else elogind)
] ++ lib.optionals withIntrospection [
gobject-introspection
]; ];
propagatedBuildInputs = [ propagatedBuildInputs = [
@ -136,9 +139,7 @@ stdenv.mkDerivation rec {
"-Dsystemdsystemunitdir=${placeholder "out"}/etc/systemd/system" "-Dsystemdsystemunitdir=${placeholder "out"}/etc/systemd/system"
"-Dpolkitd_user=polkituser" #TODO? <nixos> config.ids.uids.polkituser "-Dpolkitd_user=polkituser" #TODO? <nixos> config.ids.uids.polkituser
"-Dos_type=redhat" # only affects PAM includes "-Dos_type=redhat" # only affects PAM includes
"-Dintrospection=${lib.boolToString withIntrospection}"
"-Dtests=${lib.boolToString doCheck}" "-Dtests=${lib.boolToString doCheck}"
"-Dgtk_doc=${lib.boolToString withGtkDoc}"
"-Dman=true" "-Dman=true"
] ++ lib.optionals stdenv.isLinux [ ] ++ lib.optionals stdenv.isLinux [
"-Dsession_tracking=${if useSystemd then "libsystemd-login" else "libelogind"}" "-Dsession_tracking=${if useSystemd then "libsystemd-login" else "libelogind"}"

View file

@ -25,6 +25,7 @@
, json-glib , json-glib
, systemd , systemd
, dbus , dbus
, writeText
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -46,6 +47,10 @@ stdenv.mkDerivation rec {
patchShebangs utils/data-generators/cc/generate patchShebangs utils/data-generators/cc/generate
''; '';
depsBuildBuild = [
pkg-config
];
nativeBuildInputs = [ nativeBuildInputs = [
meson meson
ninja ninja
@ -58,11 +63,8 @@ stdenv.mkDerivation rec {
gobject-introspection gobject-introspection
docbook-xsl-nons docbook-xsl-nons
docbook_xml_dtd_45 docbook_xml_dtd_45
python3 # for data-generators (python3.pythonForBuild.withPackages (p: [ p.pygobject3 ]))
systemd # used for checks to install systemd user service ];
dbus # used for checks and pkg-config to install dbus service/s
] ++ checkInputs; # gi is in the main meson.build and checked regardless of
# whether tests are enabled
buildInputs = [ buildInputs = [
glib glib
@ -74,15 +76,24 @@ stdenv.mkDerivation rec {
libuuid libuuid
json-glib json-glib
libstemmer libstemmer
]; dbus
systemd
checkInputs = with python3.pkgs; [
pygobject3
]; ];
mesonFlags = [ mesonFlags = [
"-Ddocs=true" "-Ddocs=true"
]; ] ++ (
let
# https://gitlab.gnome.org/GNOME/tracker/-/blob/master/meson.build#L159
crossFile = writeText "cross-file.conf" ''
[properties]
sqlite3_has_fts5 = '${lib.boolToString (lib.hasInfix "-DSQLITE_ENABLE_FTS3" sqlite.NIX_CFLAGS_COMPILE)}'
'';
in
[
"--cross-file=${crossFile}"
]
);
doCheck = true; doCheck = true;