summary refs log tree commit diff
path: root/pkgs/applications/science
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/science')
-rw-r--r--pkgs/applications/science/biology/minc-tools/default.nix2
-rw-r--r--pkgs/applications/science/biology/neuron/default.nix54
-rw-r--r--pkgs/applications/science/biology/neuron/neuron-carbon-disable.patch21
-rw-r--r--pkgs/applications/science/electronics/caneda/default.nix2
-rw-r--r--pkgs/applications/science/electronics/geda/default.nix4
-rw-r--r--pkgs/applications/science/electronics/gerbv/default.nix4
-rw-r--r--pkgs/applications/science/electronics/gtkwave/default.nix4
-rw-r--r--pkgs/applications/science/electronics/pcb/default.nix4
-rw-r--r--pkgs/applications/science/electronics/qfsm/default.nix2
-rw-r--r--pkgs/applications/science/electronics/tkgate/1.x.nix4
-rw-r--r--pkgs/applications/science/electronics/xoscope/default.nix4
-rw-r--r--pkgs/applications/science/geometry/drgeo/default.nix6
-rw-r--r--pkgs/applications/science/logic/boolector/default.nix7
-rw-r--r--pkgs/applications/science/logic/ltl2ba/default.nix2
-rw-r--r--pkgs/applications/science/logic/otter/default.nix5
-rw-r--r--pkgs/applications/science/logic/prover9/default.nix6
-rw-r--r--pkgs/applications/science/logic/tptp/default.nix2
-rw-r--r--pkgs/applications/science/logic/twelf/default.nix3
-rw-r--r--pkgs/applications/science/logic/verifast/default.nix4
-rw-r--r--pkgs/applications/science/math/calc/default.nix2
-rw-r--r--pkgs/applications/science/math/cbc/default.nix2
-rw-r--r--pkgs/applications/science/math/geogebra/default.nix4
-rw-r--r--pkgs/applications/science/math/maxima/default.nix8
-rw-r--r--pkgs/applications/science/math/perseus/default.nix4
-rw-r--r--pkgs/applications/science/math/pssp/default.nix4
-rw-r--r--pkgs/applications/science/math/qalculate-gtk/default.nix3
-rw-r--r--pkgs/applications/science/math/sage/default.nix6
-rw-r--r--pkgs/applications/science/math/scilab/default.nix7
-rw-r--r--pkgs/applications/science/math/singular/default.nix2
-rw-r--r--pkgs/applications/science/math/yacas/default.nix6
-rw-r--r--pkgs/applications/science/misc/boinc/default.nix4
-rw-r--r--pkgs/applications/science/misc/openmodelica/default.nix10
-rw-r--r--pkgs/applications/science/misc/root/default.nix41
-rw-r--r--pkgs/applications/science/misc/root/sw_vers.patch90
34 files changed, 270 insertions, 63 deletions
diff --git a/pkgs/applications/science/biology/minc-tools/default.nix b/pkgs/applications/science/biology/minc-tools/default.nix
index 41813dcda149..aae0cf40cee3 100644
--- a/pkgs/applications/science/biology/minc-tools/default.nix
+++ b/pkgs/applications/science/biology/minc-tools/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   cmakeFlags = [ "-DLIBMINC_DIR=${libminc}/lib/" ];
 
   checkPhase = "ctest";
