2019-08-10 00:45:19 +01:00
|
|
|
{ stdenv, fetchFromGitHub, cmake, pkgconfig, gtk3, Cocoa }:
|
2016-07-16 10:04:05 +01:00
|
|
|
|
2016-07-22 23:41:02 +01:00
|
|
|
let
|
|
|
|
shortName = "libui";
|
2019-08-10 00:45:19 +01:00
|
|
|
version = "4.1a";
|
2016-09-28 08:00:01 +01:00
|
|
|
backend = if stdenv.isDarwin then "darwin" else "unix";
|
2016-07-22 23:41:02 +01:00
|
|
|
in
|
2016-07-16 10:04:05 +01:00
|
|
|
|
2019-08-13 22:52:01 +01:00
|
|
|
stdenv.mkDerivation {
|
2018-11-07 19:01:58 +00:00
|
|
|
name = "${shortName}-${version}";
|
2019-08-10 00:45:19 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "andlabs";
|
|
|
|
repo = "libui";
|
|
|
|
rev = "alpha4.1";
|
|
|
|
sha256 = "0bm6xvqk4drg2kw6d304x6mlfal7gh8mbl5a9f0509smmdzgdkwm";
|
2018-11-07 19:01:58 +00:00
|
|
|
};
|
2016-09-28 08:00:01 +01:00
|
|
|
|
2018-11-07 19:01:58 +00:00
|
|
|
nativeBuildInputs = [ cmake pkgconfig ];
|
2019-08-10 00:45:19 +01:00
|
|
|
propagatedBuildInputs = stdenv.lib.optional stdenv.isLinux gtk3
|
2019-06-19 19:11:51 +01:00
|
|
|
++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ];
|
2016-07-16 10:04:05 +01:00
|
|
|
|
2018-11-07 19:01:58 +00:00
|
|
|
preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
sed -i 's/set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8")//' ./CMakeLists.txt
|
|
|
|
'';
|
2016-07-22 23:41:02 +01:00
|
|
|
|
2018-11-07 19:01:58 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/{include,lib}
|
|
|
|
mkdir -p $out/lib/pkgconfig
|
|
|
|
'' + stdenv.lib.optionalString stdenv.isLinux ''
|
|
|
|
mv ./out/${shortName}.so.0 $out/lib/
|
|
|
|
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_${backend}.h $out/include
|
2016-07-22 23:41:02 +01:00
|
|
|
|
2018-11-07 19:01:58 +00:00
|
|
|
cp ${./libui.pc} $out/lib/pkgconfig/${shortName}.pc
|
|
|
|
substituteInPlace $out/lib/pkgconfig/${shortName}.pc \
|
|
|
|
--subst-var-by out $out \
|
|
|
|
--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 = with stdenv.lib; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/andlabs/libui";
|
2018-11-07 19:01:58 +00:00
|
|
|
description = "Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|