2024-05-21 16:51:37 +02:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# variables
|
|
|
|
|
TAG=gwh
|
|
|
|
|
TMP=/tmp/$TAG
|
|
|
|
|
CWD=$(pwd)
|
|
|
|
|
OUTPUT=/tmp
|
|
|
|
|
|
|
|
|
|
PRGNAM=$(basename "$CWD")
|
|
|
|
|
GITHUB_REPO=kovidgoyal/kitty
|
|
|
|
|
VERSION=${VERSION:-latest}
|
|
|
|
|
|
|
|
|
|
ARCH=$(uname -m)
|
2024-05-27 09:44:03 +02:00
|
|
|
|
BUILD=2
|
2024-05-21 16:51:37 +02:00
|
|
|
|
|
|
|
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
|
|
|
|
|
|
|
|
REPOSITORY=/home/installs/SlackBuilds/_repositories/$PRGNAM
|
|
|
|
|
|
|
|
|
|
LIBDIRSUFFIX=$(uname -m | grep -o 64)
|
|
|
|
|
|
|
|
|
|
if [ "$ARCH" = "i586" ]; then
|
|
|
|
|
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
|
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
|
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
|
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
|
|
|
|
LIBDIRSUFFIX="64"
|
|
|
|
|
else
|
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# nettoyage pr<70>alable
|
|
|
|
|
rm -fr "$PKG" "${TMP:?}"/"$PRGNAM"
|
|
|
|
|
|
|
|
|
|
mkdir -p "$PKG"
|
|
|
|
|
|
|
|
|
|
# mise en place
|
|
|
|
|
[ ! -e "$REPOSITORY" ] && git clone https://github.com/${GITHUB_REPO}.git "$REPOSITORY"
|
|
|
|
|
cd "$REPOSITORY" || exit 1
|
|
|
|
|
git pull --all
|
|
|
|
|
|
|
|
|
|
cp -R "$REPOSITORY" "$TMP"/"$PRGNAM"
|
|
|
|
|
cd "$TMP"/"$PRGNAM"/ || exit 1
|
2024-05-27 07:53:51 +02:00
|
|
|
|
[ "$VERSION" == "latest" ] && VERSION=$(git tag --sort=-version:refname | head -n1)
|
2024-05-21 16:51:37 +02:00
|
|
|
|
[ "$VERSION" == "" ] && VERSION=trunk
|
2024-05-27 09:44:03 +02:00
|
|
|
|
if [ "$VERSION" == "trunk" ]; then
|
|
|
|
|
VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)"
|
|
|
|
|
else
|
|
|
|
|
git checkout "$VERSION"
|
|
|
|
|
fi
|
2024-05-21 16:51:37 +02:00
|
|
|
|
|
|
|
|
|
# installation
|
|
|
|
|
mkdir -p "$PKG"/
|
|
|
|
|
|
|
|
|
|
# sed surgery: setup.py allows overriding the compiler flags, but
|
|
|
|
|
# puts a -O3 *after* whatever we set them to. All our SLKCFLAGS
|
|
|
|
|
# choices have -O2.
|
|
|
|
|
sed -i 's,-O3,-O2,g' setup.py
|
|
|
|
|
|
|
|
|
|
OVERRIDE_CPPFLAGS="$SLKCFLAGS -Wl,-s" \
|
|
|
|
|
OVERRIDE_CFLAGS="$SLKCFLAGS -Wl,-s" \
|
|
|
|
|
python3 setup.py \
|
|
|
|
|
--libdir-name "lib$LIBDIRSUFFIX" \
|
|
|
|
|
--verbose linux-package \
|
|
|
|
|
--ignore-compiler-warnings
|
|
|
|
|
|
|
|
|
|
mkdir -p "$PKG"/usr/bin "$PKG"/usr/share "$PKG/usr/lib$LIBDIRSUFFIX"
|
|
|
|
|
cp -a linux-package/bin/* "$PKG"/usr/bin
|
|
|
|
|
cp -a linux-package/share/* "$PKG"/usr/share
|
|
|
|
|
cp -a linux-package/lib*/* "$PKG/usr/lib$LIBDIRSUFFIX"
|
|
|
|
|
strip "$PKG"/usr/bin/"$PRGNAM"
|
|
|
|
|
|
2024-05-27 09:44:03 +02:00
|
|
|
|
mkdir -p "$PKG$PREFIX"/share/bash-completion/completions
|
|
|
|
|
cp extra/completions/alacritty.bash "$PKG$PREFIX"/share/bash-completion/completions/alacritty
|
|
|
|
|
|
|
|
|
|
mkdir -p "$PKG$PREFIX"/share/zsh/site-functions
|
|
|
|
|
cp "$PKG/usr/lib$LIBDIRSUFFIX"/kitty/shell-integration/zsh/completions/_kitty "$PKG$PREFIX"/share/zsh/site-functions/
|
2024-05-21 16:51:37 +02:00
|
|
|
|
|
|
|
|
|
mkdir -p "$PKG"/usr/doc/"$PRGNAM"
|
|
|
|
|
cp -R ./*.md ./*.rst LICENSE "$PKG"/usr/doc/"$PRGNAM"
|
|
|
|
|
|
|
|
|
|
# correction
|
|
|
|
|
cd "$PKG" || exit 1
|
|
|
|
|
chown -R root:root ./*
|
|
|
|
|
|
|
|
|
|
# embaumement
|
|
|
|
|
mkdir -p "$PKG"/install
|
|
|
|
|
|
|
|
|
|
cat <<EOF > "$PKG"/install/slack-desc
|
2024-05-27 09:44:03 +02:00
|
|
|
|
$PRGNAM: $PRGNAM (The fast, feature-rich, GPU based terminal emulator)
|
2024-05-21 16:51:37 +02:00
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM: https://sw.kovidgoyal.net/kitty/
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
# empaquetage
|
|
|
|
|
cd "$PKG" || exit 1
|
|
|
|
|
rm -f "$PKG"/{,usr/}lib"$LIBDIRSUFFIX"/*.la
|
|
|
|
|
/sbin/makepkg --linkadd y --chown n --prepend "$OUTPUT/$PRGNAM-${VERSION//-//}-$ARCH-$BUILD$TAG.txz"
|