1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-18 21:41:53 +03:00
mobile-nixos/overlay/mruby-builder/mrbgems/mruby-lvgui/lvgui.nix
Samuel Dionne-Riel 199201df98 mruby-lvgui: update lvgui version
Main changes are:

 * Dynamic build support
 * Minimal introspection
 * "better" makefile which handles the .pc file
2020-05-23 01:56:00 -04:00

67 lines
1.5 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 = "mobile-nixos-early-boot-gui";
version = "2020-02-05";
src = fetchFromGitHub {
fetchSubmodules = true;
repo = "lvgui";
owner = "mobile-nixos";
rev = "d98d5e59ba0f4a76b2f092ee957a198d9e749dfb";
sha256 = "1hn01mi44wmx12987va4h69ldnvjbvniwm9slnd5naib6j2n5rbw";
};
# 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;
}