Fix genode detection in overlay

This commit is contained in:
Ehmry - 2019-09-14 10:12:32 +02:00
parent 837b701018
commit 272f6c8277
2 changed files with 13 additions and 10 deletions

View File

@ -14,6 +14,7 @@ let
};
portIncludes = ports:
with builtins;
listToAttrs (map (name:
let port = getAttr name ports;
in {

View File

@ -1,20 +1,22 @@
self: super:
let
inherit (super) lib stdenv;
inherit (super) lib;
genodeTarget = stdenv.targetPlatform ? isGenode
-> stdenv.targetPlatform.isGenode;
hasGenode = with super.stdenv;
(if hostPlatform ? isGenode then hostPlatform.isGenode else false)
|| (if targetPlatform ? isGenode then targetPlatform.isGenode else false);
genodelibc = self.callPackage ./libc { stdenv = self.crossLibcStdenv; };
in {
binutils-unwrapped = super.binutils-unwrapped.overrideAttrs
(attrs: { patches = attrs.patches ++ [ ./binutils.patch ]; });
binutils-unwrapped = super.binutils-unwrapped.overrideAttrs (attrs: {
patches = attrs.patches ++ (lib.optional hasGenode ./binutils.patch);
});
cmake = super.cmake.overrideAttrs (attrs: {
postInstall = if genodeTarget then ''
postInstall = if hasGenode then ''
local MODULE="$out/share/cmake-${
lib.versions.majorMinor attrs.version
}/Modules/Platform/Genode.cmake"
@ -43,7 +45,7 @@ in {
postUnpack = attrs.postUnpack + ''
patch -p1 -d $(ls -d llvm-*) -i ${./llvm-genode.patch}
'';
cmakeFlags = attrs.cmakeFlags ++ (lib.optionals genodeTarget [
cmakeFlags = attrs.cmakeFlags ++ (lib.optionals hasGenode [
"-DCMAKE_C_FLAGS=-nodefaultlibs"
"-DLIBCXXABI_USE_LLVM_UNWINDER=OFF"
"-DLIBCXXABI_ENABLE_THREADS=OFF"
@ -57,16 +59,16 @@ in {
libcxx = (super.llvmPackages_8.libcxx.override {
enableShared = false;
}).overrideAttrs (attrs: {
patches = attrs.patches ++ (lib.optional genodeTarget ./libc++.patch);
patches = attrs.patches ++ (lib.optional hasGenode ./libc++.patch);
nativeBuildInputs = attrs.nativeBuildInputs
++ [ super.buildPackages.python ];
cmakeFlags = attrs.cmakeFlags
++ (lib.optional genodeTarget "-DLIBCXX_ENABLE_THREADS=OFF");
++ (lib.optional hasGenode "-DLIBCXX_ENABLE_THREADS=OFF");
});
clang-unwrapped = super.llvmPackages_8.clang-unwrapped.overrideAttrs
(attrs: {
patches = attrs.patches ++ (lib.optional genodeTarget ./clang.patch);
patches = attrs.patches ++ [ ./clang.patch ];
});
};