mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
glycin-thumbnailer: init at 2.1.1 (#503377)
This commit is contained in:
commit
51738c1bdc
5 changed files with 191 additions and 17 deletions
|
|
@ -20,8 +20,20 @@
|
|||
shared-mime-info,
|
||||
rustc,
|
||||
rustPlatform,
|
||||
|
||||
# List of loaders to build.
|
||||
# https://gitlab.gnome.org/GNOME/glycin/-/blob/2.1.1/meson_options.txt?ref_type=tags#L26-43
|
||||
enabledLoaders ? [
|
||||
"heif"
|
||||
"image-rs"
|
||||
"jxl"
|
||||
"svg"
|
||||
],
|
||||
}:
|
||||
|
||||
# Doesn't produce any output if no loaders are enabled
|
||||
assert enabledLoaders != [ ];
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "glycin-loaders";
|
||||
|
||||
|
|
@ -59,12 +71,15 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
];
|
||||
|
||||
mesonFlags = [
|
||||
"-Dglycin-loaders=true"
|
||||
"-Dglycin-thumbnailer=false"
|
||||
"-Dlibglycin=false"
|
||||
"-Dlibglycin-gtk4=false"
|
||||
"-Dvapi=false"
|
||||
(lib.mesonBool "glycin-loaders" true)
|
||||
(lib.mesonBool "glycin-thumbnailer" false)
|
||||
(lib.mesonBool "libglycin" false)
|
||||
(lib.mesonBool "libglycin-gtk4" false)
|
||||
(lib.mesonBool "vapi" false)
|
||||
(lib.mesonBool "tests" finalAttrs.finalPackage.doCheck)
|
||||
(lib.mesonOption "loaders" (
|
||||
lib.concatMapStringsSep "," (loader: "glycin-${loader}") enabledLoaders
|
||||
))
|
||||
];
|
||||
|
||||
strictDeps = true;
|
||||
|
|
@ -88,9 +103,16 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
export XDG_CACHE_HOME=$(mktemp -d)
|
||||
'';
|
||||
|
||||
# Thumbnailer files are provided by glycin-thumbnailer
|
||||
postInstall = ''
|
||||
rm -r $out/share/thumbnailers
|
||||
'';
|
||||
|
||||
env.CARGO_BUILD_TARGET = stdenv.hostPlatform.rust.rustcTargetSpec;
|
||||
|
||||
passthru = {
|
||||
inherit enabledLoaders;
|
||||
|
||||
tests = {
|
||||
withTests = finalAttrs.finalPackage.overrideAttrs {
|
||||
doCheck = true;
|
||||
|
|
@ -102,10 +124,12 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
description = "Glycin loaders for several formats";
|
||||
homepage = "https://gitlab.gnome.org/GNOME/glycin";
|
||||
teams = [ lib.teams.gnome ];
|
||||
license = with lib.licenses; [
|
||||
mpl20 # or
|
||||
lgpl21Plus
|
||||
];
|
||||
license =
|
||||
with lib.licenses;
|
||||
OR [
|
||||
mpl20
|
||||
lgpl21Plus
|
||||
];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
})
|
||||
|
|
|
|||
100
pkgs/by-name/gl/glycin-thumbnailer/package.nix
Normal file
100
pkgs/by-name/gl/glycin-thumbnailer/package.nix
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
callPackage,
|
||||
cargo,
|
||||
fontconfig,
|
||||
glib,
|
||||
glycin-loaders,
|
||||
glycin-thumbnailer,
|
||||
libglycin,
|
||||
libseccomp,
|
||||
meson,
|
||||
ninja,
|
||||
pkg-config,
|
||||
rustc,
|
||||
rustPlatform,
|
||||
wrapGAppsNoGuiHook,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "glycin-thumbnailer";
|
||||
|
||||
inherit (libglycin) version src cargoDeps;
|
||||
|
||||
nativeBuildInputs = [
|
||||
cargo
|
||||
libglycin.patchVendorHook
|
||||
meson
|
||||
ninja
|
||||
pkg-config
|
||||
rustc
|
||||
rustPlatform.cargoSetupHook
|
||||
wrapGAppsNoGuiHook
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
fontconfig
|
||||
glib
|
||||
glycin-loaders
|
||||
libglycin
|
||||
libglycin.setupHook
|
||||
libseccomp
|
||||
];
|
||||
|
||||
mesonFlags = [
|
||||
(lib.mesonBool "glycin-loaders" false)
|
||||
(lib.mesonBool "glycin-thumbnailer" true)
|
||||
(lib.mesonBool "libglycin" false)
|
||||
(lib.mesonBool "libglycin-gtk4" false)
|
||||
];
|
||||
|
||||
strictDeps = true;
|
||||
__structuredAttrs = true;
|
||||
|
||||
# Thumbnailer files are in `glycin-loaders`, but we provide them in this package
|
||||
postInstall = ''
|
||||
mkdir -p $out/share/thumbnailers
|
||||
(
|
||||
shopt -s failglob
|
||||
|
||||
for loader in ${lib.concatStringsSep " " glycin-loaders.passthru.enabledLoaders}; do
|
||||
substitute \
|
||||
"../glycin-loaders/glycin-$loader/glycin-$loader.thumbnailer.in" \
|
||||
"$out/share/thumbnailers/glycin-$loader.thumbnailer" \
|
||||
--subst-var-by "BINDIR" "$out/bin"
|
||||
done
|
||||
)
|
||||
'';
|
||||
|
||||
passthru.tests = {
|
||||
all-loaders = glycin-thumbnailer.override {
|
||||
glycin-loaders = glycin-loaders.override {
|
||||
enabledLoaders = [
|
||||
"heif"
|
||||
"image-rs"
|
||||
"jxl"
|
||||
"raw"
|
||||
"svg"
|
||||
];
|
||||
};
|
||||
};
|
||||
thumbnailer = callPackage ./tests.nix { };
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Glycin thumbnailers for several formats";
|
||||
homepage = "https://gitlab.gnome.org/GNOME/glycin";
|
||||
changelog = "https://gitlab.gnome.org/GNOME/glycin/-/tags/${finalAttrs.version}";
|
||||
license =
|
||||
with lib.licenses;
|
||||
OR [
|
||||
mpl20
|
||||
lgpl21Plus
|
||||
];
|
||||
maintainers = with lib.maintainers; [ thunze ];
|
||||
teams = [ lib.teams.gnome ];
|
||||
platforms = lib.platforms.linux;
|
||||
mainProgram = "glycin-thumbnailer";
|
||||
};
|
||||
})
|
||||
44
pkgs/by-name/gl/glycin-thumbnailer/tests.nix
Normal file
44
pkgs/by-name/gl/glycin-thumbnailer/tests.nix
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitLab,
|
||||
glycin-thumbnailer,
|
||||
shared-mime-info,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "glycin-thumbnailer-test";
|
||||
inherit (glycin-thumbnailer) version;
|
||||
|
||||
src = fetchFromGitLab {
|
||||
domain = "gitlab.gnome.org";
|
||||
owner = "sophie-h";
|
||||
repo = "test-images";
|
||||
rev = "f7a06d9131a5686c1b58c56f42f9fda9ea5e620d";
|
||||
hash = "sha256-qoteYmliUha3lY21PRM0FaeYu9aD5MsygBTsTYog9SE=";
|
||||
};
|
||||
|
||||
# Fix incorrectly detected MIME types
|
||||
preBuild = ''
|
||||
export XDG_DATA_DIRS=${shared-mime-info}/share:$XDG_DATA_DIRS
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
cd images/
|
||||
mkdir -p $out
|
||||
|
||||
for image in color/* icon/*; do
|
||||
for size in 128 256 512 1024; do
|
||||
input="file://$(realpath "$image")"
|
||||
output="$out/$(basename "$image")-$size.png"
|
||||
|
||||
${lib.getExe glycin-thumbnailer} -i "$input" -o "$output" -s $size
|
||||
file -E "$output"
|
||||
done
|
||||
done
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
})
|
||||
|
|
@ -96,10 +96,12 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
meta = {
|
||||
description = "C-Bindings to convert glycin frames to GDK Textures";
|
||||
homepage = "https://gitlab.gnome.org/GNOME/glycin";
|
||||
license = with lib.licenses; [
|
||||
mpl20 # or
|
||||
lgpl21Plus
|
||||
];
|
||||
license =
|
||||
with lib.licenses;
|
||||
OR [
|
||||
mpl20
|
||||
lgpl21Plus
|
||||
];
|
||||
teams = [ lib.teams.gnome ];
|
||||
platforms = lib.platforms.linux;
|
||||
pkgConfigModules = [
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
glib,
|
||||
gobject-introspection,
|
||||
glycin-loaders,
|
||||
glycin-thumbnailer,
|
||||
libglycin-gtk4,
|
||||
fontconfig,
|
||||
libseccomp,
|
||||
|
|
@ -153,6 +154,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
tests = {
|
||||
inherit
|
||||
glycin-loaders
|
||||
glycin-thumbnailer
|
||||
libglycin-gtk4
|
||||
;
|
||||
};
|
||||
|
|
@ -162,10 +164,12 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
description = "Sandboxed and extendable image loading library";
|
||||
homepage = "https://gitlab.gnome.org/GNOME/glycin";
|
||||
changelog = "https://gitlab.gnome.org/GNOME/glycin/-/tags/${finalAttrs.version}";
|
||||
license = with lib.licenses; [
|
||||
mpl20 # or
|
||||
lgpl21Plus
|
||||
];
|
||||
license =
|
||||
with lib.licenses;
|
||||
OR [
|
||||
mpl20
|
||||
lgpl21Plus
|
||||
];
|
||||
maintainers = [ ];
|
||||
teams = [ lib.teams.gnome ];
|
||||
platforms = lib.platforms.linux;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue