pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/buildlink3 Allow buildlink3.mk file to specify BUIL...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/9037e567bbf4
branches:  trunk
changeset: 460814:9037e567bbf4
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Thu Sep 04 19:38:06 2003 +0000

description:
Allow buildlink3.mk file to specify BUILDLINK_CFLAGS.<pkg> that are
automatically added to CFLAGS and CXXFLAGS.  Note that -D... and -I...
settings should go into BUILDLINK_CPPFLAGS.<pkg> instead.  BUILDLINK_CFLAGS
is reserved for stuff like "-pthread" or other compiler-specific flags.

Also note why we add BUILDLINK_CPPFLAGS.<pkg> to both CFLAGS and CXXFLAGS
(because a lot of software just uses CFLAGS and ignores any CPPFLAGS value
that we pass to it).

diffstat:

 mk/buildlink3/bsd.buildlink3.mk |  33 +++++++++++++++++++++++++++------
 1 files changed, 27 insertions(+), 6 deletions(-)

diffs (81 lines):

diff -r 41e4c464e296 -r 9037e567bbf4 mk/buildlink3/bsd.buildlink3.mk
--- a/mk/buildlink3/bsd.buildlink3.mk   Thu Sep 04 19:24:55 2003 +0000
+++ b/mk/buildlink3/bsd.buildlink3.mk   Thu Sep 04 19:38:06 2003 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink3.mk,v 1.3 2003/09/04 05:40:25 jlam Exp $
+# $NetBSD: bsd.buildlink3.mk,v 1.4 2003/09/04 19:38:06 jlam Exp $
 #
 # An example package buildlink3.mk file:
 #
@@ -112,10 +112,12 @@
 #                              relevant for buildlink3.mk files that
 #                              provide a setting for this variable.
 #
+# BUILDLINK_CFLAGS.<pkg>,
 # BUILDLINK_CPPFLAGS.<pkg>,
-# BUILDLINK_LDFLAGS.<pkg>      contain extra -D..., -I... and -L.../-Wl,-R
-#                              options to be passed to the compiler/linker
-#                              so that building against <pkg> will work.
+# BUILDLINK_LDFLAGS.<pkg>      contain extra compiler options, -D..., -I...
+#                              and -L.../-Wl,-R options to be passed to the
+#                              compiler/linker so that building against
+#                              <pkg> will work.
 #
 # BUILDLINK_INCDIRS.<pkg>,
 # BUILDLINK_LIBDIRS.<pkg>      subdirectories of BUILDLINK_PREFIX.<pkg>
@@ -168,10 +170,12 @@
 # BUILDLINK_CPPFLAGS and BUILDLINK_LDFLAGS contain the proper -I...
 # and -L.../-Wl,-R... options to be passed to the compiler and linker
 # to find the headers and libraries for the various packages at
-# configure/build time.
+# configure/build time.  BUILDLINK_CFLAGS contains any special compiler
+# options needed when building against the various packages.
 #
 BUILDLINK_CPPFLAGS=    # empty
 BUILDLINK_LDFLAGS=     # empty
+BUILDLINK_CFLAGS=      # empty
 
 .for _pkg_ in ${BUILDLINK_PACKAGES}
 .  for _flag_ in ${BUILDLINK_CPPFLAGS.${_pkg_}}
@@ -184,6 +188,11 @@
 BUILDLINK_LDFLAGS+=    ${_flag_}
 .    endif
 .  endfor
+.  for _flag_ in ${BUILDLINK_CFLAGS.${_pkg_}}
+.    if empty(BUILDLINK_CFLAGS:M${_flag_})
+BUILDLINK_CFLAGS+=     ${_flag_}
+.    endif
+.  endfor
 .  if !empty(BUILDLINK_INCDIRS.${_pkg_})
 .    for _dir_ in ${BUILDLINK_INCDIRS.${_pkg_}:S/^/${BUILDLINK_PREFIX.${_pkg_}}\//}
 .      if exists(${_dir_})
@@ -226,16 +235,28 @@
 BUILDLINK_LDFLAGS+=    ${_COMPILER_LD_FLAG}${RPATH_FLAG}${X11BASE}/lib
 .endif
 
-.for _flag_ in ${BUILDLINK_CPPFLAGS}
+.for _flag_ in ${BUILDLINK_CFLAGS}
 .  if empty(CFLAGS:M${_flag_})
 CFLAGS+=       ${_flag_}
 .  endif
 .  if empty(CXXFLAGS:M${_flag_})
 CXXFLAGS+=     ${_flag_}
 .  endif
+.endfor
+.for _flag_ in ${BUILDLINK_CPPFLAGS}
 .  if empty(CPPFLAGS:M${_flag_})
 CPPFLAGS+=     ${_flag_}
 .  endif
+#
+# We add BUILDLINK_CPPFLAGS to both CFLAGS and CXXFLAGS since much software
+# ignores the value of CPPFLAGS that we set in the environment.
+#
+.  if empty(CFLAGS:M${_flag_})
+CFLAGS+=       ${_flag_}
+.  endif
+.  if empty(CXXFLAGS:M${_flag_})
+CXXFLAGS+=     ${_flag_}
+.  endif
 .endfor
 .for _flag_ in ${BUILDLINK_LDFLAGS}
 .  if empty(LDFLAGS:M${_flag_})



Home | Main Index | Thread Index | Old Index