libui: 4.1a -> 4.1a-unstable-2021-01-02

This commit is contained in:
Sizhe Zhao
2025-10-11 21:51:02 +08:00
parent e0aebe32e1
commit b272de1427
4 changed files with 48 additions and 54 deletions
@@ -0,0 +1,11 @@
--- a/meson.build
+++ b/meson.build
@@ -163,7 +163,7 @@
objc_args: ['-Dlibui_EXPORTS'],
link_args: libui_libui_link_args,
soversion: libui_soversion,
- darwin_versions: []) # TODO
+ darwin_versions: '0.0.0') # TODO
install_headers('ui.h')
# TODO when the API is stable enough to be versioned, create a pkg-config file (https://mesonbuild.com/Pkgconfig-module.html) and a declare_dependency() section too
-11
View File
@@ -1,11 +0,0 @@
prefix=@out@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${exec_prefix}/include
Name: libui
Description: Simple and portable (but not inflexible) GUI library
Version: @version@
Libs: -L${libdir} -lui
Cflags: -I${includedir}
+22 -43
View File
@@ -2,69 +2,48 @@
lib,
stdenv,
fetchFromGitHub,
cmake,
meson,
ninja,
pkg-config,
gtk3,
}:
let
backend = if stdenv.hostPlatform.isDarwin then "darwin" else "unix";
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "libui";
version = "4.1a";
version = "4.1a-unstable-2021-01-02";
src = fetchFromGitHub {
owner = "andlabs";
repo = "libui";
rev = "alpha4.1";
sha256 = "0bm6xvqk4drg2kw6d304x6mlfal7gh8mbl5a9f0509smmdzgdkwm";
rev = "fea45b2d5b75839be0af9acc842a147c5cba9295";
hash = "sha256-BGbL15hBHY4aZE2ANAEd677vzZMQzMCICBafRtoQIvA=";
};
nativeBuildInputs = [
cmake
meson
ninja
pkg-config
];
propagatedBuildInputs = lib.optional stdenv.hostPlatform.isLinux gtk3;
patches = [
./darwin_versions.patch
./pkg-config.patch
];
postPatch = ''
substituteInPlace meson.build \
--subst-var-by version "${finalAttrs.version}"
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace darwin/text.m unix/text.c \
--replace-fail "strcasecmp" "g_strcasecmp"
'';
preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin ''
sed -i 's/set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8")//' ./CMakeLists.txt
'';
installPhase = ''
mkdir -p $out/{include,lib}
mkdir -p $out/lib/pkgconfig
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
mv ./out/libui.so.0 $out/lib/
ln -s $out/lib/libui.so.0 $out/lib/libui.so
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
mv ./out/libui.A.dylib $out/lib/
ln -s $out/lib/libui.A.dylib $out/lib/libui.dylib
''
+ ''
cp $src/ui.h $out/include
cp $src/ui_${backend}.h $out/include
cp ${./libui.pc} $out/lib/pkgconfig/libui.pc
substituteInPlace $out/lib/pkgconfig/libui.pc \
--subst-var-by out $out \
--subst-var-by version "${version}"
'';
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
install_name_tool -id $out/lib/libui.A.dylib $out/lib/libui.A.dylib
'';
meta = with lib; {
meta = {
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;
license = lib.licenses.mit;
platforms = lib.platforms.unix;
};
}
})
+15
View File
@@ -0,0 +1,15 @@
--- a/meson.build
+++ b/meson.build
@@ -167,6 +167,12 @@
install_headers('ui.h')
# TODO when the API is stable enough to be versioned, create a pkg-config file (https://mesonbuild.com/Pkgconfig-module.html) and a declare_dependency() section too
+pkg = import('pkgconfig')
+pkg.generate(libui_libui,
+ description: 'Simple and portable (but not inflexible) GUI library',
+ filebase: 'libui',
+ name: 'libui',
+ version: '@version@')
libui_binary_deps = []
if libui_mode == 'static'