2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, libtiff, fpc }:
|
2018-11-25 16:40:41 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "deskew";
|
2022-02-05 21:24:34 +01:00
|
|
|
version = "1.30";
|
2018-11-25 16:40:41 +01:00
|
|
|
|
2020-11-18 15:37:57 +01:00
|
|
|
src = fetchFromGitHub {
|
2018-11-25 16:40:41 +01:00
|
|
|
owner = "galfar";
|
2020-11-18 15:37:57 +01:00
|
|
|
repo = pname;
|
2018-11-25 16:40:41 +01:00
|
|
|
rev = "v${version}";
|
2022-02-05 21:24:34 +01:00
|
|
|
hash = "sha256-xghVOEMkQ/mXpOzJqMaT3SII7xneMNoFqRlqjtzmDnA=";
|
2018-11-25 16:40:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ fpc ];
|
|
|
|
buildInputs = [ libtiff ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
2022-02-05 21:24:34 +01:00
|
|
|
runHook preBuild
|
|
|
|
patchShebangs ./Scripts
|
2022-11-03 15:22:07 +01: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-05 21:24:34 +01:00
|
|
|
pushd Scripts && ./compile.sh && popd
|
|
|
|
runHook postBuild
|
2018-11-25 16:40:41 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2022-02-05 21:24:34 +01:00
|
|
|
runHook preInstall
|
|
|
|
install -Dt $out/bin Bin/deskew
|
|
|
|
runHook postInstall
|
2018-11-25 16:40:41 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2018-11-25 16:40:41 +01:00
|
|
|
description = "A command line tool for deskewing scanned text documents";
|
2022-02-05 21:24:34 +01:00
|
|
|
homepage = "https://galfar.vevb.net/deskew";
|
|
|
|
license = with licenses; [ mit mpl11 ];
|
2018-11-25 16:40:41 +01:00
|
|
|
maintainers = with maintainers; [ryantm];
|
|
|
|
platforms = platforms.all;
|
2024-02-11 03:19:15 +01:00
|
|
|
mainProgram = "deskew";
|
2018-11-25 16:40:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|