luaPackages.magick: init at 1.6.0

This commit is contained in:
Donovan Glover 2023-07-15 13:15:36 -04:00 committed by Matthieu Coudron
parent 752398b625
commit 895d66d915
4 changed files with 105 additions and 0 deletions

View File

@ -86,6 +86,7 @@ luuid,,,,,,
luv,,,,1.44.2-1,,
lush.nvim,https://github.com/rktjmp/lush.nvim,,,,,teto
lyaml,,,,,,lblasc
magick,,,,,,donovanglover
markdown,,,,,,
mediator_lua,,,,,,
mpack,,,,,,

1 name src ref server version luaversion maintainers
86 luv 1.44.2-1
87 lush.nvim https://github.com/rktjmp/lush.nvim teto
88 lyaml lblasc
89 magick donovanglover
90 markdown
91 mediator_lua
92 mpack

View File

@ -2416,6 +2416,37 @@ buildLuarocksPackage {
};
}) {};
magick = callPackage({ fetchgit, buildLuarocksPackage, lua }:
buildLuarocksPackage {
pname = "magick";
version = "1.6.0-1";
knownRockspec = (fetchurl {
url = "mirror://luarocks/magick-1.6.0-1.rockspec";
sha256 = "1pg150xsxnqvlhxpiy17s9hm4dkc84v46mlwi9rhriynqz8qks9w";
}).outPath;
src = fetchgit ( removeAttrs (builtins.fromJSON ''{
"url": "https://github.com/leafo/magick.git",
"rev": "6971fa700c4d392130492a3925344b51c7cc54aa",
"date": "2022-03-10T20:02:11-08:00",
"path": "/nix/store/fpl99q09zg3qnk4kagxk1djabl1dm47l-magick",
"sha256": "01b9qsz27f929rz5z7vapqhazxak74sichdwkjwb219nlhrwfncm",
"fetchLFS": false,
"fetchSubmodules": true,
"deepClone": false,
"leaveDotGit": false
}
'') ["date" "path"]) ;
disabled = (lua.luaversion != "5.1");
propagatedBuildInputs = [ lua ];
meta = {
homepage = "git://github.com/leafo/magick.git";
description = "Lua bindings to ImageMagick & GraphicsMagick for LuaJIT using FFI";
license.fullName = "MIT";
};
}) {};
markdown = callPackage({ buildLuarocksPackage, luaAtLeast, fetchgit, luaOlder, lua }:
buildLuarocksPackage {
pname = "markdown";

View File

@ -0,0 +1,53 @@
diff --git a/magick/wand/lib.lua b/magick/wand/lib.lua
index 21940a0..0d103dc 100644
--- a/magick/wand/lib.lua
+++ b/magick/wand/lib.lua
@@ -134,15 +134,6 @@ get_filters = function()
local prefixes = {
"/usr/include/ImageMagick",
"/usr/local/include/ImageMagick",
- unpack((function()
- local _accum_0 = { }
- local _len_0 = 1
- for p in get_flags():gmatch("-I([^%s]+)") do
- _accum_0[_len_0] = p
- _len_0 = _len_0 + 1
- end
- return _accum_0
- end)())
}
for _index_0 = 1, #prefixes do
local p = prefixes[_index_0]
@@ -204,12 +195,7 @@ try_to_load = function(...)
break
end
end
- if pcall(function()
- out = ffi.load(name)
- end) then
- return out
- end
- _continue_0 = true
+ return ffi.load(name)
until true
if not _continue_0 then
break
@@ -217,17 +203,7 @@ try_to_load = function(...)
end
return error("Failed to load ImageMagick (" .. tostring(...) .. ")")
end
-lib = try_to_load("MagickWand", function()
- local lname = get_flags():match("-l(MagickWand[^%s]*)")
- local suffix
- if ffi.os == "OSX" then
- suffix = ".dylib"
- elseif ffi.os == "Windows" then
- suffix = ".dll"
- else
- suffix = ".so"
- end
- return lname and "lib" .. lname .. suffix
+lib = try_to_load("@nix_wand@", function()
end)
return {
lib = lib,

View File

@ -15,6 +15,7 @@
, gnulib
, gnum4
, gobject-introspection
, imagemagick
, installShellFiles
, lib
, libevent
@ -477,6 +478,25 @@ with prev;
];
});
magick = prev.magick.overrideAttrs (oa: {
buildInputs = oa.buildInputs ++ [
imagemagick
];
# Fix MagickWand not being found in the pkg-config search path
patches = [
./magick.patch
];
postPatch = ''
substituteInPlace magick/wand/lib.lua \
--replace @nix_wand@ ${imagemagick}/lib/libMagickWand-7.Q16HDRI.so
'';
# Requires ffi
meta.broken = !isLuaJIT;
});
mpack = prev.mpack.overrideAttrs (drv: {
buildInputs = (drv.buildInputs or []) ++ [ libmpack ];
env = {