2
0
Fork 0

Configure Genode build with tup.config

This commit is contained in:
Ehmry - 2019-10-04 14:31:23 +02:00
parent 77fc1c8da2
commit 96e098d644
2 changed files with 31 additions and 15 deletions

View File

@ -8,7 +8,7 @@ rec {
testConfig = ./log.xml;
testScript = ''
file link -s test-log ${genode.base}/bin/test-log/test-log
file link -s test-log ${genode.base}/bin/test-log
run_genode_until {Test done.} 10
'';
}

View File

@ -5,6 +5,8 @@
{ stdenv, buildPackages, fetchgit, llvmPackages }:
let
version = "19.08-64-g69eb762e4a";
inherit (stdenv) lib targetPlatform;
specs = with targetPlatform; []
++ lib.optional is32bit "32bit"
@ -16,26 +18,30 @@ let
++ lib.optional isx86_32 "x86_32"
++ lib.optional isx86_64 "x86_64";
version = "19.07";
buildRepo = repo:
stdenv.mkDerivation {
let
tupArch = with stdenv.targetPlatform;
if isAarch32 then "arm" else
if isAarch64 then "arm64" else
if isx86_32 then "i386" else
if isx86_64 then "x86_64" else
abort "unhandled targetPlatform";
toTupConfig = attrs:
with builtins;
let op = config: name: "${config}CONFIG_${name}=${getAttr name attrs} ";
in foldl' op "" (attrNames attrs);
in stdenv.mkDerivation {
name = "genode-${repo}-${version}";
outputs = [ "out" "dev" ];
inherit repo specs version;
HOST_LIBC = buildPackages.glibc.dev;
LIBCXX = llvmPackages.libcxx;
LIBCXXABI = llvmPackages.libcxxabi;
LIBUNWIND = llvmPackages.libunwind;
LIBUNWIND_BAREMETAL =
llvmPackages.libunwind.override { isBaremetal = true; };
src = fetchgit {
url = "https://git.sr.ht/~ehmry/genode";
rev = "c425f2b3448622675c36b02fdc00ed4948c09a00";
sha256 = "1b5q2s38bmk0zbn4k2h2ar6rlf9r0656fbf1s0gnb2jaqslmn2ql";
rev = "69eb762e4a0f00424643411e599bfba46b75795b";
sha256 = "0p7nlk331b921ds94m59fnnl1d3zb719q3kayy2qkr2k6xi0pf17";
fetchSubmodules = false;
};
@ -43,9 +49,19 @@ let
depsBuildBuild = with buildPackages; [ llvm pkgconfig tup ];
tupConfig = toTupConfig {
LIBCXX = llvmPackages.libcxx;
LIBCXXABI = llvmPackages.libcxxabi;
LIBUNWIND = llvmPackages.libunwind;
LIBUNWIND_BAREMETAL = llvmPackages.libunwind.override { isBaremetal = true; };
LINUX_HEADERS = buildPackages.glibc.dev;
TUP_ARCH = tupArch;
VERSION = version;
};
configurePhase = ''
# Configure Tup
echo CONFIG_NIX= >> tup.config
echo $tupConfig | tr ' CONFIG_' '\nCONFIG_' > tup.config
echo CONFIG_NIX_OUTPUTS_OUT=$out >> tup.config
echo CONFIG_NIX_OUTPUTS_DEV=$dev >> tup.config
@ -56,7 +72,6 @@ let
find repos/gems -name Tupfile -delete
# Scan repository and generate script
rm Tupfile # skip the dhall stuff
tup init
tup generate buildPhase.sh
@ -106,6 +121,7 @@ let
export PROMPT_DIRTRIM=2
export PS1="\[\033[1;30m\]Genode-dev [\[\033[1;37m\]\w\[\033[1;30m\]] $\[\033[0m\] "
export PS2="\[\033[1;30m\]>\[\033[0m\] "
echo $tupConfig | tr ' CONFIG_' '\nCONFIG_'
'';
};