1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-19 05:51:52 +03:00
mobile-nixos/overlay/mruby-builder/mrbgems/mruby-lvgui/lvgui.nix

67 lines
1.5 KiB
Nix
Raw Normal View History

2020-02-28 07:45:11 +03:00
{ stdenv
, pkgs
2020-02-28 07:45:11 +03:00
, lib
, fetchFromGitHub
, pkg-config
, SDL2
, withSimulator ? false
}:
let
inherit (lib) optional optionals optionalString;
simulatorDeps = [
SDL2
];
# Allow libevdev to cross-compile.
libevdev = (pkgs.libevdev.override({
python3 = null;
})).overrideAttrs({nativeBuildsInputs ? [], ...}: {
nativeBuildInputs = nativeBuildsInputs ++ [
pkgs.buildPackages.python3
];
});
2020-02-28 07:45:11 +03:00
in
stdenv.mkDerivation {
2020-07-26 04:26:30 +03:00
pname = "lvgui";
version = "2020-07-25";
2020-02-28 07:45:11 +03:00
src = fetchFromGitHub {
fetchSubmodules = true;
repo = "lvgui";
owner = "mobile-nixos";
2020-07-26 04:26:30 +03:00
rev = "aceb8947f2a8d3b4672d30a8e4d74a94f3ded1ac";
sha256 = "00hcsaljxk08w0jasvqb63h60vak3lrm23b0pygiznbr7xhpm9ci";
2020-02-28 07:45:11 +03:00
};
2020-03-02 01:28:16 +03:00
# Document `LVGL_ENV_SIMULATOR` in the built headers.
# This allows the mrbgem to know about it.
# (In reality this should be part of a ./configure step or something similar.)
postPatch = ''
sed -i"" '/^#define LV_CONF_H/a #define LVGL_ENV_SIMULATOR ${if withSimulator then "1" else "0"}' lv_conf.h
'';
2020-02-28 07:45:11 +03:00
nativeBuildInputs = [
pkg-config
];
buildInputs = [
libevdev
]
++ optionals withSimulator simulatorDeps
;
NIX_CFLAGS_COMPILE = [
"-DX_DISPLAY_MISSING"
];
makeFlags = [
"PREFIX=${placeholder "out"}"
2020-02-28 07:45:11 +03:00
]
++ optional withSimulator "LVGL_ENV_SIMULATOR=1"
++ optional (!withSimulator) "LVGL_ENV_SIMULATOR=0"
;
enableParallelBuilding = true;
}