Commit fd394046 authored by Alexis Hildebrandt's avatar Alexis Hildebrandt
Browse files

bemenu: add darwin platform

parent fcec87c2
Loading
Loading
Loading
Loading
+23 −7
Original line number Diff line number Diff line
@@ -9,13 +9,14 @@
  harfbuzz,
  pkg-config,
  scdoc,
  makeWrapper,
  ncursesSupport ? true,
  ncurses,
  waylandSupport ? true,
  waylandSupport ? stdenv.hostPlatform.isLinux,
  wayland,
  wayland-protocols,
  wayland-scanner,
  x11Support ? true,
  x11Support ? stdenv.hostPlatform.isLinux,
  xorg,
}:

@@ -30,11 +31,18 @@ stdenv.mkDerivation (finalAttrs: {
    hash = "sha256-0vpqJ2jydTt6aVni0ma0g+80PFz+C4xJ5M77sMODkSg=";
  };

  postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
    substituteInPlace GNUmakefile --replace '-soname' '-install_name'
  '';

  strictDeps = true;
  nativeBuildInputs = [
  nativeBuildInputs =
    [
      pkg-config
      scdoc
  ] ++ lib.optionals waylandSupport [ wayland-scanner ];
    ]
    ++ lib.optional stdenv.hostPlatform.isDarwin makeWrapper
    ++ lib.optional waylandSupport wayland-scanner;

  buildInputs =
    [
@@ -66,12 +74,20 @@ stdenv.mkDerivation (finalAttrs: {
    ++ lib.optional waylandSupport "wayland"
    ++ 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; {
    homepage = "https://github.com/Cloudef/bemenu";
    description = "Dynamic menu library and client program inspired by dmenu";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ crertel ];
    mainProgram = "bemenu";
    platforms = with platforms; linux;
    platforms = with platforms; linux ++ darwin;
  };
})