bemenu: add darwin platform

This commit is contained in:
Alexis Hildebrandt 2025-04-10 07:02:09 +02:00
parent fcec87c2f6
commit fd39404632

View file

@ -9,13 +9,14 @@
harfbuzz, harfbuzz,
pkg-config, pkg-config,
scdoc, scdoc,
makeWrapper,
ncursesSupport ? true, ncursesSupport ? true,
ncurses, ncurses,
waylandSupport ? true, waylandSupport ? stdenv.hostPlatform.isLinux,
wayland, wayland,
wayland-protocols, wayland-protocols,
wayland-scanner, wayland-scanner,
x11Support ? true, x11Support ? stdenv.hostPlatform.isLinux,
xorg, xorg,
}: }:
@ -30,11 +31,18 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-0vpqJ2jydTt6aVni0ma0g+80PFz+C4xJ5M77sMODkSg="; hash = "sha256-0vpqJ2jydTt6aVni0ma0g+80PFz+C4xJ5M77sMODkSg=";
}; };
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace GNUmakefile --replace '-soname' '-install_name'
'';
strictDeps = true; strictDeps = true;
nativeBuildInputs = [ nativeBuildInputs =
[
pkg-config pkg-config
scdoc scdoc
] ++ lib.optionals waylandSupport [ wayland-scanner ]; ]
++ lib.optional stdenv.hostPlatform.isDarwin makeWrapper
++ lib.optional waylandSupport wayland-scanner;
buildInputs = buildInputs =
[ [
@ -66,12 +74,20 @@ stdenv.mkDerivation (finalAttrs: {
++ lib.optional waylandSupport "wayland" ++ lib.optional waylandSupport "wayland"
++ lib.optional x11Support "x11"; ++ lib.optional x11Support "x11";
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
so="$(find "$out/lib" -name "libbemenu.so.[0-9]" -print -quit)"
for f in "$out/bin/"*; do
install_name_tool -change "$(basename $so)" "$so" $f
wrapProgram $f --set BEMENU_BACKEND curses
done
'';
meta = with lib; { meta = with lib; {
homepage = "https://github.com/Cloudef/bemenu"; homepage = "https://github.com/Cloudef/bemenu";
description = "Dynamic menu library and client program inspired by dmenu"; description = "Dynamic menu library and client program inspired by dmenu";
license = licenses.gpl3Plus; license = licenses.gpl3Plus;
maintainers = with maintainers; [ crertel ]; maintainers = with maintainers; [ crertel ];
mainProgram = "bemenu"; mainProgram = "bemenu";
platforms = with platforms; linux; platforms = with platforms; linux ++ darwin;
}; };
}) })