pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/compiler Avoid using "type" to find the absolute pa...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/9bcd748bea2c
branches:  trunk
changeset: 467565:9bcd748bea2c
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Tue Feb 03 03:47:45 2004 +0000

description:
Avoid using "type" to find the absolute path to the compiler.  We find it
ourselves now using some make variable magic.

diffstat:

 mk/compiler/gcc.mk |  58 ++++++++++++++++++++++++++++-------------------------
 1 files changed, 31 insertions(+), 27 deletions(-)

diffs (109 lines):

diff -r 31d2af22f422 -r 9bcd748bea2c mk/compiler/gcc.mk
--- a/mk/compiler/gcc.mk        Tue Feb 03 01:43:32 2004 +0000
+++ b/mk/compiler/gcc.mk        Tue Feb 03 03:47:45 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: gcc.mk,v 1.13 2004/02/02 12:45:08 jlam Exp $
+# $NetBSD: gcc.mk,v 1.14 2004/02/03 03:47:45 jlam Exp $
 
 .if !defined(COMPILER_GCC_MK)
 COMPILER_GCC_MK=       defined
@@ -18,25 +18,32 @@
 _GCC3_PATTERNS=        2.95.[4-9]* 2.95.[1-9][0-9]* 2.9[6-9] 2.9[6-9].*        \
                2.[1-9][0-9][0-9]* 3.* [4-9]*
 
-.if !defined(_IS_BUILTIN_GCC)
+_CC=   ${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
+.for _dir_ in ${PATH:C/\:/ /g}
+.  if empty(_CC:M/*)
+.    if exists(${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//})
+_CC=   ${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
+.    endif
+.  endif
+.endfor
+
+.if !empty(_CC:M${LOCALBASE}/*)
+_IS_BUILTIN_GCC=       NO
+.else
+.  if !empty(_CC:M/*)
 #
 # GCC in older versions of Darwin report "Apple Computer ... based on gcc
 # version ...", so we can't just grep for "^gcc".
 #
 _IS_BUILTIN_GCC!=      \
-       gccpath="`${TYPE} ${CC} | ${AWK} '{ print $$NF }'`";            \
-       case $$gccpath in                                               \
-       ${LOCALBASE}/*)                                                 \
+       if ${_CC} -v 2>&1 | ${GREP} -q "gcc version"; then      \
+               ${ECHO} "YES";                                          \
+       else                                                            \
                ${ECHO} "NO";                                           \
-               ;;                                                      \
-       *)                                                              \
-               if ${CC} -v 2>&1 | ${GREP} -q 'gcc version'; then       \
-                       ${ECHO} "YES";                                  \
-               else                                                    \
-                       ${ECHO} "NO";                                   \
-               fi;                                                     \
-               ;;                                                      \
-       esac
+       fi
+.  else
+_IS_BUILTIN_GCC=       NO
+.  endif
 .endif
 
 # Distill the GCC_REQD list into a single _GCC_REQD value that is the
@@ -143,11 +150,11 @@
 .  if !empty(_IS_BUILTIN_GCC:M[nN][oO])
 _USE_PKGSRC_GCC=       YES
 .  else
-_GCC_VERSION_STRING!=  ${CC} -v 2>&1 | ${GREP} 'gcc version'
+_GCC_VERSION_STRING!=  ${_CC} -v 2>&1 | ${GREP} 'gcc version'
 .    if !empty(_GCC_VERSION_STRING:Megcs*)
 _GCC_VERSION=  2.8.1           # egcs is considered to be gcc-2.8.1.
 .    elif !empty(_GCC_VERSION_STRING:Mgcc*)
-_GCC_VERSION!= ${CC} -dumpversion
+_GCC_VERSION!= ${_CC} -dumpversion
 .    else
 _GCC_VERSION=  0
 .    endif
@@ -168,22 +175,18 @@
 # link against gcc shared libs.
 #
 _COMPILER_LD_FLAG=     -Wl,
+.  if !empty(_CC:M${LOCALBASE}/*)
+_GCC_SUBPREFIX=                ${_CC:T:S/\/bin$//:S/${LOCALBASE}\///:S/${LOCALBASE}//}/
+.  else
 _GCC_SUBPREFIX!=       \
        if ${PKG_INFO} -qe ${_GCC_PKGBASE}; then                        \
                ${PKG_INFO} -f ${_GCC_PKGBASE} |                        \
                ${GREP} "File:.*bin/gcc" |                              \
                ${SED} -e "s/.*File: *//;s/bin\/gcc.*//;q";             \
        else                                                            \
-               gccpath="`${TYPE} ${CC} | ${AWK} '{ print $$NF }'`";    \
-               case $$gccpath in                                       \
-               ${LOCALBASE}/*)                                         \
-                       ${ECHO} "`${BASENAME} $$gccpath`/";             \
-                       ;;                                              \
-               *)                                                      \
-                       ${ECHO} "not_found/";                           \
-                       ;;                                              \
-               esac
+               ${ECHO} "not_found/";                                   \
        fi
+.  endif
 _GCC_PREFIX=           ${LOCALBASE}/${_GCC_SUBPREFIX}
 _GCC_ARCHDIR!=         \
        if [ -x ${_GCC_PREFIX}bin/gcc ]; then                           \
@@ -257,8 +260,9 @@
 .  endif
 .else
 .  if !empty(_IS_BUILTIN_GCC:M[yY][eE][sS])
-_GCC_PATH!=    ${TYPE} ${CC} | ${AWK} '{ print $$NF }'
-PATH:=         ${_GCC_PATH:H}:${PATH}
+.    if !empty(_CC:M/*)
+PATH:=         ${_CC:H}:${PATH}
+.    endif
 .  endif
 .endif
 



Home | Main Index | Thread Index | Old Index