summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9b81f7ea723d30f47dd043469912da935c69c768 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Maintainer: Alexis Williams <alexis@typedr.at>
pkgname=frink-lang-bin
pkgver=20240227
pkgrel=2
pkgdesc="A practical calculating tool and programming language."
arch=('any')
url="https://frinklang.org/"
license=('unknown')
depends=('bash' 'java-runtime')
makedepends=('awk' 'imagemagick' 'unzip')
optdepends=('rlwrap: readline support for the command-line shell')
source=(
	"$pkgname.jar::https://frinklang.org/frinkjar/frink.jar"
	"$pkgname-unitnames.txt::https://frinklang.org/frinkjar/unitnames.txt"
	"$pkgname-functionnames.txt::https://frinklang.org/frinkjar/functionnames.txt"
)
noextract=("${source[@]%%::*}")
sha256sums=(
	'SKIP'
	'SKIP'
	'SKIP'
)

pkgver() {
	unzip -l "$srcdir/$pkgname.jar" | awk '/META-INF\/MANIFEST.MF/ { gsub("-",""); print $2 }';
}

build() {
	unzip -p "$srcdir/$pkgname.jar" "data/icon.gif" > "$srcdir/$pkgname-icon.gif"
	convert "$srcdir/$pkgname-icon.gif" -interpolate Nearest -filter point -resize '512x512' "$srcdir/$pkgname-icon.png"
}

package() {


	mkdir -p "$pkgdir/usr/share/java/frink/";
	cp "$srcdir/$pkgname.jar" "$pkgdir/usr/share/java/frink/frink.jar";

	mkdir -p "$pkgdir/usr/share/frink/";
	cp "$srcdir/$pkgname-unitnames.txt" "$pkgdir/usr/share/frink/unitnames.txt";
	cp "$srcdir/$pkgname-functionnames.txt" "$pkgdir/usr/share/frink/functionnames.txt";

	mkdir -p "$pkgdir/usr/bin/"
	cat > "$pkgdir/usr/bin/frink" << 'EOF'
#!/bin/bash
CP=/usr/share/java/frink/frink.jar

rlwrap=$(command -v rlwrap)
rlwrap_args=""
if [ -n "${rlwrap}" ] 
then
	rlwrap_args="-f /usr/share/frink/unitnames.txt -b '$' -f /usr/share/frink/functionnames.txt"
fi

java_opts=(
	"-Dawt.useSystemAAFontSettings=on"
	"-Dswing.aatext=true"
	"-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
	"-Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
)

exec $rlwrap $rlwrap_args /usr/bin/java ${java_opts[*]} -cp $CP frink.gui.FrinkStarter "$@"
EOF
	chmod a+x "$pkgdir/usr/bin/frink"

	mkdir -p "$pkgdir/usr/share/icons/"
	cp "$srcdir/$pkgname-icon.png" "$pkgdir/usr/share/icons/frink.png"

	mkdir -p "$pkgdir/usr/share/applications/"
	cat > "$pkgdir/usr/share/applications/frink.desktop" << 'EOF'
[Desktop Entry]
Type=Application
Version=1.0
Name=Frink
Comment=A practical calculating tool and programming language.
Exec=frink --gui
Icon=frink
Terminal=false
Categories=Utility;Science;Math;Calculator;Java
EOF
}