upgpkg: wordpress 6.2.1-1
[ArchLinux/community.git] / hedgedoc / trunk / PKGBUILD
blob9ba4b28b45291f68033b2705ecbbecd9ccd31f14
1 # Maintainer: Jelle van der Waa <jelle@archlinux.org>
3 pkgname=hedgedoc
4 pkgver=1.9.7
5 pkgrel=1
6 pkgdesc="Platform to write and share markdown"
7 arch=('any')
8 url='https://github.com/hedgedoc/hedgedoc'
9 license=('AGPL3')
10 depends=('nodejs-lts-hydrogen')
11 makedepends=('nodejs-lts-hydrogen' 'sqlite' 'python' 'node-gyp' 'git' 'yarn' 'npm')
12 optdepends=('postgresql: postgresql database support'
13             'mariadb: mariadb database support'
14             'sqlite: sqlite database support')
15 backup=("etc/webapps/${pkgname}"/config.json)
16 source=("${pkgname}-${pkgver}.tar.gz::https://github.com/hedgedoc/${pkgname}/archive/${pkgver}.tar.gz"
17         "sysusers.conf"
18         "tmpfiles.conf"
19         "hedgedoc.service")
20 options=(!emptydirs)
21 sha256sums=('a48b697228077711c869dc4cd7dc42ff20c3d8545c824079b3c9b6bcf1d77b2e'
22             '44806410925bb13fddfc08bfeac94320285f3847e18a49552816eb823bec888a'
23             'afe54a4a656aa5237962fe4efa3cd47dd90c8ce821aa259bfa978384c26ba53a'
24             'd51bb443c52f759260d61e055a201398cfe1e2296208f20e3d8601a6c01aa3a4')
26 prepare() {
27   cd "${pkgname}-${pkgver}"
28   sed -i 's/16.x/18.x/g' package.json
29   export NODE_OPTIONS=--openssl-legacy-provider
32 build() {
33   cd "${pkgname}-${pkgver}"
34   # Build steps from Dockerfile
35   yarn install --production=false
36   yarn run build
37   rm -rf node_modules
38   # Production modules
39   yarn install --production=true
42 package() {
43   cd "${pkgname}-${pkgver}"
45   # removing unneeded files and directories
46   find node_modules -type f \
47           \( \
48          -iname '*Makefile*' -o \
49          -iname '*armv*' -o \
50          -iname '*.cache' -o \
51          -iname '*Makefile*' -o \
52          -iname '*appveyor.yml' -o \
53          -iname '*.babelrc' -o \
54          -iname '*.bak' -o \
55          -iname '*bower.json' -o \
56          -iname '*.c' -o \
57          -iname '*.cc' -o \
58          -iname '*.cpp' -o \
59          -iname '*.md' -o \
60          -iname '*.markdown' -o \
61          -iname '*.rst' -o \
62          -iname '*.nycrc' -o \
63          -iname '*.npmignore' -o \
64          -iname '*.editorconfig' -o \
65          -iname '*.el' -o \
66          -iname '*.eslintignore' -o \
67          -iname '*.eslintrc*' -o \
68          -iname '*.fimbullinter.yaml' -o \
69          -iname '*.gitattributes' -o \
70          -iname '*.gitmodules' -o \
71          -iname '*.h' -o \
72          -iname '*.html' -o \
73          -iname '*.jshintrc' -o \
74          -iname '*.jscs.json' -o \
75          -iname '*.log' -o \
76          -iname '*logo.svg' -o \
77          -iname '*.nvmrc' -o \
78          -iname '*.o' -o \
79          -iname '*package-lock.json' -o \
80          -iname '*.travis.yml' -o \
81          -iname '*.prettierrc' -o \
82          -iname '*.sh' -o \
83          -iname '*.tags*' -o \
84          -iname '*.Dockerfile*' -o \
85          -iname '*.tm_properties' -o \
86          -iname '*.wotanrc.yaml' -o \
87          -iname '*tsconfig.json' -o \
88          -iname '*yarn.lock' \
89          \) \
90          -delete
92   find node_modules -type d \
93           \( \
94          -iwholename '*.github' -o \
95          -iwholename '*.tscache' -o \
96          -iwholename '*/man' -o \
97          -iwholename '*/test' -o \
98          -iwholename '*/scripts' -o \
99          -iwholename '*/git-hooks' -o \
100          -iwholename '*/linux-arm64' -o \
101          -iwholename '*/linux-armvy' -o \
102          -iwholename '*/linux-armv7' -o \
103          -iwholename '*/win32-ia32' -o \
104          -iwholename '*/win32-x64' -o \
105          -iwholename '*/darwin-x64' \
106          \) \
107          -exec rm -rvf {} +
109   install -m0755 -d "${pkgdir}/usr/share/webapps/${pkgname}"
111   # install application parts
112   cp -a bin public lib locales node_modules "${pkgdir}/usr/share/webapps/${pkgname}"  
113   install -m0644 app.js -t "${pkgdir}/usr/share/webapps/${pkgname}"
114   install -m0644 package.json -t "${pkgdir}/usr/share/webapps/${pkgname}"
116   # Make public/uploads a symlink to the hedgedoc  writable directory.
117   # An alternative would be to configure the uploadsPath in config.json.
118   rm "${pkgdir}/usr/share/webapps/${pkgname}/public/uploads/.gitkeep"
119   rm -d "${pkgdir}/usr/share/webapps/${pkgname}/public/uploads"
120   ln -s "/var/lib/${pkgname}/uploads" \
121           "${pkgdir}/usr/share/webapps/${pkgname}/public/uploads"
124   # Setup config files in /etc.
125   install -m0755 -d "${pkgdir}/etc/webapps/${pkgname}"
126   cp config.json.example "${pkgdir}/etc/webapps/${pkgname}/config.json"
128   ln -s "/etc/webapps/${pkgname}"/config.json "${pkgdir}/usr/share/webapps/${pkgname}/config.json"
130   # Configure hedgedoc user and some directories writable for that user.
131   install -Dm0644 ${srcdir}/sysusers.conf "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
132   install -Dm0644 ${srcdir}/tmpfiles.conf "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
134   # Install systemd service file.
135   install -Dm0644 -t "${pkgdir}/usr/lib/systemd/system/" "${srcdir}"/hedgedoc.service