125 lines
3.6 KiB
Bash
Executable file
125 lines
3.6 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# variables
|
|
VERSION=${VERSION:-latest}
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=gwh
|
|
TMP=/tmp/$TAG
|
|
CWD=$(pwd)
|
|
|
|
PRGNAM=$(basename "$CWD")
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
ARCH=${ARCH:-$(uname -m)}
|
|
|
|
REPOSITORY=${REPOSITORY:-/var/cache/SlackBuilds.gwh/$PRGNAM}
|
|
PREFIX=${PREFIX:-/usr}
|
|
|
|
# nettoyage préalable
|
|
rm -fr "$PKG" "${TMP:?}/$PRGNAM"
|
|
|
|
mkdir -p "$PKG"
|
|
|
|
# mise en place
|
|
cd "$TMP" || exit 1
|
|
[ ! -e "$REPOSITORY" ] && git clone https://github.com/aristocratos/btop.git "$REPOSITORY"
|
|
cd "$REPOSITORY" || exit 1
|
|
git pull --all
|
|
|
|
cp -R "$REPOSITORY" "$TMP"/
|
|
|
|
cd "$TMP/$PRGNAM/" || exit 1
|
|
case $VERSION in
|
|
trunk)
|
|
# PKGVERSION="git_r$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
|
|
PKGVERSION="r$(git rev-list --count HEAD)_$(git log -1 --format=%h)"
|
|
;;
|
|
latest)
|
|
PKGVERSION=$(git tag --sort=-version:refname | head -n1)
|
|
git checkout "$PKGVERSION"
|
|
;;
|
|
*)
|
|
PKGVERSION=$VERSION
|
|
git checkout "$PKGVERSION"
|
|
;;
|
|
esac
|
|
PKGNAM=${PRGNAM}
|
|
|
|
######################
|
|
# EMBED DEPENDENCIES #
|
|
######################
|
|
# rocm_smi_lib
|
|
EMBED_ROCM_SMI_LIB=${EMBED_ROCM_SMI_LIB:-"yes"}
|
|
if [ "$EMBED_ROCM_SMI_LIB" = "yes" ]; then
|
|
ROCM_SMI_LIB_VERSION=${ROCM_SMI_LIB_VERSION:-$VERSION}
|
|
ROCM_SMI_LIB_REPOSITORY=/var/cache/SlackBuilds.gwh/rocm_smi_lib
|
|
[ ! -e "$ROCM_SMI_LIB_REPOSITORY" ] && git clone https://github.com/rocm/rocm_smi_lib.git "$ROCM_SMI_LIB_REPOSITORY"
|
|
cd "$ROCM_SMI_LIB_REPOSITORY" || exit 1
|
|
git reset --hard HEAD
|
|
git pull --all
|
|
|
|
mkdir -p "$TMP/$PRGNAM"/lib/
|
|
cp -a "$ROCM_SMI_LIB_REPOSITORY" "$TMP/$PRGNAM"/lib/rocm_smi_lib
|
|
cd "$TMP/$PRGNAM"/lib/rocm_smi_lib || exit 1
|
|
case $ROCM_SMI_LIB_VERSION in
|
|
trunk)
|
|
# ROCM_SMI_LIB_VERSION="git_r$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
|
|
ROCM_SMI_LIB_VERSION="r$(git rev-list --count HEAD)_$(git log -1 --format=%h)"
|
|
;;
|
|
latest)
|
|
ROCM_SMI_LIB_VERSION=$(git tag --sort=-version:refname | head -n1)
|
|
git checkout "$ROCM_SMI_LIB_VERSION"
|
|
;;
|
|
*)
|
|
git checkout "$ROCM_SMI_LIB_VERSION"
|
|
;;
|
|
esac
|
|
PKGNAM="${PKGNAM}+rocm_smi_lib"
|
|
PKGVERSION="${PKGVERSION}+${ROCM_SMI_LIB_VERSION}"
|
|
fi
|
|
|
|
cd "$TMP/$PRGNAM/" || exit 1
|
|
make DESTDIR="$PKG" PREFIX=/usr RSMI_STATIC=true
|
|
make install DESTDIR="$PKG" PREFIX=/usr RSMI_STATIC=true
|
|
mv "$PKG$PREFIX"/share/man "$PKG$PREFIX/"
|
|
|
|
# move doc/ to the appropriate location
|
|
mkdir -p "$PKG$PREFIX/doc/$PRGNAM"
|
|
cp LICENSE ./*.md "$PKG$PREFIX/doc/$PRGNAM"
|
|
|
|
# correction
|
|
cd "$PKG" || exit 1
|
|
chown -R root:root ./*
|
|
|
|
[ -d "$PKG$PREFIX/man" ] && find "$PKG$PREFIX/man" -type f -exec gzip -9 {} \;
|
|
|
|
# embaumement
|
|
mkdir -p "$PKG/install"
|
|
|
|
cat <<EOF > "$PKG/install/slack-desc"
|
|
# HOW TO EDIT THIS FILE:
|
|
# The "handy ruler" below makes it easier to edit a package description. Line
|
|
# up the first '|' above the ':' following the base package name, and the '|'
|
|
# on the right side marks the last column you can put a character in. You must
|
|
# make exactly 11 lines for the formatting to be correct. It's also
|
|
# customary to leave one space after the ':'.
|
|
|
|
|-----handy-ruler------------------------------------------------------|
|
|
$PRGNAM: $PRGNAM ( A monitor of resources )
|
|
$PRGNAM:
|
|
$PRGNAM: Resource monitor that shows usage and stats for processor, memory,
|
|
$PRGNAM: disks, network and processes.
|
|
$PRGNAM:
|
|
$PRGNAM: C++ version and continuation of bashtop and bpytop.
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM: https://github.com/aristocratos/btop
|
|
$PRGNAM:
|
|
EOF
|
|
|
|
# empaquetage
|
|
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
|
|
/sbin/makepkg --linkadd y --chown n --prepend "$OUTPUT/$PKGNAM-$PKGVERSION-$ARCH-$BUILD$TAG.txz"
|