questions about Makefile

Martin Waschbüsch martin at waschbuesch.de
Sun Aug 14 15:03:24 UTC 2016


> Am 14.08.2016 um 15:37 schrieb Mathieu Arnold <mat at FreeBSD.org>:
> 
> +--On 13 août 2016 10:34:27 +0200 Martin Waschbüsch
> <martin at waschbuesch.de> wrote:
> | Hi all,
> | 
> | I am in the process of creating a port for a module / plugin for
> | net-mgmt/zabbix-agent.
> | 
> | I tried to follow the Porter's Handbook, but still have three items I am
> | uncertain about:
> | 
> | 1) The plugin (obviously) relies on the zabbix-agent sources.
> | I added
> | 
> | BUILD_DEPENDS=	${NONEXISTENT}:net-mgmt/zabbix3-agent:extract
> | 
> | to make sure that the sources will always be extracted.
> 
> You should use :patch, so that the sources are properly patched for FreeBSD.

Indeed! Thanks.

> | Now, how do I
> | properly reference these sources in my port? What I have right now (just
> | to make it compile) is this:
> | 
> | CONFIGURE_ARGS=
> | 	--with-zabbix=${PORTSDIR}/net-mgmt/zabbix3-agent/work/zabbix-3.0.2
> | 
> | Obviously, I'd want to somehow get that path without having to specify
> | the version number as I want to build against the version currently
> | available in ports. How do I do that? Is there any reference to something
> | like this in the handbook?
> 
> That doesn't work because:
> 
> 1) the base directory of a workdir is changeable with WRKDIRPREFIX
> 2) If zabbix gets updated, it breaks.
> 
> you have to use something like:
> 
> ZABBIX_WRKSRC!=  cd ${.CURDIR:H:H}/net-mgmt/zabbix3-agent && make -V WRKSRC

I'll give that a try.

> | 2) Imagine this module could be compiled against both, zabbix2-agent and
> | zabbix3-agent. I guess the cleanest way to support this would be having
> | one port per zabbix-version? If that is the case, should the whole thing
> | perhaps be a slave port belonging to zabbix{2,3}-agent?
> | 
> | 3) I found that I cannot (as a normal user) successfully run 'make
> | package'. I get an error like this:
> | mkdir: /usr/ports/net-mgmt/foobar/work: Permission denied
> | Before I add 'NEED_ROOT=yes' to the Makefile, are there requirements for
> | a normal user to build ports? e.g. does said user have to be in a certain
> | group, etc.? I mean, every port will have to create a workdir, and I
> | cannot imagine every port as having 'NEED_ROOT=yes' in their Makefile...
> | ;-)
> 
> Well, your user needs to be able to write, so, either checkout a ports tree
> in your home directory, and set PORTSDIR accordingly, or chown -R
> /usr/ports to your user, or set WRKDIRPREFIX to somewhere your user can
> write, for example /tmp.

Thank you very much, Mathieu! This is very very helpful.


More information about the freebsd-ports mailing list