1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 bison,
6 pkg-config,
7 rake,
8 ruby,
9 libGL,
10 libuv,
11 libX11,
12}:
13
14stdenv.mkDerivation rec {
15 pname = "mruby-zest";
16 version = "3.0.6";
17
18 src = fetchFromGitHub {
19 owner = pname;
20 repo = "${pname}-build";
21 rev = "refs/tags/${version}";
22 fetchSubmodules = true;
23 sha256 = "sha256-rIb6tQimwrUj+623IU5zDyKNWsNYYBElLQClOsP+5Dc=";
24 };
25
26 patches = [
27 ./force-cxx-as-linker.patch
28 ];
29
30 nativeBuildInputs = [
31 bison
32 pkg-config
33 rake
34 ruby
35 ];
36
37 buildInputs = [
38 libGL
39 libuv
40 libX11
41 ];
42
43 # Force optimization to fix:
44 # warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O)
45 env.NIX_CFLAGS_COMPILE = "-O3";
46
47 # Remove pre-built y.tab.c to generate with nixpkgs bison
48 preBuild = ''
49 rm mruby/mrbgems/mruby-compiler/core/y.tab.c
50 '';
51
52 installTargets = [ "pack" ];
53
54 postInstall = ''
55 ln -s "$out/zest" "$out/zyn-fusion"
56 cp -a package/{font,libzest.so,schema,zest} "$out"
57
58 # mruby-widget-lib/src/api.c requires MainWindow.qml as part of a
59 # sanity check, even though qml files are compiled into the binary
60 # https://github.com/mruby-zest/mruby-zest-build/blob/3.0.6/src/mruby-widget-lib/src/api.c#L107-L124
61 # https://github.com/mruby-zest/mruby-zest-build/blob/3.0.6/linux-pack.sh#L17-L18
62 mkdir -p "$out/qml"
63 touch "$out/qml/MainWindow.qml"
64 '';
65
66 meta = with lib; {
67 description = "Zest Framework used in ZynAddSubFX's UI";
68 homepage = "https://github.com/mruby-zest";
69 license = licenses.lgpl21Plus;
70 maintainers = with maintainers; [ kira-bruneau ];
71 platforms = platforms.all;
72 };
73}