-  doCheck = true;
+  doCheck = false;
 
   meta = with stdenv.lib; {
     homepage = https://github.com/BIC-MNI/minc-tools;
diff --git a/pkgs/applications/science/biology/neuron/default.nix b/pkgs/applications/science/biology/neuron/default.nix
index 33f6d50d8ad8..5d69b1f29e73 100644
--- a/pkgs/applications/science/biology/neuron/default.nix
+++ b/pkgs/applications/science/biology/neuron/default.nix
@@ -1,33 +1,65 @@
 { stdenv 
 , fetchurl 
-, pkgconfig 
-, ncurses 
+, pkgconfig
+, automake
+, autoconf
+, libtool
+, ncurses
+, readline
+, which
+, python ? null 
 , mpi ? null
 }:
 
 stdenv.mkDerivation rec {
-  name = "neuron-7.4";
-  buildInputs = [ stdenv pkgconfig ncurses mpi ];
+  name = "neuron-${version}";
+  version = "7.4";
+  
+  nativeBuildInputs = [ which pkgconfig automake autoconf libtool ];
+  buildInputs = [ ncurses readline python mpi  ];
 
   src = fetchurl {
-    url = "http://www.neuron.yale.edu/ftp/neuron/versions/v7.4/nrn-7.4.tar.gz";
+    url = "http://www.neuron.yale.edu/ftp/neuron/versions/v${version}/nrn-${version}.tar.gz";
     sha256 = "1rid8cmv5mca0vqkgwahm0prkwkbdvchgw2bdwvx4adkn8bbl0ql";
   };
 
+  patches = (stdenv.lib.optional (stdenv.isDarwin) [ ./neuron-carbon-disable.patch ]);
 
   enableParallelBuilding = true;
 
-  configureFlags = [ "--without-x"
-		     "${if mpi != null then "--with-mpi" else "--without-mpi"}" ];
+  ## neuron install by default everything under prefix/${host_arch}/*
+  ## override this to support nix standard file hierarchy 
+  ## without issues: install everything under prefix/
+  preConfigure = ''
+    ./build.sh
+    export prefix="''${prefix} --exec-prefix=''${out}" 
+  '';
+
+  configureFlags = with stdenv.lib;
+                    [ "--without-x" "--with-readline=${readline}" ]
+                    ++  optionals (python != null)  [ "--with-nrnpython=${python.interpreter}" ]
+                    ++ (if mpi != null then ["--with-mpi" "--with-paranrn"] 
+                        else ["--without-mpi"]);
+                        
+                        
+  postInstall = stdenv.lib.optionals (python != null) [ ''
+    ## standardise python neuron install dir if any
+    if [[ -d $out/lib/python ]]; then
+        mkdir -p ''${out}/${python.sitePackages}
+        mv ''${out}/lib/python/*  ''${out}/${python.sitePackages}/
+    fi
+  ''];
+  
+  propagatedBuildInputs = [ readline ncurses which libtool ];  
 
   meta = with stdenv.lib; {
     description = "Simulation environment for empirically-based simulations of neurons and networks of neurons";
 
     longDescription = "NEURON is a simulation environment for developing and exercising models of 
-		neurons and networks of neurons. It is particularly well-suited to problems where 
-		cable properties of cells play an important role, possibly including extracellular 
-		potential close to the membrane), and where cell membrane properties are complex, 
-		involving many ion-specific channels, ion accumulation, and second messengers";
+                neurons and networks of neurons. It is particularly well-suited to problems where 
+                cable properties of cells play an important role, possibly including extracellular 
+                potential close to the membrane), and where cell membrane properties are complex, 
+                involving many ion-specific channels, ion accumulation, and second messengers";
 
     license     = licenses.bsd3;
     homepage    = http://www.neuron.yale.edu/neuron;
diff --git a/pkgs/applications/science/biology/neuron/neuron-carbon-disable.patch b/pkgs/applications/science/biology/neuron/neuron-carbon-disable.patch
new file mode 100644
index 000000000000..923bffb1c338
--- /dev/null
+++ b/pkgs/applications/science/biology/neuron/neuron-carbon-disable.patch
@@ -0,0 +1,21 @@
+--- nrn-7.4/src/mac/Makefile.am	2015-11-12 21:42:45.000000000 +0100
++++ nrn-7.4.new/src/mac/Makefile.am	2016-08-24 17:43:39.000000000 +0200
+@@ -15,18 +15,8 @@
+ host_cpu = @host_cpu@
+ 
+ if MAC_DARWIN
+-carbon = @enable_carbon@
+ bin_SCRIPTS = $(launch_scripts)
+ install: install-am
+-if UniversalMacBinary
+-	$(CC) -arch ppc -o aoutppc -Dcpu="\"$(host_cpu)\"" -I. $(srcdir)/launch.c $(srcdir)/mac2uxarg.c -framework Carbon
+-	$(CC) -arch i386 -o aouti386 -Dcpu="\"$(host_cpu)\"" -I. $(srcdir)/launch.c $(srcdir)/mac2uxarg.c -framework Carbon
+-	lipo aouti386 aoutppc -create -output a.out
+-else
+-	gcc -g -arch i386 -Dncpu="\"$(host_cpu)\"" -I. $(srcdir)/launch.c $(srcdir)/mac2uxarg.c -framework Carbon
+-
+-endif
+-	carbon=$(carbon) sh $(srcdir)/launch_inst.sh "$(host_cpu)" "$(DESTDIR)$(prefix)" "$(srcdir)"
+ 	for i in $(S) ; do \
+ 		sed "s/^CPU.*/CPU=\"$(host_cpu)\"/" < $(DESTDIR)$(bindir)/$$i > temp; \
+ 		mv temp $(DESTDIR)$(bindir)/$$i; \
diff --git a/pkgs/applications/science/electronics/caneda/default.nix b/pkgs/applications/science/electronics/caneda/default.nix
index 404ffc5010b4..dc00cef88982 100644
--- a/pkgs/applications/science/electronics/caneda/default.nix
+++ b/pkgs/applications/science/electronics/caneda/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     sha256 = "dfbcac97f5a1b41ad9a63392394f37fb294cbf78c576673c9bc4a5370957b2c8";
   };
 
-  cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" ];
+  hardeningDisable = [ "format" ];
 
   buildInputs = [ cmake qt4 libxml2 libxslt ];
 
diff --git a/pkgs/applications/science/electronics/geda/default.nix b/pkgs/applications/science/electronics/geda/default.nix
index 25934c71e8eb..b8406c3255cc 100644
--- a/pkgs/applications/science/electronics/geda/default.nix
+++ b/pkgs/applications/science/electronics/geda/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, guile, gtk, flex, gawk, perl }:
+{ stdenv, fetchurl, pkgconfig, guile, gtk2, flex, gawk, perl }:
 
 stdenv.mkDerivation rec {
   name = "geda-${version}";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
   };
 
   configureFlags = "--disable-update-xdg-database";
-  buildInputs = [ pkgconfig guile gtk flex gawk perl ];
+  buildInputs = [ pkgconfig guile gtk2 flex gawk perl ];
 
   meta = with stdenv.lib; {
     description = "Full GPL'd suite of Electronic Design Automation tools";
diff --git a/pkgs/applications/science/electronics/gerbv/default.nix b/pkgs/applications/science/electronics/gerbv/default.nix
index 92d0ceba1cfe..7cdcbb7fd197 100644
--- a/pkgs/applications/science/electronics/gerbv/default.nix
+++ b/pkgs/applications/science/electronics/gerbv/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, pkgconfig, gettext, libtool, automake, autoconf, cairo, gtk, autoreconfHook }:
+{ stdenv, fetchgit, pkgconfig, gettext, libtool, automake, autoconf, cairo, gtk2, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   name = "gerbv-${version}";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
     sha256 = "00jn1xhf6kblxc5gac1wvk8zm12fy6sk81nj3jwdag0z6wk3z446";
   };
 
-  buildInputs = [ pkgconfig gettext libtool automake autoconf cairo gtk autoreconfHook ];
+  buildInputs = [ pkgconfig gettext libtool automake autoconf cairo gtk2 autoreconfHook ];
 
   configureFlags = ["--disable-update-desktop-database"];
 
diff --git a/pkgs/applications/science/electronics/gtkwave/default.nix b/pkgs/applications/science/electronics/gtkwave/default.nix
index 32d39d8a609d..657d20553b7f 100644
--- a/pkgs/applications/science/electronics/gtkwave/default.nix
+++ b/pkgs/applications/science/electronics/gtkwave/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, gtk, gperf, pkgconfig, bzip2, tcl, tk, judy, xz}:
+{stdenv, fetchurl, gtk2, gperf, pkgconfig, bzip2, tcl, tk, judy, xz}:
 stdenv.mkDerivation rec {
   name = "gtkwave-3.3.70";
 
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
     sha256 = "1akzf1sq8mwarrbrbz5chrvgwlsp444h5za8rg1dfyqk733s7piz";
   };
 
