-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
63 lines (56 loc) · 1.62 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
with import <nixpkgs> {};
# to build rodos and create a tgz archive with the librodos.a and all header files.
# It does so for a combination of targets/platforms: linux, posix, stm32f4, raspberry pi
let doit = (target: env: env.mkDerivation {
name = "rodos-${target}";
src = ./.;
buildPhase =
''
patchShebangs scripts/**/rodos-lib.sh
patchShebangs scripts/**/rodos-executable.sh
source setenvs.sh
rodos-lib.sh ${target}
if ! stat `find build -name librodos.a` &>/dev/null
then
echo "librodos.a not built!"
exit 1
fi
pushd tutorials/10*
rodos-executable.sh ${target} helloworld.cpp
if ! stat tst &>/dev/null
then
echo "helloworld test program could not be compiled"
exit 1
fi
popd
'';
installPhase =
''
mkdir staging
mkdir staging/lib
mkdir staging/include
mv build/libs/* staging/lib/
mv api staging/include/rodos
cd src
find -L . -name "*.h" -exec bash -c 'mkdir -p ../staging/include/rodos/$(dirname $0); mv $0 ../staging/include/rodos/$0' '{}' ';'
cd ..
RODOS_NAME=rodos-${target}-${env.hostPlatform.system}
mv staging $RODOS_NAME
tar -caf ''${RODOS_NAME}.tgz $RODOS_NAME
mkdir $out
mv ''${RODOS_NAME}.tgz $out/
'';
});
in
map (cfg: doit (builtins.elemAt cfg 0) (builtins.elemAt cfg 1))
[
["linux-makecontext" pkgsi686Linux.stdenv]
["linux-x86" pkgsi686Linux.stdenv]
["on-posix" pkgsi686Linux.stdenv]
["on-posix64" stdenv]
["discovery" pkgsCross.arm-embedded.stdenv]
["discovery_f429" pkgsCross.arm-embedded.stdenv]
["skith" pkgsCross.arm-embedded.stdenv]
["raspberrypi3" pkgsCross.arm-embedded.stdenv]
["sf2" pkgsCross.arm-embedded.stdenv]
]