2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, gtk3, Cocoa }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
backend = if stdenv.isDarwin then "darwin" else "unix";
|
|
|
|
in
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libui";
|
|
|
|
version = "4.1a";
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "andlabs";
|
|
|
|
repo = "libui";
|
|
|
|
rev = "alpha4.1";
|
|
|
|
sha256 = "0bm6xvqk4drg2kw6d304x6mlfal7gh8mbl5a9f0509smmdzgdkwm";
|
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
|
|
|
propagatedBuildInputs = lib.optional stdenv.isLinux gtk3
|
|
|
|
++ lib.optionals stdenv.isDarwin [ Cocoa ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
preConfigure = lib.optionalString stdenv.isDarwin ''
|
2020-04-24 23:36:52 +00:00
|
|
|
sed -i 's/set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8")//' ./CMakeLists.txt
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/{include,lib}
|
|
|
|
mkdir -p $out/lib/pkgconfig
|
2021-02-05 17:12:51 +00:00
|
|
|
'' + lib.optionalString stdenv.isLinux ''
|
2022-03-05 16:20:37 +00:00
|
|
|
mv ./out/libui.so.0 $out/lib/
|
|
|
|
ln -s $out/lib/libui.so.0 $out/lib/libui.so
|
2021-02-05 17:12:51 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2022-03-05 16:20:37 +00:00
|
|
|
mv ./out/libui.A.dylib $out/lib/
|
2022-07-14 12:49:19 +00:00
|
|
|
ln -s $out/lib/libui.A.dylib $out/lib/libui.dylib
|
2020-04-24 23:36:52 +00:00
|
|
|
'' + ''
|
|
|
|
cp $src/ui.h $out/include
|
|
|
|
cp $src/ui_${backend}.h $out/include
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
cp ${./libui.pc} $out/lib/pkgconfig/libui.pc
|
|
|
|
substituteInPlace $out/lib/pkgconfig/libui.pc \
|
2020-04-24 23:36:52 +00:00
|
|
|
--subst-var-by out $out \
|
|
|
|
--subst-var-by version "${version}"
|
|
|
|
'';
|
2021-02-05 17:12:51 +00:00
|
|
|
postInstall = lib.optionalString stdenv.isDarwin ''
|
2022-03-05 16:20:37 +00:00
|
|
|
install_name_tool -id $out/lib/libui.A.dylib $out/lib/libui.A.dylib
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/andlabs/libui";
|
2020-10-19 00:13:06 +00:00
|
|
|
description = "Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|