1# Maintainer: Gabriel Arakaki Giovanini <mail@gabrielgio.me>
2pkgname=firefly3
3pkgver=5.7.18
4pkgrel=4
5pkgdesc="A free and open source personal finance manager"
6url="https://firefly-iii.org"
7arch="noarch"
8license="AGPL-3.0-only"
9_php=php81
10_php_mods="
11 -curl
12 -zip
13 -sodium
14 -gd
15 -xml
16 -mbstring
17 -bcmath
18 -fileinfo
19 -session
20 -tokenizer
21 -xmlwriter
22 -dom
23 -shmop
24"
25depends="$_php ${_php_mods//-/$_php-}"
26_php_makemods="
27 -intl
28 -pdo
29 -simplexml
30"
31makedepends="$_php ${_php_makemods//-/$_php-} composer"
32subpackages="
33 $pkgname-nginx:_nginx:noarch
34 $pkgname-mysql:_mysql
35 $pkgname-psql:_psql
36 $pkgname-sqlite:_sqlite
37"
38install="
39 $pkgname.pre-install
40 $pkgname.post-install
41"
42source="
43 ${pkgname}-${pkgver}.tar.gz::https://github.com/firefly-iii/firefly-iii/archive/refs/tags/$pkgver.tar.gz
44 $pkgname-env
45"
46options="!check" # no clue how to run test on this
47builddir="$srcdir/firefly-iii-$pkgver/"
48
49package() {
50 local wwwdir="usr/share/webapps/$pkgname"
51 local confdir="etc/$pkgname"
52 local lib="var/lib/$pkgname"
53 local log="var/log/$pkgname"
54
55 install -d -m 770 -o firefly -g firefly "$pkgdir/$confdir"
56 install -d -m 770 -o firefly -g firefly "$pkgdir/$lib"
57 install -d -m 770 -o firefly -g firefly "$pkgdir/$log"
58
59 mkdir -p "$pkgdir"
60 cd "$pkgdir"
61
62 mkdir -p ./${wwwdir%/*}
63 mkdir -p ./"$lib"/upload
64 mkdir -p ./"$lib"/database
65 cp -a "$builddir" ./$wwwdir
66
67 chmod +x ./$wwwdir/artisan
68
69 cd ./$wwwdir
70 composer install --prefer-dist --no-dev --no-scripts
71 cd ..
72
73 install -m 660 \
74 "$srcdir"/$pkgname-env "$pkgdir"/$confdir/env
75
76 ln -s /$confdir/env "$pkgdir"/$wwwdir/.env
77
78 rm -r "$pkgdir"/$wwwdir/storage/database
79 ln -s /"$lib"/database "$pkgdir"/$wwwdir/storage/
80
81 rm -r "$pkgdir"/$wwwdir/storage/upload
82 ln -s /"$lib"/upload "$pkgdir"/$wwwdir/storage/
83
84 ln -s /"$lib"/oauth-private.key "$pkgdir"/$wwwdir/storage/oauth-private.key
85 ln -s /"$lib"/oauth-public.key "$pkgdir"/$wwwdir/storage/oauth-public.key
86
87 rm -r "$pkgdir"/$wwwdir/storage/logs
88 ln -T -s /"$log"/ "$pkgdir"/$wwwdir/storage/logs
89
90 chown -R firefly:firefly "$pkgdir"/$wwwdir/
91 chown -R firefly:firefly "$pkgdir/$lib"
92}
93
94_mysql() {
95 depends="firefly3 php81-pdo_mysql"
96 pkgdesc="Mysql dependencies for $pkgname"
97 mkdir -p "$subpkgdir"
98}
99
100_psql() {
101 depends=" firefly3 php81-pdo_pgsql php81-pgsql"
102 pkgdesc="Postgresql dependencies for $pkgname"
103 mkdir -p "$subpkgdir"
104}
105
106_sqlite() {
107 depends="firefly3 php81-pdo_sqlite"
108 pkgdesc="Sqlite dependencies for $pkgname"
109 mkdir -p "$subpkgdir"
110}
111
112
113sha512sums="
1144febc482056d1c635fb674b001442dcaa6d331ce3906aeeac80497b42b38fa1e2393e6b2a0d76da884db15d000c4364d299a11e4d28b2b6ebdeba8fae638a413 firefly3-5.7.18.tar.gz
115b778a4113b8d4d3465a5f80a72fe04497d68d718751e2b0ee43fdbd4379b6278bdff74c68e095668f03ef3a9969de41d734cb4f7e27fb26f1a4342f0c9e0f57e firefly3-env
116"