1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
#!/bin/bash
# Copyright (c) Contributors to the Apptainer project, established as
# Apptainer a Series of LF Projects LLC.
# For website terms of use, trademark policy, privacy policy and other
# project policies see https://lfprojects.org/policies
#
# Compile dependencies. The source tarballs and patches should be in the
# directory passed in as $1, default "."
if [ -n "$2" ] || [[ "$1" = -* ]]; then
echo "Usage: $0 [sourcedir]" >&2
echo "The default sourcedir is '.'" >&2
exit 2
fi
SRC=$PWD
if [ -n "$1" ]; then
SRC="$(cd $1;pwd)"
fi
set -ex
for PKG in squashfs-tools squashfuse e2fsprogs fuse-overlayfs gocryptfs; do
TGZ="$(echo $SRC/${PKG}-*.tar.gz)"
if [ ! -f "$TGZ" ]; then
echo "$PKG-*.tar.gz not found in $SRC" >&2
exit 1
fi
DIR=${TGZ%.tar.gz}
DIR=${DIR/*\//}
rm -rf "$DIR"
tar -xf $TGZ
cd $DIR
for PATCH in $(echo $SRC/$PKG-*.patch); do
if [ -f "$PATCH" ]; then
patch -p1 <$PATCH
fi
done
case "$PKG" in
squashfs-tools)
make -C squashfs-tools mksquashfs unsquashfs GZIP_SUPPORT=1 \
LZO_SUPPORT=1 LZ4_SUPPORT=1 XZ_SUPPORT=1 ZSTD_SUPPORT=1
;;
squashfuse)
./autogen.sh
FLAGS=-std=c99 ./configure --enable-multithreading
make squashfuse_ll
;;
e2fsprogs)
./configure
make libs && make -C misc fuse2fs
mv misc/fuse2fs .
;;
fuse-overlayfs)
./autogen.sh
./configure
make
;;
gocryptfs)
VER=${DIR/*-/}
echo "v$VER" >VERSION
# Don't hardcode the amd64 microarchitecture
sed -e '/GOAMD64.*v2/d' -i.orig build.bash
# GOPROXY=off makes sure we fail instead of making network requests
# the -B ldflags prevent rpm complaints about "No build ID note found"
CGO_ENABLED=0 GOPROXY=off ./build.bash \
-mod=vendor -tags without_openssl \
-buildvcs=false -ldflags="-X main.GitVersion=v$VER \
-B 0x`head -c20 /dev/urandom|od -An -tx1|tr -d ' \n'`"
;;
*)
echo "unrecognized package $PKG" >&2
exit 1
;;
esac
cd ..
done
|