Subject: custom CFLAGS not getting set
To: None <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 11/30/2002 23:24:05
I noticed that packages with custom CFLAGS being set were not being
actually set in the environment or being used.

For example, I had a PR for www/dillo because the CFLAGS it sets wasn't
being used.

But now I had same problems when trying with different packages.

I can set in mk/bsd.prefs.mk and it will work.

I tried debugging with PKG_DEBUG_LEVEL=2 and also look in config.log files
and see that the CFLAGS is not changed (appended too).

For example, to net/gethost I add
CFLAGS+=	-g3
but it is not used (even after clean)

And example, in my mk/bsd.prefs.mk I have
CFLAGS+=        -g0
which is used.

I used -d A with bmake and found out:

expanding "sys.mk".../home/jeremy/netbsd/usr/pkg/share/mk/sys.mk
Global:.PARSEFILE = sys.mk
Global:CFLAGS = ${DBG}

Global:.PARSEFILE = Makefile
Global:CFLAGS = ${DBG} -g3     <-- as set in my Makefile

..returning /home/jeremy/netbsd/usr/pkg/share/mk/sys.mk
Global:.PARSEDIR = /home/jeremy/netbsd/usr/pkg/share/mk
Global:.PARSEFILE = sys.mk
Global:CFLAGS = ${DBG}      <--- go reset

Global:.PARSEDIR = ../../mk
Global:.PARSEFILE = bsd.prefs.mk
transformation .sh complete
Global:CFLAGS = ${DBG} -g0   <-- set again as I defined in mk/bsd.prefs.mk

and this is repeated.

I can't really understand the order of all the output. It also has:

 expanding "sys.mk".../home/jeremy/netbsd/usr/pkg/share/mk/sys.mk
 Global:MAKEFILE = /home/jeremy/netbsd/usr/pkg/share/mk/sys.mk
 Global:.PARSEDIR = /home/jeremy/netbsd/usr/pkg/share/mk
 Global:.PARSEFILE = sys.mk
*Global:CFLAGS = ${DBG}

Under NetBSD it is working fine.

Now I see that the Linux system's
/home/jeremy/netbsd/usr/pkg/share/mk/sys.mk has:
CFLAGS=         ${DBG}

I believe that is from mk-files.

but other mk/sys.mk have:
CFLAGS?=        ${DBG}

Any suggestions on how to further troubleshoot this?

I was using LOCALBASE=/usr, but I set LOCALBASE=/usr/pkg (and /usr/local)
and the PKG_DEBUG_LEVEL=2 debugging did show that.

I am doing this under Linux. My env is
env (GNU sh-utils) 2.0.

I also tried with newest pkgsrc/mk retrieved moments ago.

I used bootstrap-pkgsrc for this. But I do see that the
othersrc/bootstrap-pkgsrc/bmake/mk/sys.mk is different.


   Jeremy C. Reed
   http://bsd.reedmedia.net/