packages: transitive depot package dependencies

The buildDepot function now takes a "depotInputs" argument that
propagates "portInputs" and "depotInputs" across packages.

Drop the stdcxx package that includes a dev output and just use
the simple depot package for now.
This commit is contained in:
Ehmry - 2021-02-02 21:41:23 +01:00
parent e9d784ac52
commit cc211e763a
6 changed files with 80 additions and 57 deletions

View File

@ -199,8 +199,8 @@ in {
jitter_sponge = "${pkgs.genodePackages.jitter_sponge}/bin/jitter_sponge"; jitter_sponge = "${pkgs.genodePackages.jitter_sponge}/bin/jitter_sponge";
report_rom = "${pkgs.genodePackages.report_rom}/bin/report_rom"; report_rom = "${pkgs.genodePackages.report_rom}/bin/report_rom";
rtc_drv = "${pkgs.genodePackages.rtc_drv}/bin/rtc_drv"; rtc_drv = "${pkgs.genodePackages.rtc_drv}/bin/rtc_drv";
vfs = "${pkgs.genodePackages.vfs}/bin/vfs"; vfs = "${pkgs.genodePackages.vfs.unpatched}/bin/vfs";
"vfs.lib.so" = "${pkgs.genodePackages.vfs.lib}/lib/vfs.lib.so"; "vfs.lib.so" = "${pkgs.genodePackages.vfs.unpatched}/lib/vfs.lib.so";
}; };
genode.core.children = genode.core.children =

View File

