nixpkgs-suyu/pkgs/development/libraries/libui/default.nix
Jonathan Ringer 9bb3fccb5b treewide: pkgs.pkgconfig -> pkgs.pkg-config, move pkgconfig to alias.nix
continuation of #109595

pkgconfig was aliased in 2018, however, it remained in
all-packages.nix due to its wide usage. This cleans
up the remaining references to pkgs.pkgsconfig and
moves the entry to aliases.nix.

python3Packages.pkgconfig remained unchanged because
it's the canonical name of the upstream package
on pypi.
2021-01-19 01:16:25 -08:00

54 lines
1.8 KiB
Nix

{ stdenv, fetchFromGitHub, cmake, pkg-config, gtk3, Cocoa }:
let
shortName = "libui";
version = "4.1a";
backend = if stdenv.isDarwin then "darwin" else "unix";
in
stdenv.mkDerivation {
name = "${shortName}-${version}";
src = fetchFromGitHub {
owner = "andlabs";
repo = "libui";
rev = "alpha4.1";
sha256 = "0bm6xvqk4drg2kw6d304x6mlfal7gh8mbl5a9f0509smmdzgdkwm";
};
nativeBuildInputs = [ cmake pkg-config ];
propagatedBuildInputs = stdenv.lib.optional stdenv.isLinux gtk3
++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ];
preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
sed -i 's/set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8")//' ./CMakeLists.txt
'';
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
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; {
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";
license = licenses.mit;
platforms = platforms.unix;
};
}