Subject: custom CFLAGS not getting set
To: None <>
From: Jeremy C. Reed <>
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/ 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/ I have
CFLAGS+=        -g0
which is used.

I used -d A with bmake and found out:

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

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

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

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

and this is repeated.

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

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

Under NetBSD it is working fine.

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

I believe that is from mk-files.

but other 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/ is different.

   Jeremy C. Reed