blob: 69cafec939df078bd990f55cac8d12f0d59abae7 (
plain)
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
|
# Maintainer: TurboPunk <turbopunk@telenet.be>
# Contributor: José San Juan <josesj@gmail.com>
pkgname=snapmaker-luban
pkgver=4.14.0
pkgrel=1
pkgdesc="Snapmaker Luban is an easy-to-use 3-in-1 software tailor-made for Snapmaker machines."
url="https://github.com/Snapmaker/Luban"
license=('AGPL v3')
arch=('x86_64')
makedepends=('npm' 'nvm' 'jq' 'yq' 'moreutils' 'fontconfig' 'ruby' 'libxcrypt-compat')
options=('!strip')
source=("git+$url.git")
sha256sums=('SKIP')
_ensure_local_nvm() {
# let's be sure we are starting clean
which nvm >/dev/null 2>&1 && nvm deactivate && nvm unload
export NVM_DIR="${srcdir}/.nvm"
# The init script returns 3 if version specified
# in ./.nvrc is not (yet) installed in $NVM_DIR
# but nvm itself still gets loaded ok
source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]]
}
prepare() {
cd ${srcdir}/Luban
git checkout tags/v${pkgver}
sed -i -e 's/:/\//g' .gitmodules
sed -i -e 's/git@/https:\/\//g' .gitmodules
git submodule sync --recursive
git submodule update --init --recursive
_ensure_local_nvm
nvm install 16
cd ${srcdir}/Luban
jq '.scripts."build:linux-x64"="bash -c '\''build/electron-builder.sh --linux --x64 --config electron-builder.yml'\''"' package.json | sponge package.json
yq '.linux.target="pacman"' electron-builder.yml | sponge electron-builder.yml
}
build() {
_ensure_local_nvm
export PATH=$PATH:node_modules/.bin
cd ${srcdir}/Luban
nvm use 16
npm install --cache "${srcdir}/npm-cache"
npm run build
npm run build:linux-x64
}
package() {
mv ${srcdir}/Luban/output/S${pkgname#s}-${pkgver}-linux-x64.pacman ${srcdir}/Luban/output/${pkgname}-${pkgver}.tar.xz
tar xf ${srcdir}/Luban/output/${pkgname}-${pkgver}.tar.xz --exclude='.*' -C ${pkgdir}
chown -R root:root "${pkgdir}"
}
|