solo5: install opam bindings for all targets that are enabled

Reuse the configuration generated by configure.sh to dynamically install
the bindings for all enabled targets. A bit of a hack grepping for the
respective lines in the Makeconf which incidentally also parse as shell.

Alternative would be to check for the target libs.
This commit is contained in:
sternenseemann 2021-03-18 00:13:43 +01:00 committed by Emery Hemingway
parent f61460e499
commit d97c564c9f

View file

@ -1,6 +1,16 @@
{ lib, stdenv, fetchurl, pkg-config, libseccomp, util-linux, qemu }:
let version = "0.6.8";
let
version = "0.6.8";
# list of all theoretically available targets
targets = [
"genode"
"hvt"
"muen"
"spt"
"virtio"
"xen"
];
in stdenv.mkDerivation {
pname = "solo5";
inherit version;
@ -29,9 +39,15 @@ in stdenv.mkDerivation {
export DESTDIR=$out
export PREFIX=$out
make install-tools
${lib.optionalString stdenv.hostPlatform.isLinux "make ${
(lib.concatMapStringsSep " " (x: "install-opam-${x}") [ "hvt" "spt" ])
}"}
# get CONFIG_* vars from Makeconf which also parse in sh
grep '^CONFIG_' Makeconf > nix_tmp_targetconf
source nix_tmp_targetconf
# install opam / pkg-config files for all enabled targets
${lib.concatMapStrings (bind: ''
[ -n "$CONFIG_${lib.toUpper bind}" ] && make install-opam-${bind}
'') targets}
runHook postInstall
'';