summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8bc2a3a1c1b26c573a0061c6a5305c2d199455dd (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
# Maintainer: karboncore

pkgname=mealie
pkgver=2.2.0
pkgrel=1
pkgdesc='A self hosted recipe manager'
arch=(any)
url=https://github.com/mealie-recipes/mealie
license=(AGPL)
depends=(python-fastapi python-sqlalchemy python-pyjwt python-text-unidecode python-slugify
         python-dateutil python-isodate apprise python-bs4 python-bcrypt python-ldap python-authlib
         python-alembic python-python-multipart python-jinja python-html2text python-orjson
         python-httpx python-pillow python-pillow-heif python-openai python-humps
         python-recipe-scrapers-git python-extruct-git python-requests python-lxml uvicorn
         python-aiofiles python-aniso8601 python-appdirs python-paho-mqtt python-pydantic
         python-pydantic-settings python-dotenv python-yaml python-rapidfuzz python-tzdata
         python-poetry python-itsdangerous sqlite)
makedepends=(git python-build python-wheel python-installer yarn nodejs-lts-hydrogen)
optdepends=('postgresql: for postgresql support'
            'python-psycopg2: for postgresql support')
source=(https://github.com/mealie-recipes/mealie/archive/refs/tags/v${pkgver}.tar.gz)
sha256sums=('14497e9319dd3680672d20934469bab4bb2451d25a49067bb10cf7c01dcfaa4d')

build() {
  cd "$srcdir/${pkgname}-${pkgver}"
  python -m build -wn
  cd frontend
  yarn install \
    --prefer-offline \
    --frozen-lockfile \
    --non-interactive \
    --production=false \
    --network-timeout 1000000
  yarn generate
}

package() {
  cd "$srcdir/${pkgname}-${pkgver}"
  python -m installer -d "$pkgdir" dist/*.whl
  rm -f "$pkgdir/usr/bin/start"
  install -Dm 644 LICENSE -t "${pkgdir}"/usr/share/licenses/${pkgname}/
  mkdir -pm755 "$pkgdir/usr/lib/mealie"
  cp -r {frontend/dist,alembic,alembic.ini} "$pkgdir/usr/lib/mealie/"
  sed -i 's@^script_location.*@script_location = /usr/lib/mealie/alembic@g' "$pkgdir/usr/lib/mealie/alembic.ini"

  # Generate startup script
  pythondir=( "$pkgdir/usr/lib/python"* )
  cat << EOF > "$pkgdir/usr/bin/mealie"
#!/bin/sh

STATIC_FILES="\${STATIC_FILES:-/usr/lib/mealie/dist}"                      \\
ALEMBIC_CONFIG_FILE="\${ALEMBIC_CONFIG_FILE:-/usr/lib/mealie/alembic.ini}" \\
PRODUCTION="\${PRODUCTION:-true}"                                          \\
DATA_DIR="\${DATA_DIR:-\$HOME/.mealie}"                                     \\
                                                                          \\
python /usr/lib/${pythondir##*/}/site-packages/mealie/main.py
EOF
  chmod 755 "$pkgdir/usr/bin/mealie"
}