From 7b56411fef87d7ab775640117bf461aaeb4a55e1 Mon Sep 17 00:00:00 2001 From: Anthony Cowley Date: Fri, 1 Apr 2016 14:56:07 -0400 Subject: tinyxml: darwin compatibility - Relax the baked-in assumption that g++ is used to build and link - Use the appropriate shared library extension on darwin --- pkgs/development/libraries/tinyxml/2.6.2-cxx.patch | 17 +++++++++++++++++ pkgs/development/libraries/tinyxml/2.6.2.nix | 14 +++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/libraries/tinyxml/2.6.2-cxx.patch (limited to 'pkgs/development/libraries/tinyxml') diff --git a/pkgs/development/libraries/tinyxml/2.6.2-cxx.patch b/pkgs/development/libraries/tinyxml/2.6.2-cxx.patch new file mode 100644 index 0000000000000..e55d0be43bcc2 --- /dev/null +++ b/pkgs/development/libraries/tinyxml/2.6.2-cxx.patch @@ -0,0 +1,17 @@ +diff -u a/Makefile b/Makefile +--- a/Makefile 2011-05-14 22:24:57.000000000 -0400 ++++ b/Makefile 2016-04-01 14:53:05.000000000 -0400 +@@ -19,9 +19,9 @@ + + #**************************************************************************** + +-CC := gcc +-CXX := g++ +-LD := g++ ++CC ?= gcc ++CXX ?= g++ ++LD ?= g++ + AR := ar rc + RANLIB := ranlib + +Common subdirectories: a/docs and b/docs diff --git a/pkgs/development/libraries/tinyxml/2.6.2.nix b/pkgs/development/libraries/tinyxml/2.6.2.nix index 7f0a343eba233..231550cd55714 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" -- cgit 1.4.1