90 lines
2.1 KiB
Nix
90 lines
2.1 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchurl
|
|
, lsb-release
|
|
, fftw
|
|
, fftwFloat
|
|
, libpng
|
|
, lua
|
|
, zlib
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "im";
|
|
version = "3.15";
|
|
|
|
src = fetchurl {
|
|
url = "mirror://sourceforge/imtoolkit/${version}/Docs%20and%20Sources/${pname}-${version}_Sources.tar.gz";
|
|
sha256 = "sha256-NsxCV/j1+BEouFS7O+KcXL3QkUdlKPMVr2ZtCTC5tX4=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
lsb-release
|
|
];
|
|
|
|
buildInputs = [
|
|
fftw
|
|
fftwFloat
|
|
libpng
|
|
lua
|
|
zlib
|
|
];
|
|
|
|
|
|
postPatch = ''
|
|
sed -i '1i#include <unistd.h>' src/libjasper2/base/jas_stream.c
|
|
'';
|
|
|
|
makeFlags = [
|
|
"NO_DEPEND=Yes"
|
|
"USE_LUA_VERSION=52"
|
|
];
|
|
|
|
pc = ''
|
|
prefix=${placeholder "out"}
|
|
exec_prefix=${placeholder "out"}
|
|
libdir=${placeholder "out"}/lib
|
|
includedir=${placeholder "out"}/include
|
|
|
|
Name: IM
|
|
Description: A toolkit for image representation, storage, capture and processing
|
|
Version: ${version}
|
|
Libs: -L${placeholder "out"} -lim -lim_jp2 -lim_process -lim_process_omp -lim_fftw3
|
|
Cflags: -I${placeholder "out"}/include
|
|
Requires: fftw3 libpng zlib
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/{include,lib/pkgconfig,share/lua/5.2}
|
|
|
|
cp -v lib/Linux*/*.so $out/lib/
|
|
cp -v lib/Linux*/*.a $out/lib/ || true
|
|
cp -vr include/*.h $out/include/
|
|
|
|
cp -v lib/Linux*/Lua*/*.so $out/lib/
|
|
cp -v lib/Linux*/Lua*/*.a $out/lib/ || true
|
|
|
|
ln -fs $out/lib/libimlua52.so $out/share/lua/5.2/imlua.so
|
|
ln -fs $out/lib/libimlua_jp252.so $out/share/lua/5.2/imlua_jp2.so
|
|
ln -fs $out/lib/libimlua_process52.so $out/share/lua/5.2/imlua_process.so
|
|
ln -fs $out/lib/libimlua_process_omp52.so $out/share/lua/5.2/imlua_process_omp.so
|
|
ln -fs $out/lib/libimlua_fftw352.so $out/share/lua/5.2/imlua_fftw3.so
|
|
|
|
# Since IM doesn't supply it, provide pkg-config file.
|
|
cat > $out/lib/pkgconfig/im.pc <<EOF
|
|
${pc}
|
|
EOF
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "A toolkit for image representation, storage, capture and processing";
|
|
license = licenses.mit;
|
|
maintainers = [ eko5z ];
|
|
platforms = with platforms; gnu ++ linux ++ darwin;
|
|
};
|
|
}
|