-  buildInputs = [ gtk gperf pkgconfig bzip2 tcl tk judy xz ];
+  buildInputs = [ gtk2 gperf pkgconfig bzip2 tcl tk judy xz ];
 
   configureFlags = [ "--with-tcl=${tcl}/lib" "--with-tk=${tk}/lib" "--enable-judy" ];
 
diff --git a/pkgs/applications/science/electronics/pcb/default.nix b/pkgs/applications/science/electronics/pcb/default.nix
index 257d6993ff59..1f5109434000 100644
--- a/pkgs/applications/science/electronics/pcb/default.nix
+++ b/pkgs/applications/science/electronics/pcb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, gtk, bison, intltool, flex, netpbm, imagemagick, dbus, xlibsWrapper, mesa, shared_mime_info, tcl, tk, gnome, pangox_compat, gd, xorg }:
+{ stdenv, fetchurl, pkgconfig, gtk2, bison, intltool, flex, netpbm, imagemagick, dbus, xlibsWrapper, mesa, shared_mime_info, tcl, tk, gnome2, pangox_compat, gd, xorg }:
 
 stdenv.mkDerivation rec {
   name = "pcb-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "0l6944hq79qsyp60i5ai02xwyp8l47q7xdm3js0jfkpf72ag7i42";
   };
 
-  buildInputs = [ pkgconfig gtk bison intltool flex netpbm imagemagick dbus xlibsWrapper mesa tcl shared_mime_info tk gnome.gtkglext pangox_compat gd xorg.libXmu ];
+  buildInputs = [ pkgconfig gtk2 bison intltool flex netpbm imagemagick dbus xlibsWrapper mesa tcl shared_mime_info tk gnome2.gtkglext pangox_compat gd xorg.libXmu ];
 
   configureFlags = ["--disable-update-desktop-database"];
 
