git.iko.soy/typeable/nixpkgs
on master help sign in
libargon2: fixed cross-compilation

Makefile had a hardcoded unprefixed ar. I wrote a patch (sending it upstream) and added an optional make flag to override it in case we're cross-compiling. Unfortunately, this causes a rebuild of native packages. This commit also fixes the pkg-config file to be generated correctly, patch was provided by @worldofpeace.

commit06073ae7df9f0202c864a7d91ed9ac40b388fd4a authorVika <kisik21@fireburn.ru> dateMon 26 Aug 2019, 13:40 (7 years ago) parent3f6d0a9
1 file changed+15−12
pkgs/development/libraries/libargon2/default.nix+15−12
pkgs/development/libraries/libargon2/default.nix+15−12
@@ -1,4 +1,4 @@
1−{ stdenv, fetchFromGitHub }:
1+{ stdenv, fetchFromGitHub, fetchpatch }:
22
33stdenv.mkDerivation rec {
44 pname = "libargon2";
@@ -11,18 +11,21 @@ stdenv.mkDerivation rec {
1111 sha256 = "0p4ry9dn0mi9js0byijxdyiwx74p1nr8zj7wjpd1fjgqva4sk23i";
1212 };
1313
14− installPhase = ''
15− runHook preInstall
16− mkdir -p $out/lib/pkgconfig
17− substitute libargon2.pc $out/lib/pkgconfig/libargon2.pc \
18− --replace @UPSTREAM_VER@ "${version}" \
19− --replace @HOST_MULTIARCH@ "" \
20− --replace 'prefix=/usr' "prefix=$out"
14+ patches = [
15+ # TODO: remove when https://github.com/P-H-C/phc-winner-argon2/pull/277 is merged + released
16+ (fetchpatch {
17+ url = "https://github.com/P-H-C/phc-winner-argon2/commit/cd1c1d8d204e4ec4557e358013567c097cb70562.patch";
18+ sha256 = "0whqv8b6q9602n7vxpzbd8bk8wz22r1jz9x5lrm9z7ib3wz81c8a";
19+ })
20+ ];
2121
22− make install PREFIX=$out LIBRARY_REL=lib
23− ln -s $out/lib/libargon2.so $out/lib/libargon2.so.0
24− runHook postInstall
25− '';
22+ makeFlags = [
23+ "AR=${stdenv.cc.targetPrefix}ar" # Fix cross-compilation
24+ "PREFIX=${placeholder "out"}"
25+ "ARGON2_VERSION=${version}"
26+ "LIBRARY_REL=lib"
27+ "PKGCONFIG_REL=lib"
28+ ];
2629
2730 meta = with stdenv.lib; {
2831 description = "A key derivation function that was selected as the winner of the Password Hashing Competition in July 2015";