2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, libtiff, fpc }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
|
|
|
pname = "deskew";
|
2022-02-10 20:34:41 +00:00
|
|
|
version = "1.30";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-11-24 20:58:05 +00:00
|
|
|
src = fetchFromGitHub {
|
2020-04-24 23:36:52 +00:00
|
|
|
owner = "galfar";
|
2020-11-24 20:58:05 +00:00
|
|
|
repo = pname;
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = "v${version}";
|
2022-02-10 20:34:41 +00:00
|
|
|
hash = "sha256-xghVOEMkQ/mXpOzJqMaT3SII7xneMNoFqRlqjtzmDnA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ fpc ];
|
|
|
|
buildInputs = [ libtiff ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
2022-02-10 20:34:41 +00:00
|
|
|
runHook preBuild
|
|
|
|
patchShebangs ./Scripts
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
# Deskew insists on using dlopen to load libtiff, we insist it links against it.
|
|
|
|
sed -i -e 's/{$DEFINE DYNAMIC_DLL_LOADING}//' Imaging/LibTiff/LibTiffDynLib.pas
|
|
|
|
sed -i -e 's/if LibTiffDynLib\.LoadTiffLibrary then//' Imaging/LibTiff/ImagingTiffLib.pas
|
|
|
|
# Make sure libtiff is in the RPATH, so that Nix can find and track the runtime dependency
|
|
|
|
export NIX_LDFLAGS="$NIX_LDFLAGS -rpath ${lib.getLib libtiff}/lib"
|
2022-02-10 20:34:41 +00:00
|
|
|
pushd Scripts && ./compile.sh && popd
|
|
|
|
runHook postBuild
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2022-02-10 20:34:41 +00:00
|
|
|
runHook preInstall
|
|
|
|
install -Dt $out/bin Bin/deskew
|
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A command line tool for deskewing scanned text documents";
|
2022-02-10 20:34:41 +00:00
|
|
|
homepage = "https://galfar.vevb.net/deskew";
|
|
|
|
license = with licenses; [ mit mpl11 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ryantm];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|