Skip to content

Instantly share code, notes, and snippets.

@EvergreenTheTree
Last active November 17, 2022 10:58
Show Gist options
  • Save EvergreenTheTree/562d5ea590d9887b29f4960b1ad0dd24 to your computer and use it in GitHub Desktop.
Save EvergreenTheTree/562d5ea590d9887b29f4960b1ad0dd24 to your computer and use it in GitHub Desktop.
Bitwig 4.3 Beta 2 PKGBUILD
# Maintainer: Jonathon Fernyhough <jonathon at_m2x+dev>
# Contributor: Aleksej Komarov <[email protected]>
# Contributor: MKzero <info[at]linux-web-development[dot]de>
# Contributor: Evergreen <evergreenubuntu[at]gmail[dot]com>
# Upstream: Bitwig GmbH <[email protected]>
# Original PKGBUILD taken wholesale from stylemistake's bitwig-studio package
# JF added a prepare() to allow side-by-side installation with release version
pkgname=bitwig-studio-beta
_pkgname=bitwig-studio
_pkgver=4.3
pkgver=${_pkgver}beta2
pkgrel=1
pkgdesc='Digital audio workstation for music production, remixing and live performance'
arch=('x86_64')
url='https://www.bitwig.com/'
license=('custom')
# Deps from bitwig-studio package
#depends=('jack' 'xdg-utils' 'zenity' 'xcb-util-wm' 'libbsd')
# Deps as suggested by namcap...
makedepends=('ostree')
depends=('gtk3' 'lib32-libx11' 'lib32-libxkbcommon' 'libxkbcommon-x11' 'xcb-util' 'xcb-util-wm')
optdepends=('alsa-lib' 'jack' 'oss' 'ffmpeg: MP3 support')
provides=('bitwig-studio')
options=(!strip)
source=("$_pkgname-$pkgver.flatpak::https://www.bitwig.com/dl/?id=479&os=installer_linux")
b2sums=('e8d2aada9ee86c7a4235ca70d3f72a08a76c545d65aea9a2f6b1d7b08fc30ee2a80759da782d71a141ebbdee1b12c285c2bc5a9770761a16569dd4d0cf3cb152')
prepare() {
msg2 "Extracting files from flatpak ..."
_ostree_repo=tmp-repo
_extract_dir="extracted"
rm -rf "$_ostree_repo"
rm -rf "$_extract_dir"
ostree init --repo="$_ostree_repo" --mode=bare-user-only
ostree --repo="$_ostree_repo" static-delta apply-offline "$_pkgname-$pkgver.flatpak" -v
_commit="$(find "$_ostree_repo" -name '*.commit' | head -n1 | sed 's,/[^/]*$,,' | sed 's,.*/,,')"
ostree --repo="$_ostree_repo" checkout "$_commit" "$_extract_dir"
# Move files from flatpak into opt
_optdir="${srcdir}/opt/${pkgname}"
mkdir -p "$_optdir"
cp -r "$_extract_dir"/files/* "$_optdir"
cd "$_optdir"
# Move out files that belong in /usr/share
mkdir -p "${srcdir}/usr/share"
mv share/applications "${srcdir}/usr/share"
mv share/icons "${srcdir}/usr/share"
mv share/mime "${srcdir}/usr/share"
# Remove unnecessary flatpak related files
rm -rf share
rm -f manifest.json
rm -rf extensions
# Patch files to avoid conflicts with stable bitwig studio install
cd "${srcdir}/usr/share/"
mv applications/com.bitwig.BitwigStudio.desktop applications/com.bitwig.BitwigStudioBeta.desktop
sed -i "s|${_pkgname}|${pkgname}|g;
s|Bitwig Studio|Bitwig Studio Beta|g;
s|BitwigStudio|BitwigStudioBeta|g;
12s|bitwig-|bitwig-beta-|g;" applications/com.bitwig.BitwigStudioBeta.desktop
mv mime/packages/com.bitwig.BitwigStudio.xml mime/packages/com.bitwig.BitwigStudioBeta.xml
sed -i "s|bitwig-|bitwig-beta-|g;
s|BitwigStudio|BitwigStudioBeta|g;
s|Studio |Studio Beta |g" mime/packages/com.bitwig.BitwigStudioBeta.xml
cd icons/hicolor/
for icon in 48x48/apps/*.png 128x128/apps/*png scalable/apps/*.svg; do
mv "$icon" "${icon/Studio/StudioBeta}"
done
for icon in scalable/mimetypes/*.svg; do
mv "$icon" "${icon/Studio.application-bitwig/StudioBeta.application-bitwig-beta}"
done
# Make link to binary in /usr/bin
mkdir -p "${srcdir}/usr/bin"
ln -s /opt/${pkgname}/${_pkgname} "${srcdir}/usr/bin/${pkgname}"
}
package() {
mv ${srcdir}/{opt,usr} ${pkgdir}/
# Install license
install -D -m644 ${pkgdir}/opt/${pkgname}/EULA.rtf ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment