-
-
Notifications
You must be signed in to change notification settings - Fork 95
/
default.nix
82 lines (73 loc) · 1.82 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{
lib
, stdenv
, pkg-config
, scdoc
, ncurses
, cairo
, fribidi
, harfbuzz
, libxkbcommon
, pango
, wayland
, wayland-scanner
, wayland-protocols
, xorg
}:
with builtins;
with lib;
let
version = readFile ./VERSION;
in stdenv.mkDerivation {
src = with fileset; toSource {
root = ./.;
fileset = unions [ ./VERSION ./GNUmakefile ./bemenu.pc.in ./scripts ./lib ./man ./client ];
};
inherit version;
pname = "bemenu";
strictDeps = true;
nativeBuildInputs = [
pkg-config
scdoc
] ++ optionals (stdenv.isLinux) [
wayland-scanner
];
buildInputs = [
ncurses
] ++ optionals (stdenv.isLinux) [
cairo
fribidi
harfbuzz
libxkbcommon
pango
# Wayland
wayland wayland-protocols
# X11
xorg.libX11 xorg.libXinerama xorg.libXft
xorg.libXdmcp xorg.libpthreadstubs xorg.libxcb
];
postPatch = "" + optionalString (stdenv.isDarwin) ''
substituteInPlace GNUmakefile --replace '-soname' '-install_name'
'';
makeFlags = [ "PREFIX=$(out)" ];
buildFlags = [ "PREFIX=$(out)" "clients" "curses" ] ++ optionals (stdenv.isLinux) [ "wayland" "x11" ];
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/fix-darwin-dylib-names.sh
# ^ does not handle .so files
postInstall = "" + optionalString (stdenv.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
done
'';
doCheck = stdenv.isLinux;
checkPhase = ''
make check-symbols
'';
meta = {
homepage = "https://github.com/Cloudef/bemenu";
description = "Dynamic menu library and client program inspired by dmenu";
license = licenses.gpl3Plus;
platforms = with platforms; darwin ++ linux;
mainProgram = "bemenu-run";
};
}