fixed the download package
[slackbuilds.git] / senpai / senpai.SlackBuild
blob1b22fddc475506a0db0698af42a4b722872b0ce2
1 #!/bin/bash
3 # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
4 # Version 2, December 2004
6 # Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
8 # Everyone is permitted to copy and distribute verbatim or modified
9 # copies of this license document, and changing it is allowed as long
10 # as the name is changed.
12 # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
13 # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
16 # 0. You just DO WHAT THE FUCK YOU WANT TO.
18 # SlackBuild script for senpai
19 # =============================
20 # By: r1w1s1@disroot.org
21 # For: senpai
22 # Descr: Your everyday IRC student
23 # URL: https://git.sr.ht/~delthas/senpai
24 # Changelog:
25 # v0.03.0: 01/August/2024 by r1w1s1 - Initial build.
27 cd $(dirname $0) ; CWD=$(pwd)
29 PRGNAM=senpai
30 VERSION=${VERSION:-0.3.0}
31 BUILD=${BUILD:-1}
32 TAG=${TAG:-_SBo}
33 ARCH=${ARCH:-x86_64}
35 TMP=${TMP:-/tmp/SBo}
36 PKG=${TMP}/package-${PRGNAM}
37 PKGTYPE=${PKGTYPE:-tgz}
38 OUTPUT=${OUTPUT:-/tmp}
40 # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
41 # the name of the created package would be, and then exit. This information
42 # could be useful to other scripts.
43 if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
44 echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
45 exit 0
48 # Clean up any previous build artifacts
49 rm -rf "$PKG"
50 mkdir -p "$TMP" "$PKG" "$OUTPUT"
51 cd "$TMP"
53 # Download and extract the source code
54 rm -rf "${PRGNAM}-${VERSION}"
55 wget -O "${PRGNAM}-v${VERSION}.tar.gz" "https://git.sr.ht/~delthas/senpai/archive/v${VERSION}.tar.gz"
56 tar xvf "${PRGNAM}-v${VERSION}.tar.gz"
57 cd "${PRGNAM}-v${VERSION}"
59 # Compile the source
60 mkdir -p "$TMP/go-cache" "$TMP/go-tmpdir" "$TMP/go"
61 export GOCACHE="${GOCACHE:-"$TMP/go-cache"}"
62 export GOTMPDIR="${GOTMPDIR:-"$TMP/go-tmpdir"}"
63 export GOMODCACHE="${GOMODCACHE:-"$TMP/go"}"
64 export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
65 export SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}"
67 make PREFIX=/usr || exit 1
69 # Install the compiled binaries to the package directory
70 make install PREFIX=/usr DESTDIR="$PKG" || exit 1
72 # Copy documentation
73 mkdir -p "$PKG/usr/doc/${PRGNAM}-${VERSION}"
74 cp -a README.md LICENSE \
75 "$PKG/usr/doc/${PRGNAM}-${VERSION}"
77 # Compress man pages and fix symlinks
78 find "$PKG/usr/share/man" -type f -exec gzip -9 {} \;
79 for i in $(find "$PKG/usr/share/man" -type l); do
80 ln -s "$(readlink "$i").gz" "$i.gz"
81 rm "$i"
82 done
84 # Copy the SlackBuild script into the package documentation
85 cat "$CWD/${PRGNAM}.SlackBuild" > "$PKG/usr/doc/${PRGNAM}-${VERSION}/${PRGNAM}.SlackBuild"
87 # Copy the slack-desc file
88 mkdir -p "$PKG/install"
89 cat "$CWD/slack-desc" > "$PKG/install/slack-desc"
91 # Create the package
92 cd "$PKG"
93 /sbin/makepkg -l y -c n "$OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE}"
95 # Generate MD5 checksum
96 cd "$OUTPUT"
97 md5sum "${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE}" > "${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE}.md5"