archrelease: copy trunk to community-any
[arch-community.git] / pgadmin4 / trunk / PKGBUILD
blobfdbb0f80fdb298dfe5db3b95c275b54ecacb7b39
1 # Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
2 # Maintainer: Jerome Leclanche <jerome@leclan.ch>
4 pkgname=pgadmin4
5 pkgver=4.30
6 pkgrel=5
7 pkgdesc='Comprehensive design and management interface for PostgreSQL'
8 url='https://www.pgadmin.org/'
9 arch=('x86_64')
10 license=('custom')
11 depends=('qt5-base' 'postgresql-libs' 'hicolor-icon-theme' 'python'
12          'libxcrypt' 'libcrypt.so' 'glibc' 'gcc-libs'
13          'python-blinker' 'python-flask' 'python-flask-login'
14          'python-flask-migrate' 'python-flask-sqlalchemy' 'python-flask-wtf'
15          'python-passlib' 'python-pytz' 'python-simplejson' 'python-six'
16          'python-speaklater' 'python-sqlparse' 'python-wtforms' 'python-psutil'
17          'python-jinja' 'python-paramiko' 'python-psycopg2' 'python-bcrypt'
18          'python-cryptography' 'python-sqlalchemy1.3' 'python-testtools'
19          'python-webencodings' 'python-werkzeug' 'python-dateutil'
20          'python-flask-gravatar' 'python-flask-mail' 'python-flask-principal'
21          'python-flask-paranoid' 'python-sshtunnel' 'python-flask-security-too'
22          'python-werkzeug' 'python-flask-compress' 'python-ldap3' 'python-cryptography'
23          'python-flask-babelex' 'python-gssapi')
24 makedepends=('python-setuptools' 'python-sphinx' 'python-extras' 'python-fixtures'
25              'python-html5lib' 'python-pbr' 'python-mimeparse' 'python-pyrsistent'
26              'imagemagick')
27 source=(https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v${pkgver}/source/${pkgname}-${pkgver}.tar.gz{,.asc}
28         pgAdmin4.desktop
29         config_distro.py
30         config_local.py
31         pgadmin4-python-de-vendor-venv-paths.patch
32         jinja-3.1.patch
33         flask-security-compat.patch
34         flask2-compat.patch)
35 validpgpkeys=('E8697E2EEF76C02D3A6332778881B2A8210976F2') # Package Manager (Package Signing Key) <packages@pgadmin.org>
36 sha512sums=('7ce12f65ce9dbfe4af9e92dd7f9327a05be8b8436ef495a0634043158417f3af5f457b88ee5422ede59f517c197668094454c6d7b7c33e255068479ce6ec13d9'
37             'SKIP'
38             'b19dda3331585010c759099eb09f4db288ce4cd3d36882b56748e1e3756dc7bee2899d7438d496280498ec6a60f6e1ba90309d49fc599403f1fdc7e8817b6645'
39             '16d00dc2095904a6b12da7039458f632873829ad98d4d7653eac5804032ba92097ccae4488d56467d0ea9bd64e2654a3dead73eb7924c947ff1737ff6e3b4745'
40             'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e'
41             'a8c1a3762469b02b745da4e3b30f7534ad6bb94e91d43f7e63604fef24f638e09575e2c9336e753e5b6dbe167c55bb49fb6247a16431415318479eb3a3712adc'
42             'ec7b9ef6d944ac5b8e2c0e7ff7626af8950b369e34bb643322d9208908baea70ad6753ae9eff2799c04fe5182edbb5c270ee69647f224349f0df890a735a7767'
43             '8b23686674c12f1bbba9ded22425874adb5f6802f2e1f7e381c07208251301f0bb56622a0440e5609c5dcc5461f50fe08c7dcab4405878e9662de6faf782a39b'
44             '5eb39b2926adc7fe715a2b1b3f2165bd84a9fab3f8afda1ddaaba557ad1d41a4aa8d279387699b7148a86c7af4782d5b6b7f50f89972ef3507d14795c006a65c')
46 prepare() {
47   cd ${pkgname}-${pkgver}
49   patch -Np1 < ../pgadmin4-python-de-vendor-venv-paths.patch
50   patch -Np1 --no-backup-if-mismatch < ../jinja-3.1.patch
51   patch -NRp1 < ../flask-security-compat.patch
52   patch -NRp1 < ../flask2-compat.patch
54   local PYTHONVERSION="$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')"
55   sed -E "s|/usr/pgadmin4/web|/usr/lib/pgadmin4/web|g;
56           s|/usr/pgadmin4/lib/python[0-9\\.]+|/usr/lib/python${PYTHONVERSION}|g" \
57       -i runtime/ConfigWindow.ui
58   sed "s|##PYTHONVERSION##|${PYTHONVERSION}|g" -i runtime/Server.cpp
60   sed -E -i requirements.txt \
61     -e '/blinker>?=/d' \
62     -e '/extras>?=/d' \
63     -e '/Flask>?=/d' \
64     -e '/Flask-Login>?=/d' \
65     -e '/Flask-Migrate>?=/d' \
66     -e '/Flask-SQLAlchemy>?=/d' \
67     -e '/Flask-WTF>?=/d' \
68     -e '/pycrypto>?=/d' \
69     -e '/passlib>?=/d' \
70     -e '/pytz>?=/d' \
71     -e '/simplejson>?=/d' \
72     -e '/six>?=/d' \
73     -e '/speaklater>?=/d' \
74     -e '/sqlparse>?=/d' \
75     -e '/WTForms>?=/d' \
76     -e '/psutil>?=/d' \
77     -e '/psycopg2>?=/d' \
78     -e '/python-dateutil>?=/d' \
79     -e '/SQLAlchemy>?=/d' \
80     -e '/Flask-Gravatar>?=/d' \
81     -e '/Flask-Mail>?=/d' \
82     -e '/Flask-Principal>?=/d' \
83     -e '/Flask-Paranoid>?=/d' \
84     -e '/htmlmin>?=/d' \
85     -e '/Flask-Security-Too>?=/d' \
86     -e '/Flask-HTMLmin>?=/d' \
87     -e '/Flask-Compress>?=/d' \
88     -e '/sshtunnel>?=/d' \
89     -e '/Werkzeug>?=/d' \
90     -e '/ldap3>?=/d' \
91     -e '/bcrypt>?<?=/d' \
92     -e '/cryptography>?<?=/d' \
93     -e '/Flask-BabelEx>?<?=/d' \
94     -e '/gssapi>?<?=/d' \
95     -e '/^#.*/d' \
96     -e '/^$/d'
97   if [[ -s requirements.txt ]]; then
98     echo "ERROR: requirements.txt must be empty:"
99     cat requirements.txt
100     exit 1
101   fi
104 build() {
105   export LANG=en_US.UTF-8
106   export LC_ALL=en_US.UTF-8
107   export PGADMIN_PYTHON_DIR=/usr
109   cd ${pkgname}-${pkgver}
110   convert +set date:create +set date:modify runtime/pgAdmin4.{ico,png}
111   # override doctree directory
112   # override SPHINXBUILD to not treat warnigs as errors
113   make docs SPHINXOPTS='-d /tmp/' SPHINXBUILD=sphinx-build
115   cd runtime
116   export CFLAGS+=" ${CPPFLAGS}"
117   export CXXFLAGS+=" ${CPPFLAGS}"
118   qmake CONFIG+=release
119   make
122 package() {
123   cd ${pkgname}-${pkgver}
125   install -Dm 755 runtime/pgAdmin4 "${pkgdir}/usr/lib/pgadmin4/runtime/pgAdmin4"
126   cp -a docs web "${pkgdir}/usr/lib/pgadmin4"
127   install -Dm 644 "${srcdir}"/config_{distro,local}.py -t "${pkgdir}/usr/lib/pgadmin4/web"
129   install -Dm 644 runtime/pgAdmin4-0.png "${pkgdir}/usr/share/icons/hicolor/256x256/apps/pgAdmin4.png"
130   install -Dm 644 runtime/pgAdmin4-1.png "${pkgdir}/usr/share/icons/hicolor/48x48/apps/pgAdmin4.png"
131   install -Dm 644 runtime/pgAdmin4-2.png "${pkgdir}/usr/share/icons/hicolor/32x32/apps/pgAdmin4.png"
132   install -Dm 644 runtime/pgAdmin4-3.png "${pkgdir}/usr/share/icons/hicolor/16x16/apps/pgAdmin4.png"
133   install -Dm 644 "${srcdir}/pgAdmin4.desktop" -t "${pkgdir}/usr/share/applications"
135   install -D /dev/stdin "${pkgdir}/usr/bin/pgadmin4" <<END
136 #!/bin/sh
137 cd /usr/lib/pgadmin4
138 exec runtime/pgAdmin4 "\$@"
140   install -D /dev/stdin "${pkgdir}/usr/bin/pgadmin4-server" <<END
141 #!/bin/sh
142 cd /usr/lib/pgadmin4
143 python web/pgAdmin4.py "\$@"
146   install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
149 # vim: ts=2 sw=2 et: