forked from merll/pgadmin4-nw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PKGBUILD
86 lines (75 loc) · 3.26 KB
/
PKGBUILD
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Maintainer: Matthias Erll <[email protected]>
pkgname=pgadmin4-nw
pkgver=5.6
pkgrel=1
pkgdesc='Comprehensive design and management interface for PostgreSQL'
url='https://www.pgadmin.org/'
arch=('x86_64')
license=('custom')
depends=('postgresql-libs' 'hicolor-icon-theme' 'python'
'libxcrypt' 'glibc' 'gcc-libs' 'nwjs-bin')
makedepends=('python-setuptools' 'python-virtualenv' 'yarn')
provides=('pgadmin4=5.6')
conflicts=('pgadmin4')
source=(https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v${pkgver}/source/pgadmin4-${pkgver}.tar.gz{,.asc}
pgAdmin4.desktop)
validpgpkeys=('E8697E2EEF76C02D3A6332778881B2A8210976F2') # Package Manager (Package Signing Key) <[email protected]>
sha512sums=('563a38545fcc3e59d6dd0db94d0a2ba433de3ac3f75889ed6e73c0db36f6105db6c92c5ffcd4a7116d726adeeb6bec3d29b517a0b4d6f7fd69ea9818713e3500'
'SKIP'
'd061d074419b78ed96600329c622334310ca8fdef4b7c68d2594eb322ba814e21f4ce54daa8a27f3ce48a643c72feb342f7258eba52db6f915dff6a73bdba7da')
prepare() {
cd pgadmin4-${pkgver}
virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt
deactivate
# Sphinx is only needed during build
virtualenv -p python3 venv-build
source venv-build/bin/activate
pip install -r requirements.txt
pip install sphinx
deactivate
}
build() {
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export PGADMIN_PYTHON_DIR=/usr
cd pgadmin4-${pkgver}
source venv-build/bin/activate
# override doctree directory
make docs SPHINXOPTS='-d /tmp/'
export CFLAGS+=" ${CPPFLAGS}"
export CXXFLAGS+=" ${CPPFLAGS}"
make runtime
cd runtime && yarn install --production=true && cd ..
make install-node
make bundle
# Change absolute path refrences in virtual environment
sed -E "s|$PWD/venv|/usr/lib/pgadmin4/venv|g" -i venv/bin/*
# Remove cached files that contain references to src directory
find . -type d -name __pycache__ -exec rm -R '{}' +
# Remove additional dev and build files
find venv/lib -type d -name "test" -or -name "tests" -exec rm -R '{}' +
rm -R web/node_modules
rm -R web/regression
find web/pgadmin -type d -name "tests" -exec rm -R '{}' +
rm web/pgadmin/messages.pot
find web/pgadmin/translations -type f -name "messages.po" -delete
}
package() {
cd pgadmin4-${pkgver}
mkdir -p "${pkgdir}/usr/lib/pgadmin4/runtime"
cp -a runtime/{assets,node_modules,src,package.json} "${pkgdir}/usr/lib/pgadmin4/runtime"
cp -a docs web venv "${pkgdir}/usr/lib/pgadmin4"
install -Dm 644 pkg/linux/pgadmin4-128x128.png "${pkgdir}/usr/share/icons/hicolor/128x128/apps/pgAdmin4.png"
install -Dm 644 pkg/linux/pgadmin4-64x64.png "${pkgdir}/usr/share/icons/hicolor/64x64/apps/pgAdmin4.png"
install -Dm 644 pkg/linux/pgadmin4-48x48.png "${pkgdir}/usr/share/icons/hicolor/48x48/apps/pgAdmin4.png"
install -Dm 644 pkg/linux/pgadmin4-32x32.png "${pkgdir}/usr/share/icons/hicolor/32x32/apps/pgAdmin4.png"
install -Dm 644 pkg/linux/pgadmin4-16x16.png "${pkgdir}/usr/share/icons/hicolor/16x16/apps/pgAdmin4.png"
install -Dm 644 "${srcdir}/pgAdmin4.desktop" -t "${pkgdir}/usr/share/applications"
install -D /dev/stdin "${pkgdir}/usr/bin/pgadmin4" <<END
#!/bin/sh
exec /usr/bin/nw /usr/lib/pgadmin4/runtime/ "\$@"
END
install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgbasename}"
}