pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CFLAGS vs COPTS in mk.conf for pkgsrc compiling



El 7/9/24 a las 11:12, Roland Illig escribió:
Am 07.09.2024 um 08:37 schrieb Ramiro Aceves:
Hello,


Hi Roland,

I started reading mk.conf page to see what variables could be tuned:

The mk.conf manual page applies primarily to the NetBSD base system.
Some parts of it may not apply to pkgsrc.

The pkgsrc guide at https://www.netbsd.org/docs/pkgsrc/pkgsrc.html
mentions CFLAGS several times and never COPTS, so that should be the way
to go.

Yes, also in this PDF document where it is easier to do a global search, COPTS is missing (https://www.netbsd.org/docs/pkgsrc/pkgsrc.pdf)


"Also note that CFLAGS should never be set in mk.conf."

In the context where this sentence occurs, it can also be interpreted as
"appending to CFLAGS is fine, just don't override it, as its default
value includes the DBG variable". Not sure why nobody fixed this
ambiguous wording in the past 17 years.

Thanks so much for the explanation. Yes, it is a bit confusing and can be interpreted as you say.


so I used COPTS instead of CFLAGS

That doesn't work in pkgsrc since in
pkgtools/bootstrap-mk-files/files/sys.mk, the default value for CFLAGS
does not include COPTS.

To find this out, I ran this command in emulators/dosbox:
bmake -V CFLAGS -dA  2>&1 | less

In the output, I searched for "Global: CFLAGS" and then went backwards
to "Parse_PushInput" to see which file caused the variable assignment.

In the NetBSD base system, COPTS is not added to CFLAGS unconditionally,
as the output of this command reveals:
grep 'CFLAGS.*COPTS' /usr/share/mk/*.mk

 From the filenames in the output, you can see that COPTS only applies to
host libraries, kernel modules, libraries and programs. Notably, this
excludes pkgsrc packages.



Thanks so much for the detailed information. All this pkgsrc makefiles structure appears very overhelming for newbies. :-)

Anyway, I am learning lots of things.

Regards.
Ramiro.


Roland




Home | Main Index | Thread Index | Old Index