2021-05-20 23:08:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-11-12 09:05:59 +00:00
|
|
|
, fetchurl
|
|
|
|
, meson
|
|
|
|
, ninja
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-11-12 09:05:59 +00:00
|
|
|
, gobject-introspection
|
|
|
|
, vala
|
2022-03-30 09:31:56 +00:00
|
|
|
, gi-docgen
|
2021-12-06 16:07:01 +00:00
|
|
|
, glib
|
|
|
|
, gsettings-desktop-schemas
|
2020-11-12 09:05:59 +00:00
|
|
|
, gtk3
|
2021-05-20 23:08:51 +00:00
|
|
|
, enableGlade ? false
|
2020-11-12 09:05:59 +00:00
|
|
|
, glade
|
2021-05-20 23:08:51 +00:00
|
|
|
, xvfb-run
|
2020-11-12 09:05:59 +00:00
|
|
|
, gdk-pixbuf
|
|
|
|
, librsvg
|
2022-04-27 09:35:20 +00:00
|
|
|
, libxml2
|
2020-04-24 23:36:52 +00:00
|
|
|
, hicolor-icon-theme
|
2020-11-19 00:13:47 +00:00
|
|
|
, at-spi2-atk
|
|
|
|
, at-spi2-core
|
2021-05-20 23:08:51 +00:00
|
|
|
, gnome
|
|
|
|
, libhandy
|
|
|
|
, runCommand
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libhandy";
|
2022-04-27 09:35:20 +00:00
|
|
|
version = "1.6.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"dev"
|
2022-06-16 17:23:12 +00:00
|
|
|
] ++ lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [
|
2021-05-20 23:08:51 +00:00
|
|
|
"devdoc"
|
|
|
|
] ++ lib.optionals enableGlade [
|
|
|
|
"glade"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
outputBin = "dev";
|
|
|
|
|
2020-11-12 09:05:59 +00:00
|
|
|
src = fetchurl {
|
2021-02-05 17:12:51 +00:00
|
|
|
url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
|
2022-04-27 09:35:20 +00:00
|
|
|
sha256 = "sha256-f6iaqoeWa20PX0700+/a9lTisB6ix84r1wMB0fn0LKM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-11-12 09:05:59 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
gobject-introspection
|
2022-03-30 09:31:56 +00:00
|
|
|
gi-docgen
|
2020-11-12 09:05:59 +00:00
|
|
|
meson
|
|
|
|
ninja
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-11-12 09:05:59 +00:00
|
|
|
vala
|
2022-04-27 09:35:20 +00:00
|
|
|
] ++ lib.optionals enableGlade [
|
|
|
|
libxml2 # for xmllint
|
2020-05-15 21:57:56 +00:00
|
|
|
];
|
|
|
|
|
2020-11-12 09:05:59 +00:00
|
|
|
buildInputs = [
|
|
|
|
gdk-pixbuf
|
|
|
|
gtk3
|
2021-05-20 23:08:51 +00:00
|
|
|
] ++ lib.optionals enableGlade [
|
|
|
|
glade
|
2020-11-12 09:05:59 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
2021-05-20 23:08:51 +00:00
|
|
|
xvfb-run
|
2020-11-19 00:13:47 +00:00
|
|
|
at-spi2-atk
|
|
|
|
at-spi2-core
|
|
|
|
librsvg
|
|
|
|
hicolor-icon-theme
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
mesonFlags = [
|
2022-06-16 17:23:12 +00:00
|
|
|
"-Dgtk_doc=${lib.boolToString (stdenv.buildPlatform == stdenv.hostPlatform)}"
|
2021-05-20 23:08:51 +00:00
|
|
|
"-Dglade_catalog=${if enableGlade then "enabled" else "disabled"}"
|
2022-06-16 17:23:12 +00:00
|
|
|
"-Dintrospection=${if (stdenv.buildPlatform == stdenv.hostPlatform) then "enabled" else "disabled"}"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
# Uses define_variable in pkg-config, but we still need it to use the glade output
|
2020-04-24 23:36:52 +00:00
|
|
|
PKG_CONFIG_GLADEUI_2_0_MODULEDIR = "${placeholder "glade"}/lib/glade/modules";
|
|
|
|
PKG_CONFIG_GLADEUI_2_0_CATALOGDIR = "${placeholder "glade"}/share/glade/catalogs";
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
doCheck = !stdenv.isDarwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
checkPhase = ''
|
2021-12-06 16:07:01 +00:00
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
testEnvironment=(
|
|
|
|
# Disable portal since we cannot run it in tests.
|
|
|
|
HDY_DISABLE_PORTAL=1
|
|
|
|
|
|
|
|
"XDG_DATA_DIRS=${lib.concatStringsSep ":" [
|
|
|
|
# HdySettings needs to be initialized from “org.gnome.desktop.interface” GSettings schema when portal is not used for color scheme.
|
|
|
|
# It will not actually be used since the “color-scheme” key will only have been introduced in GNOME 42, falling back to detecting theme name.
|
|
|
|
# See hdy_settings_constructed function in https://gitlab.gnome.org/GNOME/libhandy/-/commit/bb68249b005c445947bfb2bee66c91d0fe9c41a4
|
2022-01-13 20:06:32 +00:00
|
|
|
(glib.getSchemaDataDirPath gsettings-desktop-schemas)
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
# Some tests require icons
|
|
|
|
"${hicolor-icon-theme}/share"
|
|
|
|
]}"
|
|
|
|
)
|
|
|
|
env "''${testEnvironment[@]}" xvfb-run \
|
2020-04-24 23:36:52 +00:00
|
|
|
meson test --print-errorlogs
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
runHook postCheck
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
postFixup = ''
|
|
|
|
# Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
|
|
|
|
moveToOutput "share/doc" "$devdoc"
|
|
|
|
'';
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
passthru = {
|
|
|
|
updateScript = gnome.updateScript {
|
|
|
|
packageName = pname;
|
|
|
|
};
|
|
|
|
} // lib.optionalAttrs (!enableGlade) {
|
|
|
|
glade =
|
|
|
|
let
|
|
|
|
libhandyWithGlade = libhandy.override {
|
|
|
|
enableGlade = true;
|
|
|
|
};
|
|
|
|
in runCommand "${libhandy.name}-glade" {} ''
|
|
|
|
cp -r "${libhandyWithGlade.glade}" "$out"
|
|
|
|
chmod -R +w "$out"
|
|
|
|
sed -e "s#${libhandyWithGlade.out}#${libhandy.out}#g" -e "s#${libhandyWithGlade.glade}#$out#g" -i $(find "$out" -type f)
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-11-12 09:05:59 +00:00
|
|
|
changelog = "https://gitlab.gnome.org/GNOME/libhandy/-/tags/${version}";
|
|
|
|
description = "Building blocks for modern adaptive GNOME apps";
|
|
|
|
homepage = "https://gitlab.gnome.org/GNOME/libhandy";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.lgpl21Plus;
|
2020-11-12 09:05:59 +00:00
|
|
|
maintainers = teams.gnome.members;
|
2021-09-18 10:52:07 +00:00
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|