zpaqd: Modernize derivation

- Simplified platform-specific options
 - Almost ready for cross-compilation
This commit is contained in:
John Ericson 2017-05-22 17:09:06 -04:00
parent c443033be3
commit fedcda6cda
2 changed files with 13 additions and 12 deletions

View File

@ -7,6 +7,7 @@ rec {
"64bit" = { cpu = { bits = 64; }; }; "64bit" = { cpu = { bits = 64; }; };
i686 = { cpu = cpuTypes.i686; }; i686 = { cpu = cpuTypes.i686; };
x86_64 = { cpu = cpuTypes.x86_64; }; x86_64 = { cpu = cpuTypes.x86_64; };
x86 = { cpu = { family = "x86"; }; };
Arm = { cpu = { family = "arm"; }; }; Arm = { cpu = { family = "arm"; }; };
Mips = { cpu = { family = "mips"; }; }; Mips = { cpu = { family = "mips"; }; };
BigEndian = { cpu = { significantByte = significantBytes.bigEndian; }; }; BigEndian = { cpu = { significantByte = significantBytes.bigEndian; }; };

View File

@ -1,7 +1,10 @@
{ stdenv, fetchurl, unzip }: { stdenv, fetchurl, unzip
, buildPlatform, hostPlatform
}:
let let
s = # Generated upstream information # Generated upstream information
rec { s = rec {
baseName="zpaqd"; baseName="zpaqd";
version="715"; version="715";
name="${baseName}-${version}"; name="${baseName}-${version}";
@ -9,15 +12,12 @@ let
url="http://mattmahoney.net/dc/zpaqd715.zip"; url="http://mattmahoney.net/dc/zpaqd715.zip";
sha256="0868lynb45lm79yvx5f10lj5h6bfv0yck8whcls2j080vmk3n7rk"; sha256="0868lynb45lm79yvx5f10lj5h6bfv0yck8whcls2j080vmk3n7rk";
}; };
isUnix = with stdenv; isLinux || isGNU || isDarwin || isFreeBSD || isOpenBSD;
isx86 = stdenv.isi686 || stdenv.isx86_64; compileFlags = stdenv.lib.concatStringsSep " " ([ "-O3" "-mtune=generic" "-DNDEBUG" ]
compileFlags = with stdenv; "" ++ stdenv.lib.optional (hostPlatform.isUnix) "-Dunix -pthread"
+ (lib.optionalString (isUnix) " -Dunix -pthread") ++ stdenv.lib.optional (hostPlatform.isi686) "-march=i686"
+ (lib.optionalString (isi686) " -march=i686") ++ stdenv.lib.optional (hostPlatform.isx86_64) "-march=nocona"
+ (lib.optionalString (isx86_64) " -march=nocona") ++ stdenv.lib.optional (!hostPlatform.isx86) "-DNOJIT");
+ (lib.optionalString (!isx86) " -DNOJIT")
+ " -O3 -mtune=generic -DNDEBUG"
;
in in
stdenv.mkDerivation { stdenv.mkDerivation {
inherit (s) name version; inherit (s) name version;