summaryrefslogtreecommitdiffstats
path: root/pkgs/tools/archivers/zpaq
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com>2015-12-31 04:36:54 +0100
committerTobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com>2015-12-31 05:04:05 +0100
commitd04e57ea6a39992cb90d59b212576b090328ae60 (patch)
tree77f1b4b3d5b8175bcbc47981e319b4b0e8d4428c /pkgs/tools/archivers/zpaq
parent624b3a34c04503a2fbd19e2b0a897bb2d28666a9 (diff)
zpaq{,d}: un-break compileFlags and stop using -march=native
Running zpaq on an older but not ancient 64-bit Intel server aborts with an ‘Illegal instruction’ error. Turns out the build expression was using -march=native to generate distibution binaries... Change this to more conservative, portable settings which should cover ‘all’ CPUs. It may run slightly slower — but that at least implies running. As a nice side effect, all common compile flags are now back in `compileFlags` whence they came, and actually used consistently.
Diffstat (limited to 'pkgs/tools/archivers/zpaq')
-rw-r--r--pkgs/tools/archivers/zpaq/default.nix15
-rw-r--r--pkgs/tools/archivers/zpaq/zpaqd.nix15
2 files changed, 16 insertions, 14 deletions
diff --git a/pkgs/tools/archivers/zpaq/default.nix b/pkgs/tools/archivers/zpaq/default.nix
index c8f3a890487f..fddb3cbfb154 100644
--- a/pkgs/tools/archivers/zpaq/default.nix
+++ b/pkgs/tools/archivers/zpaq/default.nix
@@ -14,11 +14,12 @@ let
];
isUnix = with stdenv; isLinux || isGNU || isDarwin || isFreeBSD || isOpenBSD;
isx86 = stdenv.isi686 || stdenv.isx86_64;
- compileFlags = ""
- + (stdenv.lib.optionalString isUnix " -Dunix -pthread ")
- + (stdenv.lib.optionalString (!isx86) " -DNOJIT ")
- + " -DNDEBUG "
- + " -fPIC "
+ compileFlags = with stdenv; ""
+ + (lib.optionalString (isUnix) " -Dunix -pthread")
+ + (lib.optionalString (isi686) " -march=i686")
+ + (lib.optionalString (isx86_64) " -march=nocona")
+ + (lib.optionalString (!isx86) " -DNOJIT")
+ + " -O3 -mtune=generic -DNDEBUG"
;
in
stdenv.mkDerivation {
@@ -29,8 +30,8 @@ stdenv.mkDerivation {
};
sourceRoot = ".";
buildPhase = ''
- g++ -O3 -march=native -Dunix libzpaq.cpp -pthread --shared -o libzpaq.so -fPIC
- g++ -O3 -march=native -Dunix zpaq.cpp -lzpaq -L. -L"$out/lib" -pthread -o zpaq
+ g++ ${compileFlags} -fPIC --shared libzpaq.cpp -o libzpaq.so
+ g++ ${compileFlags} -L. -L"$out/lib" -lzpaq zpaq.cpp -o zpaq
'';
installPhase = ''
mkdir -p "$out"/{bin,include,lib,share/doc/zpaq}
diff --git a/pkgs/tools/archivers/zpaq/zpaqd.nix b/pkgs/tools/archivers/zpaq/zpaqd.nix
index 65f40f68f550..5518a94ba21f 100644
--- a/pkgs/tools/archivers/zpaq/zpaqd.nix
+++ b/pkgs/tools/archivers/zpaq/zpaqd.nix
@@ -14,11 +14,12 @@ let
];
isUnix = with stdenv; isLinux || isGNU || isDarwin || isFreeBSD || isOpenBSD;
isx86 = stdenv.isi686 || stdenv.isx86_64;
- compileFlags = ""
- + (stdenv.lib.optionalString isUnix " -Dunix -pthread ")
- + (stdenv.lib.optionalString (!isx86) " -DNOJIT ")
- + " -DNDEBUG "
- + " -fPIC "
+ compileFlags = with stdenv; ""
+ + (lib.optionalString (isUnix) " -Dunix -pthread")
+ + (lib.optionalString (isi686) " -march=i686")
+ + (lib.optionalString (isx86_64) " -march=nocona")
+ + (lib.optionalString (!isx86) " -DNOJIT")
+ + " -O3 -mtune=generic -DNDEBUG"
;
in
stdenv.mkDerivation {
@@ -29,8 +30,8 @@ stdenv.mkDerivation {
};
sourceRoot = ".";
buildPhase = ''
- g++ -shared -O3 libzpaq.cpp ${compileFlags} -o libzpaq.so
- g++ -O3 -L. -L"$out/lib" -lzpaq zpaqd.cpp -o zpaqd
+ g++ ${compileFlags} -fPIC --shared libzpaq.cpp -o libzpaq.so
+ g++ ${compileFlags} -L. -L"$out/lib" -lzpaq zpaqd.cpp -o zpaqd
'';
installPhase = ''
mkdir -p "$out"/{bin,include,lib,share/doc/zpaq}