You are not logged in.

#1 2013-09-23 03:42:12

farmerdave
Member
Registered: 2011-11-23
Posts: 66

creating package for mythtv commercial detection with silence

There is a new method emerging on commercial detection for MythTV, see here: http://www.mythtv.org/wiki/Commercial_d … freeviewHD
On that page is the code for silence.cpp, silence.py, silence.preset, silence_au.preset and a makefile.

I thought I would use this opportunity to learn how to make a package. So far I placed the makefile, silence.cpp and silence.py into a folder called silence-1.0, and then made a tar.gz archive. That archive along with silence.preset and silence_au.preset are in my sources folder. I've then created the following PKGBUILD file:

# Maintainer: farmerdave <farmerdave@email.com>
pkgname=silence
pkgver=1.0
pkgrel=1
pkgdesc="A python program based on Mythcommflag-wrapper (thank you Cowbut) that can be used on UK FreeviewHD channels, Australian HD and SD Freeview channels, and probably others."
arch=('i686' 'x86_64')
url="http://www.mythtv.org/wiki/Commercial_detection_with_silence_for_UK_freeviewHD"
license=('unknown - MythTV')
depends=('mythtv' 'gcc' 'make' 'libsndfile' 'python2')
makedepends=()
conflicts=()
replaces=()
backup=()
install='silence.install'
source=($pkgname-$pkgver.tar.gz
		'silence.preset'
		'silence_au.preset')
md5sums=('6e8a708b10bafc893382a79cfa83f446'
         'cd1ecf4769dd14a021c5767838348674'
         'd03a06e3f17ed3945fbe6ec54da275c4')

build() {
	cd "$srcdir/$pkgname-$pkgver"
	./configure --prefix=/usr
	make
}

package() {
	cd "$srcdir/$pkgname-$pkgver"
	make DESTDIR="$pkgdir/" install
}

I'm getting the following error which I would like help with.

$ makepkg -cs
==> Making package: silence 1.0-1 (Mon Sep 23 12:55:51 CST 2013)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found silence-1.0.tar.gz
  -> Found silence.preset
  -> Found silence_au.preset
==> Validating source files with md5sums...
    silence-1.0.tar.gz ... Passed
    silence.preset ... Passed
    silence_au.preset ... Passed
==> Extracting sources...
  -> Extracting silence-1.0.tar.gz with bsdtar
==> Removing existing pkg/ directory...
==> Starting build()...
make: `all' is up to date.
==> Entering fakeroot environment...
==> Starting package()...
install -p -t /usr/local/bin silence silence.py
install: cannot create regular file ‘/usr/local/bin/silence’: Permission denied
install: cannot create regular file ‘/usr/local/bin/silence.py’: Permission denied
make: *** [install] Error 1
==> ERROR: A failure occurred in package().
    Aborting...

Do I need to modify the provided 'makefile'?

Offline

#2 2013-09-23 03:49:49

fukawi2
Forum Moderator
From: .vic.au
Registered: 2007-09-28
Posts: 5,266
Website

Re: creating package for mythtv commercial detection with silence

It looks like the Makefile does not respect DESTDIR so yes, you'll likely have to modify it. EDIT: The alternative is just to replicate the commands that the Makefile runs directly in the PKGBUILD. Being such a simple Makefile, this is probably a better option IMHO.

On another note, there is no point adding the source files to a tarball. You can source them directly:

source=('silence.cpp', 'silence.py', 'Makefile', 'silence.preset', 'silence_au.preset')

Having said that, if you plan to submit this to the AUR then source files are not permitted. You'll need to find somewhere to host the source (if MythTV don't provide any). You could perhaps create your own GitHub repository to server them up.

Last edited by fukawi2 (2013-09-23 03:50:46)

Offline

#3 2013-09-23 09:33:10

farmerdave
Member
Registered: 2011-11-23
Posts: 66

Re: creating package for mythtv commercial detection with silence

I might need some guidance on that.
I tried two methods so far. The first is to modify the PKGBUILD so that the package() section looks like

package() {
	cd "$srcdir/$pkgname-$pkgver"
	install -p -t "$pkgdir/usr/local/bin/"
}

which results in a

pkg/silence/usr/local/bin’: No such file or directory
==> ERROR: A failure occurred in package().
    Aborting...

The second way I tried was to change the makefile to read

CC        = g++
CFLAGS    = -c -Wall -std=c++0x
LIBPATH   = -L/usr/lib
DESTDIR = /usr/local/bin

.PHONY: clean install

all: silence
	
silence: silence.o
	$(CC) silence.o -o $@ $(LIBPATH) -lsndfile

.cpp.o:
	$(CC) $(CFLAGS) $< -o $@

install: silence silence.py
	install -p -t $(DESTDIR) $^

clean: 
	-rm -f silence *.o

and the PKGBUILD to

package() {
	cd "$srcdir/$pkgname-$pkgver"
	make DESTDIR="$pkgdir/usr/local/bin/" install
}

which says the same thing (No such file or directory).

If I set DESTDIR="$pkgdir", then a package gets created and installs to /

Offline

#4 2013-09-23 10:05:24

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,414
Website

Re: creating package for mythtv commercial detection with silence

@op - Isn't there a mythtv agreed-up location for scripts?  PKGBUILDs should never install to /usr/local... what about /usr/share/mythtv/something ?

EDIT: the mythtv package actually puts scripts in /usr/share/mythtv so that's probably a good home for this one.

1) Package up the files from that wiki into a tarball and host somewhere like fukawi2 said.  You should probably try to email Hippo from that wiki page to do it and to declare a formal license.
2) Try this PKGBUILD

# Maintainer: farmerdave <farmerdave@email.com>
pkgname=silence
pkgver=1.0
pkgrel=1
pkgdesc="A python program based on Mythcommflag-wrapper (thank you Cowbut) that can be used on UK FreeviewHD channels, Australian HD and SD Freeview channels, and probably others."
arch=('i686' 'x86_64')
url="http://www.mythtv.org/wiki/Commercial_detection_with_silence_for_UK_freeviewHD"
license=('unknown - MythTV')
depends=('libsndfile' 'python2')
optdepends=('mythtv: A Homebrew PVR project')
source=($pkgname-$pkgver.tar.xz)
md5sums=('94a442a87a502f5c56df047fd8ebdccd')

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

package() {
	cd "$pkgname-$pkgver"
	install -Dm755 $pkgname "$pkgdir/usr/bin/$pkgname"
	install -m755 $pkgname "$pkgdir/usr/share/mythtv/$pkgname.py"
}

Last edited by graysky (2013-09-23 14:18:59)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2013-09-23 12:24:36

farmerdave
Member
Registered: 2011-11-23
Posts: 66

Re: creating package for mythtv commercial detection with silence

Thanks fukawi2 and graysky, the PKGBUILD now works. I'll get to work on hosting this as suggested.

Offline

#6 2013-09-23 14:20:01

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,414
Website

Re: creating package for mythtv commercial detection with silence

You're welcome.  I edited my post installing the compiled binary to /usr/bin rather than to /usr/share/mythtv.  The mythtv package places perl scripts in the /usr/share/mythtv and formal binaries in /usr/bin.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

Board footer

Powered by FluxBB