1# Maintainer: Gabriel Arakaki Giovanini <mail@gabrielgio.me>
2pkgname=firefly3
3pkgver=5.7.18
4pkgrel=1
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-mysql:_mysql
34 $pkgname-psql:_psql
35 $pkgname-sqlite:_sqlite
36"
37install="
38 $pkgname.pre-install
39 $pkgname.post-install
40"
41source="
42 ${pkgname}-${pkgver}.tar.gz::https://github.com/firefly-iii/firefly-iii/archive/refs/tags/$pkgver.tar.gz
43 $pkgname-env
44"
45options="!check" # no clue how to run test on this
46builddir="$srcdir/firefly-iii-$pkgver/"
47
48package() {
49 local wwwdir="usr/share/webapps/$pkgname"
50 local confdir="etc/$pkgname"
51 local lib="var/lib/$pkgname"
52 local log="var/log/$pkgname"
53
54 mkdir -p "$pkgdir"
55 mkdir -p "$pkgdir/$confdir"
56 mkdir -p "$pkgdir/$lib"
57 mkdir -p "$pkgdir/$log"
58
59 cd "$pkgdir"
60
61 mkdir -p ./${wwwdir%/*}
62 mkdir -p ./"$lib"/upload
63 mkdir -p ./"$lib"/database
64
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
91_mysql() {
92 depends="firefly3 php81-pdo_mysql"
93 pkgdesc="Mysql dependencies for $pkgname"
94 mkdir -p "$subpkgdir"
95}
96
97_psql() {
98 depends=" firefly3 php81-pdo_pgsql php81-pgsql"
99 pkgdesc="Postgresql dependencies for $pkgname"
100 mkdir -p "$subpkgdir"
101}
102
103_sqlite() {
104 depends="firefly3 php81-pdo_sqlite"
105 pkgdesc="Sqlite dependencies for $pkgname"
106 mkdir -p "$subpkgdir"
107}
108
109
110sha512sums="
1114febc482056d1c635fb674b001442dcaa6d331ce3906aeeac80497b42b38fa1e2393e6b2a0d76da884db15d000c4364d299a11e4d28b2b6ebdeba8fae638a413 firefly3-5.7.18.tar.gz
112b778a4113b8d4d3465a5f80a72fe04497d68d718751e2b0ee43fdbd4379b6278bdff74c68e095668f03ef3a9969de41d734cb4f7e27fb26f1a4342f0c9e0f57e firefly3-env
113"