mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-18 05:21:47 +03:00
66 lines
1.4 KiB
Nix
66 lines
1.4 KiB
Nix
{ stdenv
|
|
, pkgs
|
|
, 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
|
|
];
|
|
});
|
|
in
|
|
stdenv.mkDerivation {
|
|
pname = "lvgui";
|
|
version = "2020-07-25";
|
|
|
|
src = fetchFromGitHub {
|
|
repo = "lvgui";
|
|
owner = "mobile-nixos";
|
|
rev = "0dc257d07271fad023a5e6e9ac42222d2397c5cf";
|
|
sha256 = "1zb7naamqfzcsfi5809c93f1ygxp4w3aiw6172bpmnk1vxdchwsh";
|
|
};
|
|
|
|
# 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
|
|
'';
|
|
|
|
nativeBuildInputs = [
|
|
pkg-config
|
|
];
|
|
|
|
buildInputs = [
|
|
libevdev
|
|
]
|
|
++ optionals withSimulator simulatorDeps
|
|
;
|
|
|
|
NIX_CFLAGS_COMPILE = [
|
|
"-DX_DISPLAY_MISSING"
|
|
];
|
|
|
|
makeFlags = [
|
|
"PREFIX=${placeholder "out"}"
|
|
]
|
|
++ optional withSimulator "LVGL_ENV_SIMULATOR=1"
|
|
++ optional (!withSimulator) "LVGL_ENV_SIMULATOR=0"
|
|
;
|
|
|
|
enableParallelBuilding = true;
|
|
}
|