2
0
Fork 0

Use updateAutotoolsGnuConfigScript to build legacy packages

Update Nixpkgs to use the updateAutotoolsGnuConfigScript hook everywhere
for Genode target platforms. Tweak Coreutils and Bash to compile, make
some tests.
nix
Emery Hemingway 2 years ago
parent 32d65d2f41
commit 55c093e0c5
  1. 14
      flake.lock
  2. 3
      flake.nix
  3. 68
      overlay/default.nix
  4. 40
      overlay/gnu-config/default.nix
  5. 40
      packages/genodelabs/libc.patch
  6. 5
      packages/genodelabs/targets.nix
  7. 15
      tests/default.nix
  8. 5
      tests/driver-hw.nix
  9. 5
      tests/driver-nova.nix
  10. 99
      tests/posix.dhall
  11. 12
      tests/posix.nix

@ -38,18 +38,20 @@
},
"nixpkgs_2": {
"info": {
"lastModified": 1585835256,
"narHash": "sha256-8+3D0tUeUEzGSBMTw0FNZBCMB0negok5VisXm9vkz1U="
"lastModified": 1588878864,
"narHash": "sha256-0FFvF2iZosl1402T90plIYZ+QPbKUZTbuIvgWPh6l/Y="
},
"locked": {
"owner": "NixOS",
"owner": "ehmry",
"repo": "nixpkgs",
"rev": "09190b9c16c6021fa29733874986c46c00144ed1",
"rev": "93d0c88777bc229ab9628e883bd9b25baefda8eb",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
"owner": "ehmry",
"ref": "genode",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {

@ -7,6 +7,8 @@
inputs.genode-depot.uri = "git+https://git.sr.ht/~ehmry/genode-depot";
inputs.nixpkgs.uri = "github:ehmry/nixpkgs?ref=genode";
outputs = { self, genode-depot, nixpkgs }:
let
localSystems = [ "x86_64-linux" ];
@ -127,6 +129,7 @@
genodepkgs = self.packages.${system};
lib = self.lib.${system};
nixpkgs = nixpkgsFor.${system};
legacyPackages = self.legacyPackages.${system};
});
in { x86_64-linux = checks'.x86_64-linux-x86_64-genode; };
};

@ -1,33 +1,59 @@
# SPDX-License-Identifier: CC0-1.0
final: prev:
with prev; {
with prev;
let
overrideHostAttrs = drv: f:
if hostPlatform.isGenode then drv.overrideAttrs f else drv;
binutils-unwrapped = prev.binutils-unwrapped.overrideAttrs (attrs: {
patches = attrs.patches ++ lib.optional targetPlatform.isGenode
[ ./binutils/support-genode.patch ];
});
overrideTargetAttrs = drv: f:
if targetPlatform.isGenode then drv.overrideAttrs f else drv;
addPatches = drv: patch:
overrideTargetAttrs drv
(attrs: { patches = attrs.patches or [ ] ++ [ patch ]; });
in {
cmake = prev.cmake.overrideAttrs (attrs: {
postInstall = with stdenv;
if targetPlatform.isGenode then ''
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
'' else
null;
bash = overrideTargetAttrs bash (attrs: {
configureFlags = attrs.configureFlags
++ [ "--without-bash-malloc" ]; # no sbrk please
});
gdb = prev.gdb.overrideAttrs (attrs: {
patches = attrs.patches
++ lib.optional targetPlatform.isGenode [ ./gdb/genode.patch ];
binutils-unwrapped =
addPatches binutils-unwrapped [ ./binutils/support-genode.patch ];
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"
];
})
else
coreutils;
gdb = addPatches gdb [ ./gdb/genode.patch ];
inherit (final.genodeSources) genodeBase;
genodeLibcCross = callPackage ./libc { };

@ -0,0 +1,40 @@
{ stdenv, fetchurl }:
let
rev = "e78c96e5288993aaea3ec44e5c6ee755c668da79";
# Don't use fetchgit as this is needed during Aarch64 bootstrapping
configGuess = fetchurl {
url =
"https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=${rev}";
sha256 = "sha256-TSLpYIDGSp1flqCBi2Sgg9IWDV5bcO+Hn2Menv3R6KU=";
};
configSub = fetchurl {
url =
"https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=${rev}";
sha256 = "sha256-DkCGDN/DE3phQ1GO/Ua5ZPPtp0Ya93PnW3yfSK8EV9s=";
};
in stdenv.mkDerivation {
pname = "gnu-config";
version = "2020-05-04";
buildCommand = ''
mkdir -p $out
cp ${configGuess} $out/config.guess
cp ${configSub} $out/config.sub
'';
meta = with stdenv.lib; {
description = "Attempt to guess a canonical system name";
homepage = "https://savannah.gnu.org/projects/config";
license = licenses.gpl3;
# In addition to GPLv3:
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that
# program.
maintainers = [ maintainers.dezgeg ];
platforms = platforms.all;
};
}

@ -0,0 +1,40 @@
commit f3a7fb548c8600a6e290d306b933725ebc546cd0
Author: Emery Hemingway <ehmry@posteo.net>
Date: Wed May 6 04:38:35 2020 +0530
libc: add siginterrupt dummy
diff --git a/repos/libports/src/lib/libc/signal.cc b/repos/libports/src/lib/libc/signal.cc
index dc9af2d443..784257c48e 100644
--- a/repos/libports/src/lib/libc/signal.cc
+++ b/repos/libports/src/lib/libc/signal.cc
@@ -131,6 +131,9 @@ extern "C" int sigaction(int signum, const struct sigaction *act, struct sigacti
}
+extern "C" int siginterrupt(int sig, int flag) { return 0; };
+
+
extern "C" int _sigaction(int, const struct sigaction *, struct sigaction *) __attribute__((weak, alias("sigaction")));
extern "C" int __sys_sigaction(int, const struct sigaction *, struct sigaction *) __attribute__((weak, alias("sigaction")));
extern "C" int __libc_sigaction(int, const struct sigaction *, struct sigaction *) __attribute__((weak, alias("sigaction")));
commit 65244c99c250767922b9afca9663ddcb7a7753f8
Author: Emery Hemingway <ehmry@posteo.net>
Date: Wed May 6 04:59:56 2020 +0530
libc: add upstream mbsinit
diff --git a/repos/libports/lib/mk/libc-locale.mk b/repos/libports/lib/mk/libc-locale.mk
index 8e75e59589..2bb98b1456 100644
--- a/repos/libports/lib/mk/libc-locale.mk
+++ b/repos/libports/lib/mk/libc-locale.mk
@@ -6,7 +6,7 @@ CC_OPT += -D_Thread_local=""
FILTER_OUT = \
c16rtomb.c c32rtomb_iconv.c mbrtoc16_iconv.c mbrtoc32_iconv.c \
setlocale.c xlocale.c setrunelocale.c \
- ascii.c big5.c euc.co gb18030.c gb2312.c gbk.c mbsinit.c mskanji.c utf8.c \
+ ascii.c big5.c euc.co gb18030.c gb2312.c gbk.c mskanji.c utf8.c \
SRC_C = $(filter-out $(FILTER_OUT),$(notdir $(wildcard $(LIBC_LOCALE_DIR)/*.c)))

@ -12,7 +12,10 @@ with ports; {
portInputs = [ dde_linux ];
};
libc.portInputs = [ libc ];
libc = {
portInputs = [ libc ];
patches = [ ./libc.patch ];
};
lighttpd.portInputs = [ libc lighttpd openssl zlib ];

@ -2,7 +2,8 @@
let tests = call: { log = call ./log.nix { }; };
in { self, apps, buildPackages, depot, genodepkgs, lib, nixpkgs }:
in { self, apps, buildPackages, depot, genodepkgs, lib, nixpkgs, legacyPackages
}:
let
testPkgs = genodepkgs;
@ -32,18 +33,22 @@ let
((tests call) // {
driver_manager = call ./driver_manager.nix { };
noux = call ./noux.nix { };
posix = call ./posix.nix { };
vmm = call ./vmm_x86.nix { };
x86 = call ./x86.nix { };
} // call ./solo5 { })) (import ./driver-nova.nix {
inherit apps addManifest buildPackages depot lib nixpkgs testPkgs;
inherit apps addManifest buildPackages depot lib nixpkgs testPkgs
legacyPackages;
}).callTest;
hw = (call:
((tests call) // {
# noux = call ./noux.nix { };
posix = call ./posix.nix { };
x86 = call ./x86.nix { };
} // call ./solo5 { })) (import ./driver-hw.nix {
inherit apps addManifest buildPackages depot lib nixpkgs testPkgs;
inherit apps addManifest buildPackages depot lib nixpkgs testPkgs
legacyPackages;
}).callTest;
testsToList = tests:
@ -55,8 +60,8 @@ let
in with builtins;
listToAttrs ((concatLists (map (testsToList) [ linux hw nova ]))) // {
sotest = let
hwTests = [ hw.multi hw.x86 ];
novaTests = [ nova.multi nova.x86 nova.vmm ];
hwTests = with hw; [ multi posix x86 ];
novaTests = with nova; [ multi posix x86 vmm ];
allTests = hwTests ++ novaTests;
projectCfg.boot_items =

@ -1,6 +1,7 @@
# SPDX-License-Identifier: CC0-1.0
{ addManifest, apps, buildPackages, depot, lib, nixpkgs, testPkgs }:
{ addManifest, apps, buildPackages, depot, lib, nixpkgs, testPkgs
, legacyPackages }:
let
testDriver = with buildPackages;
@ -153,6 +154,6 @@ in {
isNova = true;
};
pkgs = testPkgs;
inherit nixpkgs depot buildPackages;
inherit nixpkgs depot buildPackages legacyPackages;
} // args));
}

@ -1,6 +1,7 @@
# SPDX-License-Identifier: CC0-1.0
{ addManifest, apps, buildPackages, depot, lib, nixpkgs, testPkgs }:
{ addManifest, apps, buildPackages, depot, lib, nixpkgs, testPkgs
, legacyPackages }:
let
testDriver = with buildPackages;
@ -154,6 +155,6 @@ in {
isNova = true;
};
pkgs = testPkgs;
inherit nixpkgs depot buildPackages;
inherit nixpkgs depot buildPackages legacyPackages;
} // args));
}

@ -0,0 +1,99 @@
-- SPDX-License-Identifier: CC0-1.0
let Test = ./test.dhall ? env:DHALL_GENODE_TEST
let Genode = Test.Genode
let Prelude = Genode.Prelude
let XML = Prelude.XML
let Child = Genode.Init.Child
let toChild =
λ(binary : Text)
→ λ(args : List Text)
→ { mapKey = binary
, mapValue =
Child.flat
Child.Attributes::{
, binary = binary
, exitPropagate = True
, resources = Genode.Init.Resources::{
, caps = 256
, ram = Genode.units.MiB 4
}
, config = Genode.Init.Config::{
, content =
[ Prelude.XML.text
''
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"/>
<vfs>
<dir name="dev"> <log/> <null/> <rtc/> </dir>
<dir name="testdir">
<inline name="testfile">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam
varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus
magna felis sollicitudin mauris. Integer in mauris eu nibh euismod
gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis
risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue,
eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas
fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a
mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque.
Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien,
sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam
arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet
et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu,
feugiat in, orci. In hac habitasse platea dictumst.
</inline>
</dir>
<dir name="tmp"><ram/></dir>
</vfs>
''
]
# Prelude.List.map
Text
XML.Type
( λ(x : Text)
→ XML.leaf
{ name = "arg", attributes = toMap { value = x } }
)
([ binary ] # args)
}
}
}
let f = λ(binary : Text) → toChild binary ([] : List Text)
let g = toChild
in Test::{
, children =
[ g "hello" [ "--version" ]
, g "b2sum" [ "testdir/testfile" ]
, f "date"
, f "dir"
, f "env"
, g "factor" [ "1337" ]
, g "head" [ "-n", "4", "testdir/testfile" ]
, f "id"
, g "ln" [ "-sv", "testdir/testfile", "tmp/testfile" ]
, g "ls" [ "-l", "-a", "-R" ]
, f "mktemp"
, f "mktemp"
, f "mktemp"
, f "pwd"
, g "seq" [ "3" ]
, g "tail" [ "-n", "4", "testdir/testfile" ]
, g "wc" [ "testdir/testfile" ]
, f "whoami"
]
}

@ -0,0 +1,12 @@
# SPDX-License-Identifier: CC0-1.0
{ testEnv, pkgs, legacyPackages, depot, ... }:
with pkgs;
testEnv.mkTest rec {
name = "posix";
testConfig = ./posix.dhall;
testInputs = map pkgs.genodeSources.depot [ "vfs" "libc" "posix" ]
++ (with legacyPackages; [ coreutils hello ]);
meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ehmry ];
}
Loading…
Cancel
Save