summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiavash Askari Nasr2021-06-22 22:23:22 +0430
committerSiavash Askari Nasr2021-06-22 22:23:22 +0430
commitf0b8e63200f1eaa51fb3a8485418ac348f79239a (patch)
tree32694c7b30065994550bd523b8d556d1b1d1f329
downloadaur-f0b8e63200f1eaa51fb3a8485418ac348f79239a.tar.gz
Make chroma-bin 0.9.2
-rw-r--r--.SRCINFO15
-rw-r--r--.gitignore1
-rw-r--r--PKGBUILD19
-rwxr-xr-xprepare_pkg.raku33
4 files changed, 68 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..420c861f5b43
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,15 @@
+pkgbase = chroma-bin
+ pkgdesc = A general purpose syntax highlighter in pure Go
+ pkgver = 0.9.2
+ pkgrel = 1
+ url = https://github.com/alecthomas/chroma
+ arch = x86_64
+ arch = i686
+ license = MIT
+ provides = chroma
+ source_x86_64 = chroma-bin-0.9.2.tar.gz::https://github.com/alecthomas/chroma/releases/download/v0.9.2/chroma-0.9.2-linux-amd64.tar.gz
+ sha256sums_x86_64 = c2bfe8654c48e26acbec5e00511911c9455e7339372529be009636769e615f4b
+ source_i686 = chroma-bin-0.9.2.tar.gz::https://github.com/alecthomas/chroma/releases/download/v0.9.2/chroma-0.9.2-linux-386.tar.gz
+ sha256sums_i686 = 0e82a6fc14660cc7770b2a97f3481e7088cec8771e96e23be35831fceee15122
+
+pkgname = chroma-bin
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..f59ec20aabf5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+* \ No newline at end of file
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..d04e920268f4
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,19 @@
+# Maintainer: Siavash Askari Nasr <ciavash@protonmail.com>
+pkgname=chroma-bin
+pkgver=0.9.2
+pkgrel=1
+pkgdesc="A general purpose syntax highlighter in pure Go"
+arch=('x86_64' 'i686')
+url='https://github.com/alecthomas/chroma'
+license=(MIT)
+provides=("${pkgname%-bin}")
+source_x86_64=("$pkgname-$pkgver.tar.gz::$url/releases/download/v$pkgver/${pkgname%-bin}-$pkgver-linux-amd64.tar.gz")
+source_i686=("$pkgname-$pkgver.tar.gz::$url/releases/download/v$pkgver/${pkgname%-bin}-$pkgver-linux-386.tar.gz")
+sha256sums_x86_64=('c2bfe8654c48e26acbec5e00511911c9455e7339372529be009636769e615f4b')
+sha256sums_i686=('0e82a6fc14660cc7770b2a97f3481e7088cec8771e96e23be35831fceee15122')
+
+package() {
+ install -Dm755 "${pkgname%-bin}" -t "${pkgdir}/usr/bin"
+ install -Dm644 README.md -t "${pkgdir}/usr/share/doc/${pkgname%-bin}"
+ install -Dm644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname%-bin}"
+}
diff --git a/prepare_pkg.raku b/prepare_pkg.raku
new file mode 100755
index 000000000000..1c50d7f9c50b
--- /dev/null
+++ b/prepare_pkg.raku
@@ -0,0 +1,33 @@
+#!/usr/bin/env raku
+
+my $pkgver := '0.9.2';
+
+put 'Downloading checksums file.';
+
+my $p := run «wget -q -O -
+ "https://github.com/alecthomas/chroma/releases/download/v$pkgver/chroma-{$pkgver}-checksums.txt"»,
+ :out;
+
+my %checksums = $p.out.lines.grep(/linux/).split(/\s+/).hash.antipairs;
+
+my $PKGBUILD_file := 'PKGBUILD'.IO;
+
+my $PKGBUILD = $PKGBUILD_file.slurp;
+
+# Set package version
+$PKGBUILD ~~ s/<?after ^^'pkgver='>\N+/$pkgver/;
+
+# Set package checksums
+for %checksums.kv -> $linux, $checksum {
+ $PKGBUILD ~~ s/<?after ^^ 'sha256sums_x86_64='> \N+/('$checksum')/ if $linux ~~ /amd64/;
+ $PKGBUILD ~~ s/<?after ^^ 'sha256sums_i686='> \N+/('$checksum')/ if $linux ~~ /386/;
+}
+
+put 'Writing to PKGBUILD.';
+$PKGBUILD_file.spurt: $PKGBUILD;
+
+put 'Writing to .SRCINFO';
+run <makepkg --printsrcinfo>, :out('.SRCINFO'.IO.open: :w);
+
+put 'Running makepkg --install';
+run <makepkg --install>;