summary refs log tree commit diff
path: root/pkgs/development/libraries/tinyxml/2.6.2.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/tinyxml/2.6.2.nix')
-rw-r--r--pkgs/development/libraries/tinyxml/2.6.2.nix14
1 files changed, 11 insertions, 3 deletions
diff --git a/pkgs/development/libraries/tinyxml/2.6.2.nix b/pkgs/development/libraries/tinyxml/2.6.2.nix
index 7f0a343eba2..231550cd557 100644
--- a/pkgs/development/libraries/tinyxml/2.6.2.nix
+++ b/pkgs/development/libraries/tinyxml/2.6.2.nix
@@ -2,6 +2,7 @@
 
 let
   version = "2.6.2";
+  SHLIB_EXT = if stdenv.isDarwin then "dylib" else "so";
 in stdenv.mkDerivation {
   name = "tinyxml-${version}";
 
@@ -16,7 +17,14 @@ in stdenv.mkDerivation {
 
     # http://sourceforge.net/tracker/index.php?func=detail&aid=3031828&group_id=13559&atid=313559
     ./2.6.2-entity.patch
+
+    # Use CC, CXX, and LD from environment
+    ./2.6.2-cxx.patch
   ];
+  preConfigure = "export LD=${if stdenv.isDarwin then "clang++" else "g++"}";
+
+  NIX_CFLAGS_COMPILE =
+    stdenv.lib.optional stdenv.isDarwin "-mmacosx-version-min=10.9";
 
   buildInputs = [ unzip ];
   buildPhase = ''
@@ -28,9 +36,9 @@ in stdenv.mkDerivation {
     make
 
     # build the lib as a shared library
-    g++ -Wall -O2 -shared -fpic tinyxml.cpp \
+    ''${CXX} -Wall -O2 -shared -fpic tinyxml.cpp \
     tinyxmlerror.cpp tinyxmlparser.cpp      \
-    tinystr.cpp -o libtinyxml.so
+    tinystr.cpp -o libtinyxml.${SHLIB_EXT}
   '';
 
   doCheck = true;
@@ -47,7 +55,7 @@ in stdenv.mkDerivation {
     mkdir -pv $out/lib/pkgconfig/
     mkdir -pv $out/share/doc/tinyxml/
 
-    cp -v libtinyxml.so $out/lib/
+    cp -v libtinyxml.${SHLIB_EXT} $out/lib/
     cp -v *.h $out/include/
 
     substituteInPlace tinyxml.pc --replace "@out@" "$out"