iniparser: fix Darwin by building static lib

This commit is contained in:
Spencer Whitt 2015-04-07 13:41:44 -04:00
parent 16ccc46c29
commit 79d3e8f8c1

View File

@ -1,5 +1,9 @@
{ stdenv, fetchurl }:
let
inherit (stdenv.lib) optional;
isClang = (stdenv.cc.cc.isClang or false);
in
stdenv.mkDerivation rec{
name = "iniparser-3.1";
@ -10,12 +14,12 @@ stdenv.mkDerivation rec{
patches = ./no-usr.patch;
buildFlags = "libiniparser.so";
# TODO: Build dylib on Darwin
buildFlags = (if stdenv.isDarwin then [ "libiniparser.a" ] else [ "libiniparser.so" ])
++ optional isClang "CC=clang";
installPhase = ''
mkdir -p $out/lib
cp libiniparser.so.0 $out/lib
ln -s libiniparser.so.0 $out/lib/libiniparser.so
mkdir -p $out/include
cp src/*.h $out/include
@ -25,7 +29,13 @@ stdenv.mkDerivation rec{
bzip2 -c -9 $i > $out/share/doc/${name}/$i.bz2;
done;
cp -r html $out/share/doc/${name}
'';
'' + (if stdenv.isDarwin then ''
cp libiniparser.a $out/lib
'' else ''
cp libiniparser.so.0 $out/lib
ln -s libiniparser.so.0 $out/lib/libiniparser.so
'');
meta = {
homepage = http://ndevilla.free.fr/iniparser;