Skip to content

Commit

Permalink
bruno: add package (#4360)
Browse files Browse the repository at this point in the history
* bruno: add package

* Add nvm

* Update PKGBUILD

* Update PKGBUILD

* Update to-release

* Update PKGBUILD

* Update PKGBUILD
  • Loading branch information
D3vil0p3r authored Nov 21, 2024
1 parent a0a1458 commit 4b6c6d3
Show file tree
Hide file tree
Showing 7 changed files with 200 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lists/to-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bruno
nvm
99 changes: 99 additions & 0 deletions packages/bruno/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

# Initial PKGBUILD from AUR.
# Old Maintainer: Vianney Bouchaud <aur dot vianney at bouchaud dot org>

pkgname=bruno
pkgver=v1.34.2.r3.g4894ac2
pkgrel=1
pkgdesc='Opensource API Client for Exploring and Testing APIs.'
groups=('blackarch' 'blackarch-webapp')
arch=('x86_64')
url="https://www.usebruno.com/"
license=('MIT')
_electron=electron31
depends=("$_electron" 'alsa-lib')
makedepends=('nvm' 'asar' 'python-setuptools' 'python')
source=("git+https://github.com/usebruno/$pkgname.git"
"com.usebruno.app.Bruno.desktop")
sha512sums=('SKIP'
'0c303dd2a3cb1d1628d25b33d515df4fdaf116298520bed5a251d8320d5f771146a625165ab07fbbf7f4698ebc3bcfc7682a44aaa635d980493c7fc208389884')

_ensure_local_nvm() {
# lets be sure we are starting clean
which nvm >/dev/null 2>&1 && nvm deactivate && nvm unload

export NVM_DIR="${srcdir}/${pkgname}-${pkgver}/.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 ]]
}

pkgver() {
cd $pkgname

( set -o pipefail
git describe --long --tags --abbrev=7 2>/dev/null |
sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
printf "%s.%s" "$(git rev-list --count HEAD)" \
"$(git rev-parse --short=7 HEAD)"
)
}

prepare() {
_ensure_local_nvm
cd $pkgname

nvm install

# https://typicode.github.io/husky/how-to.html#ci-server-and-docker
export HUSKY=0

npm install --cache "$srcdir/npm-cache"

npm install electron-builder --save-dev --cache "$srcdir/npm-cache"
npm install node-addon-api --save-dev --cache "$srcdir/npm-cache"
}

build() {
_ensure_local_nvm
export NODE_ENV=production
export NODE_OPTIONS=--openssl-legacy-provider

cd $pkgname

npm run build:graphql-docs
npm run build:bruno-query
npm run build:bruno-common
npm run sandbox:bundle-libraries --workspace=packages/bruno-js
npm run build:web

electronDist="/usr/lib/$_electron"
electronVer="$(cat $electronDist/version)"
sed -i -e "s~\"dist:linux\":.*~\"dist:linux\": \"electron-builder --linux --x64 --dir --config electron-builder-config.js -c.electronDist=$electronDist -c.electronVersion=$electronVer\",~g" packages/bruno-electron/package.json

npm run build:electron:linux
}

package() {
install -Dm0644 com.usebruno.app.Bruno.desktop -t "$pkgdir/usr/share/applications/"

cd $pkgname

install -Dm0755 /dev/null "$pkgdir/usr/bin/$pkgname"
cat >> "$pkgdir/usr/bin/$pkgname" <<EOD
#! /usr/bin/sh
ELECTRON_IS_DEV=0 exec $_electron /usr/lib/bruno "\$@"
EOD

install -Dm0644 license.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
install -d "$pkgdir/usr/lib/$pkgname/"
asar e packages/bruno-electron/out/linux-unpacked/resources/app.asar "$pkgdir/usr/lib/$pkgname/"

for i in 16 24 48 64 128 256 512 1024; do
install -Dm644 "packages/bruno-electron/resources/icons/png/${i}x${i}.png" "$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/com.usebruno.app.Bruno.png"
done
}

9 changes: 9 additions & 0 deletions packages/bruno/com.usebruno.app.Bruno.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=Bruno
Comment=Opensource API Client for Exploring and Testing APIs
Exec=/usr/bin/bruno %u
Terminal=false
Type=Application
Icon=com.usebruno.app.Bruno
StartupWMClass=Bruno
Categories=Development;
46 changes: 46 additions & 0 deletions packages/nvm/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

# Initial PKGBUILD from AUR.
# Old Maintainer: Tom Wadley <[email protected]>

pkgname=nvm
pkgver=0.40.1
pkgrel=1
pkgdesc='Node Version Manager - Simple bash script to manage multiple active node.js versions.'
url='https://github.com/nvm-sh/nvm'
arch=('any')
license=('MIT')
optdepends=('bash: bash completion')
install="${pkgname}.install"
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/nvm-sh/nvm/archive/v${pkgver}.tar.gz"
"init-nvm.sh"
"install-nvm-exec")
sha512sums=('ccf4d43abc3c812ffc694e95770fef39bdd9963c77606636f1cd54dcd64a8ec3e338aa56ba907a81a671191eda6accbb0fcda25ccf14d439d7a7d7a96acfba4d'
'b6a1906f644aa3cab17baeaf9e8bf0b256215b5fa082d73261095f45b5f16769fa91bccc597b22c2cfda0751b0e7f5865e2ff77176bb3e0998966be1fee5a76c'
'148753d8d76cda4be75139628c04784b7abb70859d3815aa651bfd91a326b8c6b71897c27e7c1482c3255f271057ebc09147cbaba9faa36a66c2e6e2c6d4612a')

