You are not logged in.

#1 2023-08-29 16:27:14

RedArcher
Member
From: South Africa
Registered: 2009-09-03
Posts: 115

[SOLVED] Packaging Listener

Hello,

I need help packaging and patching Listener 2.0.1.

Patch is taken from https://slackbuilds.org/repository/15.0/audio/listener/

PKGBUILD

pkgname=listener
pkgver=2.0.1
pkgrel=1
pkgdesc="This program listens for sound. If it detects any, it starts recording automatically and also automatically stops when things become silent again."
arch=('i686' 'x86_64')
url="https://www.vanheusden.com/listener/"
license=('GPL')
depends=('glibc')
source=("https://www.vanheusden.com/listener/$pkgname-$pkgver.tgz")
sha256sums=('ae08c0b3cfb4c38eaa0188b375c0e4c868f66c5706e33d33e210cd0320e035bc')  # replace SKIP with the actual sha256 of the file

prepare() {
  patch --directory="$pkgname-$pkgver" --forward --strip=1 --input="portaudio_default_input_device.diff"
  #patch -p1 < $CWD/portaudio_default_input_device.diff
}

build() {
  cd "$srcdir/$pkgname-$pkgver"
  make
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  # install configuration file
  install -Dm644 listener.conf "$pkgdir/usr/local/etc/listener.conf"
  install -Dm755 listener "$pkgdir/usr/bin/listener"
  #make DESTDIR="$pkgdir/" install
}

portaudio_default_input_device.diff (notice listener-2.2)

diff -Naur listener-2.2/paudio.c listener-2.2.patched/paudio.c
--- listener-2.2/paudio.c	2013-01-21 04:23:54.000000000 -0500
+++ listener-2.2.patched/paudio.c	2021-12-24 15:07:16.791531492 -0500
@@ -15,7 +15,7 @@
 	err = Pa_Initialize();
 	error_check(err, "Error initializing audio");
 
-	pcm_param.device = 0; /* default device should be the first */
+	pcm_param.device = Pa_GetDefaultInputDevice();
 	pcm_param.channelCount = n_channels;
 	pcm_param.sampleFormat = paInt16;
 	pcm_param.suggestedLatency = 0.5; /* 0.5 seconds, in order to eliminate glitches */

Error

$ makepkg -sri
==> Making package: listener 2.0.1-1 (Tue 29 Aug 2023 07:20:50 PM IDT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found listener-2.0.1.tgz
==> Validating source files with sha256sums...
    listener-2.0.1.tgz ... Passed
==> Extracting sources...
  -> Extracting listener-2.0.1.tgz with bsdtar
==> Starting prepare()...
patch: **** Can't open patch file portaudio_default_input_device.diff : No such file or directory
==> ERROR: A failure occurred in prepare().
    Aborting...

Last edited by RedArcher (2023-08-29 19:27:56)

Offline

#2 2023-08-29 16:32:17

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,808

Re: [SOLVED] Packaging Listener

The patch needs to be in the source array

Offline

#3 2023-08-29 19:25:15

RedArcher
Member
From: South Africa
Registered: 2009-09-03
Posts: 115

Re: [SOLVED] Packaging Listener

Thank you, Scimmia!

The following PKGBUILD work!

pkgname=listener
pkgver=2.0.1
pkgrel=1
pkgdesc="This program listens for sound. If it detects any, it starts recording automatically and also automatically stops when things become silent again."
arch=('i686' 'x86_64')
url="https://www.vanheusden.com/listener/"
license=('GPL')
depends=('glibc')
#source=("https://www.vanheusden.com/listener/$pkgname-$pkgver.tgz")
source=(
  "https://www.vanheusden.com/listener/$pkgname-$pkgver.tgz"
  "portaudio_default_input_device.diff")
sha256sums=(
  'ae08c0b3cfb4c38eaa0188b375c0e4c868f66c5706e33d33e210cd0320e035bc'
  'f28b568f84b528c9193f9a4d4ddc4a76587f9639c08e746ef5ced059eb38fd75')

prepare() {
  patch --directory="$pkgname-$pkgver" --forward --strip=1 --input="$srcdir/portaudio_default_input_device.diff"
}

build() {
  cd "$srcdir/$pkgname-$pkgver"
  make
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  # install configuration file
  install -Dm644 listener.conf "$pkgdir/usr/local/etc/listener.conf"
  install -Dm755 listener "$pkgdir/usr/bin/listener"
  #make DESTDIR="$pkgdir/" install
}

Offline

Board footer

Powered by FluxBB