diff --git a/pkgs/by-name/li/libui/darwin_versions.patch b/pkgs/by-name/li/libui/darwin_versions.patch new file mode 100644 index 000000000000..29f646402919 --- /dev/null +++ b/pkgs/by-name/li/libui/darwin_versions.patch @@ -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 diff --git a/pkgs/by-name/li/libui/libui.pc b/pkgs/by-name/li/libui/libui.pc deleted file mode 100644 index 42ee86fb550f..000000000000 --- a/pkgs/by-name/li/libui/libui.pc +++ /dev/null @@ -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} diff --git a/pkgs/by-name/li/libui/package.nix b/pkgs/by-name/li/libui/package.nix index 5f5430a72fca..d7304ee37133 100644 --- a/pkgs/by-name/li/libui/package.nix +++ b/pkgs/by-name/li/libui/package.nix @@ -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; }; -} +}) diff --git a/pkgs/by-name/li/libui/pkg-config.patch b/pkgs/by-name/li/libui/pkg-config.patch new file mode 100644 index 000000000000..45569a388608 --- /dev/null +++ b/pkgs/by-name/li/libui/pkg-config.patch @@ -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'