Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 123 lines (95 sloc) 4.29 KB
#! /bin/sh
set -xe
umask 022
PKG=charliecloud
VERSION=0.32
BUILD=1
PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/package/bin
PREFIX=/pkg/$PKG-$VERSION-$BUILD
if [ -n "$TESTING" ]; then PREFIX=/scratch/local2/$PKG-$VERSION-$BUILD ; fi
mkdir -p $PREFIX
cat >$PREFIX/profile <<-EOF
#source nvidia-container-toolkit
PATH=$PREFIX/bin:\$PATH
if [ -d $PREFIX/.compatlibs ]; then export LD_LIBRARY_PATH=$PREFIX/.compatlibs\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH} ; fi
EOF
source $PREFIX/profile
# needed for ~/.cache/go-build ...
BUILD_TMPDIR=/scratch/local2/$PKG-$VERSION-$BUILD.$USER.build.tmp
test -d $BUILD_TMPDIR && ( chmod -R u+rwx $BUILD_TMPDIR || true ; rm -rf $BUILD_TMPDIR )
mkdir -p $BUILD_TMPDIR/home
export TMPDIR=$BUILD_TMPDIR
export HOME=$BUILD_TMPDIR/home
mkdir -p $PREFIX/build
cd $PREFIX/build
# start with libnvidia-container and nvidia-container-toolkit
(
VERSION=1.13.1
# orig: https://github.com/NVIDIA/libnvidia-container/archive/refs/tags/v1.13.1.tar.gz
BEEHIVE=https://beehive.molgen.mpg.de/ed31ad76317bf46ee29205d10adf457d/libnvidia-container-1.13.1.tar.gz
test -e libnvidia-container-$VERSION.tar.gz || wget -nv $BEEHIVE
test -d libnvidia-container-$VERSION || tar -xf libnvidia-container-$VERSION.tar.gz
cd libnvidia-container-$VERSION
# remove "libnvidia-ngx.so" from the list of libs to be checked, focus on the basics now.
sed -i -e '/^\s\s*"libnvidia-ngx.so"/ s,"lib,//"lib,' src/nvc_info.c
# during the build some stuff gets downloaded, and the lsb_release command is required from within
# a make file, so give the people what they want ...
# (D. would not like what I would have liked to have written ...)
mkdir -p $PREFIX/bin
ln -sfv /usr/bin/chicken $PREFIX/bin/lsb_release
make install prefix=$PREFIX REVISION=mariux WITH_TIRPC=yes WITH_SECCOMP=no
cd $PREFIX/lib
ln -svf libnvidia-container.so.1.13.1 libnvidia-container.so.1
ln -svf libnvidia-container-go.so.1.13.1 libnvidia-container-go.so.1
rm -v $PREFIX/bin/lsb_release # and free the chicken again :)
)
(
VERSION=1.13.1
# orig: https://github.com/NVIDIA/nvidia-container-toolkit/archive/refs/tags/v1.13.1.tar.gz
BEEHIVE=https://beehive.molgen.mpg.de/4336b6fe833e1b52e24a3e157fb843b4/nvidia-container-toolkit-1.13.1.tar.gz
test -e nvidia-container-toolkit-$VERSION.tar.gz || wget -nv $BEEHIVE
test -d nvidia-container-toolkit-$VERSION || tar -xf nvidia-container-toolkit-$VERSION.tar.gz
cd nvidia-container-toolkit-$VERSION
mkdir -p bin
GO_LDFLAGS="-Wl,-z,lazy,${LDFLAGS}" \
GO111MODULE=auto \
GOPATH="$PWD/gopath" \
go build -v \
-modcacherw \
-buildmode=pie \
-gcflags "all=-trimpath=${PWD}" \
-asmflags "all=-trimpath=${PWD}" \
-ldflags "-s -w -extldflags=${GO_LDFLAGS/%,/}" \
-o bin \
"./..."
install -D -m755 "./bin/nvidia-container-runtime-hook" "$PREFIX/bin/nvidia-container-runtime-hook"
install -D -m755 "./bin/nvidia-ctk" "$PREFIX/bin/nvidia-ctk"
install -D -m644 "./config/config.toml.rpm-yum" "$PREFIX/etc/nvidia-container-runtime/config.toml"
install -D -m644 "./oci-nvidia-hook.json" "$PREFIX/share/containers/oci/hooks.d/00-oci-nvidia-hook.json"
install -D -m644 "./LICENSE" "$PREFIX/share/licenses/$PKG-$VERSION/LICENSE"
ln -vsf nvidia-container-runtime-hook $PREFIX/bin/nvidia-container-toolkit
)
# orig: https://github.com/hpc/charliecloud/releases/download/v0.32/charliecloud-0.32.tar.gz
BEEHIVE=https://beehive.molgen.mpg.de/d5a31bae85d99179dc2dd884e6ff5dd5/charliecloud-0.32.tar.gz
test -e charliecloud-$VERSION.tar.gz || wget --no-verbose $BEEHIVE
test -d charliecloud-$VERSION || tar -xf charliecloud-$VERSION.tar.gz
cd charliecloud-$VERSION
# an upcoming release of nextflow will make this one obsolete :/
# (basically reverting hpc/charliecloud#1536)
cat <<- PATCH | patch -p0 --verbose
--- bin/ch-run.c.dist 2023-03-14 20:43:52.000000000 +0100
+++ bin/ch-run.c 2023-05-17 14:07:58.825040328 +0200
@@ -58,2 +58,3 @@
{ "mount", 'm', "DIR", 0, "SquashFS mount point"},
+ { "no-home", -2, 0, 0, "(ignored)"},
{ "no-passwd", -9, 0, 0, "don't bind-mount /etc/{passwd,group}"},
@@ -387,2 +388,4 @@
switch (key) {
+ case -2: // --no-home, a noop.
+ break;
case -3: // --join-ct
PATCH
./configure --prefix=$PREFIX
nice -12 make -j $(( $(nproc) * 4 / 5 + 1 ))
make install
exit