pkgname=brainlet-git _name=brainlet _repository=brainlet pkgver=102 pkgrel=1 epoch=1 pkgdesc="A fast and open-source chat server" arch=('any') url="https://git.hippoz.xyz/hippoz/brainlet" license=('GPL') depends=('nodejs') makedepends=('git' 'npm') provides=('brainlet') conflicts=('brainlet') backup=('etc/brainlet/server.conf' 'etc/brainlet/secret.conf') source=("${_repository}::git+https://git.hippoz.xyz/hippoz/${_repository}.git" "${_name}.patch") sha256sums=('SKIP' 'c8aad6d8a36c41d3fa1ae6185b3d218fbbaad3c603c326c696138727d5f9ebde') pkgver() { cd "${srcdir}/${_repository}" git rev-list --count HEAD } prepare() { cd "${srcdir}/${_repository}" patch -p1 -i "${srcdir}/${_name}.patch" } package() { cd "${srcdir}/${_repository}/${_name}" mkdir -p "${pkgdir}/usr/bin" mkdir -p "${pkgdir}/etc/brainlet" npm install -g --prefix "${pkgdir}/usr" --cache "${srcdir}/npm-cache" rm "${pkgdir}/usr/lib/node_modules/${_name}" cp -r "${srcdir}/${_repository}/${_name}" "${pkgdir}/usr/lib/node_modules/${_name}" pushd "${pkgdir}/usr/lib/node_modules/${_name}/" npm install popd chmod -R 755 "${pkgdir}" ln -s "../lib/node_modules/${_name}/index.js" "${pkgdir}/usr/bin/brainlet" ln -s "../../usr/lib/node_modules/${_name}/config.js" "${pkgdir}/etc/brainlet/server.conf" ln -s "../../usr/lib/node_modules/${_name}/secret.js" "${pkgdir}/etc/brainlet/secret.conf" install -Dm644 "../LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" }