blob: 0d363a1976d0b765f830963a93e97b50b8ee7fdf (
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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
|
pkgname=companion
pkgver=3.4.3
pkgrel=1
pkgdesc="Control software for the Elgato Streamdeck with a focus on broadcasting."
arch=('x86_64' 'aarch64')
url="https://github.com/bitfocus/companion"
license=('custom')
depends=('gtk3' 'alsa-lib' 'nss' 'hicolor-icon-theme' 'libusb')
makedepends=('nvm' 'git' 'zip' 'python>=3.10.0')
install=companion.install
_node_version="18.20.4"
source=("${pkgname}-${pkgver}::git+https://github.com/bitfocus/companion.git#tag=v${pkgver}"
"bitfocus-companion.desktop")
sha256sums=('116cab8294782f68703b8bcb17a3c9423ba5c76caf3cd83ac04487c053769e61'
'65289895360dae94dd710e6804709c1e3f95e6bc275b1621cb88eb8a7cbd348f')
_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 ]]
export PATH="$(npm bin):${PATH}"
export SHARP_IGNORE_GLOBAL_LIBVIPS=yes
export YARN_CACHE_FOLDER="${srcdir}/yarn"
}
prepare() {
_ensure_local_nvm
rm -Rf "${srcdir}/npm"
mkdir "${srcdir}/npm"
rm -Rf "${srcdir}/yarn"
mkdir "${srcdir}/yarn"
cd "${srcdir}/${pkgname}-${pkgver}"
# Init submodules
git submodule update --init
nvm install "${_node_version}"
npm config set cache "${srcdir}/npm"
# Enable corepack
corepack enable
}
build() {
_ensure_local_nvm
cd "${srcdir}/${pkgname}-${pkgver}"
rm -rf electron-output
CI=1 ./tools/yarn.sh
yarn run dist
}
package() {
cd "${srcdir}"
builddir="${pkgname}-${pkgver}/electron-output/linux-unpacked"
# Licenses
install -Dm644 "${pkgname}-${pkgver}/LICENSE.md" -t "${pkgdir}/usr/share/licenses/${pkgname}/"
install -Dm644 "${builddir}/LICENSE.electron.txt" -t "${pkgdir}/usr/share/licenses/${pkgname}/"
install -Dm644 "${builddir}/LICENSES.chromium.html" -t "${pkgdir}/usr/share/licenses/${pkgname}/"
# Companion
install -d "${pkgdir}/usr/lib/bitfocus-companion"
cp -R "${builddir}"/* "${pkgdir}/usr/lib/bitfocus-companion"
rm -f "${pkgdir}/usr/lib/bitfocus-companion/resources/node-runtime/bin/npm"
rm -f "${pkgdir}/usr/lib/bitfocus-companion/resources/node-runtime/bin/npx"
# Install bin symlinks
install -d "${pkgdir}/usr/bin"
ln -sv "/usr/lib/bitfocus-companion/companion-launcher" "${pkgdir}/usr/bin/companion"
ln -sv "/usr/lib/bitfocus-companion/companion_headless.sh" "${pkgdir}/usr/bin/companion-headless"
# udev rules
install -Dm644 "${pkgname}-${pkgver}/assets/linux/50-companion-desktop.rules" -t "${pkgdir}/etc/udev/rules.d/"
install -Dm644 "${pkgname}-${pkgver}/assets/linux/50-companion-headless.rules" -t "${pkgdir}/etc/udev/rules.d/"
# Desktop file
install -Dm644 bitfocus-companion.desktop -t "${pkgdir}/usr/share/applications/"
# Icon
install -Dm644 "${pkgname}-${pkgver}/launcher/assets/icon.png" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/bitfocus-companion.png"
}
|