summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2010-07-28 13:03:11 +0000
committerPeter Simons <simons@cryp.to>2010-07-28 13:03:11 +0000
commitb89f310c7a3347359e66a61a7366db1b70a8b2c3 (patch)
treea7d6c79d7bbcfde7ab98f8335a1e78dd9684785d
parentd81ed8201f9d0b994725e970fae2efded3468539 (diff)
downloadnixpkgs-b89f310c7a3347359e66a61a7366db1b70a8b2c3.tar
nixpkgs-b89f310c7a3347359e66a61a7366db1b70a8b2c3.tar.gz
nixpkgs-b89f310c7a3347359e66a61a7366db1b70a8b2c3.tar.bz2
nixpkgs-b89f310c7a3347359e66a61a7366db1b70a8b2c3.tar.lz
nixpkgs-b89f310c7a3347359e66a61a7366db1b70a8b2c3.tar.xz
nixpkgs-b89f310c7a3347359e66a61a7366db1b70a8b2c3.tar.zst
nixpkgs-b89f310c7a3347359e66a61a7366db1b70a8b2c3.zip
pkgs/development/libraries/crypto++: fixed build impurity
 * Don't build with "-march=native", because the generated binaries
   won't work reliably on systems with a different CPU. Instead,
   "--march=i686" is used on x86, and "--march=nocona" an x86_64.
   Otherwise, "--march" remains unset.

 * Compile with -O3 instead of -O2. This code is performance-critical.

 * Don't build with '-g'.

svn path=/nixpkgs/trunk/; revision=22785
-rw-r--r--pkgs/development/libraries/crypto++/default.nix11
-rw-r--r--pkgs/top-level/all-packages.nix1
2 files changed, 11 insertions, 1 deletions
diff --git a/pkgs/development/libraries/crypto++/default.nix b/pkgs/development/libraries/crypto++/default.nix
index f1c5db1caf1..a609e43b775 100644
--- a/pkgs/development/libraries/crypto++/default.nix
+++ b/pkgs/development/libraries/crypto++/default.nix
@@ -24,6 +24,17 @@ stdenv.mkDerivation rec {
     sourceRoot="$PWD/${name}"
   '';
 
+  cxxflags = if stdenv.isi686 then "-march=i686" else
+             if stdenv.isx86_64 then "-march=nocona" else
+             "";
+
+  configurePhase = ''
+    sed -i GNUmakefile \
+      -e 's|-march=native|${cxxflags}|g' \
+      -e 's|-mtune=native||g' \
+      -e '/^CXXFLAGS =/s|-g -O2|-O3|'
+  '';
+
   # Deal with one of the crappiest build system around there.
   buildPhase = ''
     # These guys forgot a file or something.
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 342b38b2aa8..1b3a12ffedc 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3761,7 +3761,6 @@ let
   };
 
   cryptopp = import ../development/libraries/crypto++ {
-    # SIDE-EFFECT WARNING: crypto++-5.6.0 is compiled with "-O2 -march=native -mtune=native".
     inherit fetchurl stdenv unzip libtool;
   };