summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e33c72f099925fd04a993e7e2d84682364fef7b9 (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
# Maintainer: Jake <aur@ja-ke.tech>

pkgname=searx
pkgver=1.1.0
pkgrel=2
pkgdesc="A privacy-respecting, hackable metasearch engine (python(3) based)"
arch=('any')
url="https://searx.github.io/searx/"
license=('AGPL')
makedepends=('openssl')
depends=(
        'uwsgi'
        'uwsgi-plugin-python'
        'python-certifi'
        'python-flask-babel' # sub dep: flask, babel, jinja
        'python-lxml'
        'python-idna'
        'python-pygments'
        'python-dateutil'
        'python-yaml'
        'python-requests'
        'python-pysocks'
        'python-langdetect')
conflicts=('searx-git' )
replaces=('searx-py3')
backup=('etc/searx/settings.yml' 'etc/uwsgi/searx.ini')
source=("https://github.com/searx/searx/archive/v$pkgver.zip"
        'flask-babel-3.patch'
        'searx.ini'
        'searx.sysusers')
sha512sums=('ed92199913353ed246ff30c516402326e9eac0f439b4519d6500b516f9ef73e73d0b25d894c078fb9b65870f2b10a09777d1ae068d13c8e10c91ec14de450b1e'
            '1db543553aa4989e1cb9fb449a1c4badfd5a1c8e39afc99b5f894557ba74b9293b64d02882919ce9f2e4c108a6cd3b7acb51043e98bc3bab40e69078fbe8813f'
            '476a4297c51681a9a92c6db3933359cc5a8ec292e45b229d98608ef2906b80c173868a30df06c329204c6f9371736a5bb322239860199526fd559780b37a2d0a'
            '6856e26451fe053d37c2ce4b9d5f3b35891dd8ec702c5256c02d04415124c57705abc497f12943948a85621bb0238d26c2c1f3a7bf42404a6ff1487c7655909e')

prepare() {
  cd "$srcdir/$pkgname-$pkgver"

  patch -Np1 < ../flask-babel-3.patch

  # Allow newer versions of the dependencies
  sed -i "s|==|>=|g" requirements.txt

  # Generate a random secret key
  sed -i -e "s/ultrasecretkey\" # change this!/`openssl rand -hex 32`\"/g" $pkgname/settings.yml

}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  local _site_packages="$(python -c 'import site; print(site.getsitepackages()[0])')"

  python setup.py install --root="$pkgdir" --optimize=1

  mv "${pkgdir}${_site_packages}"/{README.rst,requirements*,searx}

  mkdir -p "$pkgdir/etc/$pkgname"
  mv "${pkgdir}${_site_packages}/$pkgname/settings.yml" $pkgdir/etc/$pkgname/
  ln -s /etc/$pkgname/settings.yml "${pkgdir}${_site_packages}/$pkgname/settings.yml"

  install -Dm644 "${srcdir}/searx.sysusers" "${pkgdir}/usr/lib/sysusers.d/searx.conf"
  install -Dm644 "${srcdir}/searx.ini" "${pkgdir}/etc/uwsgi/searx.ini"
}