You are not logged in.

#1 2019-05-11 03:06:47

phundrak
Member
From: Paris
Registered: 2019-05-11
Posts: 3
Website

PKGBUILD review request

Hello, this is the first time I try to make a package and submitting it. I’ve tested it on several machines running Arch (kernels 5.0.13, 5.0.10-zen and 5.0.7), the latter had literally no development tools, not even gcc. Here is the PKGBUILD:

# Maintainer: Lucien Cartier-Tilet <phundrak@phundrak.fr>
pkgname=gl4dummies-git
pkgver=r289.714a7c3
pkgrel=1
pkgdesc="C wrapper around OpenGL 3.3+."
arch=('x86_64')
url="http://gl4d.api8.fr/"
license=('GPL3')
depends=('sdl2')
makedepends=('git' 'meson' 'ninja' 'gcc' 'pkg-config')
optdepends=('sdl2_gfx: low level support'
            'sdl2_image: texture support'
            'sdl2_mixer: audio support'
            'sdl2_net: networking support'
            'sdl2_ttf: TrueType fonts support')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=('gl4dummies::git+https://github.com/noalien/GL4Dummies.git')
md5sums=('SKIP')

pkgver() {
	cd "$srcdir/${pkgname%-git}"
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
	cd "$srcdir/${pkgname%-git}"
  meson build --prefix=/usr
  ninja -C build
}

package() {
	cd "$srcdir/${pkgname%-git}"
  DESTDIR="$pkgdir" ninja -C build install
  install -Dm644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md ChangeLog NEWS
  install -Dm644 -t "$pkgdir/usr/share/licences/$pkgname/" AUTHORS COPYING
}

I tested if the library was correctly installed by compiling this simple project.
The test project itself also requires the packages `sdl2_image`, `glfw` and for some reason `cmake` due to glfw3, if you want to compile it yourself.

Any review is welcome!

Offline

#2 2019-05-11 03:42:59

Allan
Member
From: Brisbane, AU
Registered: 2007-06-09
Posts: 10,889
Website

Re: PKGBUILD review request

Looks good to me.  You could drop ninja from makedepends as meson depends on that, but it makes no difference. Note you swapped from tab indents to spaces in build() and package().

Offline

#3 2019-05-11 04:37:40

phundrak
Member
From: Paris
Registered: 2019-05-11
Posts: 3
Website

Re: PKGBUILD review request

Alright, thank you! So something like this should do then?

# Maintainer: Lucien Cartier-Tilet <phundrak@phundrak.fr>
pkgname=gl4dummies-git
pkgver=r289.714a7c3
pkgrel=1
pkgdesc="C wrapper around OpenGL 3.3+."
arch=('x86_64')
url="http://gl4d.api8.fr/"
license=('GPL3')
depends=('sdl2')
makedepends=('git' 'meson' 'gcc' 'pkg-config')
optdepends=('sdl2_gfx: low level support'
            'sdl2_image: texture support'
            'sdl2_mixer: audio support'
            'sdl2_net: networking support'
            'sdl2_ttf: TrueType fonts support')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=('gl4dummies::git+https://github.com/noalien/GL4Dummies.git')
md5sums=('SKIP')

pkgver() {
  cd "$srcdir/${pkgname%-git}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "$srcdir/${pkgname%-git}"
  meson build --prefix=/usr
  ninja -C build
}

package() {
  cd "$srcdir/${pkgname%-git}"
  DESTDIR="$pkgdir" ninja -C build install
  install -Dm644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md ChangeLog NEWS
  install -Dm644 -t "$pkgdir/usr/share/licences/$pkgname/" AUTHORS COPYING
}
Allan wrote:

Note you swapped from tab indents to spaces in build() and package().

My bad, vim didn’t swap the tabs to spaces automatically and I forgot to check that.

Offline

#4 2019-05-11 10:16:13

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 7,288

Re: PKGBUILD review request

meson build --prefix=/usr

Projects using meson often have all kinds of special options that are autoeselected and change behaviour.
I suggest you add meson configure build to verify what options meson has set.


Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

#5 2019-05-11 14:23:59

phundrak
Member
From: Paris
Registered: 2019-05-11
Posts: 3
Website

Re: PKGBUILD review request

Alright, so with

build() {
  cd "$srcdir/${pkgname%-git}"
  meson build --prefix=/usr
  meson configure build
  ninja -C build
}

instead, we should be good?

Offline

#6 2019-05-12 13:18:46

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 7,288

Re: PKGBUILD review request

Not entirely.


You have lots of ${pkgname%-git} expressions, but pkgname is set to gl4dummies-git .
This suggests you wanted to use something like

_pkgname=gl4dummies
pkgname=$_pkgname-git

in the PKGBUILD.

NOTE : If the % does strip the "-git" part this will work, but in my personal opinion stripping a part and immediately re-adding it reduces the readability.


Other pointers :

all functions in a PKGBUILD start at $srcdir, you can use relative paths .

check the provides/conflicts arrays, I doubt it does what you want


Edit : I misunderstood what % does with strings in Bash.

Last edited by Lone_Wolf (2019-05-13 10:25:14)


Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

#7 2019-05-12 23:32:49

Allan
Member
From: Brisbane, AU
Registered: 2007-06-09
Posts: 10,889
Website

Re: PKGBUILD review request

$ pkgname=gl4dummies-git
$ provides=("${pkgname%-git}")
$ echo ${provides[@]}
gl4dummies

Looks like it does exactly what is needed.

Offline

#8 2019-05-13 10:21:30

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 7,288

Re: PKGBUILD review request

Confirmed, after some searching I found http://tldp.org/LDP/abs/html/refcards.html#AEN22828 that shows what % does with strings in bash.

editing post #6 now.


Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

Board footer

Powered by FluxBB