summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authoran9wer2020-05-18 17:12:43 +0800
committeran9wer2020-05-18 17:12:43 +0800
commit153723269029a0704e22a391127ed814a5b6d526 (patch)
tree139e5f7ceae70e8403082aa5e2af833a38a03467
downloadaur-153723269029a0704e22a391127ed814a5b6d526.tar.gz
[0.1.0-1] Add rebuild for st
-rw-r--r--.SRCINFO12
-rw-r--r--PKGBUILD15
-rwxr-xr-xsuckless-rebuild51
3 files changed, 78 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..cc5849b455b3
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,12 @@
+pkgbase = an9wer-suckless-rebuild
+ pkgdesc = A script to rebuild suckless tools
+ pkgver = 0.1.0
+ pkgrel = 1
+ url = https://github.com/an9wer/pkg/tree/master/arch/suckless-rebuild
+ arch = x86_64
+ license = MIT
+ source = suckless-rebuild
+ md5sums = 52dd209ab552f2134dc129d5860eda91
+
+pkgname = an9wer-suckless-rebuild
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..619bb687e68f
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,15 @@
+# Maintainer: Runney Wu <an9wer@gmail.com>
+
+pkgname=an9wer-suckless-rebuild
+pkgver=0.1.0
+pkgrel=1
+pkgdesc="A script to rebuild suckless tools"
+url="https://github.com/an9wer/pkg/tree/master/arch/suckless-rebuild"
+arch=('x86_64')
+license=('MIT')
+source=("suckless-rebuild")
+md5sums=('52dd209ab552f2134dc129d5860eda91')
+
+package() {
+ install -m755 -D suckless-rebuild "$pkgdir/usr/bin/suckless-rebuild"
+}
diff --git a/suckless-rebuild b/suckless-rebuild
new file mode 100755
index 000000000000..213a9a743aeb
--- /dev/null
+++ b/suckless-rebuild
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+
+DESTDIR=~/.suckless
+BUILDDIR=~/.suckless-build
+
+usage() {
+ echo "Usage: suckless-rebuild st <config.h>"
+ exit 1
+}
+
+if [[ ${#@} != 2 || $1 =~ ^-h$|^--help$ || $2 =~ ^-h$|^--help$ ]]; then
+ echo "Usage: suckless-rebuild st <config.h>"
+ exit 1
+fi
+
+tool=$1
+config=$2
+
+if [[ ! $tool =~ ^st$ ]]; then
+ echo "Unknown suckless tool '$tool'."
+ exit 1
+fi
+if [[ ! -d /usr/src/$tool ]]; then
+ echo "'an9wer-$tool' may not be installed."
+ exit 1
+fi
+if [[ ! -f $config ]]; then
+ echo "'$config' is not a regular file."
+ exit 1
+fi
+
+if [[ -e $BUILDDIR/$tool ]]; then
+ temp=$(mktemp -u -d /tmp/$tool.XXXXX)
+ mv "$BUILDDIR/$tool" "$temp"
+fi
+
+mkdir -p "$BUILDDIR"
+cp -r /usr/src/st "$BUILDDIR/$tool"
+cp -f "$config" "$BUILDDIR/$tool"
+
+cd "$BUILDDIR/$tool"
+if make &> build.log && make PREFIX="$DESTDIR" install &> build.log; then
+ echo "Done! Recommend to add '~/.suckless/bin' to \$PATH to use new builded st."
+else
+ echo "Some error occurred, check '$BUILDDIR/$tool/build.log' to find more."
+fi
+if [[ -v temp ]]; then
+ sed -i "1i The last built directory was moved to $temp\n" build.log
+fi
+
+# vim: set filetype=sh: