Merge pull request #19028 from acowley/libui-darwin
libui: darwin compatibility
This commit is contained in:
commit
f7371ce3b5
@ -1,8 +1,9 @@
|
|||||||
{ stdenv, fetchgit, cmake, pkgconfig, gtk3 }:
|
{ stdenv, fetchgit, cmake, pkgconfig, gtk3, darwin }:
|
||||||
|
|
||||||
let
|
let
|
||||||
shortName = "libui";
|
shortName = "libui";
|
||||||
version = "3.1a";
|
version = "3.1a";
|
||||||
|
backend = if stdenv.isDarwin then "darwin" else "unix";
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "${shortName}-${version}";
|
name = "${shortName}-${version}";
|
||||||
@ -12,27 +13,42 @@ in
|
|||||||
sha256 = "1lpbfa298c61aarlzgp7vghrmxg1274pzxh1j9isv8x758gk6mfn";
|
sha256 = "1lpbfa298c61aarlzgp7vghrmxg1274pzxh1j9isv8x758gk6mfn";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ cmake pkgconfig gtk3 ];
|
buildInputs = [ cmake pkgconfig ] ++
|
||||||
|
(if stdenv.isDarwin then [darwin.apple_sdk.frameworks.Cocoa] else [gtk3]);
|
||||||
|
|
||||||
|
preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
|
sed -i 's/set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8")//' ./CMakeLists.txt
|
||||||
|
'';
|
||||||
|
cmakeFlags = stdenv.lib.optionals stdenv.isDarwin [
|
||||||
|
"-DCMAKE_OSX_SYSROOT="
|
||||||
|
"-DCMAKE_OSX_DEPLOYMENT_TARGET="
|
||||||
|
];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/{include,lib}
|
mkdir -p $out/{include,lib}
|
||||||
mkdir -p $out/lib/pkgconfig
|
mkdir -p $out/lib/pkgconfig
|
||||||
|
'' + stdenv.lib.optionalString stdenv.isLinux ''
|
||||||
mv ./out/${shortName}.so.0 $out/lib/
|
mv ./out/${shortName}.so.0 $out/lib/
|
||||||
ln -s $out/lib/${shortName}.so.0 $out/lib/${shortName}.so
|
ln -s $out/lib/${shortName}.so.0 $out/lib/${shortName}.so
|
||||||
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
|
mv ./out/${shortName}.A.dylib $out/lib/
|
||||||
|
ln -s $out/lib/${shortName}.A.dylib $out/lib/${shortName}.dylib
|
||||||
|
'' + ''
|
||||||
cp $src/ui.h $out/include
|
cp $src/ui.h $out/include
|
||||||
cp $src/ui_unix.h $out/include
|
cp $src/ui_${backend}.h $out/include
|
||||||
|
|
||||||
cp ${./libui.pc} $out/lib/pkgconfig/${shortName}.pc
|
cp ${./libui.pc} $out/lib/pkgconfig/${shortName}.pc
|
||||||
substituteInPlace $out/lib/pkgconfig/${shortName}.pc \
|
substituteInPlace $out/lib/pkgconfig/${shortName}.pc \
|
||||||
--subst-var-by out $out \
|
--subst-var-by out $out \
|
||||||
--subst-var-by version "${version}"
|
--subst-var-by version "${version}"
|
||||||
'';
|
'';
|
||||||
|
postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
|
install_name_tool -id $out/lib/${shortName}.A.dylib $out/lib/${shortName}.A.dylib
|
||||||
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = https://github.com/andlabs/libui;
|
homepage = https://github.com/andlabs/libui;
|
||||||
description = "Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.";
|
description = "Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.";
|
||||||
platforms = stdenv.lib.platforms.linux;
|
platforms = stdenv.lib.platforms.unix;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user