package() {
cd "${srcdir}"

# convenience script
install -Dm644 init-nvm.sh "$pkgdir/usr/share/$pkgname/init-nvm.sh"

# companion script which installs symlinks in NVM_DIR (see comment in script)
install -Dm644 install-nvm-exec "$pkgdir/usr/share/$pkgname/install-nvm-exec"

cd "${pkgname}-${pkgver}"

# nvm itself
install -Dm644 nvm.sh "$pkgdir/usr/share/$pkgname/nvm.sh"

# nvm-exec script for 'nvm exec' command
install -Dm755 nvm-exec "$pkgdir/usr/share/$pkgname/nvm-exec"

# bash completion
install -Dm644 bash_completion "$pkgdir/usr/share/$pkgname/bash_completion"

# license
install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE.md"
}

4 changes: 4 additions & 0 deletions packages/nvm/init-nvm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"
source /usr/share/nvm/nvm.sh
source /usr/share/nvm/bash_completion
source /usr/share/nvm/install-nvm-exec
4 changes: 4 additions & 0 deletions packages/nvm/install-nvm-exec
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# "nvm exec" and certain 3rd party scripts expect "nvm.sh" and "nvm-exec" to exist under $NVM_DIR
[ -e "$NVM_DIR" ] || mkdir -p "$NVM_DIR"
[ -e "$NVM_DIR/nvm.sh" ] || ln -s /usr/share/nvm/nvm.sh "$NVM_DIR/nvm.sh"
[ -e "$NVM_DIR/nvm-exec" ] || ln -s /usr/share/nvm/nvm-exec "$NVM_DIR/nvm-exec"
36 changes: 36 additions & 0 deletions packages/nvm/nvm.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## arg 1: the new package version
post_install() {
echo "
You need to source nvm before you can use it. Do one of the following
or similar depending on your shell (and then restart your shell):

echo 'source /usr/share/nvm/init-nvm.sh' >> ~/.bashrc
echo 'source /usr/share/nvm/init-nvm.sh' >> ~/.zshrc

You can now install node.js versions (e.g. nvm install 10) and
activate them (e.g. nvm use 10).

init-nvm.sh is a convenience script which does the following:
"
cat usr/share/nvm/init-nvm.sh
echo "
You may wish to customize and put these lines directly in your
.bashrc (or similar) if, for example, you would like an NVM_DIR
other than ~/.nvm or you don't want bash completion.

See the nvm readme for more information: https://github.com/creationix/nvm
"
}

## arg 1: the old package version
post_remove() {
echo "
Don't forget to clean up any lines added to your shell's startup script!

For example, from your .bashrc (or .zshrc etc.), delete the line:

source /usr/share/nvm/init-nvm.sh
"
}

# vim:set ts=2 sw=2 et:

0 comments on commit 4b6c6d3

Please sign in to comment.