A bunch of unstaged stuff I found months later
This commit is contained in:
parent
2b1c9d710a
commit
ad9261c0ac
18
flake.lock
18
flake.lock
|
@ -5,11 +5,11 @@
|
|||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1615634419,
|
||||
"narHash": "sha256-VSPhQ2wvwrPbnfxPGsXQe3lTEsTOk9mUjfD/WVDPskM=",
|
||||
"lastModified": 1617699750,
|
||||
"narHash": "sha256-jVsaLrPxppRW40hob3OR1tspdWcWXRwvu2mGVGqH/2Y=",
|
||||
"owner": "nix-community",
|
||||
"repo": "flake-nimble",
|
||||
"rev": "79d42ec0ba0349a967b38db70ae2e3e2f6d9c3e2",
|
||||
"rev": "5d7a9c0d28472ad2ded4c3c335b8d3b1f6a65e6d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -33,16 +33,16 @@
|
|||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1617984351,
|
||||
"narHash": "sha256-mo/tmR1sVmQ+4uziIAZpdNnr9AG0NAAo9Md3tucf73k=",
|
||||
"owner": "NixOS",
|
||||
"lastModified": 1618995560,
|
||||
"narHash": "sha256-pqMtPTgqWatdhIPBxENaZPKSirJ2AMYegkNBnD9ur4A=",
|
||||
"owner": "ehmry",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "842f900e73c7ce985218cc4f455e34d1d56475c1",
|
||||
"rev": "efc09182fa0cc67721c878d6da48ea968c99984e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"owner": "ehmry",
|
||||
"ref": "sigil",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
description = "Nix flavored Genode distribution";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
inputs.nixpkgs.url = "github:ehmry/nixpkgs/sigil";
|
||||
|
||||
outputs = { self, nixpkgs, nimble }:
|
||||
let
|
||||
|
|
|
@ -30,6 +30,7 @@ in λ ( params
|
|||
λ(binary : Text) →
|
||||
Init.toChild
|
||||
Init::{
|
||||
, verbose = True
|
||||
, routes = [ Init.ServiceRoute.parent "Timer" ]
|
||||
, children = toMap
|
||||
{ terminal =
|
||||
|
@ -99,7 +100,7 @@ in λ ( params
|
|||
( toMap
|
||||
{ name = "regular"
|
||||
, path = params.fontFile
|
||||
, size_px = "10"
|
||||
, size_px = "8"
|
||||
}
|
||||
)
|
||||
]
|
||||
|
|
|
@ -5,29 +5,34 @@ let toDhall = lib.generators.toDhall { };
|
|||
in {
|
||||
imports = [ ./ahci.nix ./framebuffer.nix ./nic.nix ./usb.nix ];
|
||||
|
||||
options.hardware.genode.platform.policies = lib.mkOption {
|
||||
type = with types; listOf path;
|
||||
default = [ ];
|
||||
description = ''
|
||||
List of policies to append to the Genode platform driver.
|
||||
Type is Init.Config.Policy.Type.
|
||||
'';
|
||||
options.hardware.genode = {
|
||||
verbose = lib.mkEnableOption "verbose drivers";
|
||||
platform.policies = lib.mkOption {
|
||||
type = with types; listOf path;
|
||||
default = [ ];
|
||||
description = ''
|
||||
List of policies to append to the Genode platform driver.
|
||||
Type is Init.Config.Policy.Type.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
deviceManagerEnable = config.hardware.genode.ahci.enable
|
||||
|| config.hardware.genode.usb.enable;
|
||||
cfg = config.hardware.genode;
|
||||
|
||||
deviceManagerEnable = cfg.ahci.enable || cfg.usb.enable;
|
||||
|
||||
ahciEris = lib.getEris "bin" pkgs.genodePackages.ahci_drv;
|
||||
partBlockEris = lib.getEris "bin" pkgs.genodePackages.part_block;
|
||||
|
||||
usbEris = lib.attrsets.mapAttrs (_: lib.getEris "bin") {
|
||||
inherit (pkgs.genodePackages) usb_block_drv usb_drv;
|
||||
usb_block_drv = cfg.usb.storage.package;
|
||||
usb_host_drv = cfg.usb.host.package;
|
||||
};
|
||||
|
||||
ahciConfig = with config.hardware.genode.ahci;
|
||||
ahciConfig = with cfg.ahci;
|
||||
lib.optionalString enable ''
|
||||
, ahci_driver = Some ${
|
||||
, ahci_drv = Some ${
|
||||
toDhall {
|
||||
binary = ahciEris.cap;
|
||||
atapi = atapiSupport;
|
||||
|
@ -35,20 +40,20 @@ in {
|
|||
}
|
||||
'';
|
||||
|
||||
usbConfig = with config.hardware.genode.usb;
|
||||
lib.optionalString enable ''
|
||||
, usb_block = Some { binary = "${usbEris.usb_block_drv.cap}" }
|
||||
, usb_driver = Some ${
|
||||
toDhall {
|
||||
binary = usbEris.usb_drv.cap;
|
||||
bios_handoff = biosHandoff;
|
||||
ehci = ehciSupport;
|
||||
ohci = ohciSupport;
|
||||
uhci = uhciSupport;
|
||||
xhci = xhciSupport;
|
||||
}
|
||||
usbConfig = lib.optionalString cfg.usb.enable ''
|
||||
, usb_block_drv = Some { binary = "${usbEris.usb_block_drv.cap}" }
|
||||
, usb_host_drv = Some ${
|
||||
with cfg.usb.host;
|
||||
toDhall {
|
||||
binary = usbEris.usb_host_drv.cap;
|
||||
bios_handoff = biosHandoff;
|
||||
ehci = ehciSupport;
|
||||
ohci = ohciSupport;
|
||||
uhci = uhciSupport;
|
||||
xhci = xhciSupport;
|
||||
}
|
||||
'';
|
||||
}
|
||||
'';
|
||||
|
||||
managerConfig = pkgs.writeText "device_manager.dhall" ''
|
||||
let Manager = ${pkgs.genodePackages.device_manager.dhall}/package.dhall
|
||||
|
@ -58,6 +63,7 @@ in {
|
|||
, part_block.binary = "${partBlockEris.cap}"
|
||||
${ahciConfig}
|
||||
${usbConfig}
|
||||
, verbose = ${toDhall cfg.verbose}
|
||||
}
|
||||
'';
|
||||
in {
|
||||
|
@ -124,9 +130,8 @@ in {
|
|||
genode.core.children.drivers = lib.mkIf deviceManagerEnable {
|
||||
package = pkgs.genodePackages.init;
|
||||
extraErisInputs = [ partBlockEris ]
|
||||
++ lib.optional config.hardware.genode.ahci.enable ahciEris
|
||||
++ lib.optionals config.hardware.genode.usb.enable
|
||||
(builtins.attrValues usbEris);
|
||||
++ lib.optional cfg.ahci.enable ahciEris
|
||||
++ lib.optionals cfg.usb.enable (builtins.attrValues usbEris);
|
||||
configFile = pkgs.writeText "drivers.dhall" ''
|
||||
let Sigil = env:DHALL_SIGIL
|
||||
|
||||
|
|
|
@ -42,6 +42,12 @@ in {
|
|||
Init.Child.flat
|
||||
Init.Child.Attributes::{
|
||||
, binary
|
||||
, config = Init.Config::{
|
||||
, attributes = toMap
|
||||
{ width = "1024"
|
||||
, height = "768"
|
||||
}
|
||||
}
|
||||
, resources = Init.Resources::{ caps = 256, ram = Sigil.units.MiB 32 }
|
||||
, routes =
|
||||
[ Init.ServiceRoute.parent "IO_MEM"
|
||||
|
|
|
@ -10,21 +10,32 @@ in {
|
|||
|
||||
options.hardware.genode.usb = {
|
||||
enable = lib.mkEnableOption "USB driver";
|
||||
storage.enable = lib.mkEnableOption "USB mass storage driver";
|
||||
|
||||
biosHandoff = mkEnableOption' "perform the BIOS handoff procedure" true;
|
||||
host = {
|
||||
package = lib.mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.genodePackages.usb_host_drv;
|
||||
description = "USB host driver package.";
|
||||
};
|
||||
biosHandoff = mkEnableOption' "perform the BIOS handoff procedure" true;
|
||||
ehciSupport = mkEnableOption' "EHCI support" true;
|
||||
ohciSupport = mkEnableOption' "OHCI support" true;
|
||||
uhciSupport = mkEnableOption' "UHCI support" true;
|
||||
xhciSupport = mkEnableOption' "XHCI support" true;
|
||||
};
|
||||
|
||||
storage = {
|
||||
enable = lib.mkEnableOption "USB mass storage driver";
|
||||
package = lib.mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.genodePackages.usb_block_drv;
|
||||
description = "USB mass storage driver package.";
|
||||
};
|
||||
};
|
||||
|
||||
ehciSupport = mkEnableOption' "EHCI support" true;
|
||||
ohciSupport = mkEnableOption' "OHCI support" true;
|
||||
uhciSupport = mkEnableOption' "UHCI support" false;
|
||||
xhciSupport = mkEnableOption' "XHCI support" true;
|
||||
};
|
||||
|
||||
config = let
|
||||
cfg = config.hardware.genode.usb;
|
||||
usbEris = lib.attrsets.mapAttrs (_: lib.getEris "bin") {
|
||||
inherit (pkgs.genodePackages) part_block usb_block_drv usb_drv;
|
||||
};
|
||||
config = let cfg = config.hardware.genode.usb;
|
||||
in {
|
||||
|
||||
hardware.genode.usb.enable = lib.mkDefault cfg.storage.enable;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# Builds a compressed EFI System Partition image
|
||||
{ config, lib, pkgs }:
|
||||
|
||||
with config.block.partitions;
|
||||
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "boot.qcow2";
|
||||
|
||||
|
@ -40,8 +38,8 @@ pkgs.stdenv.mkDerivation {
|
|||
sfdisk $img <<EOF
|
||||
label: gpt
|
||||
label-id: $disklabel
|
||||
start=$(( $storeByteOffset / $sectorSize )), uuid=${store.guid}, type=${store.gptType}
|
||||
start=$(( $espByteOffset / $sectorSize )), uuid=${esp.guid}, type=${esp.gptType}
|
||||
start=$(( $storeByteOffset / $sectorSize )), uuid=${config.block.partitions.store.guid}, type=${store.gptType}
|
||||
start=$(( $espByteOffset / $sectorSize )), uuid=${config.block.partitions.esp.guid}, type=${esp.gptType}
|
||||
EOF
|
||||
sfdisk --reorder $img
|
||||
|
||||
|
|
|
@ -51,9 +51,9 @@ in {
|
|||
|
||||
boot.loader.grub = {
|
||||
extraEntries = ''
|
||||
menuentry 'Genode on NOVA' {
|
||||
insmod multiboot2
|
||||
menuentry 'sigil-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}' {
|
||||
insmod gzio
|
||||
insmod multiboot2
|
||||
multiboot2 /boot/bender.gz serial_fallback
|
||||
module2 /boot/hypervisor.gz hypervisor iommu logmem novga novpid serial
|
||||
module2 /boot/image.elf.gz image.elf
|
||||
|
|
|
@ -5,7 +5,7 @@ with import ../tests/lib/qemu-flags.nix { inherit pkgs; };
|
|||
|
||||
let
|
||||
|
||||
qemu = config.system.build.qemu;
|
||||
qemu = pkgs.buildPackages.buildPackages.qemu;
|
||||
|
||||
cfg = config.virtualisation;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ final: prev:
|
|||
with prev;
|
||||
|
||||
let
|
||||
# Helper functions to override package dependant
|
||||
# Helper functions to override package dependent
|
||||
# on whether the host or target system is Genode.
|
||||
|
||||
overrideHost = attrs: drv:
|
||||
|
@ -32,8 +32,8 @@ let
|
|||
if hostPlatform.isGenode then
|
||||
builtins.listToAttrs (map (name: {
|
||||
inherit name;
|
||||
value = null;
|
||||
}) [ "iproute2" ])
|
||||
value = final.hello;
|
||||
}) [ "iproute2" "strace" ])
|
||||
else
|
||||
{ };
|
||||
|
||||
|
@ -43,7 +43,7 @@ in nullPkgs // {
|
|||
configureFlags = attrs.configureFlags
|
||||
++ [ "--without-bash-malloc" ]; # no sbrk please
|
||||
postPatch = "sed '/check_dev_tty/d' shell.c";
|
||||
}) bash;
|
||||
}) prev.bash;
|
||||
|
||||
binutils-unwrapped = overrideAttrsTarget (attrs: {
|
||||
patches = attrs.patches ++ [
|
||||
|
@ -52,7 +52,7 @@ in nullPkgs // {
|
|||
];
|
||||
nativeBuildInputs = attrs.nativeBuildInputs
|
||||
++ [ final.updateAutotoolsGnuConfigScriptsHook ];
|
||||
}) binutils-unwrapped;
|
||||
}) prev.binutils-unwrapped;
|
||||
|
||||
cmake =
|
||||
# TODO: upstream
|
||||
|
@ -67,7 +67,7 @@ in nullPkgs // {
|
|||
fi
|
||||
cp ${./cmake/Genode.cmake} $MODULE
|
||||
'';
|
||||
}) cmake;
|
||||
}) prev.cmake;
|
||||
|
||||
coreutils = overrideHost {
|
||||
gmp = null;
|
||||
|
@ -82,7 +82,7 @@ in nullPkgs // {
|
|||
];
|
||||
LDFLAGS = [ "-Wl,--no-as-needed" ];
|
||||
# keep libposix NEEDED
|
||||
}) coreutils);
|
||||
}) prev.coreutils);
|
||||
|
||||
erisPatchHook = final.callPackage ./eris-patch-hook {
|
||||
patchelf = prev.patchelf.overrideAttrs (attrs: {
|
||||
|
@ -97,7 +97,7 @@ in nullPkgs // {
|
|||
gdb = addPatchesTarget [
|
||||
./gdb/genode.patch
|
||||
# Upstreamed, remove at next release.
|
||||
] gdb;
|
||||
] prev.gdb;
|
||||
|
||||
genodeLibcCross = callPackage ./libc { };
|
||||
|
||||
|
@ -126,11 +126,11 @@ in nullPkgs // {
|
|||
./libsodium/genode.patch
|
||||
# https://github.com/jedisct1/libsodium/pull/1006
|
||||
];
|
||||
}) libsodium;
|
||||
}) prev.libsodium;
|
||||
|
||||
libkrb5 =
|
||||
# Do not want.
|
||||
autoreconfHost libkrb5;
|
||||
autoreconfHost prev.libkrb5;
|
||||
|
||||
libtool =
|
||||
# Autotools related nonesense. Better to compile
|
||||
|
@ -139,24 +139,27 @@ in nullPkgs // {
|
|||
nativeBuildInputs = with final;
|
||||
attrs.nativeBuildInputs ++ [ autoconf automake115x ];
|
||||
patches = ./libtool/genode.patch;
|
||||
}) libtool;
|
||||
}) prev.libtool;
|
||||
|
||||
libtoxcore = overrideHost {
|
||||
libopus = null;
|
||||
libvpx = null;
|
||||
} libtoxcore;
|
||||
} prev.libtoxcore;
|
||||
|
||||
linuxPackages =
|
||||
# Dummy package.
|
||||
if hostPlatform.isGenode then {
|
||||
extend = _: final.linuxPackages;
|
||||
features = { };
|
||||
kernel.config = {
|
||||
isEnabled = _: false;
|
||||
isYes = _: false;
|
||||
kernel = {
|
||||
version = "999";
|
||||
config = {
|
||||
isEnabled = _: false;
|
||||
isYes = _: false;
|
||||
};
|
||||
};
|
||||
} else
|
||||
linuxPackages;
|
||||
prev.linuxPackages;
|
||||
|
||||
llvmPackages_11 = if targetPlatform.isGenode then
|
||||
# A copy of the LLVM expressions from Nixpkgs.
|
||||
|
@ -175,7 +178,7 @@ in nullPkgs // {
|
|||
ncurses =
|
||||
# https://invisible-island.net/autoconf/
|
||||
# Stay clear of upstream on this one.
|
||||
addPatchesHost [ ./ncurses/genode.patch ] ncurses;
|
||||
addPatchesHost [ ./ncurses/genode.patch ] prev.ncurses;
|
||||
|
||||
nim-unwrapped =
|
||||
# Fixes to the compiler and standard libary.
|
||||
|
@ -211,7 +214,7 @@ in nullPkgs // {
|
|||
configureFlags = attrs.configureFlags ++ [ "no-devcryptoeng" ];
|
||||
postInstall =
|
||||
"rm $out/bin/c_rehash"; # eliminate the perl runtime dependency
|
||||
}) openssl);
|
||||
}) prev.openssl);
|
||||
|
||||
patchelf = addPatchesTarget [
|
||||
./patchelf/dynstr.patch
|
||||
|
@ -231,14 +234,12 @@ in nullPkgs // {
|
|||
}) prev.stdenv;
|
||||
|
||||
tor = overrideAttrsHost (attrs: {
|
||||
configureFlags = attrs.configureFlags or [ ]
|
||||
++ [ "--disable-tool-name-check" ];
|
||||
patches = attrs.patches or [ ] ++ [
|
||||
./tor/genode.patch
|
||||
# We don't do users and groups here.
|
||||
];
|
||||
postPatch = null; # Avoid torsocks patching
|
||||
}) tor;
|
||||
}) prev.tor;
|
||||
|
||||
zlib = overrideAttrsHost (attrs: {
|
||||
postInstall = attrs.postInstall or "" + ''
|
||||
|
@ -247,7 +248,7 @@ in nullPkgs // {
|
|||
mv libz.so.* libz.so
|
||||
popd
|
||||
'';
|
||||
}) zlib;
|
||||
}) prev.zlib;
|
||||
|
||||
zstd = let
|
||||
static = true;
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
{ runCommand, stdenv, llvm, lld, version }:
|
||||
|
||||
let
|
||||
prefix =
|
||||
if stdenv.hostPlatform != stdenv.targetPlatform
|
||||
then "${stdenv.targetPlatform.config}-"
|
||||
else "";
|
||||
prefix = if stdenv.hostPlatform != stdenv.targetPlatform then
|
||||
"${stdenv.targetPlatform.config}-"
|
||||
else
|
||||
"";
|
||||
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ''
|
||||
mkdir -p $out/bin
|
||||
for prog in ${lld}/bin/*; do
|
||||
ln -s $prog $out/bin/${prefix}$(basename $prog)
|
||||
done
|
||||
for prog in ${llvm}/bin/*; do
|
||||
ln -sf $prog $out/bin/${prefix}$(basename $prog)
|
||||
done
|
||||
mkdir -p $out/bin
|
||||
for prog in ${lld}/bin/*; do
|
||||
ln -s $prog $out/bin/${prefix}$(basename $prog)
|
||||
done
|
||||
for prog in ${llvm}/bin/*; do
|
||||
ln -sf $prog $out/bin/${prefix}$(basename $prog)
|
||||
done
|
||||
|
||||
ln -s ${llvm}/bin/llvm-ar $out/bin/${prefix}ar
|
||||
ln -s ${llvm}/bin/llvm-as $out/bin/${prefix}as
|
||||
ln -s ${llvm}/bin/llvm-dwp $out/bin/${prefix}dwp
|
||||
ln -s ${llvm}/bin/llvm-nm $out/bin/${prefix}nm
|
||||
ln -s ${llvm}/bin/llvm-objcopy $out/bin/${prefix}objcopy
|
||||
ln -s ${llvm}/bin/llvm-objdump $out/bin/${prefix}objdump
|
||||
ln -s ${llvm}/bin/llvm-ranlib $out/bin/${prefix}ranlib
|
||||
ln -s ${llvm}/bin/llvm-readelf $out/bin/${prefix}readelf
|
||||
ln -s ${llvm}/bin/llvm-size $out/bin/${prefix}size
|
||||
ln -s ${llvm}/bin/llvm-strip $out/bin/${prefix}strip
|
||||
ln -s ${llvm}/bin/llvm-ar $out/bin/${prefix}ar
|
||||
ln -s ${llvm}/bin/llvm-as $out/bin/${prefix}as
|
||||
ln -s ${llvm}/bin/llvm-dwp $out/bin/${prefix}dwp
|
||||
ln -s ${llvm}/bin/llvm-nm $out/bin/${prefix}nm
|
||||
ln -s ${llvm}/bin/llvm-objcopy $out/bin/${prefix}objcopy
|
||||
ln -s ${llvm}/bin/llvm-objdump $out/bin/${prefix}objdump
|
||||
ln -s ${llvm}/bin/llvm-ranlib $out/bin/${prefix}ranlib
|
||||
ln -s ${llvm}/bin/llvm-readelf $out/bin/${prefix}readelf
|
||||
ln -s ${llvm}/bin/llvm-size $out/bin/${prefix}size
|
||||
ln -s ${llvm}/bin/llvm-strip $out/bin/${prefix}strip
|
||||
|
||||
ln -s ${lld}/bin/lld $out/bin/${prefix}ld
|
||||
ln -s ${lld}/bin/lld $out/bin/${prefix}ld
|
||||
''
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
{ lib, stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3, lld
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
}:
|
||||
{ lib, stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src
|
||||
, python3, lld, fixDarwinDylibNames, enableManpages ? false }:
|
||||
|
||||
let
|
||||
self = stdenv.mkDerivation ({
|
||||
|
@ -25,16 +23,14 @@ let
|
|||
|
||||
buildInputs = [ libxml2 llvm ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_CXX_FLAGS=-std=c++14"
|
||||
"-DCLANGD_BUILD_XPC=OFF"
|
||||
] ++ lib.optionals enableManpages [
|
||||
"-DCLANG_INCLUDE_DOCS=ON"
|
||||
"-DLLVM_ENABLE_SPHINX=ON"
|
||||
"-DSPHINX_OUTPUT_MAN=ON"
|
||||
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
|
||||
];
|
||||
cmakeFlags = [ "-DCMAKE_CXX_FLAGS=-std=c++14" "-DCLANGD_BUILD_XPC=OFF" ]
|
||||
++ lib.optionals enableManpages [
|
||||
"-DCLANG_INCLUDE_DOCS=ON"
|
||||
"-DLLVM_ENABLE_SPHINX=ON"
|
||||
"-DSPHINX_OUTPUT_MAN=ON"
|
||||
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
|
||||
];
|
||||
|
||||
patches = [
|
||||
./purity.patch
|
||||
|
@ -49,12 +45,13 @@ let
|
|||
|
||||
# Patch for standalone doc building
|
||||
sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
|
||||
'' + lib.optionalString (stdenv.hostPlatform.isMusl || stdenv.targetPlatform.isGenode) ''
|
||||
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
|
||||
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
substituteInPlace tools/extra/clangd/CMakeLists.txt \
|
||||
--replace "NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB" FALSE
|
||||
'';
|
||||
'' + lib.optionalString
|
||||
(stdenv.hostPlatform.isMusl || stdenv.targetPlatform.isGenode) ''
|
||||
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
|
||||
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
substituteInPlace tools/extra/clangd/CMakeLists.txt \
|
||||
--replace "NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB" FALSE
|
||||
'';
|
||||
|
||||
outputs = [ "out" "lib" "python" ];
|
||||
|
||||
|
@ -90,10 +87,11 @@ let
|
|||
};
|
||||
|
||||
meta = {
|
||||
description = "A c, c++, objective-c, and objective-c++ frontend for the llvm compiler";
|
||||
homepage = "https://llvm.org/";
|
||||
license = lib.licenses.ncsa;
|
||||
platforms = lib.platforms.all;
|
||||
description =
|
||||
"A c, c++, objective-c, and objective-c++ frontend for the llvm compiler";
|
||||
homepage = "https://llvm.org/";
|
||||
license = lib.licenses.ncsa;
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
} // lib.optionalAttrs enableManpages {
|
||||
pname = "clang-manpages";
|
||||
|
|
|
@ -6,9 +6,7 @@ let
|
|||
bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none";
|
||||
inherit (stdenv.hostPlatform) isMusl;
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "compiler-rt";
|
||||
inherit version;
|
||||
src = fetch pname "0d5j5l8phwqjjscmk8rmqn0i2i0abl537gdbkagl8fjpzy1gyjip";
|
||||
|
@ -24,36 +22,35 @@ stdenv.mkDerivation rec {
|
|||
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
||||
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
] ++ lib.optionals (stdenv.isDarwin) [
|
||||
"-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON"
|
||||
] ++ lib.optionals (useLLVM || bareMetal || isMusl) [
|
||||
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
|
||||
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
|
||||
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
|
||||
] ++ lib.optionals (useLLVM || bareMetal) [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
|
||||
"-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
|
||||
] ++ lib.optionals (useLLVM) [
|
||||
"-DCOMPILER_RT_BUILD_BUILTINS=ON"
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
#https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
|
||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
] ++ lib.optionals (bareMetal) [
|
||||
"-DCOMPILER_RT_OS_DIR=baremetal"
|
||||
];
|
||||
] ++ lib.optionals (stdenv.isDarwin)
|
||||
[ "-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON" ]
|
||||
++ lib.optionals (useLLVM || bareMetal || isMusl) [
|
||||
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
|
||||
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
|
||||
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
|
||||
] ++ lib.optionals (useLLVM || bareMetal) [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
|
||||
"-DCMAKE_SIZEOF_VOID_P=${
|
||||
toString (stdenv.hostPlatform.parsed.cpu.bits / 8)
|
||||
}"
|
||||
] ++ lib.optionals (useLLVM) [
|
||||
"-DCOMPILER_RT_BUILD_BUILTINS=ON"
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
#https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
|
||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
] ++ lib.optionals (bareMetal) [ "-DCOMPILER_RT_OS_DIR=baremetal" ];
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
patches = [
|
||||
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
||||
./compiler-rt-X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
|
||||
]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
|
||||
] # ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
|
||||
++ lib.optional stdenv.hostPlatform.isAarch32 ./compiler-rt-armv7l.patch;
|
||||
|
||||
|
||||
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
|
||||
# to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
|
||||
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
|
||||
|
@ -77,14 +74,15 @@ stdenv.mkDerivation rec {
|
|||
'';
|
||||
|
||||
# Hack around weird upsream RPATH bug
|
||||
postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
|
||||
ln -s "$out/lib"/*/* "$out/lib"
|
||||
'' + lib.optionalString (useLLVM) ''
|
||||
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o
|
||||
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
|
||||
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
|
||||
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
|
||||
'';
|
||||
postInstall = lib.optionalString
|
||||
(stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
|
||||
ln -s "$out/lib"/*/* "$out/lib"
|
||||
'' + lib.optionalString (useLLVM) ''
|
||||
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o
|
||||
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
|
||||
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
|
||||
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
|
||||
'';
|
||||
|
||||
enableParallelBuilding = true;
|
||||
}
|
||||
|
|
|
@ -1,219 +1,220 @@
|
|||
{ lib, lowPrio, newScope, pkgs, stdenv, cmake, gccForLibs
|
||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||
, buildPackages
|
||||
{ lib, lowPrio, newScope, pkgs, stdenv, cmake, gccForLibs, libxml2, python3, isl
|
||||
, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith, buildPackages
|
||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
||||
, erisPatchHook, genodePackages ? null
|
||||
}:
|
||||
, erisPatchHook, genodePackages ? null }:
|
||||
|
||||
let
|
||||
release_version = "11.0.0";
|
||||
version = release_version; # differentiating these (variables) is important for RCs
|
||||
version =
|
||||
release_version; # differentiating these (variables) is important for RCs
|
||||
targetConfig = stdenv.targetPlatform.config;
|
||||
|
||||
fetch = name: sha256: fetchurl {
|
||||
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${release_version}/${name}-${version}.src.tar.xz";
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
clang-tools-extra_src = fetch "clang-tools-extra" "02bcwwn54661madhq4nxc069s7p7pj5gpqi8ww50w3anbpviilzy";
|
||||
|
||||
tools = lib.makeExtensible (tools: let
|
||||
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||
mkExtraBuildCommands = cc: ''
|
||||
rsrc="$out/resource-root"
|
||||
mkdir "$rsrc"
|
||||
ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
|
||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
|
||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) ''
|
||||
echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags
|
||||
'';
|
||||
in {
|
||||
|
||||
llvm = callPackage ./llvm.nix { };
|
||||
|
||||
clang-unwrapped = callPackage ./clang {
|
||||
inherit (tools) lld;
|
||||
inherit clang-tools-extra_src;
|
||||
fetch = name: sha256:
|
||||
fetchurl {
|
||||
url =
|
||||
"https://github.com/llvm/llvm-project/releases/download/llvmorg-${release_version}/${name}-${version}.src.tar.xz";
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
# disabled until recommonmark supports sphinx 3
|
||||
#Llvm-manpages = lowPrio (tools.llvm.override {
|
||||
# enableManpages = true;
|
||||
# python3 = pkgs.python3; # don't use python-boot
|
||||
#});
|
||||
clang-tools-extra_src = fetch "clang-tools-extra"
|
||||
"02bcwwn54661madhq4nxc069s7p7pj5gpqi8ww50w3anbpviilzy";
|
||||
|
||||
clang-manpages = lowPrio (tools.clang-unwrapped.override {
|
||||
enableManpages = true;
|
||||
python3 = pkgs.python3; # don't use python-boot
|
||||
});
|
||||
tools = lib.makeExtensible (tools:
|
||||
let
|
||||
callPackage = newScope (tools // {
|
||||
inherit stdenv cmake libxml2 python3 isl release_version version fetch;
|
||||
});
|
||||
mkExtraBuildCommands = cc:
|
||||
''
|
||||
rsrc="$out/resource-root"
|
||||
mkdir "$rsrc"
|
||||
ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
|
||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
|
||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString (stdenv.targetPlatform.isLinux
|
||||
&& !(stdenv.targetPlatform.useLLVM or false)) ''
|
||||
echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags
|
||||
'';
|
||||
in {
|
||||
|
||||
# disabled until recommonmark supports sphinx 3
|
||||
# lldb-manpages = lowPrio (tools.lldb.override {
|
||||
# enableManpages = true;
|
||||
# python3 = pkgs.python3; # don't use python-boot
|
||||
# });
|
||||
llvm = callPackage ./llvm.nix { };
|
||||
|
||||
libclang = tools.clang-unwrapped.lib;
|
||||
clang-unwrapped = callPackage ./clang {
|
||||
inherit (tools) lld;
|
||||
inherit clang-tools-extra_src;
|
||||
};
|
||||
|
||||
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
|
||||
# disabled until recommonmark supports sphinx 3
|
||||
#Llvm-manpages = lowPrio (tools.llvm.override {
|
||||
# enableManpages = true;
|
||||
# python3 = pkgs.python3; # don't use python-boot
|
||||
#});
|
||||
|
||||
libstdcxxClang = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
# libstdcxx is taken from gcc in an ad-hoc way in cc-wrapper.
|
||||
libcxx = null;
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
};
|
||||
clang-manpages = lowPrio (tools.clang-unwrapped.override {
|
||||
enableManpages = true;
|
||||
python3 = pkgs.python3; # don't use python-boot
|
||||
});
|
||||
|
||||
libcxxClang = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.libcxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
};
|
||||
# disabled until recommonmark supports sphinx 3
|
||||
# lldb-manpages = lowPrio (tools.lldb.override {
|
||||
# enableManpages = true;
|
||||
# python3 = pkgs.python3; # don't use python-boot
|
||||
# });
|
||||
|
||||
lld = callPackage ./lld.nix {};
|
||||
libclang = tools.clang-unwrapped.lib;
|
||||
|
||||
lldb = callPackage ./lldb.nix {};
|
||||
clang =
|
||||
if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
|
||||
|
||||
# Below, is the LLVM bootstrapping logic. It handles building a
|
||||
# fully LLVM toolchain from scratch. No GCC toolchain should be
|
||||
# pulled in. As a consequence, it is very quick to build different
|
||||
# targets provided by LLVM and we can also build for what GCC
|
||||
# doesn’t support like LLVM. Probably we should move to some other
|
||||
# file.
|
||||
|
||||
bintools = callPackage ./bintools.nix {};
|
||||
|
||||
lldClang = if stdenv.targetPlatform.isGenode then
|
||||
wrapCCWith rec {
|
||||
libstdcxxClang = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
gccForLibs = genodePackages.genodeSources.toolchain.cc;
|
||||
bintools = wrapBintoolsWith { inherit (tools) bintools; };
|
||||
extraBuildCommands = with genodePackages.genodeSources; ''
|
||||
echo "--gcc-toolchain=${toolchain.cc}" >> $out/nix-support/cc-cflags
|
||||
echo "--sysroot=${genodeBase}" >> $out/nix-support/cc-cflags
|
||||
echo "-I${genodeBase}/include" >> $out/nix-support/cc-cflags
|
||||
echo "-L ${genodeBase}" >> $out/nix-support/cc-ldflags
|
||||
# libstdcxx is taken from gcc in an ad-hoc way in cc-wrapper.
|
||||
libcxx = null;
|
||||
extraPackages = [ targetLlvmLibraries.compiler-rt ];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
};
|
||||
|
||||
for dir in ${gccForLibs}/${stdenv.targetPlatform.config}/include/c++/*; do
|
||||
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
||||
done
|
||||
echo "-isystem ${genodePackages.genodeSources}/repos/libports/include/stdcxx" >> $out/nix-support/libcxx-cxxflags
|
||||
for dir in ${genodePackages.genodeSources.ports.stdcxx}/*/include/stdcxx; do
|
||||
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
||||
echo "-isystem $dir/std" >> $out/nix-support/libcxx-cxxflags
|
||||
echo "-isystem $dir/c_global" >> $out/nix-support/libcxx-cxxflags
|
||||
done
|
||||
|
||||
echo "${genodePackages.stdcxx}/lib/stdcxx.lib.so" >> $out/nix-support/libcxx-ldflags
|
||||
'';
|
||||
}
|
||||
else
|
||||
wrapCCWith rec {
|
||||
libcxxClang = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
bintools = wrapBintoolsWith { inherit (tools) bintools; };
|
||||
extraPackages =
|
||||
[ targetLlvmLibraries.libcxxabi targetLlvmLibraries.compiler-rt ]
|
||||
++ lib.optionals (!stdenv.targetPlatform.isWasm)
|
||||
[ targetLlvmLibraries.libunwind ];
|
||||
[ targetLlvmLibraries.libcxxabi targetLlvmLibraries.compiler-rt ];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
};
|
||||
|
||||
lld = callPackage ./lld.nix { };
|
||||
|
||||
lldb = callPackage ./lldb.nix { };
|
||||
|
||||
# Below, is the LLVM bootstrapping logic. It handles building a
|
||||
# fully LLVM toolchain from scratch. No GCC toolchain should be
|
||||
# pulled in. As a consequence, it is very quick to build different
|
||||
# targets provided by LLVM and we can also build for what GCC
|
||||
# doesn’t support like LLVM. Probably we should move to some other
|
||||
# file.
|
||||
|
||||
bintools = callPackage ./bintools.nix { };
|
||||
|
||||
lldClang = if stdenv.targetPlatform.isGenode then
|
||||
wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
gccForLibs = genodePackages.genodeSources.toolchain.cc;
|
||||
bintools = wrapBintoolsWith { inherit (tools) bintools; };
|
||||
extraBuildCommands = with genodePackages.genodeSources; ''
|
||||
echo "--gcc-toolchain=${toolchain.cc}" >> $out/nix-support/cc-cflags
|
||||
echo "--sysroot=${genodeBase}" >> $out/nix-support/cc-cflags
|
||||
echo "-I${genodeBase}/include" >> $out/nix-support/cc-cflags
|
||||
echo "-L ${genodeBase}" >> $out/nix-support/cc-ldflags
|
||||
|
||||
for dir in ${gccForLibs}/${stdenv.targetPlatform.config}/include/c++/*; do
|
||||
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
||||
done
|
||||
echo "-isystem ${genodePackages.genodeSources}/repos/libports/include/stdcxx" >> $out/nix-support/libcxx-cxxflags
|
||||
for dir in ${genodePackages.genodeSources.ports.stdcxx}/*/include/stdcxx; do
|
||||
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
||||
echo "-isystem $dir/std" >> $out/nix-support/libcxx-cxxflags
|
||||
echo "-isystem $dir/c_global" >> $out/nix-support/libcxx-cxxflags
|
||||
done
|
||||
|
||||
echo "${genodePackages.stdcxx}/lib/stdcxx.lib.so" >> $out/nix-support/libcxx-ldflags
|
||||
'';
|
||||
}
|
||||
else
|
||||
wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
bintools = wrapBintoolsWith { inherit (tools) bintools; };
|
||||
extraPackages =
|
||||
[ targetLlvmLibraries.libcxxabi targetLlvmLibraries.compiler-rt ]
|
||||
++ lib.optionals (!stdenv.targetPlatform.isWasm)
|
||||
[ targetLlvmLibraries.libunwind ];
|
||||
extraBuildCommands = ''
|
||||
echo "-rtlib=compiler-rt -Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
|
||||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
|
||||
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
|
||||
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
};
|
||||
|
||||
lldClangNoLibcxx = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith { inherit (tools) bintools; };
|
||||
extraPackages = [ targetLlvmLibraries.compiler-rt ];
|
||||
extraBuildCommands = ''
|
||||
echo "-rtlib=compiler-rt -Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
|
||||
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
|
||||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
|
||||
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
|
||||
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
|
||||
echo "-nostdlib++" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
};
|
||||
|
||||
lldClangNoLibcxx = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
lldClangNoLibc = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
extraPackages = [ targetLlvmLibraries.compiler-rt ];
|
||||
extraBuildCommands = ''
|
||||
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
|
||||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
};
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = ''
|
||||
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
|
||||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||
echo "-nostdlib++" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
};
|
||||
|
||||
lldClangNoLibc = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
lldClangNoCompilerRt = wrapCCWith {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
extraPackages = [ ];
|
||||
extraBuildCommands = ''
|
||||
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
||||
'';
|
||||
};
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = ''
|
||||
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
|
||||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
};
|
||||
|
||||
lldClangNoCompilerRt = wrapCCWith {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
extraPackages = [ ];
|
||||
extraBuildCommands = ''
|
||||
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
||||
'';
|
||||
};
|
||||
});
|
||||
|
||||
});
|
||||
libraries = lib.makeExtensible (libraries:
|
||||
let
|
||||
callPackage = newScope (libraries // buildLlvmTools // {
|
||||
inherit stdenv cmake libxml2 python3 isl release_version version fetch;
|
||||
});
|
||||
in {
|
||||
|
||||
libraries = lib.makeExtensible (libraries: let
|
||||
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||
in {
|
||||
compiler-rt = callPackage ./compiler-rt.nix ({ }
|
||||
// (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
|
||||
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt;
|
||||
}));
|
||||
|
||||
compiler-rt = callPackage ./compiler-rt.nix ({} //
|
||||
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
|
||||
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt;
|
||||
}));
|
||||
stdenv = overrideCC stdenv buildLlvmTools.clang;
|
||||
|
||||
stdenv = overrideCC stdenv buildLlvmTools.clang;
|
||||
libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
|
||||
|
||||
libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
|
||||
libcxx = callPackage ./libc++ ({ }
|
||||
// (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
|
||||
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
|
||||
}));
|
||||
|
||||
libcxx = callPackage ./libc++ ({} //
|
||||
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
|
||||
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
|
||||
}));
|
||||
libcxxabi = callPackage ./libc++abi.nix ({ }
|
||||
// (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
|
||||
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
|
||||
libunwind = libraries.libunwind;
|
||||
}));
|
||||
|
||||
libcxxabi = callPackage ./libc++abi.nix ({} //
|
||||
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
|
||||
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
|
||||
libunwind = libraries.libunwind;
|
||||
}));
|
||||
openmp = callPackage ./openmp.nix { };
|
||||
|
||||
openmp = callPackage ./openmp.nix {};
|
||||
libunwind = callPackage ./libunwind.nix ({ }
|
||||
// (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
|
||||
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
|
||||
}));
|
||||
|
||||
libunwind = callPackage ./libunwind.nix ({} //
|
||||
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
|
||||
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
|
||||
}));
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
in { inherit tools libraries; } // libraries // tools
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{ lib, stdenv, fetch, cmake, python3, libcxxabi, llvm, fixDarwinDylibNames, version
|
||||
, enableShared ? true }:
|
||||
{ lib, stdenv, fetch, cmake, python3, libcxxabi, llvm, fixDarwinDylibNames
|
||||
, version, enableShared ? true }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "libc++";
|
||||
|
@ -23,11 +23,11 @@ stdenv.mkDerivation {
|
|||
|
||||
buildInputs = [ libcxxabi ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLIBCXX_CXX_ABI=libcxxabi"
|
||||
] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
++ lib.optional stdenv.hostPlatform.isWasm [
|
||||
cmakeFlags = [ "-DLIBCXX_CXX_ABI=libcxxabi" ]
|
||||
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi)
|
||||
"-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
++ lib.optional (stdenv.hostPlatform.useLLVM or false)
|
||||
"-DLIBCXX_USE_COMPILER_RT=ON" ++ lib.optional stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||
|
@ -35,13 +35,12 @@ stdenv.mkDerivation {
|
|||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
passthru = {
|
||||
isLLVM = true;
|
||||
};
|
||||
passthru = { isLLVM = true; };
|
||||
|
||||
meta = {
|
||||
homepage = "https://libcxx.llvm.org/";
|
||||
description = "A new implementation of the C++ standard library, targeting C++11";
|
||||
description =
|
||||
"A new implementation of the C++ standard library, targeting C++11";
|
||||
license = with lib.licenses; [ ncsa mit ];
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
|
|
|
@ -5,10 +5,13 @@ stdenv.mkDerivation {
|
|||
pname = "libc++abi";
|
||||
inherit version;
|
||||
|
||||
src = fetch "libcxxabi" "05ac7rkjbla03bc0lf92f901dfjgxdvp8cr9fpn59a5p4x27ssaq";
|
||||
src =
|
||||
fetch "libcxxabi" "05ac7rkjbla03bc0lf92f901dfjgxdvp8cr9fpn59a5p4x27ssaq";
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
|
||||
buildInputs = lib.optional
|
||||
(!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm)
|
||||
libunwind;
|
||||
|
||||
cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [
|
||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||
|
@ -16,9 +19,7 @@ stdenv.mkDerivation {
|
|||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
] ++ lib.optionals (!enableShared) [ "-DLIBCXXABI_ENABLE_SHARED=OFF" ];
|
||||
|
||||
patches = [ ./libcxxabi-no-threads.patch ];
|
||||
|
||||
|
@ -35,20 +36,19 @@ stdenv.mkDerivation {
|
|||
patch -p1 -d llvm -i ${./libcxxabi-wasm.patch}
|
||||
'';
|
||||
|
||||
installPhase = if stdenv.isDarwin
|
||||
then ''
|
||||
for file in lib/*.dylib; do
|
||||
# this should be done in CMake, but having trouble figuring out
|
||||
# the magic combination of necessary CMake variables
|
||||
# if you fancy a try, take a look at
|
||||
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
|
||||
install_name_tool -id $out/$file $file
|
||||
done
|
||||
make install
|
||||
install -d 755 $out/include
|
||||
install -m 644 ../include/*.h $out/include
|
||||
installPhase = if stdenv.isDarwin then ''
|
||||
for file in lib/*.dylib; do
|
||||
# this should be done in CMake, but having trouble figuring out
|
||||
# the magic combination of necessary CMake variables
|
||||
# if you fancy a try, take a look at
|
||||
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
|
||||
install_name_tool -id $out/$file $file
|
||||
done
|
||||
make install
|
||||
install -d 755 $out/include
|
||||
install -m 644 ../include/*.h $out/include
|
||||
'' else
|
||||
''
|
||||
else ''
|
||||
install -d -m 755 $out/include $out/lib
|
||||
install -m 644 lib/libc++abi.a $out/lib
|
||||
install -m 644 ../include/cxxabi.h $out/include
|
||||
|
@ -60,7 +60,8 @@ stdenv.mkDerivation {
|
|||
|
||||
meta = {
|
||||
homepage = "https://libcxxabi.llvm.org/";
|
||||
description = "A new implementation of low level support for a standard C++ library";
|
||||
description =
|
||||
"A new implementation of low level support for a standard C++ library";
|
||||
license = with lib.licenses; [ ncsa mit ];
|
||||
maintainers = with lib.maintainers; [ vlstill ];
|
||||
platforms = lib.platforms.all;
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetch
|
||||
, cmake
|
||||
, libxml2
|
||||
, llvm
|
||||
, version
|
||||
}:
|
||||
{ lib, stdenv, fetch, cmake, libxml2, llvm, version }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "lld";
|
||||
|
@ -29,8 +22,8 @@ stdenv.mkDerivation rec {
|
|||
|
||||
meta = {
|
||||
description = "The LLVM Linker";
|
||||
homepage = "https://lld.llvm.org/";
|
||||
license = lib.licenses.ncsa;
|
||||
platforms = lib.platforms.all;
|
||||
homepage = "https://lld.llvm.org/";
|
||||
license = lib.licenses.ncsa;
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,20 +1,5 @@
|
|||
{ stdenv
|
||||
, fetch
|
||||
, cmake
|
||||
, zlib
|
||||
, ncurses
|
||||
, swig
|
||||
, which
|
||||
, libedit
|
||||
, libxml2
|
||||
, llvm
|
||||
, clang-unwrapped
|
||||
, python3
|
||||
, version
|
||||
, darwin
|
||||
, lit
|
||||
, enableManpages ? false
|
||||
}:
|
||||
{ stdenv, fetch, cmake, zlib, ncurses, swig, which, libedit, libxml2, llvm
|
||||
, clang-unwrapped, python3, version, darwin, lit, enableManpages ? false }:
|
||||
|
||||
stdenv.mkDerivation (rec {
|
||||
pname = "lldb";
|
||||
|
@ -25,23 +10,20 @@ stdenv.mkDerivation (rec {
|
|||
patches = [ ./lldb-procfs.patch ];
|
||||
|
||||
nativeBuildInputs = [ cmake python3 which swig lit ]
|
||||
++ lib.optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
|
||||
++ lib.optionals enableManpages [
|
||||
python3.pkgs.sphinx
|
||||
python3.pkgs.recommonmark
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
ncurses
|
||||
zlib
|
||||
libedit
|
||||
libxml2
|
||||
llvm
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
darwin.libobjc
|
||||
darwin.apple_sdk.libs.xpc
|
||||
darwin.apple_sdk.frameworks.Foundation
|
||||
darwin.bootstrap_cmds
|
||||
darwin.apple_sdk.frameworks.Carbon
|
||||
darwin.apple_sdk.frameworks.Cocoa
|
||||
];
|
||||
buildInputs = [ ncurses zlib libedit libxml2 llvm ]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
darwin.libobjc
|
||||
darwin.apple_sdk.libs.xpc
|
||||
darwin.apple_sdk.frameworks.Foundation
|
||||
darwin.bootstrap_cmds
|
||||
darwin.apple_sdk.frameworks.Carbon
|
||||
darwin.apple_sdk.frameworks.Cocoa
|
||||
];
|
||||
|
||||
hardeningDisable = [ "format" ];
|
||||
|
||||
|
@ -49,15 +31,14 @@ stdenv.mkDerivation (rec {
|
|||
"-DLLVM_ENABLE_RTTI=OFF"
|
||||
"-DClang_DIR=${clang-unwrapped}/lib/cmake"
|
||||
"-DLLVM_EXTERNAL_LIT=${lit}/bin/lit"
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
"-DLLDB_USE_SYSTEM_DEBUGSERVER=ON"
|
||||
] ++ lib.optionals (!stdenv.isDarwin) [
|
||||
"-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
|
||||
] ++ lib.optionals enableManpages [
|
||||
"-DLLVM_ENABLE_SPHINX=ON"
|
||||
"-DSPHINX_OUTPUT_MAN=ON"
|
||||
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||
];
|
||||
] ++ lib.optionals stdenv.isDarwin [ "-DLLDB_USE_SYSTEM_DEBUGSERVER=ON" ]
|
||||
++ lib.optionals (!stdenv.isDarwin) [
|
||||
"-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
|
||||
] ++ lib.optionals enableManpages [
|
||||
"-DLLVM_ENABLE_SPHINX=ON"
|
||||
"-DSPHINX_OUTPUT_MAN=ON"
|
||||
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
|
@ -82,7 +63,7 @@ stdenv.mkDerivation (rec {
|
|||
make docs-lldb-man
|
||||
'';
|
||||
|
||||
propagatedBuildInputs = [];
|
||||
propagatedBuildInputs = [ ];
|
||||
|
||||
installPhase = ''
|
||||
# manually install lldb man page
|
||||
|
|
|
@ -1,26 +1,10 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetch
|
||||
, cmake
|
||||
, python3
|
||||
, libffi
|
||||
, libbfd
|
||||
, libpfm
|
||||
, libxml2
|
||||
, ncurses
|
||||
, version
|
||||
, release_version
|
||||
, zlib
|
||||
, buildPackages
|
||||
, debugVersion ? false
|
||||
, enableManpages ? false
|
||||
, enableSharedLibraries ? true
|
||||
, enablePFM ? !(stdenv.isDarwin
|
||||
|| stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
|
||||
|| stdenv.isAarch32 # broken for the armv7l builder
|
||||
)
|
||||
, enablePolly ? false
|
||||
}:
|
||||
{ lib, stdenv, fetch, cmake, python3, libffi, libbfd, libpfm, libxml2, ncurses
|
||||
, version, release_version, zlib, buildPackages, debugVersion ? false
|
||||
, enableManpages ? false, enableSharedLibraries ? true, enablePFM ?
|
||||
!(stdenv.isDarwin
|
||||
|| stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
|
||||
|| stdenv.isAarch32 # broken for the armv7l builder
|
||||
), enablePolly ? false }:
|
||||
|
||||
let
|
||||
inherit (lib) optional optionals optionalString;
|
||||
|
@ -34,7 +18,8 @@ in stdenv.mkDerivation (rec {
|
|||
inherit version;
|
||||
|
||||
src = fetch pname "0s94lwil98w7zb7cjrbnxli0z7gklb312pkw74xs1d6zk346hgwi";
|
||||
polly_src = fetch "polly" "0h442ivcslr3dv3q3g1nw5avh77f8cxsp6zild1hgspj266xpynw";
|
||||
polly_src =
|
||||
fetch "polly" "0h442ivcslr3dv3q3g1nw5avh77f8cxsp6zild1hgspj266xpynw";
|
||||
|
||||
unpackPhase = ''
|
||||
unpackFile $src
|
||||
|
@ -45,14 +30,14 @@ in stdenv.mkDerivation (rec {
|
|||
mv polly-* $sourceRoot/tools/polly
|
||||
'';
|
||||
|
||||
outputs = [ "out" "python" ]
|
||||
++ optional enableSharedLibraries "lib";
|
||||
outputs = [ "out" "python" ] ++ optional enableSharedLibraries "lib";
|
||||
|
||||
nativeBuildInputs = [ cmake python3 ]
|
||||
++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
|
||||
nativeBuildInputs = [ cmake python3 ] ++ optionals enableManpages [
|
||||
python3.pkgs.sphinx
|
||||
python3.pkgs.recommonmark
|
||||
];
|
||||
|
||||
buildInputs = [ libxml2 libffi ]
|
||||
++ optional enablePFM libpfm; # exegesis
|
||||
buildInputs = [ libxml2 libffi ] ++ optional enablePFM libpfm; # exegesis
|
||||
|
||||
propagatedBuildInputs = [ ncurses zlib ];
|
||||
|
||||
|
@ -63,34 +48,34 @@ in stdenv.mkDerivation (rec {
|
|||
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
|
||||
--replace 'set(_install_rpath "@loader_path/../lib''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
|
||||
''
|
||||
# Patch llvm-config to return correct library path based on --link-{shared,static}.
|
||||
+ optionalString (enableSharedLibraries) ''
|
||||
substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib
|
||||
patch -p1 < ./llvm-outputs.patch
|
||||
'' + ''
|
||||
# FileSystem permissions tests fail with various special bits
|
||||
substituteInPlace unittests/Support/CMakeLists.txt \
|
||||
--replace "Path.cpp" ""
|
||||
rm unittests/Support/Path.cpp
|
||||
'' + optionalString stdenv.hostPlatform.isMusl ''
|
||||
patch -p1 -i ${../TLI-musl.patch}
|
||||
substituteInPlace unittests/Support/CMakeLists.txt \
|
||||
--replace "add_subdirectory(DynamicLibrary)" ""
|
||||
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
|
||||
# valgrind unhappy with musl or glibc, but fails w/musl only
|
||||
rm test/CodeGen/AArch64/wineh4.mir
|
||||
'' + optionalString stdenv.hostPlatform.isAarch32 ''
|
||||
# skip failing X86 test cases on 32-bit ARM
|
||||
rm test/DebugInfo/X86/convert-debugloc.ll
|
||||
rm test/DebugInfo/X86/convert-inlined.ll
|
||||
rm test/DebugInfo/X86/convert-linked.ll
|
||||
rm test/tools/dsymutil/X86/op-convert.test
|
||||
'' + optionalString (stdenv.hostPlatform.system == "armv6l-linux") ''
|
||||
# Seems to require certain floating point hardware (NEON?)
|
||||
rm test/ExecutionEngine/frem.ll
|
||||
'' + ''
|
||||
patchShebangs test/BugPoint/compile-custom.ll.py
|
||||
'';
|
||||
# Patch llvm-config to return correct library path based on --link-{shared,static}.
|
||||
+ optionalString (enableSharedLibraries) ''
|
||||
substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib
|
||||
patch -p1 < ./llvm-outputs.patch
|
||||
'' + ''
|
||||
# FileSystem permissions tests fail with various special bits
|
||||
substituteInPlace unittests/Support/CMakeLists.txt \
|
||||
--replace "Path.cpp" ""
|
||||
rm unittests/Support/Path.cpp
|
||||
'' + optionalString stdenv.hostPlatform.isMusl ''
|
||||
patch -p1 -i ${../TLI-musl.patch}
|
||||
substituteInPlace unittests/Support/CMakeLists.txt \
|
||||
--replace "add_subdirectory(DynamicLibrary)" ""
|
||||
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
|
||||
# valgrind unhappy with musl or glibc, but fails w/musl only
|
||||
rm test/CodeGen/AArch64/wineh4.mir
|
||||
'' + optionalString stdenv.hostPlatform.isAarch32 ''
|
||||
# skip failing X86 test cases on 32-bit ARM
|
||||
rm test/DebugInfo/X86/convert-debugloc.ll
|
||||
rm test/DebugInfo/X86/convert-inlined.ll
|
||||
rm test/DebugInfo/X86/convert-linked.ll
|
||||
rm test/tools/dsymutil/X86/op-convert.test
|
||||
'' + optionalString (stdenv.hostPlatform.system == "armv6l-linux") ''
|
||||
# Seems to require certain floating point hardware (NEON?)
|
||||
rm test/ExecutionEngine/frem.ll
|
||||
'' + ''
|
||||
patchShebangs test/BugPoint/compile-custom.ll.py
|
||||
'';
|
||||
|
||||
# hacky fix: created binaries need to be run before installation
|
||||
preBuild = ''
|
||||
|
@ -99,34 +84,35 @@ in stdenv.mkDerivation (rec {
|
|||
'';
|
||||
|
||||
# E.g. mesa.drivers use the build-id as a cache key (see #93946):
|
||||
LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
|
||||
LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin)
|
||||
"-Wl,--build-id=sha1";
|
||||
|
||||
cmakeFlags = with stdenv; [
|
||||
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
|
||||
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
|
||||
"-DLLVM_BUILD_TESTS=ON"
|
||||
"-DLLVM_ENABLE_FFI=ON"
|
||||
"-DLLVM_ENABLE_RTTI=ON"
|
||||
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
|
||||
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
|
||||
"-DLLVM_ENABLE_DUMP=ON"
|
||||
] ++ optionals enableSharedLibraries [
|
||||
"-DLLVM_LINK_LLVM_DYLIB=ON"
|
||||
] ++ optionals enableManpages [
|
||||
"-DLLVM_BUILD_DOCS=ON"
|
||||
"-DLLVM_ENABLE_SPHINX=ON"
|
||||
"-DSPHINX_OUTPUT_MAN=ON"
|
||||
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
|
||||
] ++ optionals (!isDarwin) [
|
||||
"-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
|
||||
] ++ optionals isDarwin [
|
||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||
"-DCAN_TARGET_i386=false"
|
||||
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
"-DCMAKE_CROSSCOMPILING=True"
|
||||
"-DLLVM_TABLEGEN=${buildPackages.llvm_10}/bin/llvm-tblgen"
|
||||
];
|
||||
cmakeFlags = with stdenv;
|
||||
[
|
||||
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
|
||||
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
|
||||
"-DLLVM_BUILD_TESTS=ON"
|
||||
"-DLLVM_ENABLE_FFI=ON"
|
||||
"-DLLVM_ENABLE_RTTI=ON"
|
||||
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
|
||||
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
|
||||
"-DLLVM_ENABLE_DUMP=ON"
|
||||
] ++ optionals enableSharedLibraries [ "-DLLVM_LINK_LLVM_DYLIB=ON" ]
|
||||
++ optionals enableManpages [
|
||||
"-DLLVM_BUILD_DOCS=ON"
|
||||
"-DLLVM_ENABLE_SPHINX=ON"
|
||||
"-DSPHINX_OUTPUT_MAN=ON"
|
||||
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
|
||||
]
|
||||
++ optionals (!isDarwin) [ "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" ]
|
||||
++ optionals isDarwin [
|
||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||
"-DCAN_TARGET_i386=false"
|
||||
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
"-DCMAKE_CROSSCOMPILING=True"
|
||||
"-DLLVM_TABLEGEN=${buildPackages.llvm_10}/bin/llvm-tblgen"
|
||||
];
|
||||
|
||||
postBuild = ''
|
||||
rm -fR $out
|
||||
|
@ -139,17 +125,18 @@ in stdenv.mkDerivation (rec {
|
|||
postInstall = ''
|
||||
mkdir -p $python/share
|
||||
mv $out/share/opt-viewer $python/share/opt-viewer
|
||||
''
|
||||
+ optionalString enableSharedLibraries ''
|
||||
'' + optionalString enableSharedLibraries ''
|
||||
moveToOutput "lib/libLLVM-*" "$lib"
|
||||
moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
|
||||
''
|
||||
+ optionalString (enableSharedLibraries && (!stdenv.isDarwin)) ''
|
||||
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
|
||||
'' + optionalString (enableSharedLibraries && (!stdenv.isDarwin)) ''
|
||||
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${
|
||||
if debugVersion then "debug" else "release"
|
||||
}.cmake" \
|
||||
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
|
||||
''
|
||||
+ optionalString (stdenv.isDarwin && enableSharedLibraries) ''
|
||||
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
|
||||
'' + optionalString (stdenv.isDarwin && enableSharedLibraries) ''
|
||||
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${
|
||||
if debugVersion then "debug" else "release"
|
||||
}.cmake" \
|
||||
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
|
||||
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
|
||||
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
|
||||
|
@ -163,11 +150,12 @@ in stdenv.mkDerivation (rec {
|
|||
|
||||
requiredSystemFeatures = [ "big-parallel" ];
|
||||
meta = {
|
||||
description = "Collection of modular and reusable compiler and toolchain technologies";
|
||||
homepage = "https://llvm.org/";
|
||||
license = lib.licenses.ncsa;
|
||||
description =
|
||||
"Collection of modular and reusable compiler and toolchain technologies";
|
||||
homepage = "https://llvm.org/";
|
||||
license = lib.licenses.ncsa;
|
||||
maintainers = with lib.maintainers; [ lovek323 raskin dtzWill primeos ];
|
||||
platforms = lib.platforms.all;
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
} // lib.optionalAttrs enableManpages {
|
||||
pname = "llvm-manpages";
|
||||
|
@ -176,7 +164,7 @@ in stdenv.mkDerivation (rec {
|
|||
make docs-llvm-man
|
||||
'';
|
||||
|
||||
propagatedBuildInputs = [];
|
||||
propagatedBuildInputs = [ ];
|
||||
|
||||
installPhase = ''
|
||||
make -C docs install
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
{ stdenv
|
||||
, fetch
|
||||
, cmake
|
||||
, llvm
|
||||
, perl
|
||||
, version
|
||||
}:
|
||||
{ stdenv, fetch, cmake, llvm, perl, version }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "openmp";
|
||||
|
@ -19,8 +13,8 @@ stdenv.mkDerivation rec {
|
|||
|
||||
meta = {
|
||||
description = "Components required to build an executable OpenMP program";
|
||||
homepage = "https://openmp.llvm.org/";
|
||||
license = lib.licenses.mit;
|
||||
platforms = lib.platforms.all;
|
||||
homepage = "https://openmp.llvm.org/";
|
||||
license = lib.licenses.mit;
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From b361fa6da5a5892ada665dcabfc6a0327419db63 Mon Sep 17 00:00:00 2001
|
||||
From 3ea8cfd1fb61baccd38118331adb0b8fe1e7c7a9 Mon Sep 17 00:00:00 2001
|
||||
From: Emery Hemingway <ehmry@posteo.net>
|
||||
Date: Wed, 2 Dec 2020 19:27:10 +0100
|
||||
Subject: [PATCH] Skip user/group checks for Genode hosts
|
||||
Subject: [PATCH 1/2] Skip user/group checks for Genode hosts
|
||||
|
||||
---
|
||||
src/app/main/main.c | 4 ++++
|
||||
|
@ -10,10 +10,10 @@ Subject: [PATCH] Skip user/group checks for Genode hosts
|
|||
3 files changed, 18 insertions(+)
|
||||
|
||||
diff --git a/src/app/main/main.c b/src/app/main/main.c
|
||||
index e7ffb31b4f..a1a9037f09 100644
|
||||
index 589d365add..22b5cdf89a 100644
|
||||
--- a/src/app/main/main.c
|
||||
+++ b/src/app/main/main.c
|
||||
@@ -670,6 +670,10 @@ static tor_lockfile_t *lockfile = NULL;
|
||||
@@ -669,6 +669,10 @@ static tor_lockfile_t *lockfile = NULL;
|
||||
int
|
||||
try_locking(const or_options_t *options, int err_if_locked)
|
||||
{
|
||||
|
@ -68,5 +68,31 @@ index 3cfd520a4f..bf1857ad2a 100644
|
|||
const struct passwd *pw = NULL;
|
||||
uid_t old_uid;
|
||||
--
|
||||
2.29.2
|
||||
2.31.0
|
||||
|
||||
|
||||
From 453339560166101a6db53bb701d30184019d3bd9 Mon Sep 17 00:00:00 2001
|
||||
From: Emery Hemingway <ehmry@posteo.net>
|
||||
Date: Fri, 16 Apr 2021 15:17:43 +0200
|
||||
Subject: [PATCH 2/2] scripts/build/combine_libs: use $AR rather than ar
|
||||
|
||||
---
|
||||
scripts/build/combine_libs | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/scripts/build/combine_libs b/scripts/build/combine_libs
|
||||
index fb311552fe..9c87f68248 100755
|
||||
--- a/scripts/build/combine_libs
|
||||
+++ b/scripts/build/combine_libs
|
||||
@@ -25,7 +25,7 @@ for input in "$@"; do
|
||||
dir="$TMPDIR"/$(basename "$input" .a)
|
||||
mkdir "$dir"
|
||||
cd "$dir">/dev/null
|
||||
- ar x "$abs"
|
||||
+ "${AR:-ar}" x "$abs"
|
||||
done
|
||||
|
||||
cd "$TMPDIR" >/dev/null
|
||||
--
|
||||
2.31.0
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ stdenv.mkDerivation rec {
|
|||
|
||||
src = fetchgit {
|
||||
url = "https://git.sr.ht/~ehmry/${pname}";
|
||||
rev = "018ec1ccb109b275a54462d85eb006bc51ea04ac";
|
||||
sha256 = "1aiygypkjh2r397xwzpccav4mmkdhx7mc580javsm4cr3hhkhbvj";
|
||||
rev = "4ff7d47b83255a437d862d16b8424a3c05e3eab1";
|
||||
sha256 = "0bmcl693w34ayrw77c6gicph43yfjfm800jwj57ryshr9fdh88dq";
|
||||
};
|
||||
|
||||
nimFlags = with nimblePackages;
|
||||
|
|
|
@ -125,7 +125,7 @@ let
|
|||
find $CONTRIB_DIR/* -name '*.zip' -exec rm -rf {} \; || true
|
||||
|
||||
mkdir $out
|
||||
cp -a $CONTRIB_DIR/* $out/
|
||||
cp -av $CONTRIB_DIR/* $out/
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ in {
|
|||
pcre = { };
|
||||
pcre16 = { };
|
||||
pdf_view = { };
|
||||
platform_drv.patches = [ ./patches/platform_drv.patch ];
|
||||
platform_drv = { }; # .patches = [ ./patches/platform_drv.patch ];
|
||||
posix.depotInputs = with self; [ libc ];
|
||||
ps2_drv = { };
|
||||
qt5_base = { };
|
||||
|
@ -292,7 +292,7 @@ in {
|
|||
usb_block_drv = { };
|
||||
usb_drv = {
|
||||
portInputs = with ports; [ dde_linux ];
|
||||
meta.broken = builtins.trace "usb_drv is broken! Use usb_host_drv!" true;
|
||||
meta.broken = builtins.trace "usb_drv is broken! Use usb_host_drv!" false;
|
||||
};
|
||||
usb_hid_drv.portInputs = with ports; [ dde_linux ];
|
||||
usb_host_drv = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From f747e139da4fda694363a27010cb6d62c3b1e941 Mon Sep 17 00:00:00 2001
|
||||
From c6104cfcfb7c810fabb0fb26ec8162466ef9541b Mon Sep 17 00:00:00 2001
|
||||
From: Emery Hemingway <ehmry@posteo.net>
|
||||
Date: Tue, 10 Nov 2020 12:51:12 +0100
|
||||
Subject: [PATCH 1/2] drivers/platform/x86: move PCI capabilities to PCI report
|
||||
|
@ -9,10 +9,10 @@ Subject: [PATCH 1/2] drivers/platform/x86: move PCI capabilities to PCI report
|
|||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/repos/os/src/drivers/platform/spec/x86/pci_session_component.h b/repos/os/src/drivers/platform/spec/x86/pci_session_component.h
|
||||
index a7439a224d..54b4492983 100644
|
||||
index ecca81032b..395ec71f16 100644
|
||||
--- a/repos/os/src/drivers/platform/spec/x86/pci_session_component.h
|
||||
+++ b/repos/os/src/drivers/platform/spec/x86/pci_session_component.h
|
||||
@@ -1110,7 +1110,9 @@ class Platform::Root : public Genode::Root_component<Session_component>
|
||||
@@ -1169,7 +1169,9 @@ class Platform::Root : public Genode::Root_component<Session_component>
|
||||
|
||||
for (Genode::uint16_t val = 0; cap; cap = val >> 8) {
|
||||
val = config.read(config_access, cap, Platform::Device::ACCESS_16BIT);
|
||||
|
@ -24,10 +24,10 @@ index a7439a224d..54b4492983 100644
|
|||
} catch (...) {
|
||||
xml.attribute("cap", "failed to read");
|
||||
--
|
||||
2.28.0
|
||||
2.31.0
|
||||
|
||||
|
||||
From 1a687e4b6d3544bf369a01aeb1d8bdffc27139b1 Mon Sep 17 00:00:00 2001
|
||||
From 1713de41fd6a3eecfc917f1f709b6bb7a043624b Mon Sep 17 00:00:00 2001
|
||||
From: Emery Hemingway <ehmry@posteo.net>
|
||||
Date: Tue, 10 Nov 2020 14:46:59 +0100
|
||||
Subject: [PATCH 2/2] drivers/platform/x86: assign device by optional index
|
||||
|
@ -39,9 +39,9 @@ attribute on <policy><pci/><policy> nodes. An index is not valid if the
|
|||
|
||||
Fix #3946
|
||||
---
|
||||
repos/os/src/drivers/platform/spec/x86/README | 13 +++++++-----
|
||||
.../platform/spec/x86/pci_session_component.h | 20 +++++++++++++++----
|
||||
2 files changed, 24 insertions(+), 9 deletions(-)
|
||||
repos/os/src/drivers/platform/spec/x86/README | 13 ++++++----
|
||||
.../platform/spec/x86/pci_session_component.h | 24 ++++++++++++++-----
|
||||
2 files changed, 26 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/repos/os/src/drivers/platform/spec/x86/README b/repos/os/src/drivers/platform/spec/x86/README
|
||||
index 83649f3b33..1c605e93fd 100644
|
||||
|
@ -68,19 +68,19 @@ index 83649f3b33..1c605e93fd 100644
|
|||
|
||||
By default the driver will try to use MSIs if the device and the used kernel
|
||||
diff --git a/repos/os/src/drivers/platform/spec/x86/pci_session_component.h b/repos/os/src/drivers/platform/spec/x86/pci_session_component.h
|
||||
index 54b4492983..b321df6fcb 100644
|
||||
index 395ec71f16..670179d79c 100644
|
||||
--- a/repos/os/src/drivers/platform/spec/x86/pci_session_component.h
|
||||
+++ b/repos/os/src/drivers/platform/spec/x86/pci_session_component.h
|
||||
@@ -379,7 +379,7 @@ class Platform::Session_component : public Genode::Rpc_object<Session>
|
||||
@@ -370,7 +370,7 @@ class Platform::Session_component : public Genode::Rpc_object<Session>
|
||||
/**
|
||||
* Check according session policy device usage
|
||||
*/
|
||||
- bool permit_device(Bdf const bdf, unsigned class_code)
|
||||
- bool permit_device(Pci::Bdf const bdf, unsigned const class_code)
|
||||
+ bool permit_device(Bdf const bdf, unsigned class_code, unsigned &class_index)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
@@ -404,6 +404,16 @@ class Platform::Session_component : public Genode::Rpc_object<Session>
|
||||
@@ -397,6 +397,16 @@ class Platform::Session_component : public Genode::Rpc_object<Session>
|
||||
if (class_sub_prog && (class_sub_prog ^ class_code) >> DONT_CHECK_PROGIF)
|
||||
return;
|
||||
|
||||
|
@ -97,7 +97,7 @@ index 54b4492983..b321df6fcb 100644
|
|||
/* if this bdf is used by some policy - deny */
|
||||
if (find_dev_in_policy(bdf))
|
||||
return;
|
||||
@@ -535,9 +545,9 @@ class Platform::Session_component : public Genode::Rpc_object<Session>
|
||||
@@ -544,9 +554,9 @@ class Platform::Session_component : public Genode::Rpc_object<Session>
|
||||
throw Genode::Service_denied();
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ index 54b4492983..b321df6fcb 100644
|
|||
Genode::error("'", _label, "' - attributes beside 'class' detected");
|
||||
throw Genode::Service_denied();
|
||||
}
|
||||
@@ -663,6 +673,7 @@ class Platform::Session_component : public Genode::Rpc_object<Session>
|
||||
@@ -702,6 +712,7 @@ class Platform::Session_component : public Genode::Rpc_object<Session>
|
||||
*/
|
||||
Device_config config;
|
||||
|
||||
|
@ -117,16 +117,20 @@ index 54b4492983..b321df6fcb 100644
|
|||
while (true) {
|
||||
function += 1;
|
||||
if (!_pci_bus.find_next(bus, device, function, &config,
|
||||
@@ -682,7 +693,8 @@ class Platform::Session_component : public Genode::Rpc_object<Session>
|
||||
if (permit_device(Bdf { (unsigned)bus,
|
||||
(unsigned)device,
|
||||
(unsigned)function },
|
||||
@@ -719,9 +730,10 @@ class Platform::Session_component : public Genode::Rpc_object<Session>
|
||||
|
||||
/* check that policy permit access to the matched device */
|
||||
if (permit_device(Pci::Bdf { (unsigned)bus,
|
||||
- (unsigned)device,
|
||||
- (unsigned)function },
|
||||
- config.class_code()))
|
||||
+ (unsigned)device,
|
||||
+ (unsigned)function },
|
||||
+ config.class_code(),
|
||||
+ class_index))
|
||||
break;
|
||||
}
|
||||
|
||||
--
|
||||
2.28.0
|
||||
2.31.0
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ with pkgs;
|
|||
coreutils.hash = "sha256-ZVlFfLghHcXxwwRsN5xw2bVdIvvXoCNj2oZniOlSXrg=";
|
||||
curl.hash = "sha256-5+nRKLrho9oO0XlzDO6ppZ2kLfWaIReY24YFYSQT7Xc=";
|
||||
dde_bsd.hash = "sha256-KPA/ua3jETcHgWzhfhFm6ppds55Xi5YXJKDJvufJmU8=";
|
||||
dde_ipxe.hash = "sha256-NJ129+DkxFg1fFHJBABBFRRjqEVNSz6v2hEB80AuEM4=";
|
||||
dde_linux.hash = "sha256-xHAgeKfArgMGKCGHi0762qkUcY97vbiAQYjM/ZRXCes=";
|
||||
dde_ipxe.hash = "sha256-rnMbramSDYBEjfSMoNpFcUQ4jfJh6SIHMtieSy9/Fe4=";
|
||||
dde_linux.hash = "sha256-PBj/pTbCTZVtqqppnQyFtwH3G5qrQABBKxK19uVuT8U=";
|
||||
dde_rump = {
|
||||
hash = "sha256-Wr5otGkWEa+5xImsFHQzwap5LckNEbyWA/7xbNcOreI=";
|
||||
nativeBuildInputs = [ subversion ];
|
||||
|
|
|
@ -12,7 +12,14 @@ let Init = Sigil.Init
|
|||
|
||||
let Child = Init.Child
|
||||
|
||||
in λ(params : { bash : Text, coreutils : Text }) →
|
||||
in λ ( params
|
||||
: { bash : Text
|
||||
, coreutils : Text
|
||||
, cached_fs_rom : Text
|
||||
, vfs : Text
|
||||
, vfs_pipe : Text
|
||||
}
|
||||
) →
|
||||
λ(binary : Text) →
|
||||
let init =
|
||||
Init::{
|
||||
|
@ -25,24 +32,30 @@ in λ(params : { bash : Text, coreutils : Text }) →
|
|||
{ vfs =
|
||||
Child.flat
|
||||
Child.Attributes::{
|
||||
, binary = "vfs"
|
||||
, binary = params.vfs
|
||||
, provides = [ "File_system" ]
|
||||
, resources = Sigil.Init.Resources::{
|
||||
, caps = 256
|
||||
, ram = Sigil.units.MiB 8
|
||||
}
|
||||
, routes =
|
||||
Prelude.List.map
|
||||
Text
|
||||
Init.ServiceRoute.Type
|
||||
Init.ServiceRoute.parent
|
||||
[ "File_system", "Rtc" ]
|
||||
[ Init.ServiceRoute.parent "ROM" ]
|
||||
# Prelude.List.map
|
||||
Text
|
||||
Init.ServiceRoute.Type
|
||||
Init.ServiceRoute.parent
|
||||
[ "File_system", "Rtc" ]
|
||||
, config = Init.Config::{
|
||||
, content =
|
||||
[ VFS.vfs
|
||||
[ VFS.dir
|
||||
"dev"
|
||||
[ VFS.dir "pipes" [ VFS.leaf "pipe" ]
|
||||
[ VFS.dir
|
||||
"pipes"
|
||||
[ VFS.leafAttrs
|
||||
"plugin"
|
||||
(toMap { load = params.vfs_pipe })
|
||||
]
|
||||
, VFS.leaf "log"
|
||||
, VFS.leaf "null"
|
||||
, VFS.leaf "rtc"
|
||||
|
@ -78,11 +91,13 @@ in λ(params : { bash : Text, coreutils : Text }) →
|
|||
, label = Init.LabelSelector.prefix "shell"
|
||||
, attributes = toMap
|
||||
{ root = "/", writeable = "yes" }
|
||||
, diag = Some True
|
||||
}
|
||||
, Init.Config.Policy::{
|
||||
, service = "File_system"
|
||||
, label = Init.LabelSelector.prefix "vfs_rom"
|
||||
, attributes = toMap { root = "/" }
|
||||
, diag = Some True
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -90,7 +105,7 @@ in λ(params : { bash : Text, coreutils : Text }) →
|
|||
, vfs_rom =
|
||||
Child.flat
|
||||
Child.Attributes::{
|
||||
, binary = "cached_fs_rom"
|
||||
, binary = params.cached_fs_rom
|
||||
, provides = [ "ROM" ]
|
||||
, resources = Init.Resources::{
|
||||
, caps = 256
|
||||
|
@ -101,6 +116,12 @@ in λ(params : { bash : Text, coreutils : Text }) →
|
|||
[ Init.Config.Policy::{
|
||||
, service = "ROM"
|
||||
, label = Init.LabelSelector.prefix "shell"
|
||||
, diag = Some True
|
||||
}
|
||||
, Init.Config.Policy::{
|
||||
, service = "ROM"
|
||||
, label = Init.LabelSelector.prefix "/nix/store/"
|
||||
, diag = Some True
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -114,21 +135,6 @@ in λ(params : { bash : Text, coreutils : Text }) →
|
|||
, caps = 256
|
||||
, ram = Sigil.units.MiB 8
|
||||
}
|
||||
, routes =
|
||||
Prelude.List.map
|
||||
Text
|
||||
Init.ServiceRoute.Type
|
||||
( λ(label : Text) →
|
||||
Init.ServiceRoute.parentLabel
|
||||
"ROM"
|
||||
(Some label)
|
||||
(Some label)
|
||||
)
|
||||
[ "libc.lib.so"
|
||||
, "libm.lib.so"
|
||||
, "posix.lib.so"
|
||||
, "vfs.lib.so"
|
||||
]
|
||||
, config =
|
||||
( Libc.toConfig
|
||||
Libc::{
|
||||
|
@ -144,6 +150,14 @@ in λ(params : { bash : Text, coreutils : Text }) →
|
|||
}
|
||||
)
|
||||
with attributes = toMap { ld_verbose = "true" }
|
||||
, routes =
|
||||
[ { service =
|
||||
{ name = "ROM"
|
||||
, label = Init.LabelSelector.prefix "urn:erisx2:"
|
||||
}
|
||||
, route = Init.Route.parent (None Text)
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,27 @@
|
|||
{
|
||||
name = "bash";
|
||||
machine = { pkgs, ... }: {
|
||||
genode.init.children.bash = {
|
||||
machine = { config, lib, modulesPath, pkgs, ... }: {
|
||||
genode.init.children.bash = let
|
||||
extraErisInputs' = with pkgs.genodePackages; {
|
||||
bash = lib.getEris "bin" pkgs.bash;
|
||||
cached_fs_rom = lib.getEris "bin" cached_fs_rom;
|
||||
vfs = lib.getEris "bin" vfs;
|
||||
vfs_pipe = lib.getEris "lib" vfs_pipe;
|
||||
};
|
||||
params = {
|
||||
bash = "${pkgs.bash}";
|
||||
coreutils = "${pkgs.coreutils}";
|
||||
cached_fs_rom = extraErisInputs'.cached_fs_rom.cap;
|
||||
vfs = extraErisInputs'.vfs.cap;
|
||||
vfs_pipe = extraErisInputs'.vfs_pipe.cap;
|
||||
};
|
||||
in {
|
||||
package = pkgs.genodePackages.init;
|
||||
extraErisInputs = builtins.attrValues extraErisInputs';
|
||||
configFile = pkgs.writeText "bash.child.dhall" ''
|
||||
${
|
||||
./bash.dhall
|
||||
} { bash = "${pkgs.bash}", coreutils = "${pkgs.coreutils}" }
|
||||
${./bash.dhall} ${lib.generators.toDhall params}
|
||||
'';
|
||||
extraInputs = with pkgs.genodePackages; [
|
||||
pkgs.bash
|
||||
cached_fs_rom
|
||||
libc
|
||||
posix
|
||||
vfs
|
||||
vfs_pipe
|
||||
];
|
||||
extraInputs = with pkgs.genodePackages; [ pkgs.bash libc posix ];
|
||||
};
|
||||
};
|
||||
testScript = ''
|
||||
|
|
|
@ -16,9 +16,11 @@ let
|
|||
test = map (p: import p) [
|
||||
./ahci.nix
|
||||
./bash.nix
|
||||
./graphics.nix
|
||||
./hello.nix
|
||||
./log.nix
|
||||
./nim.nix
|
||||
./tor.nix
|
||||
./usb.nix
|
||||
./vmm_x86.nix
|
||||
];
|
||||
|
|
|
@ -4,13 +4,7 @@
|
|||
|
||||
genode.gui.consoleLog.enable = true;
|
||||
|
||||
genode.core.storeBackend = "fs";
|
||||
hardware.genode.framebuffer.driver = "boot";
|
||||
hardware.genode.usb = {
|
||||
enable = true;
|
||||
biosHandoff = false;
|
||||
storage.enable = true;
|
||||
};
|
||||
hardware.genode.framebuffer.driver = "vesa";
|
||||
|
||||
genode.init.verbose = true;
|
||||
genode.init.children.hello = {
|
||||
|
|
|
@ -12,7 +12,6 @@ in λ(binary : Text) →
|
|||
Child.flat
|
||||
Child.Attributes::{
|
||||
, binary
|
||||
, exitPropagate = True
|
||||
, resources = Sigil.Init.Resources::{
|
||||
, caps = 500
|
||||
, ram = Sigil.units.MiB 10
|
||||
|
|
|
@ -35,10 +35,6 @@ rec {
|
|||
../../nixos-modules/hardware
|
||||
../../nixos-modules/qemu-vm.nix
|
||||
../../nixos-modules/services
|
||||
{
|
||||
key = "no-manual";
|
||||
documentation.nixos.enable = false;
|
||||
}
|
||||
{
|
||||
key = "qemu";
|
||||
system.build.qemu = qemu;
|
||||
|
@ -77,16 +73,14 @@ rec {
|
|||
address = "192.168.${toString fst}.${toString m.snd}";
|
||||
prefixLength = 24;
|
||||
}];
|
||||
genode.driver = "virtio";
|
||||
# genode.driver = "virtio";
|
||||
});
|
||||
in {
|
||||
key = "ip-address";
|
||||
config = {
|
||||
networking.hostName = mkDefault m.fst;
|
||||
|
||||
networking.interfaces = {
|
||||
eth0.genode.driver = "virtio";
|
||||
} // listToAttrs interfaces;
|
||||
networking.interfaces = listToAttrs interfaces;
|
||||
|
||||
networking.primaryIPAddress = optionalString (interfaces != [ ])
|
||||
(head (head interfaces).value.ipv4.addresses).address;
|
||||
|
|
|
@ -280,7 +280,7 @@ class Machine:
|
|||
|
||||
if "usb" in args:
|
||||
start_command += (
|
||||
"-device piix3-usb-uhci -drive "
|
||||
"-device piix3-usb-ehci -drive "
|
||||
+ "id=usbdisk,file="
|
||||
+ args["usb"]
|
||||
+ ",if=none,readonly "
|
||||
|
|
|
@ -2,26 +2,28 @@
|
|||
name = "tor";
|
||||
machine = { config, lib, pkgs, ... }: {
|
||||
|
||||
virtualisation.memorySize = 768;
|
||||
documentation.nixos = {
|
||||
enable = true;
|
||||
includeAllModules = true;
|
||||
};
|
||||
|
||||
environment.defaultPackages = { };
|
||||
|
||||
genode.gui.consoleLog.enable = true;
|
||||
genode.core.storeBackend = "fs";
|
||||
hardware.genode.usb.enable = true;
|
||||
hardware.genode.usb.storage.enable = true;
|
||||
|
||||
services.tor = {
|
||||
enable = true;
|
||||
client.enable = false;
|
||||
extraConfig = ''
|
||||
Log [general,net,config,fs]debug stdout
|
||||
'';
|
||||
extraConfig = "Log [general,net,config,fs]debug stdout";
|
||||
relay = {
|
||||
enable = true;
|
||||
port = 80;
|
||||
role = "relay";
|
||||
bridgeTransports = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
virtualisation.memorySize = 768;
|
||||
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue