slackbuilds/ap/ncdu/SlackBuild
2024-05-27 07:53:51 +02:00

78 lines
2.4 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# variables
VERSION=${VERSION:-latest}
BUILD=2
TAG=gwh
OUTPUT=/tmp
TMP=/tmp/$TAG
CWD=$(pwd)
PRGNAM=$(basename "$CWD")
PKG=$TMP/pkg-$PRGNAM
ARCH=$(uname -m)
REPOSITORY=/home/installs/SlackBuilds/_repositories/$PRGNAM
PREFIX=/usr
# nettoyage préalable
rm -fr "$PKG" "${TMP:?}/$PRGNAM"
mkdir -p "$PKG"
# mise en place
[ ! -e "$REPOSITORY" ] && git clone https://code.blicky.net/yorhel/ncdu.git --recursive "$REPOSITORY"
cd "$REPOSITORY" || exit 1
git pull --all
git submodule update
cp -R "$REPOSITORY" $TMP/
cd "$TMP/$PRGNAM/" || exit 1
[ "$VERSION" == "latest" ] && VERSION=$(git tag --sort=-version:refname | head -n1)
[ "$VERSION" == "" ] && VERSION=trunk
[ "$VERSION" == "trunk" ] && VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)" || git checkout "$VERSION"
#zig build -Drelease-safe --prefix "$PKG$PREFIX" install
#make ZIG_FLAGS=" --release=safe " #"fast -fno-sanitize=undefined "
make install PREFIX="$PKG$PREFIX" MANDIR="$PKG$PREFIX"/man/man1 ZIG_FLAGS=" --release=safe "
mkdir -p "$PKG$PREFIX/doc/$PRGNAM"
cp -a LICENSES/ ChangeLog ./*.md "$PKG$PREFIX/doc/$PRGNAM/"
# correction
cd "$PKG" || exit 1
chown -R root:root ./*
[ -d "$PKG$PREFIX/man" ] && find "$PKG$PREFIX/man" -name "*.?" -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 (NCurses Disk Usage)
$PRGNAM:
$PRGNAM: Ncdu is a disk usage analyzer with an ncurses interface. It is
$PRGNAM: designed to find space hogs on a remote server where you dont have
$PRGNAM: an entire graphical setup available, but it is a useful tool even on
$PRGNAM: regular desktop systems. Ncdu aims to be fast, simple and easy to
$PRGNAM: use, and should be able to run in any minimal POSIX-like environment
$PRGNAM: with ncurses installed.
$PRGNAM:
$PRGNAM:
$PRGNAM: https://dev.yorhel.nl/ncdu
EOF
# empaquetage
rm -f "$PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la"
/sbin/makepkg --linkadd y --chown n --prepend "$OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz"