Browse Source
- Implement support for "ports" - Update Nixpkgs to use Genode 20.02 - Remove packaging of forked Genode20.02 20.02
26 changed files with 427 additions and 494 deletions
@ -1,43 +1,109 @@
|
||||
{ |
||||
"inputs": { |
||||
"dhall-haskell": { |
||||
"inputs": { |
||||
"nixpkgs": { |
||||
"inputs": {}, |
||||
"narHash": "sha256-wJg4DA700SoQbEz61448sR6BgxRa1R92K3vvCV1g+HY=", |
||||
"originalUrl": "git+https://github.com/nixos/nixpkgs.git?ref=18.09-beta&rev=1d4de0d552ae9aa66a5b8dee5fb0650a4372d148", |
||||
"url": "git+https://github.com/nixos/nixpkgs.git?ref=18.09-beta&rev=1d4de0d552ae9aa66a5b8dee5fb0650a4372d148" |
||||
}, |
||||
"nixpkgsStaticLinux": { |
||||
"inputs": {}, |
||||
"narHash": "sha256-famU3pJZ4vkElV9qc71HmyRVSvcrAhfMZ0UJKpmmKP8=", |
||||
"originalUrl": "git+https://github.com/nh2/nixpkgs.git?ref=static-haskell-nix-stack-dhall-working", |
||||
"url": "git+https://github.com/nh2/nixpkgs.git?ref=static-haskell-nix-stack-dhall-working&rev=925aac04f4ca58aceb83beef18cb7dae0715421b" |
||||
} |
||||
}, |
||||
"narHash": "sha256-KJl9ZLcMcEsLSPcwcWoc0Ac74/6HKC9LkVMeLwhyhlg=", |
||||
"originalUrl": "git+https://github.com/dhall-lang/dhall-haskell?ref=flake", |
||||
"url": "git+https://github.com/dhall-lang/dhall-haskell?ref=flake&rev=aea28adf3d10ff1982aa4ddd176d1476251b932f" |
||||
}, |
||||
"genode-depot": { |
||||
"inputs": { |
||||
"nixpkgs": { |
||||
"inputs": {}, |
||||
"narHash": "sha256-OnpEWzNxF/AU4KlqBXM2s5PWvfI5/BS6xQrPvkF5tO8=", |
||||
"originalUrl": "nixpkgs", |
||||
"url": "github:edolstra/nixpkgs/7f8d4b088e2df7fdb6b513bc2d6941f1d422a013" |
||||
} |
||||
}, |
||||
"narHash": "sha256-7eL2MfGgeEaIwJXPc4LQ7pBa4JeGicm9th7onjKgzsE=", |
||||
"originalUrl": "git+https://git.sr.ht/~ehmry/genode-depot", |
||||
"url": "git+https://git.sr.ht/~ehmry/genode-depot?ref=master&rev=8c2aafed45b4075e37f1cd93de0ebf93f38c83c3" |
||||
"inputs": { |
||||
"dhall-haskell": { |
||||
"info": { |
||||
"narHash": "sha256-KJl9ZLcMcEsLSPcwcWoc0Ac74/6HKC9LkVMeLwhyhlg=" |
||||
}, |
||||
"inputs": { |
||||
"nixpkgs": { |
||||
"info": { |
||||
"narHash": "sha256-wJg4DA700SoQbEz61448sR6BgxRa1R92K3vvCV1g+HY=" |
||||
}, |
||||
"inputs": {}, |
||||
"locked": { |
||||
"ref": "18.09-beta", |
||||
"rev": "1d4de0d552ae9aa66a5b8dee5fb0650a4372d148", |
||||
"type": "git", |
||||
"url": "https://github.com/nixos/nixpkgs.git" |
||||
}, |
||||
"original": { |
||||
"ref": "18.09-beta", |
||||
"rev": "1d4de0d552ae9aa66a5b8dee5fb0650a4372d148", |
||||
"type": "git", |
||||
"url": "https://github.com/nixos/nixpkgs.git" |
||||
} |
||||
}, |
||||
"nixpkgsStaticLinux": { |
||||
"info": { |
||||
"narHash": "sha256-famU3pJZ4vkElV9qc71HmyRVSvcrAhfMZ0UJKpmmKP8=" |
||||
}, |
||||
"inputs": {}, |
||||
"locked": { |
||||
"ref": "static-haskell-nix-stack-dhall-working", |
||||
"rev": "925aac04f4ca58aceb83beef18cb7dae0715421b", |
||||
"type": "git", |
||||
"url": "https://github.com/nh2/nixpkgs.git" |
||||
}, |
||||
"original": { |
||||
"ref": "static-haskell-nix-stack-dhall-working", |
||||
"type": "git", |
||||
"url": "https://github.com/nh2/nixpkgs.git" |
||||
} |
||||
} |
||||
}, |
||||
"locked": { |
||||
"ref": "flake", |
||||
"rev": "aea28adf3d10ff1982aa4ddd176d1476251b932f", |
||||
"type": "git", |
||||
"url": "https://github.com/dhall-lang/dhall-haskell" |
||||
}, |
||||
"original": { |
||||
"ref": "flake", |
||||
"type": "git", |
||||
"url": "https://github.com/dhall-lang/dhall-haskell" |
||||
} |
||||
}, |
||||
"genode-depot": { |
||||
"info": { |
||||
"narHash": "sha256-7eL2MfGgeEaIwJXPc4LQ7pBa4JeGicm9th7onjKgzsE=" |
||||
}, |
||||
"inputs": { |
||||
"nixpkgs": { |
||||
"inputs": {}, |
||||
"narHash": "sha256-H97qzDLWl646rcgEPMA0oQDt817kGcpCiROdi1j2N0I=", |
||||
"originalUrl": "github:ehmry/nixpkgs", |
||||
"url": "github:ehmry/nixpkgs/c73578fb214872baf2261f52eccbcbfdf6d54f32" |
||||
"info": { |
||||
"narHash": "sha256-OnpEWzNxF/AU4KlqBXM2s5PWvfI5/BS6xQrPvkF5tO8=" |
||||
}, |
||||
"inputs": {}, |
||||
"locked": { |
||||
"owner": "edolstra", |
||||
"repo": "nixpkgs", |
||||
"rev": "7f8d4b088e2df7fdb6b513bc2d6941f1d422a013", |
||||
"type": "github" |
||||
}, |
||||
"original": { |
||||
"id": "nixpkgs", |
||||
"type": "indirect" |
||||
} |
||||
} |
||||
}, |
||||
"locked": { |
||||
"ref": "master", |
||||
"rev": "8c2aafed45b4075e37f1cd93de0ebf93f38c83c3", |
||||
"type": "git", |
||||
"url": "https://git.sr.ht/~ehmry/genode-depot" |
||||
}, |
||||
"original": { |
||||
"type": "git", |
||||
"url": "https://git.sr.ht/~ehmry/genode-depot" |
||||
} |
||||
}, |
||||
"version": 3 |
||||
"nixpkgs": { |
||||
"info": { |
||||
"lastModified": 1583160598, |
||||
"narHash": "sha256-jiBSr7JK/xy7pIXFVhjdxpWy0pudDDRDW5XjzmDXPjA=" |
||||
}, |
||||
"inputs": {}, |
||||
"locked": { |
||||
"owner": "ehmry", |
||||
"repo": "nixpkgs", |
||||
"rev": "37cf068dcf79503fa6f399dcb44bc15c5d2f33f0", |
||||
"type": "github" |
||||
}, |
||||
"original": { |
||||
"owner": "ehmry", |
||||
"repo": "nixpkgs", |
||||
"type": "github" |
||||
} |
||||
} |
||||
}, |
||||
"version": 4 |
||||
} |
||||
|
@ -1,274 +0,0 @@
|
||||
# SPDX-License-Identifier: CC0-1.0 |
||||
|
||||
{ nixpkgs, mkDhallManifest }: |
||||
|
||||
let |
||||
|
||||
src = nixpkgs.fetchgit { |
||||
url = "https://git.sr.ht/~ehmry/genode"; |
||||
rev = "11ff9a1dc524dadd3252777d9be529910e375e66"; |
||||
sha256 = "1238ashnx40fmc715w1mqiachdw7bkd04zy6d6l1hmn7f0ld535n"; |
||||
}; |
||||
|
||||
inherit (nixpkgs) buildPackages llvmPackages; |
||||
|
||||
sourceForgeToolchain = nixpkgs.buildPackages.callPackage ./toolchain.nix { }; |
||||
|
||||
stdenvLlvm = let inherit (nixpkgs) stdenv; |
||||
in assert stdenv.cc.isClang; stdenv; |
||||
|
||||
stdenvGcc = let |
||||
env = nixpkgs.stdenvAdapters.overrideCC nixpkgs.stdenv sourceForgeToolchain; |
||||
in assert env.cc.isGNU; env; |
||||
|
||||
inherit (stdenvLlvm) lib targetPlatform; |
||||
specs = with targetPlatform; |
||||
[ ] |
||||
|
||||
++ lib.optional is32bit "32bit" |
||||
|
||||
++ lib.optional is64bit "64bit" |
||||
|
||||
++ lib.optional isAarch32 "arm" |
||||
|
||||
++ lib.optional isAarch64 "arm_64" |
||||
|
||||
++ lib.optional isRiscV "riscv" |
||||
|
||||
++ lib.optional isx86 "x86" |
||||
|
||||
++ lib.optional isx86_32 "x86_32" |
||||
|
||||
++ lib.optional isx86_64 "x86_64"; |
||||
|
||||
toTupConfig = env: attrs: |
||||
let |
||||
tupArch = with env.targetPlatform; |
||||
|
||||
if isAarch32 then |
||||
"arm" |
||||
else |
||||
|
||||
if isAarch64 then |
||||
"arm64" |
||||
else |
||||
|
||||
if isx86_32 then |
||||
"i386" |
||||
else |
||||
|
||||
if isx86_64 then |
||||
"x86_64" |
||||
else |
||||
|
||||
abort "unhandled targetPlatform"; |
||||
|
||||
attrs' = with env; { TUP_ARCH = tupArch; } // attrs; |
||||
|
||||
in with builtins; |
||||
env.mkDerivation { |
||||
name = "tup.config"; |
||||
nativeBuildInputs = with nixpkgs.buildPackages; [ |
||||
binutils |
||||
pkgconfig |
||||
which |
||||
]; |
||||
text = let |
||||
op = config: name: '' |
||||
${config}CONFIG_${name}=${getAttr name attrs} |
||||
''; |
||||
in foldl' op "" (attrNames attrs); |
||||
passAsFile = [ "text" ]; |
||||
preferLocalBuild = true; |
||||
buildCommand = let |
||||
subst = let |
||||
vars = [ "AR" "NM" ]; |
||||
f = other: var: |
||||
other + '' |
||||
echo CONFIG_${var}=`which ''$${var}` >> $out |
||||
''; |
||||
in foldl' f "" vars; |
||||
utils = let |
||||
vars = [ "pkg-config" "objcopy" ]; |
||||
f = other: var: |
||||
other + '' |
||||
echo CONFIG_${var}=`which ${var}` >> $out |
||||
''; |
||||
in foldl' f "" vars; |
||||
in '' |
||||
cp $textPath $out |
||||
${subst} |
||||
${utils} |
||||
''; |
||||
}; |
||||
|
||||
tupConfigGcc = let |
||||
f = env: |
||||
let prefix = bin: env.cc.targetPrefix + bin; |
||||
in { |
||||
CC = prefix "gcc"; |
||||
CXX = prefix "g++"; |
||||
LD = prefix "ld"; |
||||
OBJCOPY = prefix "objcopy"; |
||||
RANLIB = prefix "ranlib"; |
||||
READELF = prefix "readelf"; |
||||
STRIP = prefix "strip"; |
||||
PKGCONFIG = "${nixpkgs.buildPackages.pkgconfig}/bin/pkg-config"; |
||||
|
||||
IS_GCC = ""; |
||||
LINUX_HEADERS = buildPackages.glibc.dev; |
||||
}; |
||||
in toTupConfig stdenvGcc (f stdenvGcc); |
||||
|
||||
tupConfigLlvm = let |
||||
f = env: |
||||
let prefix = bin: "${env.cc}/bin/${env.cc.targetPrefix}${bin}"; |
||||
in { |
||||
CC = prefix "cc"; |
||||
CXX = prefix "c++"; |
||||
LD = prefix "ld"; |
||||
OBJCOPY = "llvm-objcopy"; |
||||
OBJDUMP = "llvm-objdump"; |
||||
RANLIB = "llvm-ranlib"; |
||||
READELF = "llvm-readelf"; |
||||
STRIP = "llvm-strip"; |
||||
PKGCONFIG = "${nixpkgs.buildPackages.pkgconfig}/bin/pkg-config"; |
||||
|
||||
IS_LLVM = ""; |
||||
LIBCXXABI = llvmPackages.libcxxabi; |
||||
LIBCXX = llvmPackages.libcxx; |
||||
LIBUNWIND_BAREMETAL = |
||||
llvmPackages.libunwind.override { isBaremetal = true; }; |
||||
LIBUNWIND = llvmPackages.libunwind; |
||||
LINUX_HEADERS = buildPackages.glibc.dev; |
||||
}; |
||||
in toTupConfig stdenvLlvm (f stdenvLlvm); |
||||
|
||||
buildRepo = { env, repo, repoInputs }: |
||||
env.mkDerivation { |
||||
pname = repo; |
||||
version = "19.11"; |
||||
inherit repo specs src; |
||||
|
||||
nativeBuildInputs = repoInputs; |
||||
# This is wrong, why does pkg-config not collect buildInputs? |
||||
|
||||
propagatedNativeBuildInputs = repoInputs; |
||||
|
||||
depsBuildBuild = with buildPackages; [ llvm pkgconfig tup ]; |
||||
|
||||
tupConfig = if env.cc.isGNU then |
||||
tupConfigGcc |
||||
else if env.cc.isClang then |
||||
tupConfigLlvm |
||||
else |
||||
throw "no Tup config for this stdenv"; |
||||
|
||||
configurePhase = '' |
||||
# Configure Tup |
||||
set -v |
||||
install -m666 $tupConfig tup.config |
||||
echo CONFIG_NIX_OUTPUTS_OUT=$out >> tup.config |
||||
echo CONFIG_NIX_OUTPUTS_DEV=$out >> tup.config |
||||
|
||||
# Disable other repos |
||||
for R in repos/*; do |
||||
[ "$R" != "repos/$repo" ] && find $R -name Tupfile -delete |
||||
done |
||||
|
||||
# Scan repository and generate script |
||||
tup init |
||||
tup generate buildPhase.sh |
||||
|
||||
# Redirect artifacts to Nix store |
||||
mkdir -p $out/lib $out/include |
||||
ln -s $out out |
||||
ln -s $out dev |
||||
''; |
||||
|
||||
buildPhase = '' |
||||
test -d repos/$repo/src/ld && cp -rv repos/$repo/src/ld $out/ |
||||
pushd . |
||||
set -v |
||||
source buildPhase.sh |
||||
set +v |
||||
popd |
||||
''; |
||||
|
||||
installPhase = '' |
||||
# Populate the "dev" headers |
||||
if [ -d "repos/$repo/include" ]; then |
||||
for DIR in repos/$repo/include; do |
||||
for SPEC in $specs; do |
||||
if [ -d $DIR/spec/$SPEC ]; then |
||||
cp -r $DIR/spec/$SPEC/* $out/include |
||||
rm -r $DIR/spec/$SPEC |
||||
fi |
||||
done |
||||
rm -rf $DIR/spec |
||||
cp -r $DIR $out/ |
||||
done |
||||
fi |
||||
|
||||
touch $out/.genode |
||||
for pc in $out/lib/pkgconfig/*.pc; do |
||||
sed -e "s|^Libs: |Libs: -L$out/lib |" -i $pc |
||||
done |
||||
''; |
||||
|
||||
meta = with env.lib; { |
||||
description = |
||||
"The Genode operation system framework (${repo} repository)."; |
||||
homepage = "https://genode.org/"; |
||||
license = licenses.agpl3; |
||||
maintainers = [ maintainers.ehmry ]; |
||||
}; |
||||
|
||||
}; |
||||
|
||||
buildRepoGcc' = { ... }@args: |
||||
let drv = buildRepo ({ env = stdenvGcc; } // args); |
||||
in { manifest = mkDhallManifest drv; } // drv; |
||||
|
||||
buildRepoLlvm' = { ... }@args: |
||||
let drv = buildRepo ({ env = stdenvLlvm; } // args); |
||||
in { manifest = mkDhallManifest drv; } // drv; |
||||
|
||||
drvs = rec { |
||||
|
||||
base = buildRepoGcc' { |
||||
repo = "base"; |
||||
repoInputs = [ ]; |
||||
}; |
||||
|
||||
base-linux = buildRepoGcc' { |
||||
repo = "base-linux"; |
||||
repoInputs = [ base ]; |
||||
}; |
||||
|
||||
os = buildRepoLlvm' { |
||||
repo = "os"; |
||||
repoInputs = [ base ]; |
||||
}; |
||||
|
||||
gems = buildRepoLlvm' { |
||||
repo = "gems"; |
||||
repoInputs = [ base os ]; |
||||
}; |
||||
|
||||
inherit stdenvGcc stdenvLlvm tupConfigGcc tupConfigLlvm; |
||||
|
||||
}; |
||||
|
||||
manifest = with builtins; |
||||
let |
||||
repoDrvs = filter (drv: typeOf drv == "set" && hasAttr "repo" drv && hasAttr "manifest" drv) |
||||
(attrValues drvs); |
||||
records = map (drv: "${drv.repo}=${drv.manifest}") repoDrvs; |
||||
text = "{" + builtins.concatStringsSep "," records + "}"; |
||||
in nixpkgs.writeTextFile { |
||||
name = "genode.manifest.dhall"; |
||||
inherit text; |
||||
}; |
||||
|
||||
in drvs // manifest // { pname = "genode"; inherit manifest; } |
@ -0,0 +1,14 @@
|
||||
diff --git a/tool/ports/mk/install.mk b/tool/ports/mk/install.mk
|
||||
index 6fe5271abf..dec4984063 100644
|
||||
--- a/tool/ports/mk/install.mk
|
||||
+++ b/tool/ports/mk/install.mk
|
||||
@@ -179,7 +179,8 @@ _svn_dir = $(call _assert,$(DIR($1)),Missing declaration of DIR($*))
|
||||
$(VERBOSE)dir=$(call _svn_dir,$*);\
|
||||
rm -rf $$dir; \
|
||||
$(MSG_DOWNLOAD)$(URL($*)); \
|
||||
- svn export -q $(URL($*))@$(REV($*)) $$dir;
|
||||
+ svn export --trust-server-cert --non-interactive \
|
||||
+ -q $(URL($*))@$(REV($*)) $$dir;
|
||||
|
||||
|
||||
##
|
@ -1,69 +0,0 @@
|
||||
# SPDX-License-Identifier: CC0-1.0 |
||||
|
||||
{ stdenv, buildPackages, fetchgit, base, os, pkgconfig, tup }: |
||||
|
||||
let |
||||
tupArch = with stdenv.targetPlatform; |
||||
if isAarch32 then "arm" else |
||||
if isAarch64 then "arm64" else |
||||
if isx86_32 then "i386" else |
||||
if isx86_64 then "x86_64" else |
||||
abort "unhandled targetPlatform"; |
||||
|
||||
toTupConfig = attrs: |
||||
with builtins; |
||||
let op = config: name: "${config}CONFIG_${name}=${getAttr name attrs} "; |
||||
in foldl' op "" (attrNames attrs); |
||||
|
||||
in stdenv.mkDerivation rec { |
||||
name = "nic_bus"; |
||||
version = "1.0"; |
||||
src = fetchgit { |
||||
url = "https://git.sr.ht/~ehmry/nic_bus"; |
||||
rev = "76881b4fbb99e9a995d1f35a33529ff8f38c89bc"; |
||||
sha256 = "08fcbfnlg0ljbgv95yd5q70c7xa0sg2k0njv4ygancs7d7f7q4bb"; |
||||
}; |
||||
|
||||
nativeBuildInputs = [ pkgconfig tup ]; |
||||
|
||||
buildInputs = [ base os ]; |
||||
|
||||
tupConfig = toTupConfig { |
||||
TUP_ARCH = tupArch; |
||||
VERSION = version; |
||||
}; |
||||
|
||||
configurePhase = '' |
||||
cp -v ${base.src}/Tuprules.tup . |
||||
|
||||
# Configure Tup |
||||
echo $tupConfig | tr ' CONFIG_' '\nCONFIG_' > tup.config |
||||
echo CONFIG_NIX_OUTPUTS_OUT=$out >> tup.config |
||||
echo CONFIG_NIX_OUTPUTS_DEV=$dev >> tup.config |
||||
|
||||
# Scan repository and generate script |
||||
tup init |
||||
tup generate buildPhase.sh |
||||
|
||||
# Redirect artifacts to Nix store |
||||
mkdir -p $out |
||||
ln -s $out out |
||||
''; |
||||
|
||||
buildPhase = '' |
||||
test -d repos/$repo/src/ld && cp -rv repos/$repo/src/ld $dev/ |
||||
pushd . |
||||
set -v |
||||
source buildPhase.sh |
||||
set +v |
||||
popd |
||||
''; |
||||
|
||||
dontInstall = true; |
||||
|
||||
meta = with stdenv.lib; { |
||||
license = licenses.agpl3; |
||||
maintainers = [ maintainers.ehmry ]; |
||||
}; |
||||
|
||||
} |
Loading…
Reference in new issue