tech-pkg archive

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

Using cpuflags in pkgsrc



        Currently using cpuflags in pkgsrc involves adding
        .sinclude "/usr/pkg/share/mk/cpuflags.mk"
        to /etc/mk.conf, at which point it will happily set the
        compiler flags to target the current CPU.

        Unfortunately, if a package requires a different gcc version
        (qemu on NetBSD 4 or later is a good example), or the user
        has set GCC_REQD this fails as the cpuflags.mk include
        happens before compiler.mk is processed. (PR pkg/24811)

        Thw following (when combined with a pkgsrc tree containing
        cpuflags 1.35 or later) allows the user to set USE_CPUFLAGS=yes
        and have compiler.mk include cpuflags.mk from within the
        pkgsrc tree.

        An installed cpuflags is still useful to someone using build.sh,
        or just compiling software outside of pkgsrc, so it can still
        be included in the normal fashion.

        This dual usage of cpuflags.mk does feel a little awkward
        (read: trying to be too clever)

        What do people think?

--
                David/absolute       -- www.NetBSD.org: No hype required --

Index: mk/compiler.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/compiler.mk,v
retrieving revision 1.68
diff -u -r1.68 compiler.mk
--- mk/compiler.mk      20 Oct 2008 20:44:49 -0000      1.68
+++ mk/compiler.mk      20 Jan 2009 17:30:37 -0000
@@ -155,6 +155,12 @@
 .  endif
 .endfor

+# If USE_CPUFLAGS is set, include cpuflags.mk from within the pkgsrc tree
+#
+.if defined(USE_CPUFLAGS) && ${USE_CPUFLAGS} == "yes"
+. include "../devel/cpuflags/files/cpuflags.mk"
+.endif
+
 .if defined(ABI) && !empty(ABI)
 _WRAP_EXTRA_ARGS.CC+=  ${_COMPILER_ABI_FLAG.${ABI}}
 _WRAP_EXTRA_ARGS.CXX+= ${_COMPILER_ABI_FLAG.${ABI}}


Home | Main Index | Thread Index | Old Index