pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/devel/gmp Rewrite to support builtin gmp on CentOS 6.5...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/257f237a03ff
branches:  trunk
changeset: 631482:257f237a03ff
user:      obache <obache%pkgsrc.org@localhost>
date:      Fri Mar 07 13:26:15 2014 +0000

description:
Rewrite to support builtin gmp on CentOS 6.5/x86_64.
* gmp.h is a wrapper to include archtecture specific include file.
* builtin library is in lib${LIBABISUFFIX}.

diffstat:

 devel/gmp/builtin.mk |  73 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 62 insertions(+), 11 deletions(-)

diffs (92 lines):

diff -r af7abe2ede24 -r 257f237a03ff devel/gmp/builtin.mk
--- a/devel/gmp/builtin.mk      Fri Mar 07 11:30:49 2014 +0000
+++ b/devel/gmp/builtin.mk      Fri Mar 07 13:26:15 2014 +0000
@@ -1,26 +1,77 @@
-# $NetBSD: builtin.mk,v 1.5 2014/03/07 11:30:49 obache Exp $
+# $NetBSD: builtin.mk,v 1.6 2014/03/07 13:26:15 obache Exp $
 
 BUILTIN_PKG:=  gmp
 
 BUILTIN_FIND_HEADERS_VAR:=     H_GMP
 BUILTIN_FIND_HEADERS.H_GMP=    gmp.h gmp/gmp.h
-PKGCONFIG_FILE.gmp=    H_GMP
-PKGCONFIG_BASE.gmp=    ${H_GMP:H:S/\gmp$//:H}
+
+BUILTIN_VERSION_SCRIPT.gmp=                                            \
+               { ${ECHO} "\#include <${H_GMP}>";                       \
+                 ${ECHO} "__GNU_MP_VERSION/__GNU_MP_VERSION_MINOR/__GNU_MP_VERSION_PATCHLEVEL";                                                                \
+               } | ${CCPATH:U${CC}} -E  - | ${SED} -e 's,/,.,g' | ${TAIL} -1
+
+.include "../../mk/buildlink3/bsd.builtin.mk"
+
+###
+### Determine if there is a built-in implementation of the package and
+### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
+###
+.if !defined(IS_BUILTIN.gmp)
+IS_BUILTIN.gmp=                no
+.  if empty(H_GMP:M__nonexistent__) && empty(H_GMP:M${LOCALBASE}/*)
+IS_BUILTIN.gmp=                yes
+.  endif
+.endif
+MAKEVARS+=     IS_BUILTIN.gmp
 
-BUILTIN_VERSION_SCRIPT.gmp= ${AWK} \
-       '/\#define[ \t]*__GNU_MP_VERSION[ \t]/ { major = $$3; } \
-       /\#define[ \t]*__GNU_MP_VERSION_MINOR[ \t]/ { minor = $$3; } \
-       /\#define[ \t]*__GNU_MP_VERSION_PATCHLEVEL[ \t]/ { patch = $$3; } \
-       END { if (major!="" && minor!="" && patch!="") \
-       print major "." minor "." patch; else print ""; }'
+###
+### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
+### a package name to represent the built-in package.
+###
+.if !defined(BUILTIN_PKG.gmp) && \
+    !empty(IS_BUILTIN.gmp:M[yY][eE][sS]) && \
+    empty(H_GMP:M__nonexistent__)
+BUILTIN_VERSION.gmp!=  ${BUILTIN_VERSION_SCRIPT.gmp}
+BUILTIN_PKG.gmp=     gmp-${BUILTIN_VERSION.gmp}
+.endif
+MAKEVARS+=      BUILTIN_PKG.gmp
 
-.include "../../mk/buildlink3/pkgconfig-builtin.mk"
+###
+### Determine whether we should use the built-in implementation if it
+### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
+###
+.if !defined(USE_BUILTIN.gmp)
+.  if ${PREFER.gmp} == "pkgsrc"
+USE_BUILTIN.gmp=       no
+.  else
+USE_BUILTIN.gmp=       ${IS_BUILTIN.gmp}
+.    if defined(BUILTIN_PKG.gmp) && \
+        !empty(IS_BUILTIN.gmp:M[yY][eE][sS])
+USE_BUILTIN.gmp=       yes
+.      for _dep_ in ${BUILDLINK_API_DEPENDS.gmp}
+.        if !empty(USE_BUILTIN.gmp:M[yY][eE][sS])
+USE_BUILTIN.gmp!=      \
+        if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.gmp:Q}; then   \
+                ${ECHO} yes;                                            \
+        else                                                            \
+                ${ECHO} no;                                             \
+        fi
+.        endif
+.      endfor
+.    endif
+.  endif  # PREFER.gmp
+.endif
+MAKEVARS+=      USE_BUILTIN.gmp
+
 
 CHECK_BUILTIN.gmp?=    no
 .if !empty(CHECK_BUILTIN.gmp:M[Nn][Oo])
 .  if !empty(USE_BUILTIN.gmp:M[Yy][Ee][Ss])
-GMP_INCLUDE=           ${FIND_FILES_gmp:S/\/gmp.h//}
+GMP_INCLUDE=           ${H_GMP:H}
 CONFIGURE_ARGS+=       --with-gmp-include=${GMP_INCLUDE}
+BUILDLINK_INCDIRS.gmp= ${GMP_INCLUDE}
+CONFIGURE_ARGS+=       --with-gmp-lib=${BUILDLINK_PREFIX.gmp}/lib${LIBABISUFFIX}
+BUILDLINK_LIBDIRS.gmp= lib${LIBABISUFFIX}
 CPPFLAGS+=             -I${GMP_INCLUDE}
 CFLAGS+=               -I${GMP_INCLUDE}
 .  endif



Home | Main Index | Thread Index | Old Index