r/voidlinux • u/ajicrystal • Apr 17 '26
Adding options to source template
I managed to compile my favourite console music player - MOC. I created my first xbps-src template below. Its very basic but works for my options. How do you create build options for ogg support for example - libvorbis, libogg only if required ?
any other feedback welcome.
#Template file for 'mocp'
pkgname=mocp
version=2.5.2
revision=1
build_style=gnu-configure
configure_args=""
hostmakedepends="pkg-config"
makedepends="ncurses-devel db-devel libflac-devel libid3tag-devel libmad-devel alsa-lib-devel libltdl-devel libcurl-devel"
depends="ncurses alsa-lib libflac libid3tag libmad libcurl"
short_desc="Music player"
maintainer="Maintainer <email>"
license="GPL"
homepage="https://moc.daper.net/"
distfiles="http://ftp.daper.net/pub/soft/moc/stable/moc-${version}.tar.bz2"
checksum="f3a68115602a4788b7cfa9bbe9397a9d5e24c68cb61a57695d1c2c3ecf49db08"
6
Upvotes
3
u/sanya567xxx Apr 17 '26
To add options to a template, you'd want to add the definition, add default options, option description, and use vopt_* functions in relevant variables/lines.
Taken from dvdauthor package as an example:
vopt_if is a bash function that checks if option with specific name has been enabled for the running build process, and returns first value if true, and second otherwise.
https://github.com/void-linux/void-packages/blob/master/Manual.md#build-options see here for more vopt_ functions, there's a few of them (mostly adapting to a particular build style's configuration options)
1
u/zlice0 Apr 17 '26
it was removed because it hasn't been updated in forever and isn't going to get changes for newer ffmpeg.
8 is pretty close to ready besides a couple packages and 4 should be removed entirely.
so if you build moc, you will need to also build ffmpeg4 at some point in the future.
you can look at these commits to get the template (i hate reddit markdown)
2
u/Slight-Brilliant3198 Apr 17 '26
I never underatood the advantage of having an xbps-src template, over simply manually compiling from source.
Why even bother? This is not a provocative question, I'm really interested because I never found a reason to bother with xbps-src, other than the kernel.
2
u/Blank-Inspection13 Apr 17 '26
put that build options in configure_args , can refer to specific , mentioned packages instruction.