@ -84,6 +84,11 @@ with lib;
ipxe = ipxe_nic_drv; ipxe = ipxe_nic_drv;
virtio = virtio_nic_drv; virtio = virtio_nic_drv;
}.${interface.genode.driver}; }.${interface.genode.driver};
binaryPath = with pkgs.genodePackages;
{
ipxe = "${ipxe_nic_drv}/bin/ipxe_nic_drv";
virtio = "${virtio_nic_drv}/bin/virtio_nic_drv";
}.${interface.genode.driver};
in { in {
inputs = [ binary ]; inputs = [ binary ];
configFile = let configFile = let
@ -103,8 +108,7 @@ with lib;
in Init.Child.flat in Init.Child.flat
Init.Child.Attributes::{ Init.Child.Attributes::{
, binary = "${binary}/bin/${binary.pname}" , binary = "${binaryPath}"
, provides = [ "Nic" ]
, resources = Init.Resources::{ caps = 128, ram = Genode.units.MiB 4 } , resources = Init.Resources::{ caps = 128, ram = Genode.units.MiB 4 }
, routes = [ Init.ServiceRoute.parent "IO_MEM" ] , routes = [ Init.ServiceRoute.parent "IO_MEM" ]
, config = Init.Config::{ , config = Init.Config::{
@ -127,6 +131,11 @@ with lib;
lwip = vfs_lwip; lwip = vfs_lwip;
lxip = vfs_lxip; lxip = vfs_lxip;
}.${interface.genode.stack}; }.${interface.genode.stack};
vfsPluginPath = with pkgs.genodePackages;
{
lwip = "${vfs_lwip}/lib/vfs_lwip.lib.so";
lxip = "${vfs_lxip}/lib/vfs_lxip.lib.so";
}.${interface.genode.stack};
in { in {
name = name'; name = name';
value = if interface.genode.stack == null then value = if interface.genode.stack == null then
@ -147,7 +156,7 @@ with lib;
} }
{ {
name = "load"; name = "load";
value = "${vfsPlugin}/lib/${vfsPlugin.pname}.lib.so"; value = vfsPlugin;
} }
] ++ lib.optionals (interface.ipv4.addresses != [ ]) ] ++ lib.optionals (interface.ipv4.addresses != [ ])
(let addr = head interface.ipv4.addresses; (let addr = head interface.ipv4.addresses;

View File

@ -49,8 +49,6 @@ in upstream // {
portInputs = with genodeSources.ports; [ libc libssh openssl zlib ]; portInputs = with genodeSources.ports; [ libc libssh openssl zlib ];
}; };
stdcxx = callPackage ./stdcxx { };
worldSources = buildPackages.fetchFromGitHub { worldSources = buildPackages.fetchFromGitHub {
owner = "genodelabs"; owner = "genodelabs";
repo = "genode-world"; repo = "genode-world";

View File

@ -190,10 +190,20 @@ let
buildDepot = buildDepot =
# Build a Depot target from the Genode sources # Build a Depot target from the Genode sources
{ name, apiOnly ? false, portInputs ? [ ], nativeBuildInputs ? [ ] { name, apiOnly ? false, portInputs ? [ ], depotInputs ? [ ]
, buildInputs ? [ ], meta ? { }, ... }@extraAttrs: , nativeBuildInputs ? [ ], buildInputs ? [ ], meta ? { }, ... }@extraAttrs:
stdenv'.mkDerivation (extraAttrs // { let
getDepotInputs = lib.concatMap (x:
[ x ] ++ x.passthru.depotInputs
++ (getDepotInputs x.passthru.depotInputs));
depotInputs' = lib.lists.unique (getDepotInputs depotInputs);
portInputs' = portInputs
++ lib.concatMap (builtins.getAttr "portInputs") depotInputs';
in stdenv'.mkDerivation (extraAttrs // {
pname = name; pname = name;
inherit (genodeSources) version; inherit (genodeSources) version;
enableParallelBuilding = true; enableParallelBuilding = true;
@ -208,7 +218,7 @@ let
configurePhase = let configurePhase = let
copyPorts = # wasteful copy copyPorts = # wasteful copy
toString toString
(builtins.map (drv: " cp -r ${drv}/* $CONTRIB_DIR/;") portInputs); (builtins.map (drv: " cp -r ${drv}/* $CONTRIB_DIR/;") portInputs');
in '' in ''
runHook preConfigure runHook preConfigure
export GENODE_DIR=$(pwd) export GENODE_DIR=$(pwd)
@ -237,6 +247,7 @@ let
runHook preInstall runHook preInstall
rm -r depot/genodelabs/bin/${arch}/${name}/*\.build rm -r depot/genodelabs/bin/${arch}/${name}/*\.build
local outputBinDir="''${!outputBin}/bin"
local outputLibDir="''${!outputLib}/lib" local outputLibDir="''${!outputLib}/lib"
find depot/genodelabs/bin/${arch}/${name} -name '*.lib.so' \ find depot/genodelabs/bin/${arch}/${name} -name '*.lib.so' \
-exec install -Dt "$outputLibDir" {} \; -delete -exec install -Dt "$outputLibDir" {} \; -delete
@ -252,11 +263,12 @@ let
fi fi
find depot/genodelabs/bin/${arch}/${name} -executable \ find depot/genodelabs/bin/${arch}/${name} -executable \
-exec install -Dt "''${!outputBin}/bin" {} \; -exec install -Dt "$outputBinDir" {} \;
runHook postInstall runHook postInstall
''; '';
passthru = { inherit depotInputs portInputs; };
meta = { platforms = lib.platforms.genode; } // meta; meta = { platforms = lib.platforms.genode; } // meta;
}); });

View File

@ -15,13 +15,14 @@ let
vbox5' = { vbox5' = {
nativeBuildInputs = with buildPackages; [ iasl yasm ]; nativeBuildInputs = with buildPackages; [ iasl yasm ];
portInputs = with ports; [ libc libiconv qemu-usb stdcxx virtualbox5 ]; depotInputs = with self; [ posix libiconv stdcxx zlib ];
portInputs = with ports; [ qemu-usb virtualbox5 ];
}; };
in { in {
acpi_drv = { }; acpi_drv = { };
acpica = { }; acpica = { };
ahci_drv = { }; ahci_drv = { };
backdrop.portInputs = with ports; [ libc libpng zlib ]; backdrop = { depotInputs = with self; [ posix libpng ]; };
bash-minimal = { bash-minimal = {
enableParallelBuilding = false; enableParallelBuilding = false;
nativeBuildInputs = with buildPackages; [ autoconf ]; nativeBuildInputs = with buildPackages; [ autoconf ];
@ -41,14 +42,18 @@ in {
clipboard = { }; clipboard = { };
coreutils-minimal = { coreutils-minimal = {
enableParallelBuilding = false; enableParallelBuilding = false;
portInputs = with ports; [ coreutils libc ]; depotInputs = with self; [ libc ];
portInputs = with ports; [ coreutils ];
postInstall = '' postInstall = ''
find depot/genodelabs/bin/ -name '*.tar' -exec tar xf {} -C $out \; find depot/genodelabs/bin/ -name '*.tar' -exec tar xf {} -C $out \;
''; '';
}; };
cpu_burner = { }; cpu_burner = { };
cpu_load_display = { }; cpu_load_display = { };
curl.portInputs = with ports; [ curl libc libssh openssl zlib ]; curl = {
depotInputs = with self; [ libcrypto libssh libssl zlib ];
portInputs = with ports; [ curl ];
};
decorator = { }; decorator = { };
demo = { }; demo = { };
depot_deploy = { }; depot_deploy = { };
@ -109,19 +114,34 @@ in {
lan9118_nic_drv = { }; lan9118_nic_drv = { };
libarchive = { }; libarchive = { };
libc = { libc = {
buildInputs = [ self.vfs ]; depotInputs = with self; [ vfs ];
portInputs = with ports; [ libc ]; portInputs = with ports; [ libc ];
patches = [ ./patches/libc.patch ]; patches = [ ./patches/libc.patch ];
}; };
libcrypto.portInputs = with ports; [ libc openssl ]; libcrypto = {
libiconv.portInputs = with ports; [ libc libiconv ]; depotInputs = with self; [ libc ];
portInputs = with ports; [ openssl ];
};
libiconv = {
depotInputs = with self; [ libc ];
portInputs = with ports; [ libiconv ];
};
liblzma = { }; liblzma = { };
libpng = { }; libpng = {
depotInputs = with self; [ zlib ];
portInputs = with ports; [ libpng ];
};
libqgenodeviewwidget = { }; libqgenodeviewwidget = { };
libqpluginwidget = { }; libqpluginwidget = { };
libsparkcrypto = { }; libsparkcrypto = { };
libssh.portInputs = with ports; [ libc libssh openssl zlib ]; libssh = {
libssl.portInputs = with ports; [ libc openssl ]; depotInputs = with self; [ libcrypto zlib ];
portInputs = with ports; [ libssh ];
};
libssl = {
depotInputs = with self; [ libcrypto ];
portInputs = with ports; [ openssl ];
};
lighttpd = { }; lighttpd = { };
linux_nic_drv.HOST_INC_DIR = [ hostLibcInc ]; linux_nic_drv.HOST_INC_DIR = [ hostLibcInc ];
linux_rtc_drv = { }; linux_rtc_drv = { };
@ -138,7 +158,10 @@ in {
mpfr = { }; mpfr = { };
mupdf = { }; mupdf = { };
nano3d = { }; nano3d = { };
ncurses.portInputs = with ports; [ libc ncurses ]; ncurses = {
depotInputs = with self; [ libc ];
portInputs = with ports; [ ncurses ];
};
nic_bridge = { }; nic_bridge = { };
nic_loopback = { }; nic_loopback = { };
nic_router = { }; nic_router = { };
@ -153,8 +176,7 @@ in {
pdf_view = { }; pdf_view = { };
platform_drv.patches = [ ./patches/platform_drv.patch ]; platform_drv.patches = [ ./patches/platform_drv.patch ];
posix = { posix = {
buildInputs = [ self.libc ]; depotInputs = with self; [ libc ];
portInputs = with ports; [ ports.libc ];
patches = [ ./patches/libc.patch ]; patches = [ ./patches/libc.patch ];
}; };
ps2_drv = { }; ps2_drv = { };
@ -192,8 +214,11 @@ in {
seoul.portInputs = with ports; [ libc seoul ]; seoul.portInputs = with ports; [ libc seoul ];
sequence = { }; sequence = { };
spark = { }; spark = { };
ssh_terminal.portInputs = with ports; [ libc libssh ]; ssh_terminal = { depotInputs = with self; [ libssh ]; };
stdcxx.portInputs = with ports; [ libc stdcxx ]; stdcxx = {
depotInputs = with self; [ libc ];
portInputs = with ports; [ stdcxx ];
};
stdin2out = { }; stdin2out = { };
system_rtc = { }; system_rtc = { };
tar = { }; tar = { };
@ -281,10 +306,7 @@ in {
vbox5-nova = vbox5'; vbox5-nova = vbox5';
verify = { }; verify = { };
vesa_drv.portInputs = with ports; [ libc x86emu ]; vesa_drv.portInputs = with ports; [ libc x86emu ];
vfs = { vfs.patches = [ ./patches/vfs.patch ];
outputs = [ "out" "lib" ];
patches = [ ./patches/vfs.patch ];
};
vfs_audit = { }; vfs_audit = { };
vfs_block = { }; vfs_block = { };
vfs_fatfs = { }; vfs_fatfs = { };
@ -307,9 +329,15 @@ in {
postInstall = "mv $out/bin/virtio_*_nic $out/bin/$pname"; postInstall = "mv $out/bin/virtio_*_nic $out/bin/$pname";
}; };
which = { }; which = { };
wifi_drv.portInputs = with ports; [ dde_linux libc openssl ]; wifi_drv = {
depotInputs = with self; [ libcrypto ];
portInputs = with ports; [ dde_linux ];
};
window_layouter = { }; window_layouter = { };
wm = { }; wm = { };
zlib = { }; zlib = {
depotInputs = with self; [ libc ];
portInputs = with ports; [ zlib ];
};
zynq_nic_drv = { }; zynq_nic_drv = { };
} }

View File

@ -1,24 +0,0 @@
{ genodePackages }:
let
inherit (genodePackages) genodeSources;
port = genodeSources.ports.stdcxx;
in genodeSources.buildUpstream {
name = "stdcxx";
outputs = [ "out" "dev" ];
targets = [ "LIB=stdcxx" ];
portInputs = [ genodeSources.ports.libc port ];
propagatedBuildInputs = [ genodeSources.genodeBase ];
STDCXX_PORT = port;
postInstall = ''
mkdir -p $dev/include
pushd $STDCXX_PORT/*
cp -r --no-preserve=mode \
include/stdcxx/* \
$GENODE_DIR/repos/libports/include/stdcxx/* \
$dev/include/
popd
'';
}