You are not logged in.

#1 2015-09-29 13:08:32

Ulfgard
Member
Registered: 2015-09-29
Posts: 2

PKGBUILD okay?

Hi forums,

I am relatively new to package building and wanted to add a package of the shark machine learning library to AUR. I have checked on two machines that it builds and installs but I am not 100% sure that everything is correct. Could someone check, whether this abides to the community standards and does the right thing?

Namcap seems to be mostly fine with it. The only warning that seems serious is the optional dependency to atlas-lapack: the PKGBUILD checks whether this package is available and if yes, builds against it. So it is optional in the sense of "not required" but if building with atlas installed and then removing atlas will result in a broken shark library. What is the best way to handle this? I would not want to force anyone to spent an eternity on installing atlas, just to try out the library - on the other hand, more serious users would always want this.

Here ist the PKGBUILD

# Maintainer: Oswin Krause oswin.krause@di.ku.dk
# Contributor:
pkgname=shark-ml-svn
pkgver=3.0.0
pkgrel=1
provides=('shark-ml')
conflicts=('shark-ml-svn')
pkgdesc="Shark C++ machine learning library"
arch=('i686' 'x86_64')
url="image.diku.dk/shark"
license=('LGPL3')
depends=('boost-libs>=1.55')
optdepends=('atlas-lapack')
makedepends=('cmake>=2.8' 'svn')
source=('Shark::svn+https://svn.code.sf.net/p/shark-project/code/trunk/Shark')
noextract=()
md5sums=('SKIP')

pkgver() {
	cd "$srcdir/Shark"
	printf "r%s" "$(svnversion | tr -d 'A-z')"
}

build() {
	cd "$srcdir/Shark"
	cmake "-DCMAKE_INSTALL_PREFIX=/usr/" "-DBUILD_EXAMPLES=OFF" "-DBUILD_TESTING=OFF" "-DBUILD_SHARED_LIBS=ON" .
	make
}

package() {
	cd "$srcdir/Shark"
	make DESTDIR="$pkgdir/" install
}

-- mod edit: added code tags.  Trilby --

Last edited by Trilby (2015-09-29 13:17:57)

Offline

#2 2015-09-29 13:11:27

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: PKGBUILD okay?

Not bad!

It should be "conflicts=('shark-ml)".
Get rid of the blank "noextract=()". 
Add the "http://" at the start of the URL.
I'd guess that you don't need the "'Shark::" at the start of the source.  From memory makepkg takes the last directory as the name anyway

Offline

#3 2015-09-29 13:21:37

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: PKGBUILD okay?

Welcome to the forums.  Please use code tags around file contents or command output on the forum.  I added them to your first post.

Ulfgard wrote:

the PKGBUILD checks whether this package is available and if yes, builds against it... What is the best way to handle this?

The best way would be to have two distinct PKGBUILDs, one for shark-atlas-something and the other for shark-something.  Strictly speaking, a PKGBUILD should build the same package on any machine it is run on (except for i686 x86_64 architecture differences) and a PKGBUILD should be able to be built in a clean chroot and/or built on one machine and installed on a separate one.  So the kind of build-time conditional you use for atlas is ill-advised.

That said, if you stick with it, you wouldn't be the only one cutting that corner in the AUR.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2015-09-29 14:33:01

Ulfgard
Member
Registered: 2015-09-29
Posts: 2

Re: PKGBUILD okay?

Hmm I understand. Thanks for adding code tags, I did not know they existed here smile. And thank for the good advise!


So, I should have two build files, number 1 with atlas:

# Maintainer: Oswin Krause oswin.krause@di.ku.dk
# Contributor:
pkgname=shark-ml-atlas-svn
pkgver=3.0.0
pkgrel=1
provides=('shark-ml')
conflicts=('shark-ml')
pkgdesc="Shark C++ machine learning library"
arch=('i686' 'x86_64')
url="http://image.diku.dk/shark"
license=('LGPL3')
depends=('boost-libs>=1.55' 'atlas-lapack')
makedepends=('cmake>=2.8' 'svn')
source=('svn+https://svn.code.sf.net/p/shark-project/code/trunk/Shark')
md5sums=('SKIP')

pkgver() {
	cd "$srcdir/Shark"
	printf "r%s" "$(svnversion | tr -d 'A-z')"
}

build() {
	cd "$srcdir/Shark"
	cmake "-DCMAKE_INSTALL_PREFIX=/usr/" "-DBUILD_EXAMPLES=OFF" "-DBUILD_TESTING=OFF" "-DBUILD_SHARED_LIBS=ON" .
	make
}

package() {
	cd "$srcdir/Shark"
	make DESTDIR="$pkgdir/" install
}

number 2 without:

# Maintainer: Oswin Krause oswin.krause@di.ku.dk
# Contributor:
pkgname=shark-ml-svn
pkgver=3.0.0
pkgrel=1
provides=('shark-ml')
conflicts=('shark-ml')
pkgdesc="Shark C++ machine learning library"
arch=('i686' 'x86_64')
url="http://image.diku.dk/shark"
license=('LGPL3')
depends=('boost-libs>=1.55')
makedepends=('cmake>=2.8' 'svn')
source=('svn+https://svn.code.sf.net/p/shark-project/code/trunk/Shark')
md5sums=('SKIP')

pkgver() {
	cd "$srcdir/Shark"
	printf "r%s" "$(svnversion | tr -d 'A-z')"
}

build() {
	cd "$srcdir/Shark"
	cmake "-DCMAKE_INSTALL_PREFIX=/usr/" "-DBUILD_EXAMPLES=OFF"\
             "-DENABLE_ATLAS=OFF" "-DBUILD_TESTING=OFF" "-DBUILD_SHARED_LIBS=ON" .
	make
}

package() {
	cd "$srcdir/Shark"
	make DESTDIR="$pkgdir/" install
}

and if i understood correctly, as both provide and conflict with shark-ml, installing the second when the first is already installed will conflict and vice-versa.

Last edited by Ulfgard (2015-09-29 14:33:27)

Offline

Board footer

Powered by FluxBB