diff --git a/pkgs/applications/science/electronics/qfsm/default.nix b/pkgs/applications/science/electronics/qfsm/default.nix
index 95b312a44389..4b4d21aca006 100644
--- a/pkgs/applications/science/electronics/qfsm/default.nix
+++ b/pkgs/applications/science/electronics/qfsm/default.nix
@@ -12,6 +12,8 @@ stdenv.mkDerivation rec {
 
   patches = [ ./drop-hardcoded-prefix.patch ];
 
+  hardeningDisable = [ "format" ];
+
   enableParallelBuilding = true;
 
   meta = {
diff --git a/pkgs/applications/science/electronics/tkgate/1.x.nix b/pkgs/applications/science/electronics/tkgate/1.x.nix
index 61d03173e0ba..2a3f17b670b4 100644
--- a/pkgs/applications/science/electronics/tkgate/1.x.nix
+++ b/pkgs/applications/science/electronics/tkgate/1.x.nix
@@ -17,8 +17,8 @@ stdenv.mkDerivation rec {
   patchPhase = ''
     sed -i config.h \
       -e 's|.*#define.*TKGATE_TCLTK_VERSIONS.*|#define TKGATE_TCLTK_VERSIONS "${tcl.release}"|' \
-      -e 's|.*#define.*TKGATE_INCDIRS.*|#define TKGATE_INCDIRS "${tcl}/include ${tk}/include ${libiconvInc} ${libX11}/include"|' \
-      -e 's|.*#define.*TKGATE_LIBDIRS.*|#define TKGATE_LIBDIRS "${tcl}/lib ${tk}/lib ${libiconvLib} ${libX11}/lib"|' \
+      -e 's|.*#define.*TKGATE_INCDIRS.*|#define TKGATE_INCDIRS "${tcl}/include ${tk}/include ${libiconvInc} ${libX11.dev}/include"|' \
+      -e 's|.*#define.*TKGATE_LIBDIRS.*|#define TKGATE_LIBDIRS "${tcl}/lib ${tk}/lib ${libiconvLib} ${libX11.out}/lib"|' \
       \
       -e '20 i #define TCL_LIBRARY "${tcl}/lib"' \
       -e '20 i #define TK_LIBRARY "${tk}/lib/${tk.libPrefix}"' \
diff --git a/pkgs/applications/science/electronics/xoscope/default.nix b/pkgs/applications/science/electronics/xoscope/default.nix
index df7d053d93bd..f26b13c5e32c 100644
--- a/pkgs/applications/science/electronics/xoscope/default.nix
+++ b/pkgs/applications/science/electronics/xoscope/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, gtk, pkgconfig}:
+{stdenv, fetchurl, gtk2, pkgconfig}:
 
 stdenv.mkDerivation rec {
   name = "xoscope-2.0";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "00xlvvqyw6l1ljbsx1vgx2v1jfh0xacz1a0yhq1dj6yxf5wh58x8";
   };
 
-  buildInputs = [ gtk pkgconfig ];
+  buildInputs = [ gtk2 pkgconfig ];
 
   # from: https://aur.archlinux.org/packages.php?ID=12140&detail=1
   patches = [ ./gtkdepre.diff ];
diff --git a/pkgs/applications/science/geometry/drgeo/default.nix b/pkgs/applications/science/geometry/drgeo/default.nix
index 048f34d7abfa..8db1beedebbb 100644
--- a/pkgs/applications/science/geometry/drgeo/default.nix
+++ b/pkgs/applications/science/geometry/drgeo/default.nix
@@ -1,17 +1,19 @@
-{ stdenv, fetchurl, libglade, gtk, guile, libxml2, perl
+{ stdenv, fetchurl, libglade, gtk2, guile, libxml2, perl
 , intltool, libtool, pkgconfig }:
 
 stdenv.mkDerivation rec {
   name = "drgeo-${version}";
   version = "1.1.0";
 
+  hardeningDisable = [ "format" ];
+
   src = fetchurl {
     url = "mirror://sourceforge/ofset/${name}.tar.gz";
     sha256 = "05i2czgzhpzi80xxghinvkyqx4ym0gm9f38fz53idjhigiivp4wc";
   };
   patches = [ ./struct.patch ];
 
-  buildInputs = [libglade gtk guile libxml2
+  buildInputs = [libglade gtk2 guile libxml2
     perl intltool libtool pkgconfig];
 
   prebuild = ''
diff --git a/pkgs/applications/science/logic/boolector/default.nix b/pkgs/applications/science/logic/boolector/default.nix
index 3879ee8ef470..37d25c9e9477 100644
--- a/pkgs/applications/science/logic/boolector/default.nix
+++ b/pkgs/applications/science/logic/boolector/default.nix
@@ -23,10 +23,11 @@ let
   license = with stdenv.lib.licenses; if useV16 then unfreeRedistributable else gpl3;
 in
 stdenv.mkDerivation (boolectorPkg // {
-  buildInputs = [ zlib ];
-  enableParallelBuilding = false;
+  buildInputs = [
+    zlib zlib.static (stdenv.lib.getOutput "static" stdenv.cc.libc)
+  ];
 
-  buildPhase = "./build.sh";
+  enableParallelBuilding = false;
 
   installPhase = ''
     mkdir -p $out/bin $out/lib $out/include
diff --git a/pkgs/applications/science/logic/ltl2ba/default.nix b/pkgs/applications/science/logic/ltl2ba/default.nix
index 59c6461f5b6c..f0947fa0ed6e 100644
--- a/pkgs/applications/science/logic/ltl2ba/default.nix
+++ b/pkgs/applications/science/logic/ltl2ba/default.nix
@@ -9,6 +9,8 @@ stdenv.mkDerivation rec {
     sha256 = "16z0gc7a9dkarwn0l6rvg5jdhw1q4qyn4501zlchy0zxqddz0sx6";
   };
 
+  hardeningDisable = [ "format" ];
+
   preConfigure = ''
     substituteInPlace Makefile \
     --replace "CC=gcc" ""
diff --git a/pkgs/applications/science/logic/otter/default.nix b/pkgs/applications/science/logic/otter/default.nix
index 08d19c143eed..b19650eb8630 100644
--- a/pkgs/applications/science/logic/otter/default.nix
+++ b/pkgs/applications/science/logic/otter/default.nix
@@ -17,6 +17,9 @@ stdenv.mkDerivation {
   src = fetchurl {
     inherit (s) url sha256;
   };
+
+  hardeningDisable = [ "format" ];
+
   buildPhase = ''
     find . -name Makefile | xargs sed -i -e "s@/bin/rm@$(type -P rm)@g"
     find . -name Makefile | xargs sed -i -e "s@/bin/mv@$(type -P mv)@g"
@@ -32,11 +35,13 @@ stdenv.mkDerivation {
     make -C source/formed realclean
     make -C source/formed formed
   '';
+
   installPhase = ''
     mkdir -p "$out"/{bin,share/otter}
     cp bin/* source/formed/formed "$out/bin/"
     cp -r examples examples-mace2 documents README* Legal Changelog Contents index.html "$out/share/otter/"
   '';
+
   meta = {
     inherit (s) version;
     description = "A reliable first-order theorem prover";
diff --git a/pkgs/applications/science/logic/prover9/default.nix b/pkgs/applications/science/logic/prover9/default.nix
index d92c7887210e..43c2ae141b7a 100644
--- a/pkgs/applications/science/logic/prover9/default.nix
+++ b/pkgs/applications/science/logic/prover9/default.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation {
     sha256 = "1l2i3d3h5z7nnbzilb6z92r0rbx0kh6yaxn2c5qhn3000xcfsay3";
   };
 
-  phases = "unpackPhase patchPhase buildPhase installPhase";
+  hardeningDisable = [ "format" ];
 
   patchPhase = ''
     RM=$(type -tp rm)
@@ -23,6 +23,8 @@ stdenv.mkDerivation {
 
   buildFlags = "all";
 
+  checkPhase = "make test1";
+
   installPhase = ''
     mkdir -p $out/bin
     cp bin/* $out/bin
@@ -37,7 +39,7 @@ stdenv.mkDerivation {
       for first-order and equational logic. Prover9 is a successor of
       the Otter Prover. This is the LADR command-line version.
     '';
-    platforms = stdenv.lib.platforms.unix;
+    platforms = stdenv.lib.platforms.linux;
     maintainers = [];
   };
 }
diff --git a/pkgs/applications/science/logic/tptp/default.nix b/pkgs/applications/science/logic/tptp/default.nix
index 32906b88d590..db7e0c0c9382 100644
--- a/pkgs/applications/science/logic/tptp/default.nix
+++ b/pkgs/applications/science/logic/tptp/default.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
       "http://www.cs.miami.edu/~tptp/TPTP/Distribution/TPTP-v${version}.tgz"
       "http://www.cs.miami.edu/~tptp/TPTP/Archive/TPTP-v${version}/TPTP-v${version}.tgz"
     ];
-    sha256 = "1i5hi8grfl5zyh8py63zn39rg019bd90h2l312iswbgai6nyfdw0";
+    sha256 = "17mnqxnyibmzf5vvbnyhsd010zykqw8ikx4pvyj0x9sfyhpvgfix";
   };
 
   buildInputs = [ tcsh yap perl patchelf ];
diff --git a/pkgs/applications/science/logic/twelf/default.nix b/pkgs/applications/science/logic/twelf/default.nix
index 7d5724967c17..ca2422558e9a 100644
--- a/pkgs/applications/science/logic/twelf/default.nix
+++ b/pkgs/applications/science/logic/twelf/default.nix
@@ -21,6 +21,9 @@ stdenv.mkDerivation rec {
     rsync -av bin/{*,.heap} $out/bin/
     bin/.mkexec ${smlnj}/bin/sml $out/ twelf-server twelf-server
 
+    substituteInPlace emacs/twelf-init.el \
+      --replace '(concat twelf-root "emacs")' '(concat twelf-root "share/emacs/site-lisp/twelf")'
+
     mkdir -p $out/share/emacs/site-lisp/twelf/
     rsync -av emacs/ $out/share/emacs/site-lisp/twelf/
 
diff --git a/pkgs/applications/science/logic/verifast/default.nix b/pkgs/applications/science/logic/verifast/default.nix
index d7c593b736e4..ada586fc4e6d 100644
--- a/pkgs/applications/science/logic/verifast/default.nix
+++ b/pkgs/applications/science/logic/verifast/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, gtk, gdk_pixbuf, atk, pango, glib, cairo, freetype
+{ stdenv, fetchurl, gtk2, gdk_pixbuf, atk, pango, glib, cairo, freetype
 , fontconfig, libxml2, gnome2 }:
 
 assert stdenv.isLinux;
 
 let
   libPath = stdenv.lib.makeLibraryPath
-    [ stdenv.cc.libc stdenv.cc.cc gtk gdk_pixbuf atk pango glib cairo
+    [ stdenv.cc.libc stdenv.cc.cc gtk2 gdk_pixbuf atk pango glib cairo
       freetype fontconfig libxml2 gnome2.gtksourceview
     ] + ":${stdenv.cc.cc.lib}/lib64";
 
diff --git a/pkgs/applications/science/math/calc/default.nix b/pkgs/applications/science/math/calc/default.nix
index 8673d7debd9d..b9db4174c094 100644
--- a/pkgs/applications/science/math/calc/default.nix
+++ b/pkgs/applications/science/math/calc/default.nix
@@ -3,7 +3,7 @@
 with stdenv.lib;
 let
   makeFlags = ''
-    INCDIR=${glibc}/include \
+    INCDIR=${glibc.dev}/include \
     BINDIR=$out/bin LIBDIR=$out/lib CALC_INCDIR=$out/include/calc CALC_SHAREDIR=$out/share/calc MANDIR=$out/share/man/man1 \
     USE_READLINE=-DUSE_READLINE READLINE_LIB=-lreadline READLINE_EXTRAS='-lhistory -lncurses' \
     TERMCONTROL=-DUSE_TERMIOS \
diff --git a/pkgs/applications/science/math/cbc/default.nix b/pkgs/applications/science/math/cbc/default.nix
index 0d1ef26092e2..7643c912db4b 100644
--- a/pkgs/applications/science/math/cbc/default.nix
+++ b/pkgs/applications/science/math/cbc/default.nix
@@ -12,6 +12,8 @@ stdenv.mkDerivation {
 
   enableParallelBuilding = true;
 
+  hardeningDisable = [ "format" ];
+
   buildInputs = [ zlib bzip2 ];
 
   # FIXME: move share/coin/Data to a separate output?
diff --git a/pkgs/applications/science/math/geogebra/default.nix b/pkgs/applications/science/math/geogebra/default.nix
index fcbd13566657..0e16e1fb3050 100644
--- a/pkgs/applications/science/math/geogebra/default.nix
+++ b/pkgs/applications/science/math/geogebra/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   name = "geogebra-${version}";
-  version = "5.0.265.0";
+  version = "5.0.271.0";
 
   preferLocalBuild = true;
 
   src = fetchurl {
     url = "http://download.geogebra.org/installers/5.0/GeoGebra-Linux-Portable-${version}.tar.bz2";
-    sha256 = "74e5abfa098ee0fc464cd391cd3ef6db474ff25e8ea4fbcd82c4b4b5d3d5c459";
+    sha256 = "5dd5be1cde27c9b567f79c38048045864064b69c0d2b469ae93e1fca5f543475";
   };
 
   srcIcon = fetchurl {
diff --git a/pkgs/applications/science/math/maxima/default.nix b/pkgs/applications/science/math/maxima/default.nix
index 21d3c656d304..4981767f21f2 100644
--- a/pkgs/applications/science/math/maxima/default.nix
+++ b/pkgs/applications/science/math/maxima/default.nix
@@ -1,8 +1,8 @@
-{ stdenv, fetchurl, sbcl, texinfo, perl, makeWrapper, rlwrap ? null, tk ? null, gnuplot ? null }:
+{ stdenv, fetchurl, sbcl, texinfo, perl, python, makeWrapper, rlwrap ? null, tk ? null, gnuplot ? null }:
 
 let
   name    = "maxima";
-  version = "5.36.1";
+  version = "5.38.1";
 
   searchPath =
     stdenv.lib.makeBinPath
@@ -13,10 +13,10 @@ stdenv.mkDerivation {
 
   src = fetchurl {
     url = "mirror://sourceforge/${name}/${name}-${version}.tar.gz";
-    sha256 = "0x1rk659sn3cq0n5c90848ilzr1gb1wf0072fl6jhkdq00qgh2s0";
+    sha256 = "1p6646rvq43hk09msyp0dk50cqpkh07mf4x0bc2fqisqmcv6b1hf";
   };
 
-  buildInputs = [sbcl texinfo perl makeWrapper];
+  buildInputs = [sbcl texinfo perl python makeWrapper];
 
   postInstall = ''
     # Make sure that maxima can find its runtime dependencies.
diff --git a/pkgs/applications/science/math/perseus/default.nix b/pkgs/applications/science/math/perseus/default.nix
index 15a1de5f0c5f..55293e6c8a79 100644
--- a/pkgs/applications/science/math/perseus/default.nix
+++ b/pkgs/applications/science/math/perseus/default.nix
@@ -5,6 +5,8 @@ stdenv.mkDerivation {
   version = "4-beta";
   buildInputs = [ unzip ];
 
+  hardeningDisable = [ "stackprotector" ];
+
   src = fetchurl {
     url = "http://www.sas.upenn.edu/~vnanda/source/perseus_4_beta.zip";
     sha256 = "09brijnqabhgfjlj5wny0bqm5dwqcfkp1x5wif6yzdmqh080jybj";
@@ -30,7 +32,7 @@ stdenv.mkDerivation {
       around datasets arising from point samples, images, distance
       matrices and so forth.
     '';
-    homepage = "www.sas.upenn.edu/~vnanda/perseus/index.html";
+    homepage = "http://www.sas.upenn.edu/~vnanda/perseus/index.html";
     license = stdenv.lib.licenses.gpl3;
     maintainers = with stdenv.lib.maintainers; [erikryb];
     platforms = stdenv.lib.platforms.linux;
diff --git a/pkgs/applications/science/math/pssp/default.nix b/pkgs/applications/science/math/pssp/default.nix
index 6ced805b3115..e74e17fa44f5 100644
--- a/pkgs/applications/science/math/pssp/default.nix
+++ b/pkgs/applications/science/math/pssp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libxml2, readline, zlib, perl, cairo, gtk, gsl
+{ stdenv, fetchurl, libxml2, readline, zlib, perl, cairo, gtk2, gsl
 , pkgconfig, gtksourceview, pango, gettext, libglade
 }:
 
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
     sha256 = "0vri2pzvmm38qaihfvwlry30f40lcnps4blg59ixic4q20ldxf5d";
   };
 
-  buildInputs = [ libxml2 readline zlib perl cairo gtk gsl pkgconfig
+  buildInputs = [ libxml2 readline zlib perl cairo gtk2 gsl pkgconfig
     gtksourceview pango gettext libglade ];
 
   doCheck = false;
diff --git a/pkgs/applications/science/math/qalculate-gtk/default.nix b/pkgs/applications/science/math/qalculate-gtk/default.nix
index f825e798a065..5f49b240fc06 100644
--- a/pkgs/applications/science/math/qalculate-gtk/default.nix
+++ b/pkgs/applications/science/math/qalculate-gtk/default.nix
@@ -1,4 +1,5 @@
 { stdenv, fetchurl, intltool, autoreconfHook, pkgconfig, libqalculate, gtk3, wrapGAppsHook }:
+
 stdenv.mkDerivation rec {
   name = "qalculate-gtk-${version}";
   version = "0.9.9";
@@ -8,6 +9,8 @@ stdenv.mkDerivation rec {
     sha256 = "0v9ibycilygmi9zzi7cxif7si56c85lfzdvbqnbf32whg8ydqqkg";
   };
 
+  hardeningDisable = [ "format" ];
+
   nativeBuildInputs = [ intltool pkgconfig autoreconfHook wrapGAppsHook ];
   buildInputs = [ libqalculate gtk3 ];
 
diff --git a/pkgs/applications/science/math/sage/default.nix b/pkgs/applications/science/math/sage/default.nix
index 6e0b4313b47d..9e17fe60c295 100644
--- a/pkgs/applications/science/math/sage/default.nix
+++ b/pkgs/applications/science/math/sage/default.nix
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
   name = "sage-6.8";
 
   src = fetchurl {
-    url = "mirror://sagemath/${name}.tar.gz";
+    url = "http://old.files.sagemath.org/src-old/${name}.tar.gz";
     sha256 = "102mrzzi215g1xn5zgcv501x9sghwg758jagx2jixvg1rj2jijj9";
   };
 
@@ -18,11 +18,14 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  hardeningDisable = [ "format" ];
+
   preConfigure = ''
     export SAGE_NUM_THREADS=$NIX_BUILD_CORES
     export SAGE_ATLAS_ARCH=fast
     mkdir -p $out/sageHome
     export HOME=$out/sageHome
+    export CPPFLAGS="-P"
   '';
 
   preBuild = "patchShebangs build";
@@ -30,7 +33,6 @@ stdenv.mkDerivation rec {
   installPhase = ''DESTDIR=$out make install'';
 
   meta = {
-    broken = true;
     homepage = "http://www.sagemath.org";
     description = "A free open source mathematics software system";
     license = stdenv.lib.licenses.gpl2Plus;
diff --git a/pkgs/applications/science/math/scilab/default.nix b/pkgs/applications/science/math/scilab/default.nix
index 8482bd6fe94b..4e30814ff7df 100644
--- a/pkgs/applications/science/math/scilab/default.nix
+++ b/pkgs/applications/science/math/scilab/default.nix
@@ -3,7 +3,7 @@
 , Xaw3d, withXaw3d ? false
 #, withPVMlib ? false
 , tcl, tk, withTk ? false
-, gtk, withGtk ? false # working ?
+, gtk2, withGtk ? false # working ?
 #, withF2c ? false
 , ocaml, withOCaml ? false
 #, withJava ? false
@@ -16,12 +16,11 @@ stdenv.mkDerivation rec {
   name = "scilab-${version}";
   src = fetchurl {
     url = "http://www.scilab.org/download/${version}/${name}-src.tar.gz";
-    # md5 coming from http://www.scilab.org/download/index_download.php
-    md5 = "17a7a6aa52918f33d96777a0dc423658";
+    sha256 = "1adk6jqlj7i3gjklvlf1j3il1nb22axnp4rvwl314an62siih0sc";
   };
 
   buildInputs = [gfortran ncurses]
-  ++ lib.optionals withGtk [gtk]
+  ++ lib.optionals withGtk [gtk2]
   ++ lib.optionals withOCaml [ocaml]
   ++ lib.optional withX xlibsWrapper
   ;
diff --git a/pkgs/applications/science/math/singular/default.nix b/pkgs/applications/science/math/singular/default.nix
index 8bae1d6206d0..a0fdf7c82395 100644
--- a/pkgs/applications/science/math/singular/default.nix
+++ b/pkgs/applications/science/math/singular/default.nix
@@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
     find . -exec sed -e 's@/bin/uname@${coreutils}&@g' -i '{}' ';'
   '';
 
+  hardeningDisable = stdenv.lib.optional stdenv.isi686 "stackprotector";
+
   postInstall = ''
     rm -rf "$out/LIB"
     cp -r Singular/LIB "$out"
diff --git a/pkgs/applications/science/math/yacas/default.nix b/pkgs/applications/science/math/yacas/default.nix
index 2c9d63be1b4d..0f6dc35fe0cb 100644
--- a/pkgs/applications/science/math/yacas/default.nix
+++ b/pkgs/applications/science/math/yacas/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "1dmafm3w0lm5w211nwkfzaid1rvvmgskz7k4500pjhgdczi5sd78";
   };
 
+  hardeningDisable = [ "format" ];
+
   # Perl is only for the documentation
   nativeBuildInputs = [ perl ];
 
@@ -32,11 +34,11 @@ stdenv.mkDerivation rec {
     '';
   };
 
-  meta = { 
+  meta = {
       description = "Easy to use, general purpose Computer Algebra System";
       homepage = http://yacas.sourceforge.net/;
       license = stdenv.lib.licenses.gpl2Plus;
       maintainers = with stdenv.lib.maintainers; [viric];
-      platforms = with stdenv.lib.platforms; all;
+      platforms = with stdenv.lib.platforms; linux;
   };
 }
diff --git a/pkgs/applications/science/misc/boinc/default.nix b/pkgs/applications/science/misc/boinc/default.nix
index d45f4a2b2102..53ea9ce72125 100644
--- a/pkgs/applications/science/misc/boinc/default.nix
+++ b/pkgs/applications/science/misc/boinc/default.nix
@@ -1,6 +1,6 @@
 { fetchFromGitHub, stdenv, autoconf, automake, pkgconfig, m4, curl,
 mesa, libXmu, libXi, freeglut, libjpeg, libtool, wxGTK, xcbutil,
-sqlite, gtk, patchelf, libXScrnSaver, libnotify, libX11, libxcb }:
+sqlite, gtk2, patchelf, libXScrnSaver, libnotify, libX11, libxcb }:
 
 stdenv.mkDerivation rec {
   version = "7.4.42";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ libtool automake autoconf m4 pkgconfig curl mesa libXmu libXi
-    freeglut libjpeg wxGTK sqlite gtk libXScrnSaver libnotify patchelf libX11 
+    freeglut libjpeg wxGTK sqlite gtk2 libXScrnSaver libnotify patchelf libX11
     libxcb xcbutil
   ];
 
diff --git a/pkgs/applications/science/misc/openmodelica/default.nix b/pkgs/applications/science/misc/openmodelica/default.nix
index 8ea670c38189..8d673a15fa8e 100644
--- a/pkgs/applications/science/misc/openmodelica/default.nix
+++ b/pkgs/applications/science/misc/openmodelica/default.nix
@@ -1,7 +1,7 @@
 {stdenv, fetchgit, fetchsvn, autoconf, automake, libtool, gfortran, clang, cmake, gnumake,
 hwloc, jre, liblapack, blas, hdf5, expat, ncurses, readline, qt4, webkit, which,
 lp_solve, omniorb, sqlite, libatomic_ops, pkgconfig, file, gettext, flex, bison,
-doxygen, boost, openscenegraph, gnome, pangox_compat, xorg, git, bash, gtk, makeWrapper }:
+doxygen, boost, openscenegraph, gnome2, pangox_compat, xorg, git, bash, gtk2, makeWrapper }:
 
 let
 
@@ -17,8 +17,12 @@ stdenv.mkDerivation {
   buildInputs = [autoconf cmake automake libtool gfortran clang gnumake
     hwloc jre liblapack blas hdf5 expat ncurses readline qt4 webkit which
     lp_solve omniorb sqlite libatomic_ops pkgconfig file gettext flex bison
-    doxygen boost openscenegraph gnome.gtkglext pangox_compat xorg.libXmu
-    git gtk makeWrapper];
+    doxygen boost openscenegraph gnome2.gtkglext pangox_compat xorg.libXmu
+    git gtk2 makeWrapper];
+
+  hardeningDisable = [ "format" ];
+
+  enableParallelBuilding = true;
 
   patchPhase = ''
     cp -fv ${fakegit}/bin/checkout-git.sh libraries/checkout-git.sh
diff --git a/pkgs/applications/science/misc/root/default.nix b/pkgs/applications/science/misc/root/default.nix
index 855766cace7c..a736bdad2ea1 100644
--- a/pkgs/applications/science/misc/root/default.nix
+++ b/pkgs/applications/science/misc/root/default.nix
@@ -1,5 +1,5 @@
-{ stdenv, fetchurl, fetchpatch, cmake, pkgconfig, python
-, libX11, libXpm, libXft, libXext, zlib, lzma, gsl }:
+{ stdenv, fetchurl, fetchpatch, cmake, pcre, pkgconfig, python
+, libX11, libXpm, libXft, libXext, zlib, lzma, gsl, Cocoa }:
 
 stdenv.mkDerivation rec {
   name = "root-${version}";
@@ -10,13 +10,17 @@ stdenv.mkDerivation rec {
     sha256 = "00f3v3l8nimfkcxpn9qpyh3h23na0mi4wkds2y5gwqh8wh3jryq9";
   };
 
-  buildInputs = [ cmake pkgconfig python libX11 libXpm libXft libXext zlib lzma gsl ];
+  buildInputs = [ cmake pcre pkgconfig python zlib lzma gsl ]
+    ++ stdenv.lib.optionals (!stdenv.isDarwin) [ libX11 libXpm libXft libXext ]
+    ++ stdenv.lib.optionals (stdenv.isDarwin) [ Cocoa ]
+    ;
 
   patches = [
     (fetchpatch {
       url = "https://github.com/root-mirror/root/commit/ee9964210c56e7c1868618a4434c5340fef38fe4.patch";
       sha256 = "186i7ni75yvjydy6lpmaplqxfb5z2019bgpbhff1n6zn2qlrff2r";
     })
+    ./sw_vers.patch
   ];
 
   preConfigure = ''
@@ -27,14 +31,41 @@ stdenv.mkDerivation rec {
     "-Drpath=ON"
     "-DCMAKE_INSTALL_LIBDIR=lib"
     "-DCMAKE_INSTALL_INCLUDEDIR=include"
+    "-Dalien=OFF"
+    "-Dbonjour=OFF"
+    "-Dcastor=OFF"
+    "-Dchirp=OFF"
+    "-Ddavix=OFF"
+    "-Ddcache=OFF"
+    "-Dfftw3=OFF"
+    "-Dfitsio=OFF"
+    "-Dfortran=OFF"
+    "-Dgfal=OFF"
+    "-Dgviz=OFF"
+    "-Dhdfs=OFF"
+    "-Dkrb5=OFF"
+    "-Dldap=OFF"
+    "-Dmonalisa=OFF"
+    "-Dmysql=OFF"
+    "-Dodbc=OFF"
+    "-Dopengl=OFF"
+    "-Doracle=OFF"
+    "-Dpgsql=OFF"
+    "-Dpythia6=OFF"
+    "-Dpythia8=OFF"
+    "-Drfio=OFF"
+    "-Dsqlite=OFF"
+    "-Dssl=OFF"
+    "-Dxml=OFF"
+    "-Dxrootd=OFF"
   ]
-  ++ stdenv.lib.optional (stdenv.cc.libc != null) "-DC_INCLUDE_DIRS=${stdenv.cc.libc}/include";
+  ++ stdenv.lib.optional (stdenv.cc.libc != null) "-DC_INCLUDE_DIRS=${stdenv.lib.getDev stdenv.cc.libc}/include";
 
   enableParallelBuilding = true;
 
   meta = {
     homepage = "https://root.cern.ch/";
     description = "A data analysis framework";
-    platforms = stdenv.lib.platforms.linux;
+    platforms = stdenv.lib.platforms.unix;
   };
 }
diff --git a/pkgs/applications/science/misc/root/sw_vers.patch b/pkgs/applications/science/misc/root/sw_vers.patch
new file mode 100644
index 000000000000..3de2b839bf4b
--- /dev/null
+++ b/pkgs/applications/science/misc/root/sw_vers.patch
@@ -0,0 +1,90 @@
+diff --git a/build/unix/compiledata.sh b/build/unix/compiledata.sh
+--- a/build/unix/compiledata.sh
++++ b/build/unix/compiledata.sh
+@@ -49,7 +49,7 @@ fi
+ 
+ if [ "$ARCH" = "macosx" ] || [ "$ARCH" = "macosx64" ] || \
+    [ "$ARCH" = "macosxicc" ]; then
+-   macosx_minor=`sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2`
++   macosx_minor=7
+    SOEXT="so"
+    if [ $macosx_minor -ge 5 ]; then
+       if [ "x`echo $SOFLAGS | grep -- '-install_name'`" != "x" ]; then
+diff --git a/cmake/modules/SetUpMacOS.cmake b/cmake/modules/SetUpMacOS.cmake
+--- a/cmake/modules/SetUpMacOS.cmake
++++ b/cmake/modules/SetUpMacOS.cmake
+@@ -12,25 +12,11 @@ set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} /usr/X11R6)
+ #---------------------------------------------------------------------------------------------------------
+ 
+ if (CMAKE_SYSTEM_NAME MATCHES Darwin)
+-  EXECUTE_PROCESS(COMMAND sw_vers "-productVersion"
+-                  COMMAND cut -d . -f 1-2
+-                  OUTPUT_VARIABLE MACOSX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
+-  MESSAGE(STATUS "Found a Mac OS X System ${MACOSX_VERSION}")
+-  EXECUTE_PROCESS(COMMAND sw_vers "-productVersion"
+-                  COMMAND cut -d . -f 2
+-                  OUTPUT_VARIABLE MACOSX_MINOR OUTPUT_STRIP_TRAILING_WHITESPACE)
+-
+-  if(MACOSX_VERSION VERSION_GREATER 10.7 AND ${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
+     set(libcxx ON CACHE BOOL "Build using libc++" FORCE)
+-  endif()
+ 
+-  if(${MACOSX_MINOR} GREATER 4)
+     #TODO: check haveconfig and rpath -> set rpath true
+     #TODO: check Thread, define link command
+     #TODO: more stuff check configure script
+-    execute_process(COMMAND /usr/sbin/sysctl machdep.cpu.extfeatures OUTPUT_VARIABLE SYSCTL_OUTPUT)
+-    if(${SYSCTL_OUTPUT} MATCHES 64)
+-       MESSAGE(STATUS "Found a 64bit system")
+        set(ROOT_ARCHITECTURE macosx64)
+        SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
+        SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -m64")
+@@ -38,27 +24,6 @@ if (CMAKE_SYSTEM_NAME MATCHES Darwin)
+        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
+        SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
+        SET(CMAKE_FORTRAN_FLAGS "${CMAKE_FORTRAN_FLAGS} -m64")
+-    else(${SYSCTL_OUTPUT} MATCHES 64)
+-       MESSAGE(STATUS "Found a 32bit system")
+-       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
+-       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
+-       SET(CMAKE_FORTRAN_FLAGS "${CMAKE_FORTRAN_FLAGS} -m32")
+-    endif(${SYSCTL_OUTPUT} MATCHES 64)
+-  endif()
+-
+-  if(MACOSX_VERSION VERSION_GREATER 10.6)
+-    set(MACOSX_SSL_DEPRECATED ON)
+-  endif()
+-  if(MACOSX_VERSION VERSION_GREATER 10.7)
+-    set(MACOSX_ODBC_DEPRECATED ON)
+-  endif()
+-  if(MACOSX_VERSION VERSION_GREATER 10.8)
+-    set(MACOSX_GLU_DEPRECATED ON)
+-    set(MACOSX_KRB5_DEPRECATED ON)
+-  endif()
+-  if(MACOSX_VERSION VERSION_GREATER 10.9)
+-    set(MACOSX_LDAP_DEPRECATED ON)
+-  endif()
+ 
+   if (CMAKE_COMPILER_IS_GNUCXX)
+      message(STATUS "Found GNU compiler collection")
+@@ -135,7 +100,7 @@ if (CMAKE_SYSTEM_NAME MATCHES Darwin)
+   endif()
+ 
+   #---Set Linker flags----------------------------------------------------------------------
+-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}  -mmacosx-version-min=${MACOSX_VERSION} -Wl,-rpath,@loader_path/../lib")
++  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,@loader_path/../lib")
+ 
+ 
+ else (CMAKE_SYSTEM_NAME MATCHES Darwin)
+diff --git a/config/root-config.in b/config/root-config.in
+--- a/config/root-config.in
++++ b/config/root-config.in
+@@ -304,7 +304,7 @@ macosxicc)
+    ;;
+ macosx64)
+    # MacOS X with gcc (GNU cc v4.x) in 64 bit mode
+-   macosx_minor=`sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2`
++   macosx_minor=7
+    # cannot find the one linked to libGraf if relocated after built
+    if [ $macosx_minor -le 4 ]; then
+       rootlibs="$rootlibs -lfreetype"