2
0
Fork 0
genodepkgs/overlay/default.nix

157 lines
4.5 KiB
Nix
Raw Normal View History

{ flake }:
final: prev:
with prev;
let
2020-11-26 12:11:29 +01:00
# Helper functions to override package dependant
# on whether the host or target system is Genode.
overrideHost = attrs: drv:
2020-10-19 23:04:41 +02:00
if hostPlatform.isGenode then drv.override attrs else drv;
2020-11-26 12:11:29 +01:00
overrideTarget = attrs: drv:
if targetPlatform.isGenode then drv.override attrs else drv;
2020-03-24 13:47:30 +01:00
2020-11-26 12:11:29 +01:00
overrideAttrsHost = f: drv:
if hostPlatform.isGenode then drv.overrideAttrs f else drv;
2020-11-26 12:11:29 +01:00
overrideAttrsTarget = f: drv:
if targetPlatform.isGenode then drv.overrideAttrs f else drv;
2020-11-26 12:11:29 +01:00
addPatches' = patches: attrs: { patches = attrs.patches or [ ] ++ patches; };
addPatchesHost = ps: overrideAttrsHost (addPatches' ps);
addPatchesTarget = ps: overrideAttrsTarget (addPatches' ps);
2020-11-26 12:11:29 +01:00
autoreconfHost = overrideAttrsHost
(attrs: { nativeBuildInputs = [ final.autoreconfHook ]; });
2020-11-25 21:06:52 +01:00
in {
2020-03-24 13:47:30 +01:00
2020-11-26 12:11:29 +01:00
bash = overrideAttrsTarget (attrs: {
configureFlags = attrs.configureFlags
++ [ "--without-bash-malloc" ]; # no sbrk please
2020-06-08 08:55:57 +02:00
postPatch = "sed '/check_dev_tty/d' shell.c";
2020-11-26 12:11:29 +01:00
}) bash;
2020-03-24 13:47:30 +01:00
2020-11-26 12:11:29 +01:00
binutils-unwrapped = overrideAttrsTarget (attrs: {
patches = attrs.patches ++ [ ./binutils/support-genode.patch ];
nativeBuildInputs = [ final.updateAutotoolsGnuConfigScriptsHook ];
2020-11-26 12:11:29 +01:00
}) binutils-unwrapped;
2020-11-26 12:11:29 +01:00
cmake = overrideAttrsTarget (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
'';
2020-11-26 12:11:29 +01:00
}) cmake;
coreutils = overrideHost {
gmp = null;
libiconv = null;
} (overrideAttrsHost (attrs: {
configureFlags = [
"--disable-acl"
"--disable-largefile"
"--disable-xattr"
"--disable-libcap"
"--disable-nls"
];
LDFLAGS = [ "-Wl,--no-as-needed" ];
# keep libposix NEEDED
}) coreutils);
gdb = addPatchesTarget [ ./gdb/genode.patch ] gdb;
2020-04-05 18:50:52 +02:00
genodeLibcCross = callPackage ./libc { };
genodePackages = import ../packages {
inherit flake;
2020-11-06 20:59:33 +01:00
pkgs = final;
2020-10-19 23:04:41 +02:00
};
2020-11-26 12:11:29 +01:00
libconfig =
overrideAttrsHost (attrs: { configureFlags = [ "--disable-examples" ]; })
libconfig;
2020-11-01 20:23:01 +01:00
2020-03-24 13:47:30 +01:00
libcCrossChooser = name:
if stdenv.targetPlatform.isGenode then
targetPackages.genodeLibcCross
2020-03-24 13:47:30 +01:00
else
prev.libcCrossChooser name;
2020-11-26 12:11:29 +01:00
libsodium = overrideAttrsHost (attrs: {
2020-11-01 20:23:01 +01:00
patches = (attrs.patches or [ ]) ++ [ ./libsodium/genode.patch ];
2020-11-26 12:11:29 +01:00
}) libsodium;
libkrb5 = autoreconfHost libkrb5;
2020-11-01 20:23:01 +01:00
2020-11-26 12:11:29 +01:00
libtool = overrideAttrsTarget (attrs: {
nativeBuildInputs = with final;
attrs.nativeBuildInputs ++ [ autoconf automake115x ];
patches = ./libtool/genode.patch;
2020-11-26 12:11:29 +01:00
}) libtool;
2020-11-26 12:11:29 +01:00
libtoxcore = overrideHost {
2020-11-01 20:23:01 +01:00
libopus = null;
libvpx = null;
2020-11-26 12:11:29 +01:00
} libtoxcore;
2020-11-01 20:23:01 +01:00
2020-11-20 10:25:49 +01:00
llvmPackages_11 = callPackage ./llvm-11 ({
inherit (stdenvAdapters) overrideCC;
buildLlvmTools = buildPackages.llvmPackages_11.tools;
targetLlvmLibraries = targetPackages.llvmPackages_11.libraries;
inherit (final.genodePackages.genodeSources) genodeBase;
2020-11-25 21:06:52 +01:00
} // stdenv.lib.optionalAttrs
(stdenv.hostPlatform.isi686 && buildPackages.stdenv.cc.isGNU) {
stdenv = gcc7Stdenv;
});
2020-11-26 12:11:29 +01:00
ncurses = addPatchesHost [ ./ncurses/genode.patch ] ncurses;
2020-11-20 10:25:49 +01:00
2020-12-03 12:49:39 +01:00
openssl =
overrideHost { static = true; } # shared library comes out stupid big
(overrideAttrsHost (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
}) openssl);
2020-11-26 12:11:29 +01:00
rsync = overrideHost {
enableACLs = false;
popt = null;
2020-11-26 12:11:29 +01:00
} (overrideAttrsHost (attrs: { outputs = [ "out" "man" ]; }) rsync);
solo5-tools = callPackage ./solo5-tools { };
2020-12-03 12:22:18 +01:00
tor = overrideAttrsHost (attrs: {
configureFlags = attrs.configureFlags or [ ]
++ [ "--disable-tool-name-check" ];
patches = attrs.patches or [ ] ++ [ ./tor/genode.patch ];
postPatch = null; # Avoid torsocks patching
}) tor;
2020-11-26 12:11:29 +01:00
zlib = overrideAttrsHost (attrs: {
2020-06-10 18:21:26 +02:00
postInstall = attrs.postInstall or "" + ''
pushd ''${!outputLib}/lib
find . -type l -delete
mv libz.so.* libz.so
popd
'';
2020-11-26 12:11:29 +01:00
}) zlib;
}