209 lines
5.4 KiB
Nix
209 lines
5.4 KiB
Nix
{ nixpkgs }:
|
|
|
|
let
|
|
inherit (nixpkgs.genodeHeaders) version src;
|
|
|
|
sourceForgeToolchain =
|
|
nixpkgs.buildPackages.callPackage ./toolchain.nix { };
|
|
|
|
stdenv' =
|
|
nixpkgs.stdenvAdapters.overrideCC nixpkgs.stdenv sourceForgeToolchain;
|
|
|
|
platform = stdenv'.targetPlatform;
|
|
|
|
arch = with platform;
|
|
if isx86_64 then
|
|
"x86_64"
|
|
else
|
|
throw "unknown Genode arch for platform ${platform.system}";
|
|
|
|
toolPrefix = if platform.isx86 then
|
|
"genode-x86-"
|
|
else
|
|
throw "unknown tool prefix for Genode arch ${arch}";
|
|
|
|
mkPort = { name, hash, nativeBuildInputs ? [ ] }:
|
|
let
|
|
value = stdenv'.mkDerivation {
|
|
pname = name;
|
|
inherit src version;
|
|
|
|
outputHashMode = "recursive";
|
|
outputHash = hash;
|
|
|
|
nativeBuildInputs = with nixpkgs.buildPackages;
|
|
[ bison glibc flex gitMinimal subversion glibcLocales which wget ]
|
|
++ nativeBuildInputs;
|
|
|
|
patches = [ ./svn-trust-server-cert.patch ];
|
|
|
|
configurePhase = ''
|
|
runHook preConfigure
|
|
patchShebangs ./tool/ports
|
|
runHook postConfigure
|
|
'';
|
|
|
|
buildPhase = ''
|
|
export CONTRIB_DIR=$out
|
|
./tool/ports/prepare_port $pname
|
|
'';
|
|
|
|
dontInstall = true;
|
|
|
|
GIT_SSL_CAINFO =
|
|
"${nixpkgs.buildPackages.cacert}/etc/ssl/certs/ca-bundle.crt";
|
|
|
|
impureEnvVars = stdenv'.lib.fetchers.proxyImpureEnvVars
|
|
++ [ "GIT_PROXY_COMMAND" "SOCKS_SERVER" ];
|
|
|
|
};
|
|
in { inherit name value; };
|
|
|
|
portDrvs = with nixpkgs.buildPackages; builtins.listToAttrs (builtins.map mkPort [
|
|
{
|
|
name = "stb";
|
|
hash = "sha256-RQKF/H3wsKy6ZT9PLv4vzerJl+0Be2wqNjqsUBYZU6U=";
|
|
}
|
|
{
|
|
name = "libc";
|
|
hash = "sha256-yx5jGJI1w6KAwS2JPHhWpPFEeEyOv7yfIeXLRgQM7l8=";
|
|
}
|
|
{
|
|
name = "x86emu";
|
|
hash = "sha256-fKUab/HflrcZqzSk/cz/QimPtPILGwvXgHkwE4y2uQc=";
|
|
}
|
|
{
|
|
name = "lwip";
|
|
hash = "sha256-1oOJoCME8N1nQKUxG7vRBFRtJ9MausrIfno91QchMEU=";
|
|
}
|
|
{
|
|
name = "dde_linux";
|
|
hash = "sha256-9xD+pIjYeL9W/2HsOpJCGJs5+RgM2gmwxXC+h1Yc90Y=";
|
|
}
|
|
{
|
|
name = "dde_bsd";
|
|
hash = "sha256-ZcF6L4maC1vB5IP1jR6L4CWlaNf5Qu4xVjqITK3Yt0w=";
|
|
}
|
|
{
|
|
name = "dde_rump";
|
|
hash = "sha256-aU5s+sf9/bZxzSX7+9wNEn3693yxDJB/dNVWMLuJkQI=";
|
|
}
|
|
{
|
|
name = "dde_ipxe";
|
|
hash = "sha256-UIwC0O5IlxNWQKBJYE9h5ekVWP18UTvejsgb1i6KHCs=";
|
|
}
|
|
{
|
|
name = "openssl";
|
|
hash = "sha256-eZYdDT4L3R64mhUKGAiiQUOF9GgeEHDZlsDZbI4BM58=";
|
|
}
|
|
{
|
|
name = "libiconv";
|
|
hash = "sha256-TN3cZAo7zq7OLXXB2lLxOnM5c98aA0GksE7ACrymVvE=";
|
|
}
|
|
{
|
|
name = "qemu-usb";
|
|
hash = "sha256-awBouSz5MBBc9HuHZiZJK7jbabNSyqBQMX2NPXHvR0I=";
|
|
}
|
|
{
|
|
name = "stdcxx";
|
|
hash = "sha256-hXRdT6f2prKsCXDSJ4HMF1MNaRh0/EoNMrJUBuHQeyI=";
|
|
}
|
|
{
|
|
name = "virtualbox5";
|
|
hash = "sha256-VZPXyFLzLFCmxbbBqmZ9HP0y6E+1I+v/+Rt22IjlOrI=";
|
|
nativeBuildInputs = [
|
|
iasl
|
|
libxslt
|
|
unzip
|
|
yasm
|
|
];
|
|
}
|
|
{
|
|
name = "expat";
|
|
hash = "sha256-CCMxMn2DpzrIkW9WMBaX1T77T/GECy8pVlsT+BpbsQs=";
|
|
}
|
|
{
|
|
name = "jpeg";
|
|
hash = "sha256-ZUMuNV9ltGqZhny6LAn/Do1ojbypnSHa9dfQ0ZVZhUE=";
|
|
}
|
|
{
|
|
name = "lz4";
|
|
hash = "sha256-xYohPuOwqiFBHkqwP/q0fMafmWzMg4rt3qYZqO624wk=";
|
|
}
|
|
{
|
|
name = "mesa";
|
|
hash = "sha256-ho8t+7jFzYPi8nmHi4usFNunwHsbSBdtvVOtAlbz9Oc=";
|
|
nativeBuildInputs = [ python ];
|
|
}
|
|
{
|
|
name = "mupdf";
|
|
hash = "sha256-7zl2DKFIPzQdX/poF0jxejn81OCWrh7QfTuNmtOA4WA=";
|
|
}
|
|
{
|
|
name = "jitterentropy";
|
|
hash = "sha256-FnLuTDOCyQ9/jpQfx0vtyrbUymW7G3BuSM+NINKOxK4=";
|
|
}
|
|
{
|
|
name = "libpng";
|
|
hash = "sha256-Y3DjI7m1kYGbHX8hRob3RYnTTTX4LteOt5Yqzlcq/tQ=";
|
|
}
|
|
{
|
|
name = "libssh";
|
|
hash = "sha256-IjHv+cbvAU7RVcKJSvHJmG8ZDULpEAawr7snPzWdMsU=";
|
|
}
|
|
{
|
|
name = "zlib";
|
|
hash = "sha256-gWv8RKlc3TacC4sHPKXyhqVDRkM6MIXuWLqEx5gHz7s=";
|
|
}
|
|
]);
|
|
|
|
in { name, targets, ports ? [ ], nativeBuildInputs ? [ ], ... }@extraAttrs:
|
|
|
|
let ports' = builtins.map (name: builtins.getAttr name portDrvs) ports;
|
|
|
|
in stdenv'.mkDerivation (extraAttrs // {
|
|
pname = name;
|
|
inherit version targets;
|
|
src = nixpkgs.fetchFromGitHub {
|
|
owner = "genodelabs";
|
|
repo = "genode";
|
|
rev = version;
|
|
sha256 = "0idk92ibrasla0y2xkrmyh49dx0nzg96gqkcmn6r3w5r3fdpsfjy";
|
|
};
|
|
|
|
nativeBuildInputs = with nixpkgs.buildPackages;
|
|
[ binutils bison flex stdenv.cc tcl which ] ++ nativeBuildInputs;
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
configurePhase = ''
|
|
runHook preConfigure
|
|
patchShebangs ./tool/check_abi
|
|
patchShebangs ./tool/create_builddir
|
|
substituteInPlace repos/base/etc/tools.conf \
|
|
--replace "/usr/local/genode/tool/19.05/bin/" ""
|
|
substituteInPlace tool/check_abi \
|
|
--replace "exec nm" "exec ${toolPrefix}nm"
|
|
./tool/create_builddir ${arch} BUILD_DIR=build
|
|
substituteInPlace build/etc/build.conf \
|
|
--replace "#REPOSITORIES" "REPOSITORIES"
|
|
runHook postConfigure
|
|
'' + (if ports != [ ] then
|
|
"mkdir contrib;"
|
|
+ toString (builtins.map (drv: " ln -sv ${drv}/* contrib/;") ports')
|
|
else
|
|
"");
|
|
|
|
makeFlags = [ "-C build" ] ++ targets;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
find build/bin -name '*.xsd' -delete
|
|
find build/bin -name '*.lib.so' -exec install -Dt $out/lib '{}' \; -delete
|
|
find build/bin -exec install -Dt $out/bin '{}' \;
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru.ports = portDrvs;
|
|
})
|