desktop/pgadmin4/PKGBUILD
2017-06-06 22:10:29 +02:00

85 lines
2.9 KiB
Bash

pkgname=pgadmin4
pkgver=1.5
pkgrel=1
_name=pgAdmin4
pkgdesc="Comprehensive design and management interface for PostgreSQL"
arch=('x86_64')
url="https://www.pgadmin.org/"
license=('custom')
depends=('qt5-webengine' 'python3' 'postgresql-libs' 'hicolor-icon-theme')
makedepends=('python3-setuptools' 'python3-sphinx' 'python3-pip' 'imagemagick')
source=("https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v$pkgver/source/$pkgname-$pkgver.tar.gz"
"pgadmin4.desktop")
sha256sums=('a814d926e9af046ff8ebaf968ec37da8f26ba012de2bff655630703ed2c6bf5c'
'763ed68d27b335292c62521268e9b5791584bc32892316453fa5409cb19f1286')
prepare() {
cd $pkgname-$pkgver
convert runtime/pgAdmin4.{ico,png}
}
build() {
msg2 "building runtime"
cd $pkgname-$pkgver/runtime
export PYTHON_CONFIG=/usr/bin/python3-config
qmake-qt5 CONFIG+=release
make
msg2 "building python deps"
cd $srcdir/$pkgname-$pkgver
mkdir -p python
pip3 install --target="$srcdir/$pkgname-$pkgver/python" -r requirements.txt
msg2 "building docs"
# using python3
sed -i s!"python"!"python3"! docs/en_US/Makefile.sphinx
PYTHONPATH="$srcdir/$pkgname-$pkgver/python:$PYTHONPATH" make docs
}
package() {
msg2 "installing python deps"
cd $srcdir/$pkgname-$pkgver
install -d ${pkgdir}/usr/lib/$pkgname/modules/site-packages
cp -dr python/* ${pkgdir}/usr/lib/$pkgname/modules/site-packages
msg2 "installing runtime"
cd $srcdir/$pkgname-$pkgver
install -D runtime/pgAdmin4 ${pkgdir}/usr/lib/$pkgname/runtime/$pkgname
install -d ${pkgdir}/usr/bin
msg2 "installing other stuff"
cp -a docs web ${pkgdir}/usr/lib/$pkgname
msg2 "installing configuration stuff"
# tell pgadmin we want use desktop mode
cat >>"${pkgdir}/usr/lib/$pkgname/web/config_local.py" <<END
SERVER_MODE = False
HELP_PATH = "/usr/lib/pgadmin4/docs/en_US/_build/html/"
END
cat >>"${pkgdir}/usr/lib/pgadmin4/web/config_distro.py" <<END
END
msg2 "installing executable"
# put wrapper on /usr/bin
echo "#!/bin/sh
export PYTHONPATH=/usr/lib/$pkgname/modules/site-packages
/usr/lib/$pkgname/runtime/pgadmin4" '"${@}"' > "${srcdir}/$pkgname-$pkgver/$pkgname.sh"
chmod 755 "${srcdir}/$pkgname-$pkgver/$pkgname.sh"
# install the wrapper on /usr/bin
install -D "${srcdir}/$pkgname-$pkgver/$pkgname.sh" ${pkgdir}/usr/bin/${pkgname}
# .desktop
install -D "$srcdir/pgadmin4.desktop" "$pkgdir/usr/share/applications/pgadmin4.desktop"
# icons
install -Dm644 runtime/pgAdmin4-0.png "$pkgdir/usr/share/icons/hicolor/256x256/apps/pgAdmin4.png"
install -Dm644 runtime/pgAdmin4-1.png "$pkgdir/usr/share/icons/hicolor/48x48/apps/pgAdmin4.png"
install -Dm644 runtime/pgAdmin4-2.png "$pkgdir/usr/share/icons/hicolor/32x32/apps/pgAdmin4.png"
install -Dm644 runtime/pgAdmin4-3.png "$pkgdir/usr/share/icons/hicolor/16x16/apps/pgAdmin4.png"
# License
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}