nixpkgs/pkgs/development/libraries/hspell/default.nix
Christian Kampka 67f0a216e5
hspell: fix cross-platform build issues
hspell uses a couple of binaries it generates during it's own build.
These will cause the build to fail later in cross-platform builds as
these binaries have the wrong executable format.
Using a hspell to bootstrap it's own build natively resolves this issue.
2020-09-02 16:41:51 +02:00

39 lines
1.3 KiB
Nix

{ stdenv, fetchurl, perl, zlib, buildPackages }:
stdenv.mkDerivation rec {
name = "${passthru.pname}-${passthru.version}";
passthru = {
pname = "hspell";
version = "1.1";
};
PERL_USE_UNSAFE_INC = "1";
src = fetchurl {
url = "${meta.homepage}${name}.tar.gz";
sha256 = "08x7rigq5pa1pfpl30qp353hbdkpadr1zc49slpczhsn0sg36pd6";
};
patchPhase = ''patchShebangs .'';
preBuild = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
make CC=${buildPackages.stdenv.cc}/bin/cc find_sizes
mv find_sizes find_sizes_build
make clean
substituteInPlace Makefile --replace "./find_sizes" "./find_sizes_build"
substituteInPlace Makefile --replace "ar cr" "${stdenv.lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar cr"
substituteInPlace Makefile --replace "ranlib" "${stdenv.lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib"
substituteInPlace Makefile --replace "STRIP=strip" "STRIP=${stdenv.lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}strip"
'';
nativeBuildInputs = [ perl zlib ];
# buildInputs = [ zlib ];
meta = with stdenv.lib; {
description = "Hebrew spell checker";
homepage = "http://hspell.ivrix.org.il/";
platforms = platforms.all;
license = licenses.gpl2;
};
}