116 lines
3.3 KiB
Nix
116 lines
3.3 KiB
Nix
{ upstreamSources, pinnedPackages }:
|
|
final: prev:
|
|
with prev;
|
|
let
|
|
overrideHost = drv: attrs:
|
|
if hostPlatform.isGenode then drv.override attrs else drv;
|
|
|
|
overrideHostAttrs = drv: f:
|
|
if hostPlatform.isGenode then drv.overrideAttrs f else drv;
|
|
|
|
overrideTargetAttrs = drv: f:
|
|
if targetPlatform.isGenode then drv.overrideAttrs f else drv;
|
|
|
|
addPatches = drv: patch:
|
|
overrideTargetAttrs drv
|
|
(attrs: { patches = attrs.patches or [ ] ++ [ patch ]; });
|
|
|
|
in {
|
|
|
|
bash = overrideTargetAttrs bash (attrs: {
|
|
configureFlags = attrs.configureFlags
|
|
++ [ "--without-bash-malloc" ]; # no sbrk please
|
|
postPatch = "sed '/check_dev_tty/d' shell.c";
|
|
});
|
|
|
|
binutils-unwrapped = overrideTargetAttrs binutils-unwrapped (attrs: {
|
|
patches = attrs.patches ++ [ ./binutils/support-genode.patch ];
|
|
nativeBuildInputs = [ final.updateAutotoolsGnuConfigScriptsHook ];
|
|
});
|
|
|
|
cmake = overrideTargetAttrs cmake (attrs: {
|
|
postInstall = with stdenv; ''
|
|
local MODULE="$out/share/cmake-${
|
|
lib.versions.majorMinor attrs.version
|
|
}/Modules/Platform/Genode.cmake"
|
|
if [ -e "$MODULE" ]; then
|
|
echo "Upstream provides $MODULE!"
|
|
exit 1
|
|
fi
|
|
cp ${./cmake/Genode.cmake} $MODULE
|
|
'';
|
|
});
|
|
|
|
coreutils = if targetPlatform.isGenode then
|
|
(coreutils.override {
|
|
gmp = null;
|
|
libiconv = null;
|
|
}).overrideAttrs (attrs: {
|
|
configureFlags = [
|
|
"--disable-acl"
|
|
"--disable-largefile"
|
|
"--disable-xattr"
|
|
"--disable-libcap"
|
|
"--disable-nls"
|
|
];
|
|
LDFLAGS = [ "-Wl,--no-as-needed" ];
|
|
# keep libposix NEEDED
|
|
})
|
|
else
|
|
coreutils;
|
|
|
|
gdb = addPatches gdb [ ./gdb/genode.patch ];
|
|
|
|
genodeLibcCross = callPackage ./libc { };
|
|
|
|
genodePackages = import ../packages {
|
|
inherit pinnedPackages;
|
|
nixpkgs = final;
|
|
};
|
|
|
|
genodeSources = buildPackages.callPackage ../packages/genodelabs {
|
|
inherit upstreamSources pinnedPackages;
|
|
};
|
|
|
|
libcCrossChooser = name:
|
|
if stdenv.targetPlatform.isGenode then
|
|
targetPackages.genodeLibcCross
|
|
else
|
|
prev.libcCrossChooser name;
|
|
|
|
llvmPackages_8 = callPackage ./llvm-8 ({
|
|
inherit (stdenvAdapters) overrideCC;
|
|
inherit (targetPackages.genodeSources) genodeBase;
|
|
buildLlvmTools = buildPackages.llvmPackages_8.tools;
|
|
targetLlvmLibraries = targetPackages.llvmPackages_8.libraries;
|
|
});
|
|
|
|
openssl = overrideHostAttrs openssl (attrs: {
|
|
outputs = [ "out" ]
|
|
++ builtins.filter (x: x != "bin" && x != "out") attrs.outputs;
|
|
patches = attrs.patches or [ ] ++ [ ./openssl/genode.patch ];
|
|
configureScript = {
|
|
x86_64-genode = "./Configure Genode-x86_64";
|
|
}.${stdenv.hostPlatform.system} or (throw
|
|
"Not sure what configuration to use for ${stdenv.hostPlatform.config}");
|
|
configureFlags = attrs.configureFlags ++ [ "no-devcryptoeng" ];
|
|
postInstall =
|
|
"rm $out/bin/c_rehash"; # eliminate the perl runtime dependency
|
|
});
|
|
|
|
rsync = overrideHost rsync { enableACLs = false; };
|
|
|
|
solo5-tools = callPackage ./solo5-tools { };
|
|
|
|
tup = prev.tup.overrideAttrs (attrs: { setupHook = ./tup/setup-hook.sh; });
|
|
|
|
zlib = overrideHostAttrs zlib (attrs: {
|
|
postInstall = attrs.postInstall or "" + ''
|
|
pushd ''${!outputLib}/lib
|
|
find . -type l -delete
|
|
mv libz.so.* libz.so
|
|
popd
|
|
'';
|
|
});
|
|
}
|