2
0
Fork 0

overlay: add setup-hook to tup

This commit is contained in:
Emery Hemingway 2020-04-22 17:16:02 +05:30
parent 6c8629d1be
commit 8c4e0dcbb0
6 changed files with 47 additions and 64 deletions

View File

@ -50,4 +50,6 @@ with prev; {
solo5-tools = callPackage ./solo5-tools { };
tup = prev.tup.overrideAttrs (attrs: { setupHook = ./tup/setup-hook.sh; });
}

44
overlay/tup/setup-hook.sh Normal file
View File

@ -0,0 +1,44 @@
#!/bin/sh
tupConfigurePhase() {
runHook preConfigure
echo -n CONFIG_TUP_ARCH= >> tup.config
case "$system" in
"i686-*") echo i386 >> tup.config;;
"x86_64-*") echo x86_64 >> tup.config;;
"powerpc-*") echo powerpc >> tup.config;;
"powerpc64-*") echo powerpc64 >> tup.config;;
"ia64-*") echo ia64 >> tup.config;;
"alpha-*") echo alpha >> tup.config;;
"sparc-*") echo sparc >> tup.config;;
"aarch64-*") echo arm64 >> tup.config;;
"arm*") echo arm >> tup.config;;
esac
echo "${tupConfig-}" >> tup.config
tup init
tup generate tupBuild.sh
runHook postConfigure
}
if [ -z "${dontUseTupConfigure-}" -a -z "${configurePhase-}" ]; then
configurePhase=tupConfigurePhase
fi
tupBuildPhase() {
runHook preBuild
pushd .
. tupBuild.sh
popd
runHook postBuild
}
if [ -z "${dontUseTupBuild-}" -a -z "${buildPhase-}" ]; then
buildPhase=tupBuildPhase
fi

View File

@ -14,20 +14,6 @@ stdenv.mkDerivation rec {
sha256 = "0vw3s4q3rp5dp1i93sq0cybfssh3gbqgyqg6k69781pjda7mzn54";
};
configurePhase = ''
# Scan repository and generate script
tup init
tup generate buildPhase.sh
'';
buildPhase = ''
pushd .
set -v
source buildPhase.sh
set +v
popd
'';
installPhase = "install -Dm755 {.,$out}/block_router";
meta = with stdenv.lib; {

View File

@ -23,8 +23,6 @@ let
'';
});
genodeTupRules = ./Tuprules.tup;
depotPkgs = with builtins;
let
names = attrNames (import ./genodelabs/targets.nix {

View File

@ -1,26 +1,7 @@
# SPDX-License-Identifier: CC0-1.0
{ stdenv, fetchgit, 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}=${attrs.${name}} ";
in foldl' op "" (attrNames attrs);
in stdenv.mkDerivation rec {
stdenv.mkDerivation rec {
pname = "nic_bus";
version = "2.0";
@ -32,20 +13,6 @@ in stdenv.mkDerivation rec {
nativeBuildInputs = [ tup ];
configurePhase = ''
# Scan repository and generate script
tup init
tup generate buildPhase.sh
'';
buildPhase = ''
pushd .
set -v
source buildPhase.sh
set +v
popd
'';
installPhase = "install -Dm755 {.,$out}/${pname}";
meta = with stdenv.lib; {

View File

@ -14,20 +14,6 @@ stdenv.mkDerivation rec {
sha256 = "01qy86khkihj8jgvgc92w4bb3kpf640g1l2m5h5ym7s03viqinkr";
};
configurePhase = ''
# Scan repository and generate script
tup init
tup generate buildPhase.sh
'';
buildPhase = ''
pushd .
set -v
source buildPhase.sh
set +v
popd
'';
installPhase = "install -Dm755 {.,$out/bin}/sotest-harness";
meta = with stdenv.lib; {