[BACK]Return to bsd.pkg.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / mk

Annotation of pkgsrc/mk/bsd.pkg.mk, Revision 1.1540.2.25

1.1540.2.25! tv          1: #      $NetBSD: bsd.pkg.mk,v 1.1540.2.24 2005/02/25 14:46:51 tv Exp $
1.1       agc         2: #
1.95      mrg         3: # This file is in the public domain.
1.1       agc         4: #
1.95      mrg         5: # This file is derived from bsd.port.mk - 940820 Jordan K. Hubbard.
1.1       agc         6: #
1.1540.2.5  tv          7: # Please see the pkgsrc/doc/guide manual for details on the
1.1540.2.1  tv          8: # variables used in this make file template.
1.1       agc         9: #
1.1540.2.11  tv         10: # XXX tv: rev 1.1554 is not merged yet (phase "error handlers")
                     11: #
1.1540.2.1  tv         12:
                     13: ############################################################################
                     14: # Include any preferences, if not already included, and common definitions
                     15: ############################################################################
1.197     hubertf    16:
1.272     tv         17: .include "../../mk/bsd.prefs.mk"
1.1537    jlam       18: .include "../../mk/bsd.hacks.mk"
                     19:
1.1540.2.1  tv         20: # _PKG_PHASES_WRKDIR is an ordered list of phases which require ${WRKDIR}
                     21: # to exist.  _PKG_PHASES_ALL also includes the phases from before ${WRKDIR}
                     22: # is created.  These macros are used below mainly in .for loops.
                     23:
                     24: _PKG_PHASES_ALL=       fetch checksum ${_PKG_PHASES_WRKDIR}
                     25: _PKG_PHASES_WRKDIR=    depends extract patch tools wrapper \
                     26:                        configure build test install package
                     27:
                     28: ############################################################################
                     29: # Transform package Makefile variables and set defaults
                     30: ############################################################################
1.567     fredb      31:
1.1540.2.14  tv         32: CHECK_FILES?=          NO      # run check-files after install
1.1540.2.13  tv         33: CHECK_FILES_STRICT?=   NO      # make check-files very strict on errors
1.1540.2.1  tv         34: CHECK_SHLIBS?=         YES     # run check-shlibs after install
1.272     tv         35: CLEANDEPENDS?=         NO
1.317     hubertf    36: DEINSTALLDEPENDS?=     NO      # add -R to pkg_delete
1.1540.2.1  tv         37: MKCRYPTO?=             YES     # build crypto packages by default
                     38: NOCLEAN?=              NO      # don't clean up after update
1.327     rh         39: REINSTALL?=            NO      # reinstall upon update
1.636     jlam       40: SHLIB_HANDLING?=       YES     # do automatic shared lib handling
1.1540.2.1  tv         41:
1.1540.2.5  tv         42: ##### Variant spellings
1.1540.2.1  tv         43:
                     44: .if defined(LICENCE) && !defined(LICENSE)
                     45: LICENSE=               ${LICENCE}
                     46: .endif
                     47: .if defined(ACCEPTABLE_LICENCES) && !defined(ACCEPTABLE_LICENSES)
                     48: ACCEPTABLE_LICENSES=   ${ACCEPTABLE_LICENCES}
                     49: .endif
                     50:
1.1540.2.5  tv         51: ##### PKGBASE, PKGNAME[_NOREV], PKGVERSION
1.5       hubertf    52:
1.460     mycroft    53: PKGBASE?=              ${PKGNAME:C/-[^-]*$//}
                     54: PKGVERSION?=           ${PKGNAME:C/^.*-//}
1.1498    jlam       55: .if defined(PKGREVISION) && !empty(PKGREVISION) && (${PKGREVISION} != "0")
                     56: .  if defined(PKGNAME)
                     57: PKGNAME_NOREV:=                ${PKGNAME}
                     58: PKGNAME:=              ${PKGNAME}nb${PKGREVISION}
                     59: .  else
                     60: PKGNAME?=              ${DISTNAME}nb${PKGREVISION}
                     61: PKGNAME_NOREV=         ${DISTNAME}
                     62: .  endif
                     63: .else
                     64: PKGNAME?=              ${DISTNAME}
                     65: PKGNAME_NOREV=         ${PKGNAME}
                     66: .endif
1.459     mycroft    67:
1.1540.2.5  tv         68: ##### PLIST
1.1540.2.1  tv         69:
                     70: .if ${PKG_INSTALLATION_TYPE} == "pkgviews"
                     71: PLIST_TYPE?=           dynamic
                     72: .endif
                     73: PLIST_TYPE?=           static
                     74:
                     75: .if !defined(PLIST_SRC)
                     76: .  if exists(${PKGDIR}/PLIST.common)
                     77: PLIST_SRC+=            ${PKGDIR}/PLIST.common
                     78: .  endif
                     79: .  if exists(${PKGDIR}/PLIST.${OPSYS})
                     80: PLIST_SRC+=            ${PKGDIR}/PLIST.${OPSYS}
1.1540.2.25! tv         81: .  endif
        !            82: .  if exists(${PKGDIR}/PLIST.${MACHINE_ARCH:C/i[3-6]86/i386/g})
1.1540.2.24  tv         83: PLIST_SRC+=            ${PKGDIR}/PLIST.${MACHINE_ARCH:C/i[3-6]86/i386/g}
1.1540.2.25! tv         84: .  endif
        !            85: .  if exists(${PKGDIR}/PLIST.${OPSYS}-${MACHINE_ARCH:C/i[3-6]86/i386/g})
1.1540.2.24  tv         86: PLIST_SRC+=            ${PKGDIR}/PLIST.${OPSYS}-${MACHINE_ARCH:C/i[3-6]86/i386/g}
1.1540.2.25! tv         87: .  endif
        !            88: .  if exists(${PKGDIR}/PLIST)
1.1540.2.1  tv         89: PLIST_SRC+=            ${PKGDIR}/PLIST
                     90: .  endif
                     91: .  if exists(${PKGDIR}/PLIST.common_end)
                     92: PLIST_SRC+=            ${PKGDIR}/PLIST.common_end
                     93: .  endif
1.1540.2.22  tv         94: .endif # !PLIST_SRC
1.851     jlam       95:
1.1540.2.5  tv         96: ##### Others
1.1540.2.1  tv         97:
                     98: _DISTDIR?=             ${DISTDIR}/${DIST_SUBDIR}
                     99: BUILD_DEFS?=           # empty
                    100: BUILD_DEPENDS?=                # empty
1.1540.2.7  tv        101: BUILD_TARGET?=         all
1.1540.2.18  tv        102: COMMENT?=              (no description)
                    103: CONFIGURE_DIRS?=       ${WRKSRC}
                    104: CONFIGURE_SCRIPT?=     ./configure
1.1540.2.1  tv        105: DEPENDS?=              # empty
                    106: DESCR_SRC?=            ${PKGDIR}/DESCR
1.1540.2.24  tv        107: DIGEST_ALGORITHMS?=    SHA1 RMD160
1.1540.2.1  tv        108: DISTFILES?=            ${DISTNAME}${EXTRACT_SUFX}
                    109: DISTINFO_FILE?=                ${PKGDIR}/distinfo
                    110: EXTRACT_ONLY?=         ${DISTFILES}
                    111: EXTRACT_SUFX?=         .tar.gz
1.1540.2.5  tv        112: INSTALL_DIRS?=         ${BUILD_DIRS}
                    113: INSTALL_MAKE_FLAGS?=   ${MAKE_FLAGS}
1.1540.2.1  tv        114: INSTALL_TARGET?=       install
1.999     agc       115: INTERACTIVE_STAGE?=    none
1.1540.2.1  tv        116: MAINTAINER?=           tech-pkg@NetBSD.org
                    117: MAKE_FLAGS?=           # empty
                    118: MAKEFILE?=             Makefile
1.1540.2.24  tv        119: PATCH_DIGEST_ALGORITHM?=SHA1
1.1540.2.1  tv        120: PKG_SUFX?=             .tgz
                    121: PKGFILE?=              ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
                    122: PKGREPOSITORY?=                ${PACKAGES}/${PKGREPOSITORYSUBDIR}
                    123: PKGREPOSITORYSUBDIR?=  All
                    124: PKGWILDCARD?=          ${PKGBASE}-[0-9]*
                    125: SVR4_PKGNAME?=         ${PKGNAME}
                    126: USE_DIGEST?=           YES
                    127: USE_GNU_TOOLS?=                # empty
                    128: WRKSRC?=               ${WRKDIR}/${DISTNAME}
                    129:
                    130: BUILD_DEFS_FIXED+=     PKGPATH
                    131: BUILD_DEFS_FIXED+=     OPSYS OS_VERSION MACHINE_ARCH MACHINE_GNU_ARCH
                    132: BUILD_DEFS_FIXED+=     CPPFLAGS CFLAGS FFLAGS LDFLAGS
                    133: BUILD_DEFS_FIXED+=     CONFIGURE_ENV CONFIGURE_ARGS
                    134: BUILD_DEFS_FIXED+=     OBJECT_FMT LICENSE RESTRICTED
                    135: BUILD_DEFS_FIXED+=     NO_SRC_ON_FTP NO_SRC_ON_CDROM
                    136: BUILD_DEFS_FIXED+=     NO_BIN_ON_FTP NO_BIN_ON_CDROM
                    137: BUILD_DEFS_FIXED+=     ${OSVERSION_SPECIFIC:DOSVERSION_SPECIFIC}
                    138:
1.1540.2.5  tv        139: ##### Non-overridable constants
1.1540.2.1  tv        140:
                    141: # Latest versions of tools required for correct pkgsrc operation.
                    142: DIGEST_REQD=           20010302
1.1540.2.19  tv        143: PKGTOOLS_REQD=         ${_OPSYS_PKGTOOLS_REQD:U20050204}
1.1540.2.1  tv        144:
1.1540.2.15  tv        145: PKG_DB_TMPDIR=         ${WRKDIR}/.pkgdb
1.1540.2.1  tv        146: DDIR=                  ${WRKDIR}/.DDIR
1.1540.2.15  tv        147: DESCR=                 ${PKG_DB_TMPDIR}/+DESC
1.1540.2.1  tv        148: DLIST=                 ${WRKDIR}/.DLIST
                    149: PLIST=                 ${WRKDIR}/.PLIST
                    150:
                    151: # Files to create for versioning and build information
1.1540.2.15  tv        152: BUILD_VERSION_FILE=    ${PKG_DB_TMPDIR}/+BUILD_VERSION
                    153: BUILD_INFO_FILE=       ${PKG_DB_TMPDIR}/+BUILD_INFO
1.1540.2.1  tv        154:
                    155: # Files containing size of pkg w/o and w/ all required pkgs
1.1540.2.15  tv        156: SIZE_PKG_FILE=         ${PKG_DB_TMPDIR}/+SIZE_PKG
                    157: SIZE_ALL_FILE=         ${PKG_DB_TMPDIR}/+SIZE_ALL
1.1540.2.1  tv        158:
                    159: # File to denote "no deletion of a package"
1.1540.2.15  tv        160: PRESERVE_FILE=         ${PKG_DB_TMPDIR}/+PRESERVE
1.1540.2.1  tv        161:
                    162: .for targ in ${_PKG_PHASES_WRKDIR}
                    163: ${targ}_COOKIE=                ${WRKDIR}/.${targ}_done
                    164: .endfor
                    165:
1.1540.2.5  tv        166: ##### Transform USE_* into dependencies
1.1540.2.1  tv        167:
                    168: .include "../../mk/bsd.pkg.use.mk"
                    169:
                    170: ############################################################################
                    171: # Sanity checks
                    172: ############################################################################
                    173:
                    174: # Fail-safe in the case of circular dependencies
                    175: .if defined(_PKGSRC_DEPS) && defined(PKGNAME) && !empty(_PKGSRC_DEPS:M${PKGNAME})
                    176: PKG_FAIL_REASON+=      "Circular dependency detected"
                    177: .endif
1.800     jlam      178:
1.1252    jlam      179: # PKG_INSTALLATION_TYPE can only be one of two values: "pkgviews" or
                    180: # "overwrite".
                    181: .if (${PKG_INSTALLATION_TYPE} != "pkgviews") && \
                    182:     (${PKG_INSTALLATION_TYPE} != "overwrite")
                    183: PKG_FAIL_REASON+=      "PKG_INSTALLATION_TYPE must be \`\`pkgviews'' or \`\`overwrite''."
                    184: .endif
                    185:
                    186: .if empty(PKG_INSTALLATION_TYPES:M${PKG_INSTALLATION_TYPE})
                    187: PKG_FAIL_REASON+=      "This package doesn't support PKG_INSTALLATION_TYPE=${PKG_INSTALLATION_TYPE}."
                    188: .endif
                    189:
                    190: .if (${PLIST_TYPE} != "dynamic") && (${PLIST_TYPE} != "static")
                    191: PKG_FAIL_REASON+=      "PLIST_TYPE must be \`\`dynamic'' or \`\`static''."
                    192: .endif
                    193:
                    194: .if (${PKG_INSTALLATION_TYPE} == "overwrite") && (${PLIST_TYPE} != "static")
                    195: PKG_FAIL_REASON+=      "PLIST_TYPE must be \`\`static'' for \`\`overwrite'' packages."
                    196: .endif
                    197:
1.1540.2.1  tv        198: # Check that we are using up-to-date pkg_* tools with this file.
                    199: .if !defined(NO_PKGTOOLS_REQD_CHECK)
                    200: .  if ${PKGTOOLS_VERSION} < ${PKGTOOLS_REQD}
                    201: PKG_FAIL_REASON+='Error: The package tools installed on this system are out of date.'
                    202: PKG_FAIL_REASON+='The installed package tools are dated ${PKGTOOLS_VERSION:C|(....)(..)(..)|\1/\2/\3|} and you must update'
                    203: PKG_FAIL_REASON+='them to at least ${PKGTOOLS_REQD:C|(....)(..)(..)|\1/\2/\3|} using the following command:'
                    204: PKG_FAIL_REASON+=''
                    205: PKG_FAIL_REASON+='     cd ${PKGSRCDIR}/pkgtools/pkg_install && ${MAKE} clean && ${MAKE} install'
1.1339    jlam      206: .  endif
1.1540.2.21  tv        207: .endif # !NO_PKGTOOLS_REQD_CHECK
1.1252    jlam      208:
1.1540.2.7  tv        209: .if defined(ALL_TARGET)
                    210: PKG_FAIL_REASON+='ALL_TARGET is deprecated and must be replaced with BUILD_TARGET.'
                    211: .endif
                    212:
1.1540.2.1  tv        213: .if defined(NO_WRKSUBDIR)
                    214: PKG_FAIL_REASON+='NO_WRKSUBDIR has been deprecated - please replace it with an explicit'
                    215: PKG_FAIL_REASON+='assignment of WRKSRC= $${WRKDIR}'
                    216: .endif # NO_WRKSUBDIR
1.1252    jlam      217:
1.820     jlam      218: # We need to make sure the buildlink-x11 package is not installed since it
1.1027    jlam      219: # breaks builds that use imake.
                    220: .if defined(USE_IMAKE)
1.820     jlam      221: .  if exists(${LOCALBASE}/lib/X11/config/buildlinkX11.def) || \
                    222:       exists(${X11BASE}/lib/X11/config/buildlinkX11.def)
1.1102    schmonz   223: PKG_FAIL_REASON+= "${PKGNAME} uses imake, but the buildlink-x11 package was found." \
1.820     jlam      224:         "    Please deinstall it (pkg_delete buildlink-x11)."
                    225: .  endif
1.1027    jlam      226: .endif # USE_IMAKE
1.131     tv        227:
1.1540.2.1  tv        228: .if !defined(CATEGORIES) || !defined(DISTNAME)
                    229: PKG_FAIL_REASON+='CATEGORIES and DISTNAME are mandatory.'
1.1246    jlam      230: .endif
                    231:
1.1540.2.1  tv        232: .if defined(LIB_DEPENDS)
                    233: PKG_FAIL_REASON+='LIB_DEPENDS is deprecated and must be replaced with DEPENDS.'
1.338     kim       234: .endif
1.1015    jlam      235:
1.1540.2.1  tv        236: .if defined(PKG_PATH)
                    237: PKG_FAIL_REASON+='Please unset PKG_PATH before doing pkgsrc work!'
1.1015    jlam      238: .endif
                    239:
1.1540.2.1  tv        240: .if defined(MASTER_SITE_SUBDIR)
                    241: PKG_FAIL_REASON+='MASTER_SITE_SUBDIR is deprecated and must be replaced with MASTER_SITES.'
1.522     wiz       242: .endif
                    243:
1.1540.2.1  tv        244: .if defined(PATCH_SITE_SUBDIR)
                    245: PKG_FAIL_REASON+='PATCH_SITE_SUBDIR is deprecated and must be replaced with PATCH_SITES.'
1.758     jlam      246: .endif
1.986     schmonz   247:
1.1540.2.1  tv        248: .if defined(ONLY_FOR_ARCHS) || defined(NOT_FOR_ARCHS) \
                    249:        || defined(ONLY_FOR_OPSYS) || defined(NOT_FOR_OPSYS)
                    250: PKG_FAIL_REASON+='ONLY/NOT_FOR_ARCHS/OPSYS are deprecated and must be replaced with ONLY/NOT_FOR_PLATFORM.'
                    251: .endif
1.1539    tv        252:
1.1540.2.1  tv        253: .if (${PKGSRC_LOCKTYPE} == "sleep" || ${PKGSRC_LOCKTYPE} == "once")
1.1540.2.5  tv        254: .  if !defined(OBJHOSTNAME)
1.1540.2.1  tv        255: PKG_FAIL_REASON+='PKGSRC_LOCKTYPE needs OBJHOSTNAME defined.'
1.1540.2.5  tv        256: .  elif !exists(${SHLOCK})
1.1540.2.1  tv        257: PKG_FAIL_REASON+='The ${SHLOCK} utility does not exist, and is necessary for locking.'
                    258: PKG_FAIL_REASON+='Please "${MAKE} install" in ../../pkgtools/shlock.'
1.1540.2.5  tv        259: .  endif
1.94      agc       260: .endif
1.272     tv        261:
1.1381    jlam      262: #
1.1540.2.1  tv        263: # Many ways to disable a package.
                    264: #
                    265: # Ignore packages that can't be resold if building for a CDROM.
                    266: #
                    267: # Don't build a package if it's restricted and we don't want to
                    268: # get into that.
                    269: #
                    270: # Don't build any package that utilizes strong cryptography, for
                    271: # when the law of the land forbids it.
                    272: #
                    273: # Don't attempt to build packages against X if we don't have X.
                    274: #
                    275: # Don't build a package if it's broken.
                    276: #
1.1536    sketch    277:
1.1540.2.1  tv        278: .if (defined(NO_BIN_ON_CDROM) && defined(FOR_CDROM))
                    279: PKG_FAIL_REASON+= "${PKGNAME} may not be placed in binary form on a CDROM:" \
                    280:          "    "${NO_BIN_ON_CDROM:Q}
1.1252    jlam      281: .endif
1.1540.2.1  tv        282: .if (defined(NO_SRC_ON_CDROM) && defined(FOR_CDROM))
                    283: PKG_FAIL_REASON+= "${PKGNAME} may not be placed in source form on a CDROM:" \
                    284:          "    "${NO_SRC_ON_CDROM:Q}
                    285: .endif
                    286: .if (defined(RESTRICTED) && defined(NO_RESTRICTED))
                    287: PKG_FAIL_REASON+= "${PKGNAME} is restricted:" \
                    288:         "    "${RESTRICTED:Q}
1.1199    grant     289: .endif
1.1540.2.1  tv        290: .if !(${MKCRYPTO} == "YES" || ${MKCRYPTO} == yes)
                    291: .  if defined(CRYPTO)
                    292: PKG_FAIL_REASON+= "${PKGNAME} may not be built, because it utilizes strong cryptography"
                    293: .  endif
1.1199    grant     294: .endif
1.1540.2.1  tv        295: .if defined(USE_X11) && !exists(${X11BASE})
                    296: PKG_FAIL_REASON+= "${PKGNAME} uses X11, but ${X11BASE} not found"
1.1217    grant     297: .endif
1.1540.2.1  tv        298: .if defined(BROKEN)
                    299: PKG_FAIL_REASON+= "${PKGNAME} is marked as broken:" ${BROKEN:Q}
1.1528    recht     300: .endif
1.1209    grant     301:
1.1540.2.1  tv        302: .if defined(LICENSE)
                    303: .  ifdef ACCEPTABLE_LICENSES
                    304: .    for _lic in ${ACCEPTABLE_LICENSES}
                    305: .      if ${LICENSE} == "${_lic}"
                    306: _ACCEPTABLE=   yes
                    307: .      endif   # LICENSE == _lic
                    308: .    endfor    # _lic
                    309: .  endif       # ACCEPTABLE_LICENSES
                    310: .  ifndef _ACCEPTABLE
                    311: PKG_FAIL_REASON+= "${PKGNAME} has an unacceptable license: ${LICENSE}." \
                    312:         "    To view the license, enter \"${MAKE} show-license\"." \
                    313:         "    To indicate acceptance, add this line to your /etc/mk.conf:" \
                    314:         "    ACCEPTABLE_LICENSES+=${LICENSE}"
                    315: .  endif       # _ACCEPTABLE
                    316: .endif         # LICENSE
1.1462    jschauma  317:
1.1540.2.1  tv        318: # Define __PLATFORM_OK only if the OS matches the pkg's allowed list.
                    319: .if defined(ONLY_FOR_PLATFORM) && !empty(ONLY_FOR_PLATFORM)
                    320: .  for __tmp__ in ${ONLY_FOR_PLATFORM}
                    321: .    if ${MACHINE_PLATFORM:M${__tmp__}} != ""
                    322: __PLATFORM_OK?=        yes
                    323: .    endif     # MACHINE_PLATFORM
                    324: .  endfor      # __tmp__
                    325: .else          # !ONLY_FOR_PLATFORM
                    326: __PLATFORM_OK?=        yes
                    327: .endif         # ONLY_FOR_PLATFORM
                    328: .for __tmp__ in ${NOT_FOR_PLATFORM}
                    329: .  if ${MACHINE_PLATFORM:M${__tmp__}} != ""
                    330: .    undef __PLATFORM_OK
                    331: .  endif       # MACHINE_PLATFORM
                    332: .endfor                # __tmp__
                    333: .if !defined(__PLATFORM_OK)
                    334: PKG_SKIP_REASON+= "${PKGNAME} is not available for ${MACHINE_PLATFORM}"
                    335: .endif         # !__PLATFORM_OK
1.1295    grant     336:
1.1540.2.1  tv        337: .if !defined(NO_SKIP)
                    338: .  if defined(PKG_FAIL_REASON) || defined(PKG_SKIP_REASON)
                    339: _PKG_SKIPPED=  # defined
                    340: .  endif
1.1295    grant     341: .endif
1.1       agc       342:
1.1540.2.1  tv        343: ############################################################################
                    344: # Set up build environment
                    345: ############################################################################
1.1488    jlam      346:
1.1540.2.1  tv        347: .if !defined(_PKG_SKIPPED)
1.1488    jlam      348:
1.1540.2.1  tv        349: # Allow variables to be set on a per-OS basis
                    350: OPSYSVARS+=    CFLAGS CPPFLAGS CXXFLAGS FFLAGS LDFLAGS LIBS
                    351: .  for var in ${OPSYSVARS:O}
                    352: .    if defined(${var}.${OPSYS})
                    353: ${var}+=       ${${var}.${OPSYS}}
                    354: .    elif defined(${var}.*)
                    355: ${var}+=       ${${var}.*}
                    356: .    endif
1.1488    jlam      357: .  endfor
1.1       agc       358:
1.1540.2.1  tv        359: CPPFLAGS+=     ${CPP_PRECOMP_FLAGS}
                    360:
1.1540.2.20  tv        361: .  if !empty(USE_BUILDLINK3:M[nN][oO])
1.1540.2.1  tv        362: LDFLAGS+=      ${COMPILER_RPATH_FLAG}${LOCALBASE}/lib
                    363: LDFLAGS+=      -L${LOCALBASE}/lib
1.1540.2.20  tv        364: .  endif
1.1489    schmonz   365:
1.1540.2.1  tv        366: ALL_ENV+=      CC=${CC:Q}
                    367: ALL_ENV+=      CFLAGS=${CFLAGS:Q}
                    368: ALL_ENV+=      CPPFLAGS=${CPPFLAGS:Q}
                    369: ALL_ENV+=      CXX=${CXX:Q}
                    370: ALL_ENV+=      CXXFLAGS=${CXXFLAGS:Q}
                    371: ALL_ENV+=      COMPILER_RPATH_FLAG=${COMPILER_RPATH_FLAG:Q}
1.1540.2.10  tv        372: ALL_ENV+=      F77=${F77:Q}
                    373: ALL_ENV+=      FC=${FC:Q}
1.1540.2.1  tv        374: ALL_ENV+=      FFLAGS=${FFLAGS:Q}
                    375: ALL_ENV+=      LDFLAGS=${LDFLAGS:Q}
                    376: ALL_ENV+=      LINKER_RPATH_FLAG=${LINKER_RPATH_FLAG:Q}
                    377: ALL_ENV+=      PATH=${PATH:Q}:${LOCALBASE}/bin:${X11BASE}/bin
                    378: ALL_ENV+=      PREFIX=${PREFIX}
                    379:
                    380: MAKE_ENV+=     ${ALL_ENV}
                    381: MAKE_ENV+=     ${NO_EXPORT_CPP:D:UCPP=${CPP:Q}}
                    382: MAKE_ENV+=     LINK_ALL_LIBGCC_HACK=${LINK_ALL_LIBGCC_HACK:Q}
                    383: MAKE_ENV+=     LOCALBASE=${LOCALBASE}
                    384: MAKE_ENV+=     NO_WHOLE_ARCHIVE_FLAG=${NO_WHOLE_ARCHIVE_FLAG:Q}
                    385: MAKE_ENV+=     WHOLE_ARCHIVE_FLAG=${WHOLE_ARCHIVE_FLAG:Q}
                    386: MAKE_ENV+=     X11BASE=${X11BASE}
                    387: MAKE_ENV+=     X11PREFIX=${X11PREFIX}
                    388:
                    389: # Constants to provide a consistent environment for packages using
                    390: # BSD-style Makefiles.
                    391: MAKE_ENV+=     MAKECONF=${PKGMAKECONF:U/dev/null}
                    392: MAKE_ENV+=     OBJECT_FMT=${OBJECT_FMT:Q}
                    393: MAKE_ENV+=     ${USETOOLS:DUSETOOLS=${USETOOLS:Q}}
                    394:
                    395: SCRIPTS_ENV+=  ${ALL_ENV}
                    396: SCRIPTS_ENV+=  _PKGSRCDIR=${_PKGSRCDIR}
                    397: SCRIPTS_ENV+=  ${BATCH:DBATCH=yes}
                    398: SCRIPTS_ENV+=  CURDIR=${.CURDIR}
                    399: SCRIPTS_ENV+=  DEPENDS=${DEPENDS:Q}
                    400: SCRIPTS_ENV+=  DISTDIR=${DISTDIR}
                    401: SCRIPTS_ENV+=  FILESDIR=${FILESDIR}
                    402: SCRIPTS_ENV+=  LOCALBASE=${LOCALBASE}
                    403: SCRIPTS_ENV+=  PATCHDIR=${PATCHDIR}
                    404: SCRIPTS_ENV+=  PKGSRCDIR=${PKGSRCDIR}
                    405: SCRIPTS_ENV+=  SCRIPTDIR=${SCRIPTDIR}
                    406: SCRIPTS_ENV+=  VIEWBASE=${VIEWBASE}
                    407: SCRIPTS_ENV+=  WRKDIR=${WRKDIR}
                    408: SCRIPTS_ENV+=  WRKSRC=${WRKSRC}
                    409: SCRIPTS_ENV+=  X11BASE=${X11BASE}
1.240     agc       410:
1.1540.2.1  tv        411: # Set PLIST_SUBST to substitute "${variable}" to "value" in PLIST
                    412: PLIST_SUBST+=  CHGRP=${CHGRP:Q}
                    413: PLIST_SUBST+=  CHMOD=${CHMOD:Q}
                    414: PLIST_SUBST+=  CHOWN=${CHOWN:Q}
                    415: PLIST_SUBST+=  LN=${LN:Q}
                    416: PLIST_SUBST+=  LOCALBASE=${LOCALBASE}
                    417: PLIST_SUBST+=  LOWER_VENDOR=${LOWER_VENDOR}
                    418: PLIST_SUBST+=  LOWER_OPSYS=${LOWER_OPSYS}
                    419: PLIST_SUBST+=  LOWER_OS_VERSION=${LOWER_OS_VERSION}
                    420: PLIST_SUBST+=  MACHINE_ARCH=${MACHINE_ARCH}
                    421: PLIST_SUBST+=  MACHINE_GNU_ARCH=${MACHINE_GNU_ARCH}
                    422: PLIST_SUBST+=  MACHINE_GNU_PLATFORM=${MACHINE_GNU_PLATFORM}
                    423: PLIST_SUBST+=  MKDIR=${MKDIR:Q}
                    424: PLIST_SUBST+=  OPSYS=${OPSYS}
                    425: PLIST_SUBST+=  OS_VERSION=${OS_VERSION}
                    426: PLIST_SUBST+=  PKGBASE=${PKGBASE}
                    427: PLIST_SUBST+=  PKGNAME=${PKGNAME_NOREV}
                    428: PLIST_SUBST+=  PKGLOCALEDIR=${PKGLOCALEDIR}
                    429: PLIST_SUBST+=  PKGVERSION=${PKGVERSION:C/nb[0-9]*$//}
                    430: PLIST_SUBST+=  QMAILDIR=${QMAILDIR} # XXXTV is this used?
                    431: PLIST_SUBST+=  RM=${RM:Q}
                    432: PLIST_SUBST+=  RMDIR=${RMDIR:Q}
                    433: PLIST_SUBST+=  SVR4_PKGNAME=${SVR4_PKGNAME}
                    434: PLIST_SUBST+=  TRUE=${TRUE:Q}
                    435: PLIST_SUBST+=  VIEWBASE=${VIEWBASE}
                    436: PLIST_SUBST+=  X11BASE=${X11BASE}
                    437: PLIST_SUBST+=  X11PREFIX=${X11PREFIX}
                    438:
                    439: # Automatically increase process limit where necessary for building.
                    440: .  if defined(UNLIMIT_RESOURCES)
                    441: .    for res in ${UNLIMIT_RESOURCES}
                    442: _ULIMIT_CMD+=  ${ULIMIT_CMD_${res}:D${ULIMIT_CMD_${res}} ; }
                    443: .    endfor
1.789     hubertf   444: .  endif
1.436     fredb     445:
1.1540.2.5  tv        446: # if automatic manual page compression is done by the package according
                    447: # to MANZ's value, set MANCOMPRESSED if MANZ is set
                    448: .  if defined(MANCOMPRESSED_IF_MANZ) && defined(MANZ)
                    449: MANCOMPRESSED= yes
                    450: MAKE_ENV+=     MANZ=${MANZ}
                    451: .  endif
                    452:
                    453: # CONF_DEPENDS notes a dependency where the config directory for the
                    454: # package matches the dependency's config directory.  CONF_DEPENDS is
                    455: # only meaningful if ${PKG_INSTALLATION_TYPE} == "pkgviews".
                    456: #
                    457: CONF_DEPENDS?=         # empty
                    458: .  if !empty(CONF_DEPENDS)
                    459: USE_PKGINSTALL=                YES
                    460: .  endif
                    461:
1.1540.2.1  tv        462: .endif # !_PKG_SKIPPED
1.221     agc       463:
1.1540.2.1  tv        464: ############################################################################
                    465: # Debug support
                    466: ############################################################################
1.221     agc       467:
                    468: # Debugging levels for this file, dependent on PKG_DEBUG_LEVEL definition
                    469: # 0 == normal, default, quiet operation
                    470: # 1 == all shell commands echoed before invocation
                    471: # 2 == shell "set -x" operation
                    472: PKG_DEBUG_LEVEL?=      0
                    473: _PKG_SILENT=           @
1.1058    jlam      474: _PKG_DEBUG=            # empty
                    475: _PKG_DEBUG_SCRIPT=     # empty
1.221     agc       476:
                    477: .if ${PKG_DEBUG_LEVEL} > 0
1.1058    jlam      478: _PKG_SILENT=           # empty
1.221     agc       479: .endif
                    480:
                    481: .if ${PKG_DEBUG_LEVEL} > 1
                    482: _PKG_DEBUG=            set -x;
1.1058    jlam      483: _PKG_DEBUG_SCRIPT=     ${SH} -x
1.57      hubertf   484: .endif
                    485:
1.1540.2.1  tv        486: ############################################################################
                    487: # External tools
                    488: ############################################################################
1.161     agc       489:
1.1540.2.1  tv        490: # top part not skipped by _PKG_SKIPPED
1.57      hubertf   491:
1.1540.2.1  tv        492: # Used to print all the '===>' style prompts - override this to turn them off.
                    493: ECHO_MSG?=             ${ECHO}
1.1       agc       494:
1.1540.2.1  tv        495: # Define SMART_MESSAGES in /etc/mk.conf for messages giving the tree
                    496: # of dependencies for building, and the current target.
                    497: .ifdef SMART_MESSAGES
                    498: _PKGSRC_IN?=           ===> ${.TARGET} [${PKGNAME}${_PKGSRC_DEPS}] ===
1.663     wiz       499: .endif
1.1540.2.1  tv        500: _PKGSRC_IN?=           ===
1.663     wiz       501:
1.1540.2.1  tv        502: DO_NADA?=              ${TRUE} # deprecated; for compatibility only
                    503: SHCOMMENT?=            ${ECHO_MSG} >/dev/null '***'
                    504: TOUCH_FLAGS?=          -f
1.1114    grant     505:
1.1540.2.1  tv        506: FETCH_BEFORE_ARGS+=    ${PASSIVE_FETCH:D-p}
                    507:
                    508: .if !defined(_PKG_SKIPPED)
                    509:
                    510: INSTALL_DATA?=                 ${INSTALL} ${COPY} -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE}
                    511: INSTALL_DATA_DIR?=     ${INSTALL} -d -o ${SHAREOWN} -g ${SHAREGRP} -m ${PKGDIRMODE}
                    512: INSTALL_GAME?=         ${INSTALL} ${COPY} ${_STRIPFLAG_INSTALL} -o ${GAMEOWN} -g ${GAMEGRP} -m ${GAMEMODE}
                    513: INSTALL_GAME_DATA?=    ${INSTALL} ${COPY} -o ${GAMEOWN} -g ${GAMEGRP} -m ${GAMEDATAMODE}
                    514: INSTALL_LIB?=          ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
                    515: INSTALL_LIB_DIR?=      ${INSTALL_PROGRAM_DIR}
                    516: INSTALL_MAN?=          ${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
                    517: INSTALL_MAN_DIR?=      ${INSTALL} -d -o ${MANOWN} -g ${MANGRP} -m ${PKGDIRMODE}
                    518: INSTALL_PROGRAM?=      ${INSTALL} ${COPY} ${_STRIPFLAG_INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
                    519: INSTALL_PROGRAM_DIR?=  ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m ${PKGDIRMODE}
                    520: INSTALL_SCRIPT?=       ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
                    521: INSTALL_SCRIPT_DIR?=   ${INSTALL_PROGRAM_DIR}
                    522:
                    523: _INSTALL_MACROS=       BSD_INSTALL=${INSTALL:Q}
                    524: .  for mac in DATA GAME LIB MAN PROGRAM SCRIPT
                    525: _INSTALL_MACROS+=      BSD_INSTALL_${mac}=${INSTALL_${mac}:Q}
                    526: _INSTALL_MACROS+=      BSD_INSTALL_${mac}_DIR=${INSTALL_${mac}_DIR:Q}
                    527: CONFIGURE_ENV+=                INSTALL_${mac}=${INSTALL_${mac}:Q}
                    528: CONFIGURE_ENV+=                INSTALL_${mac}_DIR=${INSTALL_${mac}_DIR:Q}
                    529: .  endfor
                    530: MAKE_ENV+=             ${_INSTALL_MACROS}
                    531: SCRIPTS_ENV+=          ${_INSTALL_MACROS}
                    532:
                    533: .  if defined(USE_GNU_TOOLS) && !empty(USE_GNU_TOOLS:Mmake)
                    534: MAKE_PROGRAM=          ${GMAKE}
                    535: .  elif defined(USE_IMAKE)
1.1540.2.9  tv        536: .    if ${_IMAKE_MAKE} == ${GMAKE}
                    537: USE_GNU_TOOLS+=                make
                    538: .    endif
1.1540.2.1  tv        539: MAKE_PROGRAM=          ${_IMAKE_MAKE}
1.1114    grant     540: .  endif
1.1540.2.1  tv        541: MAKE_PROGRAM?=         ${MAKE}
1.1114    grant     542:
1.1540.2.1  tv        543: MTREE_ARGS?=           -U -f ${MTREE_FILE} -d -e -p
                    544: MTREE_FILE?=           ${PKGSRCDIR}/mk/${OPSYS}.pkg.dist
                    545:
                    546: PKG_ARGS_COMMON=       -v -c -${COMMENT:Q}" " -d ${DESCR} -f ${PLIST}
                    547: PKG_ARGS_COMMON+=      -l -b ${BUILD_VERSION_FILE} -B ${BUILD_INFO_FILE}
                    548: PKG_ARGS_COMMON+=      -s ${SIZE_PKG_FILE} -S ${SIZE_ALL_FILE}
                    549: PKG_ARGS_COMMON+=      -P "`${MAKE} ${MAKEFLAGS} run-depends-list | ${SORT} -u`"
                    550: PKG_ARGS_COMMON+=      ${INSTALL_FILE:D-i ${INSTALL_FILE}}
                    551: PKG_ARGS_COMMON+=      ${DEINSTALL_FILE:D-k ${DEINSTALL_FILE}}
                    552: PKG_ARGS_COMMON+=      ${MESSAGE:D-D ${MESSAGE}}
                    553: PKG_ARGS_COMMON+=      ${NO_MTREE:D:U-m ${MTREE_FILE}}
                    554: PKG_ARGS_COMMON+=      ${PKG_PRESERVE:D-n ${PRESERVE_FILE}}
                    555: .  if ${PKG_INSTALLATION_TYPE} == "overwrite"
                    556: PKG_ARGS_COMMON+=      ${CONFLICTS:D-C "${CONFLICTS}"}
                    557: .  endif
1.164     agc       558:
1.1540.2.1  tv        559: PKG_ARGS_INSTALL=      -p ${PREFIX} ${PKG_ARGS_COMMON}
                    560: PKG_ARGS_BINPKG=       -p ${PREFIX:S/^${DESTDIR}//} -L ${PREFIX} ${PKG_ARGS_COMMON}
1.631     hubertf   561:
1.1540.2.1  tv        562: .endif # !_PKG_SKIPPED
                    563:
                    564: ############################################################################
1.1540.2.5  tv        565: # External bsd.pkg.mk fragments needing to perform overrides
1.1540.2.1  tv        566: ############################################################################
                    567:
                    568: .if !defined(_PKG_SKIPPED)
1.1250    jlam      569:
1.1540.2.1  tv        570: USE_PKGINSTALL?=       NO
                    571: .  if !empty(USE_PKGINSTALL:M[yY][eE][sS])
                    572: .    include "../../mk/bsd.pkg.install.mk"
                    573: .  endif
                    574:
                    575: .endif # !_PKG_SKIPPED
                    576:
                    577: ############################################################################
                    578: # Transform package Makefile variables (overridable by external fragments)
                    579: ############################################################################
                    580:
                    581: .if !defined(_PKG_SKIPPED)
1.1136    jlam      582:
1.164     agc       583: # Set INSTALL_FILE to be the name of any INSTALL file
1.1540.2.1  tv        584: .  if !defined(INSTALL_FILE) && exists(${PKGDIR}/INSTALL)
1.164     agc       585: INSTALL_FILE=          ${PKGDIR}/INSTALL
1.1540.2.1  tv        586: .  endif
1.164     agc       587:
                    588: # Set DEINSTALL_FILE to be the name of any DEINSTALL file
1.1540.2.1  tv        589: .  if !defined(DEINSTALL_FILE) && exists(${PKGDIR}/DEINSTALL)
1.164     agc       590: DEINSTALL_FILE=                ${PKGDIR}/DEINSTALL
1.1540.2.1  tv        591: .  endif
1.1       agc       592:
1.848     jlam      593: # If MESSAGE hasn't been defined, then set MESSAGE_SRC to be a space-separated
                    594: # list of files to be concatenated together to generate the MESSAGE file.
                    595: #
1.1540.2.1  tv        596: .  if !defined(MESSAGE_SRC) && !defined(MESSAGE)
                    597: .    if exists(${PKGDIR}/MESSAGE)
1.1103    seb       598: MESSAGE_SRC=           ${PKGDIR}/MESSAGE
1.1540.2.1  tv        599: .    else
                    600: .      if exists(${PKGDIR}/MESSAGE.common)
1.1101    grant     601: MESSAGE_SRC=           ${PKGDIR}/MESSAGE.common
1.1540.2.1  tv        602: .      endif
                    603: .      if exists(${PKGDIR}/MESSAGE.${OPSYS})
1.1101    grant     604: MESSAGE_SRC+=          ${PKGDIR}/MESSAGE.${OPSYS}
1.1540.2.1  tv        605: .      endif
                    606: .      if exists(${PKGDIR}/MESSAGE.${MACHINE_ARCH:C/i[3-6]86/i386/g})
1.1160    salo      607: MESSAGE_SRC+=  ${PKGDIR}/MESSAGE.${MACHINE_ARCH:C/i[3-6]86/i386/g}
1.1540.2.1  tv        608: .      endif
                    609: .      if exists(${PKGDIR}/MESSAGE.${OPSYS}-${MACHINE_ARCH:C/i[3-6]86/i386/g})
1.1104    grant     610: MESSAGE_SRC+=  ${PKGDIR}/MESSAGE.${OPSYS}-${MACHINE_ARCH:C/i[3-6]86/i386/g}
1.1540.2.1  tv        611: .      endif
1.1103    seb       612: .    endif
1.1101    grant     613: .  endif
1.654     wiz       614:
1.1540.2.1  tv        615: .  if defined(MESSAGE_SRC)
1.1540.2.15  tv        616: MESSAGE=               ${PKG_DB_TMPDIR}/+DISPLAY
1.654     wiz       617:
                    618: # Set MESSAGE_SUBST to substitute "${variable}" to "value" in MESSAGE
1.1540.2.1  tv        619: MESSAGE_SUBST+=        LOCALBASE=${LOCALBASE}
                    620: MESSAGE_SUBST+=        PKG_SYSCONFDIR=${PKG_SYSCONFDIR}
                    621: MESSAGE_SUBST+=        PKGNAME=${PKGNAME}
                    622: MESSAGE_SUBST+=        PREFIX=${PREFIX}
                    623: MESSAGE_SUBST+=        QMAILDIR=${QMAILDIR} # XXXTV is this used?
                    624: MESSAGE_SUBST+=        ROOT_GROUP=${ROOT_GROUP}
                    625: MESSAGE_SUBST+=        ROOT_USER=${ROOT_USER}
                    626: MESSAGE_SUBST+=        VIEWBASE=${VIEWBASE}
                    627: MESSAGE_SUBST+=        X11BASE=${X11BASE}
                    628: MESSAGE_SUBST+=        X11PREFIX=${X11PREFIX}
1.848     jlam      629:
                    630: MESSAGE_SUBST_SED=     ${MESSAGE_SUBST:S/=/}!/:S/$/!g/:S/^/ -e s!\\\${/}
1.1540.2.1  tv        631: .  endif
1.1422    jlam      632:
1.1540.2.5  tv        633: ##### Config file related settings - see doc/guide
1.676     agc       634:
1.1540.2.1  tv        635: PKG_SYSCONFVAR?=       ${PKGBASE}
                    636: PKG_SYSCONFSUBDIR?=    # empty
                    637: .  if ${PKG_INSTALLATION_TYPE} == "overwrite"
                    638: PKG_SYSCONFDEPOTBASE=  # empty
                    639: PKG_SYSCONFBASEDIR=    ${PKG_SYSCONFBASE}
                    640: .  else
                    641: .    if !empty(PKG_SYSCONFBASE:M${PREFIX}) || \
                    642:         !empty(PKG_SYSCONFBASE:M${PREFIX}/*)
                    643: PKG_SYSCONFDEPOTBASE=  # empty
                    644: PKG_SYSCONFBASEDIR=    ${PKG_SYSCONFBASE}
                    645: .      if !empty(CONF_DEPENDS)
                    646: _PLIST_IGNORE_FILES+=  ${PKG_SYSCONFDIR:S,^${PREFIX}/,,}
                    647: .      endif
                    648: .    else
                    649: PKG_SYSCONFDEPOTBASE=  ${PKG_SYSCONFBASE}/${DEPOT_SUBDIR}
                    650: PKG_SYSCONFBASEDIR=    ${PKG_SYSCONFDEPOTBASE}/${PKGNAME}
                    651: .    endif
                    652: .  endif
                    653: .  if empty(PKG_SYSCONFSUBDIR)
                    654: DFLT_PKG_SYSCONFDIR:=  ${PKG_SYSCONFBASEDIR}
                    655: .  else
                    656: DFLT_PKG_SYSCONFDIR:=  ${PKG_SYSCONFBASEDIR}/${PKG_SYSCONFSUBDIR}
                    657: .  endif
                    658: PKG_SYSCONFDIR=                ${DFLT_PKG_SYSCONFDIR}
                    659: .  if defined(PKG_SYSCONFDIR.${PKG_SYSCONFVAR})
                    660: PKG_SYSCONFDIR=                ${PKG_SYSCONFDIR.${PKG_SYSCONFVAR}}
                    661: PKG_SYSCONFBASEDIR=    ${PKG_SYSCONFDIR.${PKG_SYSCONFVAR}}
                    662: PKG_SYSCONFDEPOTBASE=  # empty
                    663: .  endif
1.383     hubertf   664:
1.1540.2.1  tv        665: ALL_ENV+=              PKG_SYSCONFDIR=${PKG_SYSCONFDIR:Q}
                    666: BUILD_DEFS_FIXED+=     PKG_SYSCONFBASEDIR PKG_SYSCONFDIR
1.695     tron      667:
1.1540.2.1  tv        668: .endif # !_PKG_SKIPPED
1.383     hubertf   669:
1.1540.2.5  tv        670: ##### Checksum and other file handling support
1.1540.2.1  tv        671: # not skipped by _PKG_SKIPPED
1.383     hubertf   672:
1.1540.2.1  tv        673: ALLFILES?=     ${DISTFILES} ${PATCHFILES}
                    674: CKSUMFILES?=   ${ALLFILES}
                    675: .for __tmp__ in ${IGNOREFILES}
                    676: CKSUMFILES:=   ${CKSUMFILES:N${__tmp__}}
                    677: .endfor
1.1127    agc       678:
1.1540.2.1  tv        679: # List of all files, with ${DIST_SUBDIR} in front.  Used for fetch and checksum.
                    680: .if defined(DIST_SUBDIR)
                    681: .  if ${CKSUMFILES} != ""
                    682: _CKSUMFILES?=  ${CKSUMFILES:S/^/${DIST_SUBDIR}\//}
1.789     hubertf   683: .  endif
1.1540.2.1  tv        684: .  if !empty(DISTFILES)
                    685: _DISTFILES?=   ${DISTFILES:S/^/${DIST_SUBDIR}\//}
                    686: .  else
                    687: _DISTFILES?=   # empty
1.789     hubertf   688: .  endif
1.1540.2.1  tv        689: .  if defined(IGNOREFILES) && !empty(IGNOREFILES)
                    690: _IGNOREFILES?= ${IGNOREFILES:S/^/${DIST_SUBDIR}\//}
1.789     hubertf   691: .  endif
1.1540.2.1  tv        692: .  if defined(PATCHFILES) && !empty(PATCHFILES)
                    693: _PATCHFILES?=  ${PATCHFILES:S/^/${DIST_SUBDIR}\//}
                    694: .  else
                    695: _PATCHFILES?=  # empty
1.789     hubertf   696: .  endif
1.1540.2.1  tv        697: .else
                    698: _CKSUMFILES?=  ${CKSUMFILES}
                    699: _DISTFILES?=   ${DISTFILES}
                    700: _IGNOREFILES?= ${IGNOREFILES}
                    701: _PATCHFILES?=  ${PATCHFILES}
                    702: .endif
                    703: _ALLFILES?=    ${_DISTFILES} ${_PATCHFILES}
                    704:
                    705: ############################################################################
                    706: # Phase `fetch'
                    707: ############################################################################
                    708:
                    709: .if !empty(PKG_PHASES:Mfetch) && !defined(_PKG_SKIPPED)
                    710:
                    711: ##### Master site selection
                    712:
                    713: .  include "../../mk/bsd.sites.mk"
                    714:
                    715: .  if defined(DIST_SUBDIR)
                    716: _MASTER_SITE_BACKUP:=  ${MASTER_SITE_BACKUP:=${DIST_SUBDIR}/}
                    717: .    if defined(MASTER_SITE_OVERRIDE)
                    718: _MASTER_SITE_OVERRIDE:=        ${MASTER_SITE_OVERRIDE:=${DIST_SUBDIR}/}
                    719: .    endif # MASTER_SITE_OVERRIDE
                    720: .  else  # !DIST_SUBDIR
                    721: _MASTER_SITE_BACKUP:=  ${MASTER_SITE_BACKUP}
                    722: .    if defined(MASTER_SITE_OVERRIDE)
                    723: _MASTER_SITE_OVERRIDE:= ${MASTER_SITE_OVERRIDE}
                    724: .    endif # MASTER_SITE_OVERRIDE
                    725: .  endif # DIST_SUBDIR
                    726:
                    727: # Where to put distfiles that don't have any other master site
                    728: MASTER_SITE_LOCAL?=    ${MASTER_SITE_BACKUP:=LOCAL_PORTS/}
                    729:
                    730: ##### Make subtargets for "fetch".
                    731:
                    732: #===> check-vulnerable:  Check for any vulnerabilities in the package
                    733: _CHECK_VULNERABLE=                                                     \
                    734:        ${SETENV} PKGNAME="${PKGNAME}"                                  \
                    735:                  PKGBASE="${PKGBASE}"                                  \
                    736:                ${AWK} '/^$$/ { next }                                  \
                    737:                        /^\#.*/ { next }                                \
                    738:                        { s = sprintf("${PKG_ADMIN} pmatch \"%s\" %s && ${ECHO} \"*** WARNING - %s vulnerability in %s - see %s for more information ***\"", $$1, ENVIRON["PKGNAME"], $$2, ENVIRON["PKGNAME"], $$3); system(s); } \
                    739:                ' < ${PKGVULNDIR}/pkg-vulnerabilities || ${ECHO} 'could not check pkg-vulnerabilities file'
                    740:
                    741: _REAL_TARGETS.fetch+=          check-vulnerable
                    742: .PHONY: check-vulnerable
                    743: check-vulnerable:
                    744: .  if !defined(ALLOW_VULNERABLE_PACKAGES) && !exists(${extract_COOKIE})
                    745: .    if exists(${PKGVULNDIR}/pkg-vulnerabilities)
                    746:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                    747:        ${ECHO_MSG} "${_PKGSRC_IN}> Checking for vulnerabilities in ${PKGNAME}"; \
                    748:        vul=`${_CHECK_VULNERABLE}`;                                     \
                    749:        case "$$vul" in                                                 \
                    750:        "")     ;;                                                      \
                    751:        *)      ${ECHO} "$$vul";                                        \
                    752:                ${ECHO} "or define ALLOW_VULNERABLE_PACKAGES if this package is absolutely essential"; \
                    753:                ${FALSE} ;;                                             \
                    754:        esac
                    755: .    else
                    756:        @${ECHO_MSG} "${_PKGSRC_IN}> *** No ${PKGVULNDIR}/pkg-vulnerabilities file found,"
                    757:        @${ECHO_MSG} "${_PKGSRC_IN}> *** skipping vulnerability checks. To fix, install"
                    758:        @${ECHO_MSG} "${_PKGSRC_IN}> *** the pkgsrc/security/audit-packages package and run"
                    759:        @${ECHO_MSG} "${_PKGSRC_IN}> *** '${LOCALBASE}/sbin/download-vulnerability-list'."
                    760: .    endif
1.1127    agc       761: .  endif
1.653     jwise     762:
1.1540.2.1  tv        763: #===> "pre-fetch"
1.653     jwise     764:
1.1540.2.1  tv        765: _REAL_TARGETS.fetch+=          pre-fetch
                    766: .PHONY: pre-fetch
                    767: pre-fetch: .OPTIONAL
1.1252    jlam      768:
1.1540.2.1  tv        769: #===> "do-fetch"
1.383     hubertf   770:
1.1540.2.1  tv        771: _REAL_TARGETS.fetch+=          do-fetch
                    772: .PHONY: do-fetch
                    773: #do-fetch:
1.416     agc       774:
1.1540.2.1  tv        775: #===> "post-fetch"
1.1       agc       776:
1.1540.2.1  tv        777: _REAL_TARGETS.fetch+=          post-fetch
                    778: .PHONY: post-fetch
                    779: post-fetch: .OPTIONAL
1.43      hubertf   780:
1.1540.2.1  tv        781: .endif # !empty(PKG_PHASES:Mfetch) && !defined(_PKG_SKIPPED)
1.1       agc       782:
1.1540.2.1  tv        783: ############################################################################
                    784: # Phase `checksum'
                    785: ############################################################################
1.87      agc       786:
1.1540.2.1  tv        787: # not skipped by _PKG_SKIPPED
1.691     fredb     788:
1.1540.2.1  tv        789: #===> uptodate-digest:  Install "digest" if needed.
                    790: # this is also used by `patch' and `make*sum'
                    791: .PHONY: uptodate-digest
                    792: uptodate-digest:
                    793: .if !empty(USE_DIGEST:M[yY][eE][sS])
                    794:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                    795:        if [ -f ${DISTINFO_FILE} -a \( ! -f ${DIGEST} -o ${DIGEST_VERSION} -lt ${DIGEST_REQD} \) ]; then \
                    796:                { cd ${PKGSRCDIR}/pkgtools/digest;                      \
                    797:                ${MAKE} clean;                                          \
                    798:                if [ -f ${DIGEST} ]; then                               \
                    799:                        ${MAKE} ${MAKEFLAGS} deinstall;                 \
                    800:                fi;                                                     \
                    801:                ${MAKE} ${MAKEFLAGS} test;                              \
                    802:                if [ -f ${DIGEST} ]; then                               \
                    803:                        ${MAKE} ${MAKEFLAGS} deinstall;                 \
                    804:                fi;                                                     \
                    805:                ${MAKE} ${MAKEFLAGS} ${DEPENDS_TARGET};                 \
                    806:                ${MAKE} ${MAKEFLAGS} clean; }                           \
                    807:        fi
1.691     fredb     808: .endif
1.15      agc       809:
1.1540.2.1  tv        810: .if !empty(PKG_PHASES:Mchecksum) && !defined(_PKG_SKIPPED)
1.1067    jlam      811:
1.1540.2.1  tv        812: #===> do-checksum
                    813:
                    814: _REAL_TARGETS.checksum+=       do-checksum
                    815: .PHONY: do-checksum
                    816: do-checksum: .OPTIONAL
                    817: .  if !defined(NO_CHECKSUM) && !exists(${extract_COOKIE})
                    818: do-checksum: uptodate-digest
                    819:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                    820:        if [ ! -f ${DISTINFO_FILE} ]; then                              \
                    821:                ${ECHO_MSG} "=> No checksum file.";                     \
                    822:        else                                                            \
1.1540.2.24  tv        823:                (cd ${DISTDIR}; OK="true"; missing="";                  \
1.1540.2.1  tv        824:                  for file in "" ${_CKSUMFILES}; do                     \
                    825:                        if [ "X$$file" = X"" ]; then continue; fi;      \
1.1540.2.24  tv        826:                        filesummed=false;                               \
                    827:                        for a in ${DIGEST_ALGORITHMS}; do               \
                    828:                                CKSUM2=`${AWK} 'NF == 4 && $$1 == "'$$a'" && $$2 == "('$$file')" && $$3 == "=" {print $$4;}' ${DISTINFO_FILE}`; \
                    829:                                case "$${CKSUM2}" in                    \
                    830:                                "")     ${ECHO_MSG} "=> No $$a checksum recorded for $$file."; \
                    831:                                        ;;                              \
                    832:                                *)      filesummed=true;                \
                    833:                                        CKSUM=`${DIGEST} $$a < $$file`; \
                    834:                                        if [ "$$CKSUM2" = "IGNORE" ]; then \
                    835:                                                ${ECHO_MSG} "=> Checksum for $$file is set to IGNORE in checksum file even though"; \
                    836:                                                ${ECHO_MSG} "   the file is not in the "'$$'"{IGNOREFILES} list."; \
                    837:                                                OK="false";             \
                    838:                                        elif [ "$$CKSUM" = "$$CKSUM2" ]; then   \
                    839:                                                ${ECHO_MSG} "=> Checksum $$a OK for $$file."; \
                    840:                                        else                            \
                    841:                                                ${ECHO_MSG} "=> Checksum $$a mismatch for $$file."; \
                    842:                                                OK="false";             \
                    843:                                        fi ;;                           \
                    844:                                esac;                                   \
                    845:                        done;                                           \
                    846:                        case "$$filesummed" in                          \
                    847:                        false)  missing="$$missing $$file";             \
                    848:                                OK=false ;;                             \
                    849:                        esac;                                           \
1.1540.2.1  tv        850:                  done;                                                 \
                    851:                  for file in "" ${_IGNOREFILES}; do                    \
                    852:                        if [ "X$$file" = X"" ]; then continue; fi;      \
                    853:                        CKSUM2=`${AWK} 'NF == 4 && $$3 == "=" && $$2 == "('$$file')"{print $$4;}' ${DISTINFO_FILE}`; \
                    854:                        if [ "$$CKSUM2" = "" ]; then                    \
                    855:                                ${ECHO_MSG} "=> No checksum recorded for $$file, file is in "'$$'"{IGNOREFILES} list."; \
                    856:                                OK="false";                             \
                    857:                        elif [ "$$CKSUM2" != "IGNORE" ]; then           \
                    858:                                ${ECHO_MSG} "=> Checksum for $$file is not set to IGNORE in checksum file even though"; \
                    859:                                ${ECHO_MSG} "   the file is in the "'$$'"{IGNOREFILES} list."; \
                    860:                                OK="false";                             \
                    861:                        fi;                                             \
                    862:                  done;                                                 \
                    863:                  if [ "$$OK" != "true" ]; then                         \
1.1540.2.24  tv        864:                        case "$$missing" in                             \
                    865:                        "")     ;;                                      \
                    866:                        *)      ${ECHO_MSG} "Missing checksums for $$missing";; \
                    867:                        esac;                                           \
1.1540.2.1  tv        868:                        ${ECHO_MSG} "Make sure the Makefile and checksum file (${DISTINFO_FILE})"; \
                    869:                        ${ECHO_MSG} "are up to date.  If you want to override this check, type"; \
                    870:                        ${ECHO_MSG} "\"${MAKE} NO_CHECKSUM=yes [other args]\"."; \
                    871:                        exit 1;                                         \
                    872:                  fi) ;                                                 \
                    873:        fi
1.1067    jlam      874: .  endif
1.1540.2.1  tv        875:
                    876: .endif # !empty(PKG_PHASES:Mchecksum) && !defined(_PKG_SKIPPED)
                    877:
                    878: ############################################################################
                    879: # Phase `depends'
                    880: ############################################################################
                    881:
                    882: .if !empty(PKG_PHASES:Mdepends) && !defined(_PKG_SKIPPED)
                    883:
                    884: .  if defined(RECOMMENDED)
                    885: .    if !empty(IGNORE_RECOMMENDED:M[nN][oO])
                    886: DEPENDS+=              ${RECOMMENDED}
                    887: .    else
                    888: BUILD_DEFS_FIXED+=     IGNORE_RECOMMENDED
                    889: .    endif
1.1067    jlam      890: .  endif
                    891:
1.1540.2.5  tv        892: .  include "../../mk/tools.mk"
                    893:
                    894: # If NO_BUILD is defined, default to not needing a compiler.
                    895: .  if defined(NO_BUILD)
                    896: USE_LANGUAGES?=                # empty
                    897: .  endif
                    898: .  include "../../mk/compiler.mk"
                    899:
                    900: # USE_BUILDLINK3 == "no" implies NO_BUILDLINK
                    901: .  if !empty(USE_BUILDLINK3:M[nN][oO])
                    902: NO_BUILDLINK=          yes
                    903: .  endif
                    904: .  if !defined(NO_BUILDLINK)
                    905: .    include "../../mk/buildlink3/bsd.buildlink3.mk"
                    906: .  endif
                    907:
                    908: ##### "depends" target implementation
                    909:
1.1540.2.1  tv        910: # Remove some redundant dependencies from the DEPENDS list.
                    911: .  include "../../mk/reduce-depends.mk"
1.1067    jlam      912:
1.1540.2.1  tv        913: _REAL_TARGETS.depends+=                depends-message
1.1466    xtraeme   914:
1.1540.2.5  tv        915: #===> "do-depends"
1.1       agc       916:
1.1540.2.5  tv        917: _REAL_TARGETS.depends+=                do-depends
                    918: .PHONY: do-depends
1.1       agc       919:
1.1540.2.1  tv        920: .endif # !empty(PKG_PHASES:Mdepends) && !defined(_PKG_SKIPPED)
1.177     agc       921:
1.1540.2.1  tv        922: ############################################################################
                    923: # Phase `extract'
                    924: ############################################################################
1.135     agc       925:
1.1540.2.1  tv        926: .if !empty(PKG_PHASES:Mextract) && !defined(_PKG_SKIPPED)
1.1       agc       927:
1.1540.2.1  tv        928: _REAL_TARGETS.extract+=                extract-message
                    929:
                    930: #===> "build-defs-message"
                    931: # if BUILD_DEFS is non-empty, show a notice the the builder
                    932:
                    933: .  if !empty(PKGSRC_SHOW_BUILD_DEFS:M[yY][eE][sS])
                    934: _REAL_TARGETS.extract+=                build-defs-message
                    935: .PHONY: build-defs-message
                    936: build-defs-message:
                    937: .    if !empty(BUILD_DEFS)
                    938:        @${ECHO} "=========================================================================="
                    939:        @${ECHO} "The following variables will affect the build process of this package,"
                    940:        @${ECHO} "${PKGNAME}.  Their current value is shown below:"
                    941:        @${ECHO} ""
                    942: .      for var in ${BUILD_DEFS}
                    943: .        if !defined(${var})
                    944:        @${ECHO} "        * ${var} (not defined)"
                    945: .        elif defined(${var}) && empty(${var})
                    946:        @${ECHO} "        * ${var} (defined)"
                    947: .        else
                    948:        @${ECHO} "        * ${var} = ${${var}}"
                    949: .        endif
                    950: .      endfor
                    951:        @${ECHO} ""
                    952:        @${ECHO} "You may want to abort the process now with CTRL-C and change their value"
                    953:        @${ECHO} "before continuing.  Be sure to run \`${MAKE} clean' after"
                    954:        @${ECHO} "the changes."
                    955:        @${ECHO} "=========================================================================="
                    956: .    endif
1.789     hubertf   957: .  endif
1.1540.2.1  tv        958:
                    959: #===> "pre-extract"
                    960:
                    961: _REAL_TARGETS.extract+=                pre-extract
                    962: .PHONY: pre-extract
                    963: pre-extract: .OPTIONAL
                    964:
                    965: #===> "do-extract"
                    966:
                    967: _REAL_TARGETS.extract+=                do-extract
                    968: .PHONY: do-extract
                    969: #do-extract:
                    970:
                    971: #===> "post-extract"
                    972:
                    973: _REAL_TARGETS.extract+=                post-extract
                    974: .PHONY: post-extract
                    975: post-extract: .OPTIONAL
                    976:
                    977: .endif # !empty(PKG_PHASES:Mextract) && !defined(_PKG_SKIPPED)
                    978:
                    979: ############################################################################
                    980: # Phase `patch'
                    981: ############################################################################
                    982:
                    983: .if !empty(PKG_PHASES:Mpatch) && !defined(_PKG_SKIPPED)
                    984:
                    985: # determine if we need a working patch(1).
                    986: .  if defined(PATCHFILES)
                    987: _NEED_PATCH=           YES
                    988: .  elif defined(_OPSYS_GPATCH_REQD) && !empty(_OPSYS_GPATCH_REQD:M[yY][eE][sS])
                    989: _NEED_PATCH=           YES
1.1315    cube      990: .  else
1.1540.2.1  tv        991: _NEED_PATCH!=          if [ -d ${PATCHDIR} ]; then \
                    992:                                if [ "`${ECHO} ${PATCHDIR}/patch-*`" != "${PATCHDIR}/patch-*" ]; then \
                    993:                                        ${ECHO} YES; \
                    994:                                else \
                    995:                                        ${ECHO} NO; \
                    996:                                fi \
                    997:                        else \
                    998:                                ${ECHO} NO; \
                    999:                        fi
1.1315    cube     1000: .  endif
1.1540.2.1  tv       1001:
                   1002: .  if ${_NEED_PATCH} == "YES"
                   1003: USE_GNU_TOOLS+=                patch
1.1315    cube     1004: .  endif
1.1540.2.1  tv       1005:
                   1006: .  if defined(PATCH_DEBUG) || defined(PKG_VERBOSE)
                   1007: PATCH_DEBUG_TMP=       yes
1.1315    cube     1008: .  endif
1.1540.2.1  tv       1009: PATCH_DEBUG_TMP?=      no
                   1010:
                   1011: PATCH_STRIP?=          -p0
                   1012: .  if ${PATCH_DEBUG_TMP} == "yes"
                   1013: PATCH_ARGS?=           -d ${WRKSRC} -E ${PATCH_STRIP}
                   1014: .  endif
                   1015: PATCH_ARGS?=           -d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP}
1.1       agc      1016:
1.1540.2.1  tv       1017: PATCH_ARGS+=           ${BATCH:D--batch}
                   1018: .  if defined(_PATCH_CAN_BACKUP) && (${_PATCH_CAN_BACKUP} == "yes")
                   1019: PATCH_ARGS+=           ${_PATCH_BACKUP_ARG} .orig
                   1020: .  endif
                   1021: PATCH_FUZZ_FACTOR?=    -F0     # Default to zero fuzz
1.1       agc      1022:
1.1540.2.1  tv       1023: # The following variables control how "distribution" patches are extracted
                   1024: # and applied to the package sources.
                   1025: #
                   1026: # PATCH_DIST_STRIP is a patch option that sets the pathname strip count.
                   1027: # PATCH_DIST_ARGS is the list of arguments to pass to the patch command.
                   1028: # PATCH_DIST_CAT is the command that outputs the patch to stdout.
                   1029: #
                   1030: # For each of these variables, there is a patch-specific variant that
                   1031: # may be set, i.e. PATCH_DIST_STRIP.<patch>, PATCH_DIST_ARGS.<patch>,
                   1032: # PATCH_DIST_CAT.<patch>.
                   1033: #
                   1034: PATCH_DIST_STRIP?=             -p0
                   1035: .  for i in ${PATCHFILES}
                   1036: PATCH_DIST_STRIP.${i:S/=/--/}?=        ${PATCH_DIST_STRIP}
                   1037: .    if defined(PATCH_DIST_ARGS)
                   1038: PATCH_DIST_ARGS.${i:S/=/--/}?= ${PATCH_DIST_ARGS}
                   1039: .    elif ${PATCH_DEBUG_TMP} == "yes"
                   1040: PATCH_DIST_ARGS.${i:S/=/--/}?= -d ${WRKSRC} -E ${PATCH_DIST_STRIP.${i:S/=/--/}}
                   1041: .    else
                   1042: PATCH_DIST_ARGS.${i:S/=/--/}?= -d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP.${i:S/=/--/}}
                   1043: .    endif
                   1044: .  endfor
                   1045: .  if defined(BATCH)
                   1046: PATCH_DIST_ARGS+=              --batch
                   1047: .    for i in ${PATCHFILES}
                   1048: PATCH_DIST_ARGS.${i:S/=/--/}+= --batch
                   1049: .    endfor
                   1050: .  endif
                   1051: .  if defined(_PATCH_CAN_BACKUP) && (${_PATCH_CAN_BACKUP} == "yes")
                   1052: PATCH_DIST_ARGS+=              ${_PATCH_BACKUP_ARG} .orig_dist
                   1053: .    for i in ${PATCHFILES}
                   1054: PATCH_DIST_ARGS.${i:S/=/--/}+= ${_PATCH_BACKUP_ARG} .orig_dist
                   1055: .    endfor
                   1056: .  endif
                   1057: PATCH_DIST_CAT?=       { case $$patchfile in                           \
                   1058:                          *.Z|*.gz) ${GZCAT} $$patchfile ;;             \
                   1059:                          *.bz2)    ${BZCAT} $$patchfile ;;             \
                   1060:                          *)        ${CAT} $$patchfile ;;               \
                   1061:                          esac; }
                   1062: .  for i in ${PATCHFILES}
                   1063: PATCH_DIST_CAT.${i:S/=/--/}?=  { patchfile=${i}; ${PATCH_DIST_CAT}; }
                   1064: .  endfor
1.1       agc      1065:
1.1540.2.1  tv       1066: .  if !empty(PKGSRC_SHOW_PATCH_ERRORMSG:M[yY][eE][sS])
                   1067: PKGSRC_PATCH_FAIL=                                                     \
                   1068: if [ -n "${PKG_OPTIONS}" ] || [ -n "${_LOCALPATCHFILES}" ]; then       \
1.1540.2.9  tv       1069:        ${ECHO} "=========================================================================="; \
1.1540.2.1  tv       1070:        ${ECHO};                                                        \
1.1540.2.9  tv       1071:        ${ECHO} "Some of the selected build options and/or local patches may be incompatible."; \
1.1540.2.1  tv       1072:        ${ECHO} "Please try building with fewer options or patches.";   \
                   1073:        ${ECHO};                                                        \
1.1540.2.9  tv       1074:        ${ECHO} "=========================================================================="; \
1.1540.2.1  tv       1075: fi; exit 1
                   1076: .  endif
                   1077: PKGSRC_PATCH_FAIL?=    exit 1
1.602     hubertf  1078:
1.1540.2.3  tv       1079: _REAL_TARGETS.patch+=  patch-message pre-patch do-patch post-patch
                   1080:
1.1540.2.1  tv       1081: .endif # !empty(PKG_PHASES:Mpatch) && !defined(_PKG_SKIPPED)
1.254     tron     1082:
1.1540.2.1  tv       1083: ############################################################################
                   1084: # Phase `tools'
                   1085: ############################################################################
1.254     tron     1086:
1.1540.2.1  tv       1087: do-tools: .OPTIONAL
                   1088: .if !empty(PKG_PHASES:Mtools) && !defined(_PKG_SKIPPED)
1.273     tv       1089:
1.1540.2.3  tv       1090: _REAL_TARGETS.tools+=  tools-message pre-tools do-tools post-tools
                   1091:
1.1540.2.1  tv       1092: .endif # !empty(PKG_PHASES:Mtools) && !defined(_PKG_SKIPPED)
                   1093:
                   1094: ############################################################################
                   1095: # Phase `wrapper'
                   1096: ############################################################################
1.1       agc      1097:
1.1540.2.1  tv       1098: do-wrapper: .OPTIONAL
                   1099: .if !empty(PKG_PHASES:Mwrapper) && !defined(_PKG_SKIPPED)
1.907     agc      1100:
1.1540.2.1  tv       1101: .  include "../../mk/wrapper/bsd.wrapper.mk"
1.1       agc      1102:
1.1540.2.3  tv       1103: _REAL_TARGETS.wrapper+=        wrapper-message pre-wrapper do-wrapper post-wrapper
                   1104:
1.1540.2.1  tv       1105: .endif # !empty(PKG_PHASES:Mwrapper) && !defined(_PKG_SKIPPED)
                   1106:
                   1107: ############################################################################
                   1108: # Phase `configure'
                   1109: ############################################################################
                   1110:
                   1111: .if !empty(PKG_PHASES:Mconfigure) && !defined(_PKG_SKIPPED)
                   1112:
                   1113: CONFIGURE_ENV+=                ${ALL_ENV}
                   1114: CONFIGURE_ENV+=                ac_given_INSTALL="`${TYPE} ${INSTALL} | ${AWK} '{ print $$NF }'` -c -o ${BINOWN} -g ${BINGRP}"
                   1115: CONFIGURE_ENV+=                AWK=${AWK:Q}
                   1116: CONFIGURE_ENV+=                INSTALL="`${TYPE} ${INSTALL} | ${AWK} '{ print $$NF }'` -c -o ${BINOWN} -g ${BINGRP}"
                   1117: CONFIGURE_ENV+=                MAKE=${MAKE_PROGRAM:T:Q}
                   1118: CONFIGURE_ENV+=                M4=${M4:Q}
                   1119: CONFIGURE_ENV+=                YACC=${YACC:Q}
1.262     tv       1120:
1.1540.2.1  tv       1121: .  if defined(GNU_CONFIGURE)
                   1122: #
                   1123: # If GNU_CONFIGURE is defined, then pass LIBS to the GNU configure script.
                   1124: # also pass in a CONFIG_SHELL to avoid picking up bash
                   1125: #
                   1126: CONFIG_SHELL?=         ${SH}
                   1127: CONFIGURE_ENV+=                CONFIG_SHELL=${CONFIG_SHELL}
                   1128: CONFIGURE_ENV+=                install_sh=${INSTALL:Q}
                   1129: CONFIGURE_ENV+=                LIBS=${LIBS:Q}
1.1540.2.19  tv       1130: CONFIGURE_ENV+=                ${USE_LIBTOOL:Dlt_cv_sys_max_cmd_len=${_OPSYS_MAX_CMDLEN_CMD:D${_OPSYS_MAX_CMDLEN_CMD:sh}}}
1.996     jlam     1131: #
1.1366    jlam     1132: # GNU_CONFIGURE_PREFIX is the argument to the --prefix option passed to the
1.996     jlam     1133: # GNU configure script.
                   1134: #
                   1135: GNU_CONFIGURE_PREFIX?= ${PREFIX}
                   1136: CONFIGURE_ARGS+=       --host=${MACHINE_GNU_PLATFORM}
                   1137: CONFIGURE_ARGS+=       --prefix=${GNU_CONFIGURE_PREFIX}
1.1       agc      1138: HAS_CONFIGURE=         yes
1.1540.2.1  tv       1139: .    if defined(USE_X11)
1.1076    jlam     1140: CONFIGURE_ARGS+=       --x-includes=${X11BASE}/include
1.1536    sketch   1141: CONFIGURE_ARGS+=        --x-libraries=${X11BASE}/lib${LIBABISUFFIX}
1.1540.2.1  tv       1142: .    endif
1.1456    reed     1143: CONFIGURE_HAS_INFODIR?=        yes
1.1540.2.1  tv       1144: .    if !empty(INFO_FILES) && !empty(CONFIGURE_HAS_INFODIR:M[yY][eE][sS])
1.1455    reed     1145: CONFIGURE_ARGS+=       --infodir=${PREFIX}/${INFO_DIR}
1.1540.2.1  tv       1146: .    endif
1.1397    grant    1147: #
                   1148: # By default, override config.guess and config.sub for GNU configure
                   1149: # packages. pkgsrc's updated versions of these scripts allows GNU
                   1150: # configure to recognise NetBSD ports such as shark.
                   1151: #
1.1403    jlam     1152: CONFIG_GUESS_OVERRIDE?=                \
                   1153:        config.guess */config.guess */*/config.guess
                   1154: CONFIG_SUB_OVERRIDE?=          \
                   1155:        config.sub */config.sub */*/config.sub
1.1540.2.12  tv       1156: CONFIG_RPATH_OVERRIDE?=                # set by platform file as needed
1.1400    jlam     1157: #
                   1158: # By default, override config.status for GNU configure packages.  We
                   1159: # never want it to execute after the configure phase has ended as it
                   1160: # might overwrite any post-configure changes we might have made to the
                   1161: # generated files.
                   1162: #
                   1163: CONFIG_STATUS_OVERRIDE?=       \
                   1164:        config.status */config.status */*/config.status
1.1540.2.1  tv       1165: .  endif
1.865     jlam     1166:
1.1540.2.3  tv       1167: _REAL_TARGETS.configure+=configure-message pre-configure pre-configure-override do-configure post-configure
                   1168:
1.1540.2.1  tv       1169: .endif # !empty(PKG_PHASES:Mconfigure) && !defined(_PKG_SKIPPED)
                   1170:
                   1171: ############################################################################
                   1172: # Phase `build'
                   1173: ############################################################################
                   1174:
                   1175: .if !empty(PKG_PHASES:Mbuild) && !defined(_PKG_SKIPPED)
                   1176:
1.1540.2.3  tv       1177: _REAL_TARGETS.build+=  build-message pre-build do-build post-build
                   1178:
1.1540.2.1  tv       1179: .endif # !empty(PKG_PHASES:Mbuild) && !defined(_PKG_SKIPPED)
                   1180:
                   1181: ############################################################################
                   1182: # Phase `test'
                   1183: ############################################################################
                   1184:
                   1185: .if !empty(PKG_PHASES:Mtest)
1.1540.2.3  tv       1186:
                   1187: _REAL_TARGETS.test+=   test-message pre-test do-test post-test
                   1188:
1.1540.2.1  tv       1189: .endif # !empty(PKG_PHASES:Mtest)
                   1190:
                   1191: ############################################################################
                   1192: # Phase `install'
                   1193: ############################################################################
                   1194:
                   1195: .if !empty(PKG_PHASES:Minstall)
                   1196:
                   1197: ##### PLIST manipulation
                   1198:
1.1540.2.4  tv       1199: .  include "../../mk/plist.mk"
1.1540.2.1  tv       1200:
1.1540.2.19  tv       1201: ##### Handle alternatives
                   1202:
                   1203: .  include "../../mk/alternatives.mk"
                   1204:
1.1540.2.1  tv       1205: ##### Make subtargets for non-su portion of "install".
                   1206:
                   1207: #===> "install-check-pkgname"
                   1208:
                   1209: _REAL_TARGETS.install+=                install-check-pkgname
                   1210: .PHONY: install-check-pkgname
                   1211: install-check-pkgname:
                   1212:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   1213:        extractname=`${CAT} ${extract_COOKIE}`;                         \
                   1214:        case "$$extractname" in                                         \
                   1215:        "")     ${ECHO_MSG} "*** Warning: ${WRKDIR} may contain an older version of ${PKGBASE}" ;; \
                   1216:        "${PKGNAME}")   ;;                                              \
                   1217:        *)      ${ECHO_MSG} "*** Warning: Package version $$extractname in ${WRKDIR}"; \
                   1218:                ${ECHO_MSG} "*** Current version ${PKGNAME} in pkgsrc directory"; \
                   1219:                ${ECHO_MSG} "*** Cleaning and rebuilding the newer version of the package..."; \
                   1220:                ${MAKE} clean && ${MAKE} build ;;                       \
                   1221:        esac
                   1222:
                   1223: #===> "do-su-install"
                   1224: # su to root, then run real-su-install
                   1225:
                   1226: _REAL_TARGETS.install+=                do-su-install
                   1227:
                   1228: ##### Make subtargets for su portion of "install".
                   1229:
                   1230: #===> "message"
                   1231: # generate ${MESSAGE} from ${MESSAGE_SRC} by substituting
                   1232: # for MESSAGE_SUBST entries
                   1233:
                   1234: _REAL_TARGETS.su-install+=     message
                   1235: .PHONY: message
                   1236: message: ${MESSAGE}
                   1237: .  if defined(MESSAGE)
                   1238: ${MESSAGE}: ${MESSAGE_SRC}
                   1239:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   1240:        if [ -z "${MESSAGE_SRC}" ]; then                                \
                   1241:                ${ECHO} "${MESSAGE_SRC} not found.";                    \
                   1242:                ${ECHO} "Please set MESSAGE_SRC correctly.";            \
                   1243:        else                                                            \
                   1244:                ${CAT} ${MESSAGE_SRC} |                                 \
                   1245:                        ${SED} ${MESSAGE_SUBST_SED}                     \
                   1246:                        > ${MESSAGE};                                   \
                   1247:        fi
1.865     jlam     1248: .  endif
                   1249:
1.1540.2.1  tv       1250: #===> "init-install"
                   1251: # check for conflicts and create install directories
1.1       agc      1252:
1.1540.2.1  tv       1253: _REAL_TARGETS.su-install+=     init-install
                   1254: .PHONY: init-install
                   1255: init-install:
                   1256: .  if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER) &&     \
                   1257:     (${PKG_INSTALLATION_TYPE} == "overwrite")
                   1258: .    if defined(CONFLICTS)
                   1259:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   1260:        ${RM} -f ${WRKDIR}/.CONFLICTS
                   1261: .      for conflict in ${CONFLICTS}
                   1262:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   1263:        found="`${PKG_BEST_EXISTS} \"${conflict}\" || ${TRUE}`";        \
                   1264:        if [ X"$$found" != X"" ]; then                                  \
                   1265:                ${ECHO} "$$found" >> ${WRKDIR}/.CONFLICTS;              \
                   1266:        fi
                   1267: .      endfor
                   1268:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   1269:        if [ -s ${WRKDIR}/.CONFLICTS ]; then                            \
                   1270:                found=`${SED} -e s'|${_PKG_DBDIR}/||g' ${WRKDIR}/.CONFLICTS | tr '\012' ' '`; \
                   1271:                ${ECHO_MSG} "${_PKGSRC_IN}> ${PKGNAME} conflicts with installed package(s): $$found found."; \
                   1272:                ${ECHO_MSG} "*** They install the same files into the same place."; \
                   1273:                ${ECHO_MSG} "*** Please remove $$found first with pkg_delete(1)."; \
                   1274:                ${RM} -f ${WRKDIR}/.CONFLICTS;                          \
                   1275:                exit 1;                                                 \
                   1276:        fi
                   1277: .    endif     # CONFLICTS
                   1278:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   1279:        found="`${PKG_BEST_EXISTS} \"${PKGWILDCARD}\" || ${TRUE}`";     \
                   1280:        if [ "$$found" != "" ]; then                                    \
                   1281:                ${ECHO_MSG} "${_PKGSRC_IN}> $$found is already installed - perhaps an older version?"; \
                   1282:                ${ECHO_MSG} "*** If so, you may use either of:"; \
                   1283:                ${ECHO_MSG} "***  - \"pkg_delete $$found\" and \"${MAKE} reinstall\" to upgrade properly"; \
                   1284:                ${ECHO_MSG} "***  - \"${MAKE} update\" to rebuild the package and all of its dependencies"; \
                   1285:                ${ECHO_MSG} "***  - \"${MAKE} replace\" to replace only the package without re-linking"; \
                   1286:                ${ECHO_MSG} "***    dependencies, risking various problems."; \
                   1287:                exit 1;                                                 \
                   1288:        fi
1.1540.2.15  tv       1289: .  endif # !NO_PKG_REGISTER && !FORCE_PKG_REGISTER && overwrite
1.1540.2.1  tv       1290: .  if ${PKG_INSTALLATION_TYPE} == "pkgviews"
                   1291:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   1292:        found="`${PKG_INFO} -e ${PKGNAME} || ${TRUE}`";                 \
                   1293:        if [ "$$found" != "" ]; then                                    \
                   1294:                ${ECHO_MSG} "${_PKGSRC_IN}>  $$found is already installed."; \
                   1295:                exit 1;                                                 \
                   1296:        fi
                   1297: .  endif
                   1298:        ${_PKG_SILENT}${_PKG_DEBUG}if [ `${SH} -c umask` -ne ${DEF_UMASK} ]; then \
1.1540.2.15  tv       1299:                ${ECHO_MSG} "${_PKGSRC_IN}> Warning: your umask is \"`${SH} -c umask`"\".; \
1.1540.2.1  tv       1300:                ${ECHO_MSG} "If this is not desired, set it to an appropriate value (${DEF_UMASK})"; \
                   1301:                ${ECHO_MSG} "and install this package again by \`\`${MAKE} deinstall reinstall''."; \
                   1302:        fi
1.1540.2.13  tv       1303: .  if defined(PKG_DEVELOPER) && (${CHECK_FILES} == "YES")
                   1304:        ${_PKG_SILENT}${_PKG_DEBUG}${ECHO_MSG} "${_PKGSRC_IN}> Generating pre-install file lists"
1.1540.2.23  tv       1305:        ${_PKG_SILENT}${_PKG_DEBUG}${FIND} ${PREFIX} -type f -or -type l -print \
1.1540.2.13  tv       1306:                2>/dev/null ${CHECK_FILES_SKIP_CMD} >${WRKDIR}/.prefix.pre \
                   1307:                || ${TRUE}
                   1308: .    if ${CHECK_FILES_STRICT} == "YES"
1.1540.2.23  tv       1309:        ${_PKG_SILENT}${_PKG_DEBUG}${FIND} ${PKG_SYSCONFDIR} -print \
1.1540.2.13  tv       1310:                2>/dev/null ${CHECK_FILES_SKIP_CMD} >${WRKDIR}/.sysconfdir.pre \
                   1311:                || ${TRUE}
1.1540.2.23  tv       1312:        ${_PKG_SILENT}${_PKG_DEBUG}${FIND} ${VARBASE} -print \
1.1540.2.13  tv       1313:                2>/dev/null ${CHECK_FILES_SKIP_CMD} >${WRKDIR}/.varbase.pre \
                   1314:                || ${TRUE}
                   1315: .    endif
                   1316: .  endif
1.1540.2.1  tv       1317: .  if defined(INSTALLATION_DIRS) && !empty(INSTALLATION_DIRS)
                   1318:        ${_PKG_SILENT}${_PKG_DEBUG}${ECHO_MSG} "${_PKGSRC_IN}> Creating installation directories"
                   1319:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   1320:        for dir in ${INSTALLATION_DIRS}; do                             \
                   1321:                case $$dir in                                           \
                   1322:                /*)     ;;                                              \
                   1323:                *bin|*bin/*|*libexec|*libexec/*)                        \
                   1324:                        ${INSTALL_PROGRAM_DIR} ${PREFIX}/$$dir ;;       \
                   1325:                *man/*)                                                 \
                   1326:                        ${INSTALL_MAN_DIR} ${PREFIX}/$$dir ;;           \
                   1327:                *)                                                      \
                   1328:                        ${INSTALL_DATA_DIR} ${PREFIX}/$$dir ;;          \
                   1329:                esac;                                                   \
                   1330:        done
                   1331: .  endif       # INSTALLATION_DIRS
                   1332: .  if !defined(NO_MTREE)
                   1333:        ${_PKG_SILENT}${_PKG_DEBUG}if [ `${ID} -u` = `${ID} -u ${ROOT_USER}` ]; then            \
                   1334:                if [ ! -f ${MTREE_FILE} ]; then                         \
                   1335:                        ${ECHO_MSG} "Error: mtree file \"${MTREE_FILE}\" is missing."; \
                   1336:                        exit 1;                                         \
                   1337:                else                                                    \
                   1338:                        if [ ! -d ${PREFIX} ]; then                     \
                   1339:                                ${MKDIR} ${PREFIX};                     \
                   1340:                        fi;                                             \
                   1341:                        ${MTREE} ${MTREE_ARGS} ${PREFIX}/;              \
                   1342:                fi;                                                     \
                   1343:        else                                                            \
                   1344:                ${ECHO_MSG} "Warning: not superuser, can't run mtree."; \
                   1345:                ${ECHO_MSG} "Become ${ROOT_USER} and try again to ensure correct permissions."; \
                   1346:        fi
                   1347: .  else
                   1348:        ${_PKG_SILENT}${_PKG_DEBUG}[ -d ${PREFIX} ] || ${MKDIR} ${PREFIX}
                   1349: .  endif # !NO_MTREE
1.1       agc      1350:
1.1540.2.15  tv       1351: #===> "pre-install-fake-pkg"
                   1352:
                   1353: .  if !defined(NO_PKG_REGISTER)
                   1354: _REAL_TARGETS.su-install+=     pre-install-fake-pkg
                   1355: .  endif # !NO_PKG_REGISTER
                   1356:
1.1540.2.1  tv       1357: #===> "pre-install-script"
                   1358:
                   1359: _REAL_TARGETS.su-install+=     pre-install-script
                   1360: .PHONY: pre-install-script
                   1361: pre-install-script: .OPTIONAL
                   1362:
                   1363: #===> "pre-install"
                   1364:
                   1365: _REAL_TARGETS.su-install+=     pre-install
                   1366: .PHONY: pre-install
                   1367: pre-install: .OPTIONAL
                   1368:
                   1369: #===> "do-install"
                   1370:
                   1371: _REAL_TARGETS.su-install+=     do-install
1.1540.2.5  tv       1372: .PHONY: do-install
                   1373: .if !target(do-install)
                   1374: do-install:
                   1375: .  for DIR in ${INSTALL_DIRS}
                   1376:        ${_PKG_SILENT}${_PKG_DEBUG}${_ULIMIT_CMD}cd ${DIR} && ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} -f ${MAKEFILE} ${INSTALL_TARGET}
                   1377: .  endfor
                   1378: .endif
1.1540.2.1  tv       1379:
                   1380: #===> "post-install"
                   1381:
                   1382: _REAL_TARGETS.su-install+=     post-install
                   1383: .PHONY: post-install
                   1384: post-install: .OPTIONAL
                   1385:
                   1386: #===> "plist"
                   1387: #
                   1388: # PLIST must be generated at this late point (instead of
                   1389: # depending on it somewhere earlier), because it needs
                   1390: # to be created _after_ the {pre,do,post}-install
                   1391: # targets are run.
                   1392: #
                   1393: # We generate _before_ post-install-script is run so
                   1394: # that the real config files and rc.d scripts aren't
                   1395: # listed in the PLIST.
                   1396: #
                   1397: _REAL_TARGETS.su-install+=     plist
                   1398: .PHONY: plist
                   1399: plist: ${PLIST}
                   1400:
1.1540.2.13  tv       1401: #===> "post-install-check-files"
                   1402:
                   1403: .if defined(PKG_DEVELOPER) && (${CHECK_FILES} == "YES")
                   1404: _REAL_TARGETS.su-install+=     post-install-check-files
                   1405: .PHONY: post-install-check-files
                   1406: post-install-check-files:
                   1407:        ${_PKG_SILENT}${_PKG_DEBUG}${ECHO_MSG} "${_PKGSRC_IN}> Generating post-install file lists"
1.1540.2.23  tv       1408:        ${_PKG_SILENT}${_PKG_DEBUG}${FIND} ${PREFIX} -type f -or -type l -print \
1.1540.2.13  tv       1409:                2>/dev/null ${CHECK_FILES_SKIP_CMD} >${WRKDIR}/.prefix.post \
                   1410:                || ${TRUE}
                   1411: .  if ${CHECK_FILES_STRICT} == "YES"
1.1540.2.23  tv       1412:        ${_PKG_SILENT}${_PKG_DEBUG}${FIND} ${PKG_SYSCONFDIR} -print \
1.1540.2.13  tv       1413:                2>/dev/null ${CHECK_FILES_SKIP_CMD} >${WRKDIR}/.sysconfdir.post\
                   1414:                || ${TRUE}
1.1540.2.23  tv       1415:        ${_PKG_SILENT}${_PKG_DEBUG}${FIND} ${VARBASE} -print \
1.1540.2.13  tv       1416:                2>/dev/null ${CHECK_FILES_SKIP_CMD} >${WRKDIR}/.varbase.post \
                   1417:                || ${TRUE}
                   1418: .  endif
                   1419: .endif
                   1420:
1.1540.2.1  tv       1421: #===> "post-install-script"
                   1422:
                   1423: _REAL_TARGETS.su-install+=     post-install-script
                   1424: .PHONY: post-install-script
                   1425: post-install-script: .OPTIONAL
                   1426:
                   1427: #===> "post-install-man"
                   1428: # fixup manpages to match actual installed files
                   1429:
                   1430: _REAL_TARGETS.su-install+=     post-install-man
                   1431: .PHONY: post-install-man
                   1432: post-install-man:
                   1433:        ${_PKG_SILENT}${_PKG_DEBUG}newmanpages=`${EGREP} -h             \
                   1434:                '^([^@/]*/)*man/([^/]*/)?(man[1-9ln]/.*\.[1-9ln]|cat[1-9ln]/.*\.0)(\.gz)?$$' \
                   1435:                ${PLIST} 2>/dev/null || ${TRUE}`;                       \
                   1436:        if [ X"${MANCOMPRESSED}" != X"" -a X"${MANZ}" = X"" ]; then     \
                   1437:                ${ECHO_MSG} "${_PKGSRC_IN}> [Automatic manual page handling]";  \
                   1438:                ${ECHO_MSG} "${_PKGSRC_IN}> Decompressing manual pages for ${PKGNAME}"; \
                   1439:                for manpage in $$newmanpages; do                        \
                   1440:                        manpage=`${ECHO} $$manpage | ${SED} -e 's|\.gz$$||'`; \
                   1441:                        if [ -h ${PREFIX}/$$manpage.gz ]; then          \
                   1442:                                set - `${LS} -l ${PREFIX}/$$manpage.gz | ${SED} -e 's|\.gz$$||'`; \
                   1443:                                shift `expr $$# - 1`;                   \
                   1444:                                ${RM} -f ${PREFIX}/$$manpage;           \
                   1445:                                ${LN} -s $${1} ${PREFIX}/$$manpage;     \
                   1446:                                ${RM} ${PREFIX}/$$manpage.gz;           \
                   1447:                        else                                            \
                   1448:                                ${GUNZIP_CMD} ${PREFIX}/$$manpage.gz;   \
                   1449:                        fi;                                             \
                   1450:                        if [ X"${PKG_VERBOSE}" != X"" ]; then           \
                   1451:                                ${ECHO_MSG} "$$manpage";                \
                   1452:                        fi;                                             \
                   1453:                done;                                                   \
                   1454:        fi;                                                             \
                   1455:        if [ X"${MANCOMPRESSED}" = X"" -a X"${MANZ}" != X"" ]; then     \
                   1456:                ${ECHO_MSG} "${_PKGSRC_IN}> [Automatic manual page handling]";  \
                   1457:                ${ECHO_MSG} "${_PKGSRC_IN}> Compressing manual pages for ${PKGNAME}"; \
                   1458:                for manpage in $$newmanpages; do                        \
                   1459:                        manpage=`${ECHO} $$manpage | ${SED} -e 's|\.gz$$||'`; \
                   1460:                        if [ -h ${PREFIX}/$$manpage ]; then             \
1.1540.2.9  tv       1461:                                set - `${LS} -l ${PREFIX}/$$manpage`;   \
1.1540.2.1  tv       1462:                                shift `expr $$# - 1`;                   \
                   1463:                                ${RM} -f ${PREFIX}/$$manpage.gz;        \
                   1464:                                ${LN} -s $${1}.gz ${PREFIX}/$$manpage.gz; \
                   1465:                                ${RM} ${PREFIX}/$$manpage;              \
                   1466:                        else                                            \
                   1467:                                ${GZIP_CMD} ${PREFIX}/$$manpage;        \
                   1468:                        fi;                                             \
                   1469:                        if [ X"${PKG_VERBOSE}" != X"" ]; then           \
                   1470:                                ${ECHO_MSG} "$$manpage";                \
                   1471:                        fi;                                             \
                   1472:                done;                                                   \
                   1473:        fi
                   1474:
                   1475: #===> "post-install-shlib"
                   1476:
                   1477: .  if ${_DO_SHLIB_CHECKS} == "yes"
                   1478: .    if ${PKG_INSTALLATION_TYPE} == "overwrite"
                   1479: _REAL_TARGETS.su-install+=     post-install-shlib
                   1480: .PHONY: post-install-shlib
                   1481: post-install-shlib:
                   1482:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   1483:        ${MAKE} ${MAKEFLAGS} do-shlib-handling SHLIB_PLIST_MODE=0
                   1484: .    endif
                   1485: .  endif
                   1486:
                   1487: #===> "post-install-message"
                   1488: # display MESSAGE, if specified
                   1489:
                   1490: .  ifdef MESSAGE
                   1491: _REAL_TARGETS.su-install+=     post-install-message
                   1492: .PHONY: post-install-message
                   1493: post-install-message:
                   1494:        @${ECHO_MSG} "${_PKGSRC_IN}> Please note the following:"
                   1495:        @${ECHO_MSG} ""
                   1496:        @${CAT} ${MESSAGE}
                   1497:        @${ECHO_MSG} ""
                   1498: .    if !empty(PKGSRC_MESSAGE_RECIPIENTS)
                   1499:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   1500:        (${ECHO} "The ${PKGNAME} package was installed on `${HOSTNAME_CMD}` at `date`"; \
                   1501:        ${ECHO} "";                                                     \
                   1502:        ${ECHO} "Please note the following:";                           \
                   1503:        ${ECHO} "";                                                     \
                   1504:        ${CAT} ${MESSAGE};                                              \
                   1505:        ${ECHO} "") |                                                   \
                   1506:        ${MAIL_CMD} -s"Package ${PKGNAME} installed on `${HOSTNAME_CMD}`" ${PKGSRC_MESSAGE_RECIPIENTS}
                   1507: .    endif
                   1508: .  endif
1.1433    grant    1509:
1.1540.2.15  tv       1510: #===> "register-pkg"
1.1370    jlam     1511:
1.1540.2.15  tv       1512: .  if !defined(NO_PKG_REGISTER)
                   1513: _REAL_TARGETS.su-install+=     register-pkg
                   1514: .  endif # !NO_PKG_REGISTER
1.1453    jlam     1515:
1.1540.2.1  tv       1516: #===> "check-shlibs"
1.1032    jlam     1517:
1.1540.2.1  tv       1518: .  if defined(PKG_DEVELOPER) && (${CHECK_SHLIBS} == "YES")
                   1519: _REAL_TARGETS.su-install+=     check-shlibs
1.1492    tv       1520: .  endif
                   1521:
1.1540.2.13  tv       1522: #===> "check-files"
                   1523:
                   1524: .  if defined(PKG_DEVELOPER) && (${CHECK_FILES} == "YES")
                   1525: _REAL_TARGETS.su-install+=     check-files
                   1526: .  endif
                   1527:
1.1540.2.1  tv       1528: .endif # !empty(PKG_PHASES:Minstall)
1.1441    jmmv     1529:
1.1540.2.1  tv       1530: ############################################################################
1.1540.2.3  tv       1531: # Special install phase `replace'
                   1532: ############################################################################
                   1533:
                   1534: _REAL_TARGETS.replace+=        do-su-replace
                   1535:
                   1536: _REAL_TARGETS.su-replace+=
                   1537:
                   1538: _REAL_TARGETS.undo-replace+= do-su-undo-replace
                   1539:
                   1540: ############################################################################
1.1540.2.1  tv       1541: # Phase `package'
                   1542: ############################################################################
1.1410    jlam     1543:
1.1540.2.5  tv       1544: .PHONY: descr
                   1545: descr: ${DESCR}
                   1546: ${DESCR}: ${DESCR_SRC}
                   1547:        @${CAT} ${DESCR_SRC}     >${DESCR}
                   1548: .if defined(HOMEPAGE)
                   1549:        @\
                   1550:        ${ECHO}                 >>${DESCR} ; \
                   1551:        ${ECHO} "Homepage:"     >>${DESCR} ; \
                   1552:        ${ECHO} '${HOMEPAGE}'   >>${DESCR}
                   1553: .endif
                   1554:
1.1540.2.3  tv       1555: _REAL_TARGETS.package+=        do-su-package
                   1556:
                   1557: _REAL_TARGETS.su-package+=
                   1558:
1.1540.2.1  tv       1559: ############################################################################
1.1540.2.3  tv       1560: # Variables calculated after all the above, and recursion support
1.1540.2.1  tv       1561: ############################################################################
1.1374    jlam     1562:
1.1540.2.2  tv       1563: # explicit "-f Makefile" here to work around problems with the MAKEFILE var
                   1564: # and case-insensitive filesystems (see PR pkg/28392)
                   1565: #
1.1540.2.1  tv       1566: .for targ in ${_PKG_PHASES_ALL}
                   1567: .PHONY: recurse-${targ}
                   1568: recurse-${targ}:
1.1540.2.2  tv       1569:        ${_PKG_SILENT}${_PKG_DEBUG}cd ${PKGDIR} && ${MAKE} -f Makefile ${targ}
1.1540.2.1  tv       1570: .endfor
1.1       agc      1571:
1.1540.2.1  tv       1572: # convenience target, to display make variables from command line
                   1573: # i.e. "make show-var VARNAME=var", will print var's value
                   1574: .PHONY: show-var show-var-noeval
                   1575: show-var show-var-noeval:
                   1576:        @${ECHO} ${${VARNAME}:Q}
1.117     agc      1577:
1.1540.2.1  tv       1578: # enhanced version of target above, to display multiple variables
                   1579: .PHONY: show-vars show-vars-noeval
                   1580: show-vars show-vars-noeval:
                   1581: .for VARNAME in ${VARNAMES}
                   1582:        @${ECHO} ${${VARNAME}:Q}
                   1583: .endfor
1.1       agc      1584:
1.1540.2.3  tv       1585: # Find out the PREFIX of dependencies where the PREFIX is needed at build time.
                   1586: .if defined(EVAL_PREFIX)
                   1587: .  for def in ${EVAL_PREFIX}
                   1588: .    if !defined(${def:C/=.*$//})
                   1589: ${def:C/=.*$//}_DEFAULT?=${LOCALBASE}
1.1540.2.24  tv       1590: _${def:C/=.*$//}_CMD=  ${PKG_INFO} -qp ${def:C/^.*=//} 2>/dev/null | ${AWK} '{ print $$2; exit }' | ${GREP} . || ${ECHO} ${${def:C/=.*$//}_DEFAULT}
1.1540.2.3  tv       1591: ${def:C/=.*$//}=       ${_${def:C/=.*$//}_CMD:sh}
                   1592: .    endif
                   1593: .  endfor
                   1594: .endif
                   1595:
1.1540.2.17  tv       1596: .if !defined(_PATH_ORIG)
                   1597: _PATH_ORIG:=           ${PATH}
                   1598: MAKEFLAGS+=            _PATH_ORIG=${_PATH_ORIG:Q}
1.1540.2.19  tv       1599: .endif
1.1540.2.17  tv       1600:
1.1540.2.19  tv       1601: .if !empty(PREPEND_PATH)
1.1540.2.1  tv       1602: # This is very Special.  Because PREPEND_PATH is set with += in reverse order,
                   1603: # the awk expression reverses the order again (since bootstrap bmake doesn't
                   1604: # yet support the :[-1..1] construct).
1.1540.2.17  tv       1605: _PATH_CMD=             ${ECHO} `${ECHO} ${PREPEND_PATH:Q} | ${AWK} '{ORS=":";for (i=NF;i>0;i--) print $$i}'`${_PATH_ORIG}
1.1540.2.1  tv       1606: PATH=                  ${_PATH_CMD:sh} # DOES NOT use :=, to defer evaluation
                   1607: .endif
                   1608:
                   1609: ############################################################################
                   1610: # User-visible make targets
                   1611: ############################################################################
                   1612:
                   1613: # Catch-all targets.
                   1614: # Without anything specified, assume "all".  Also allow "dependall" to be
                   1615: # specified for those in the habit of using that in NetBSD main source.
                   1616: # Recurses to ensure that .if make() conditionals work as expected.
1.547     hubertf  1617:
1.1540.2.1  tv       1618: .if !empty(PKGSRC_RUN_TEST:M[yY][eE][sS])
                   1619: # only invoke "test" if requested; makes SMART_MESSAGES look nicer
                   1620: _PKG_ALL_TARGET=       test
                   1621: .endif
1.547     hubertf  1622:
1.1540.2.1  tv       1623: .PHONY: all dependall
                   1624: .MAIN: all
                   1625: all dependall: recurse-${_PKG_ALL_TARGET:Ubuild}
1.1       agc      1626:
1.1540.2.5  tv       1627: # Depend is generally meaningless for arbitrary packages, but if someone wants
                   1628: # one they can override this.  This is just to catch people who've gotten into
                   1629: # the habit of typing `${MAKE} depend all install' as a matter of course.
                   1630:
                   1631: .PHONY: depend
                   1632: depend: .OPTIONAL
                   1633:
                   1634: # Same goes for tags
                   1635: .PHONY: tags
                   1636: tags: .OPTIONAL
                   1637:
1.1540.2.3  tv       1638: ##### If this package will be skipped, use placebo targets.
1.1540.2.1  tv       1639:
                   1640: .if defined(_PKG_SKIPPED)
1.1540.2.3  tv       1641:
                   1642: .  for targ in ${_PKG_PHASES_ALL} \
                   1643:                replace undo-replace \
                   1644:                update
1.1540.2.1  tv       1645: ${targ}:
                   1646: .    if !defined(SKIP_SILENT)
1.1540.2.9  tv       1647:        @for str in ${PKG_FAIL_REASON} ${PKG_SKIP_REASON}; do           \
                   1648:                ${ECHO} "${_PKGSRC_IN}> $$str";                         \
1.547     hubertf  1649:        done
1.789     hubertf  1650: .    endif
1.1102    schmonz  1651: .    if defined(PKG_FAIL_REASON)
                   1652:        @${FALSE}
1.789     hubertf  1653: .    endif
1.1540.2.1  tv       1654: .  endfor
1.38      hubertf  1655:
1.1540.2.3  tv       1656: .else  # !defined(_PKG_SKIPPED)
1.1       agc      1657:
1.1540.2.3  tv       1658: ##### Real targets.  These don't have any commands attached; they simply defer
                   1659: ##### to other implementation targets below.
1.1       agc      1660:
1.1540.2.1  tv       1661: .PHONY: ${_PKG_PHASES_ALL} replace undo-replace
                   1662: fetch: real-fetch
                   1663: checksum: fetch real-checksum
                   1664: depends: checksum ${WRKDIR} acquire-depends-lock ${depends_COOKIE} release-depends-lock
                   1665: extract: depends acquire-extract-lock ${extract_COOKIE} release-extract-lock
                   1666: patch: extract acquire-patch-lock ${patch_COOKIE} release-patch-lock
                   1667: tools: patch acquire-tools-lock ${tools_COOKIE} release-tools-lock
                   1668: wrapper: tools acquire-wrapper-lock ${wrapper_COOKIE} release-wrapper-lock
                   1669: configure: wrapper acquire-configure-lock ${configure_COOKIE} release-configure-lock
                   1670: build: configure acquire-build-lock ${build_COOKIE} release-build-lock
                   1671: test: build acquire-test-lock ${test_COOKIE} release-test-lock
                   1672: install: test acquire-install-lock ${install_COOKIE} release-install-lock
                   1673: package: install acquire-package-lock ${package_COOKIE} release-package-lock
                   1674: replace: build real-replace
                   1675: undo-replace: real-undo-replace
                   1676:
1.1540.2.3  tv       1677: ##### *_COOKIE to real-* layer for targets which use cookies.
                   1678:
                   1679: .  for targ in ${_PKG_PHASES_WRKDIR}
                   1680: ${${targ}_COOKIE}: real-${targ}
1.1540.2.8  tv       1681:        ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f $@ && ${ECHO} ${PKGNAME} >$@
1.1540.2.3  tv       1682: .  endfor
                   1683:
                   1684: # mark a stage as complete if its cookie (and all parent cookies) exist
                   1685: .  if exists(${depends_COOKIE})
                   1686: ${depends_COOKIE}: .MADE
                   1687: .    if exists(${extract_COOKIE})
                   1688: ${extract_COOKIE}: .MADE
                   1689: .      if exists(${patch_COOKIE})
                   1690: ${patch_COOKIE}: .MADE
                   1691: .        if exists(${tools_COOKIE})
                   1692: ${tools_COOKIE}: .MADE
                   1693: .          if exists(${wrapper_COOKIE})
                   1694: ${wrapper_COOKIE}: .MADE
                   1695: .            if exists(${configure_COOKIE})
                   1696: ${configure_COOKIE}: .MADE
                   1697: .              if exists(${build_COOKIE})
                   1698: ${build_COOKIE}: .MADE
                   1699: .                if exists(${test_COOKIE})
                   1700: ${test_COOKIE}: .MADE
                   1701: .                  if exists(${install_COOKIE})
                   1702: ${install_COOKIE}: .MADE
                   1703: .                    if exists(${package_COOKIE})
                   1704: ${package_COOKIE}: .MADE
                   1705: .                    endif
                   1706: .                  endif
                   1707: .                endif
                   1708: .              endif
                   1709: .            endif
                   1710: .          endif
                   1711: .        endif
                   1712: .      endif
                   1713: .    endif
                   1714: .  endif
                   1715:
                   1716: ##### NO_* for skipping phases
                   1717:
                   1718: .  if defined(NO_DEPENDS) || (empty(DEPENDS) && empty(BUILD_DEPENDS))
                   1719: ${depends_COOKIE}: .MADE
                   1720: .  endif
                   1721: .  if defined(NO_TOOLS)
                   1722: ${tools_COOKIE}: .MADE
                   1723: .  endif
                   1724: .  if defined(NO_WRAPPER)
                   1725: ${wrapper_COOKIE}: .MADE
                   1726: .  endif
                   1727: .  if defined(NO_CONFIGURE)
                   1728: ${configure_COOKIE}: .MADE
                   1729: .  endif
                   1730: .  if defined(NO_BUILD)
                   1731: ${build_COOKIE}: .MADE
                   1732: .  endif
                   1733: .  if empty(PKGSRC_RUN_TEST:M[yY][eE][sS])
                   1734: real-test: .MADE
                   1735: .  endif
                   1736: .  if defined(NO_INSTALL)
                   1737: ${install_COOKIE}: .MADE
                   1738: .  endif
                   1739:
                   1740: .  if defined(NO_PACKAGE) && !defined(FORCE_PACKAGE)
                   1741: _REAL_TARGETS.package:=        no-package
                   1742: no-package:
                   1743: .    if !defined(SKIP_SILENT)
                   1744:        @${ECHO_MSG} "${_PKGSRC_IN}> ${PKGNAME} may not be packaged: ${NO_PACKAGE}."
                   1745: .    endif
                   1746: .  endif
                   1747:
                   1748: .  for targ in extract configure build install
                   1749: .    if !empty(INTERACTIVE_STAGE:M${targ}) && defined(BATCH)
                   1750: _REAL_TARGETS.${targ}:=        ${targ}-is-interactive
                   1751: ${targ}-is-interactive:
                   1752:        @${ECHO} "*** The ${targ} stage of this package requires user interaction"
                   1753:        @${ECHO} "*** Please ${targ} manually with \"cd ${PKGDIR} && ${MAKE} ${targ}\""
                   1754:        @${FALSE}
                   1755: .    endif
                   1756: .  endfor
                   1757:
                   1758: ##### User-visible messages for most targets
                   1759:
                   1760: _PHASE_MSG.depends=    Verifying dependencies
                   1761: _PHASE_MSG.extract=    Extracting
                   1762: _PHASE_MSG.patch=      Patching
                   1763: _PHASE_MSG.tools=      Overriding tools
                   1764: _PHASE_MSG.wrapper=    Creating toolchain wrappers
                   1765: _PHASE_MSG.configure=  Configuring
                   1766: _PHASE_MSG.build=      Building
                   1767: _PHASE_MSG.test=       Testing
                   1768: _PHASE_MSG.install=    Installing
                   1769: _PHASE_MSG.package=    Packaging
                   1770:
                   1771: .  for targ in ${_PKG_PHASES_WRKDIR}
                   1772: .PHONY: ${targ}-message
                   1773: ${targ}-message:
                   1774:        @${ECHO_MSG} "${_PKGSRC_IN}> ${_PHASE_MSG.${targ}} for ${PKGNAME}"
                   1775: .  endfor
                   1776:
                   1777: ##### real-* to actual component target layer
                   1778:
                   1779: # Simple dependencies are not used, deliberately, so that it is possible
                   1780: # to invoke a single subtarget by hand while working on a new package.
                   1781: #
                   1782: # Please note that the order of the targets in _REAL_TARGETS.<phase> is
                   1783: # important, and should not be modified (.ORDER is not recognized by
                   1784: # make(1) in a serial make; i.e., without "-j n").
                   1785:
                   1786: .  for targ in ${_PKG_PHASES_ALL} replace undo-replace su-install
                   1787: .PHONY: real-${targ}
                   1788: .ORDER: ${_REAL_TARGETS.${targ}}
                   1789: real-${targ}: ${_REAL_TARGETS.${targ}}
                   1790: .  endfor
                   1791:
1.1540.2.1  tv       1792: .endif # !defined(_PKG_SKIPPED)
                   1793:
1.1540.2.3  tv       1794: ##### su target support
                   1795:
                   1796: .for targ in install package replace undo-replace deinstall
                   1797: .PHONY: do-su-${targ}
                   1798: do-su-${targ}:
                   1799:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   1800:        if [ `${ID} -u` = `${ID} -u ${ROOT_USER}` ]; then               \
                   1801:                ${MAKE} ${MAKEFLAGS} $$realtarget;                      \
                   1802:        elif [ "X${BATCH}" != X"" ]; then                               \
                   1803:                ${ECHO_MSG} "Warning: Batch mode, not superuser, can't run $$action for ${PKGNAME}."; \
                   1804:                ${ECHO_MSG} "Become ${ROOT_USER} and try again to ensure correct permissions."; \
                   1805:        else                                                            \
                   1806:                args="DEINSTALLDEPENDS=${DEINSTALLDEPENDS}";            \
                   1807:                if [ "X${FORCE_PKG_REGISTER}" != X"" ]; then            \
                   1808:                        args="$$args FORCE_PKG_REGISTER=1";             \
                   1809:                fi;                                                     \
                   1810:                if [ "X${PKG_DEBUG_LEVEL}" != X"" ]; then               \
                   1811:                        args="$$args PKG_DEBUG_LEVEL=${PKG_DEBUG_LEVEL}"; \
                   1812:                fi;                                                     \
                   1813:                if [ "X${PRE_ROOT_CMD}" != "X${TRUE}" ]; then           \
                   1814:                        ${ECHO} "*** WARNING *** Running: ${PRE_ROOT_CMD}"; \
                   1815:                        ${PRE_ROOT_CMD};                                \
                   1816:                fi;                                                     \
                   1817:                ${ECHO_MSG} "${_PKGSRC_IN}> Becoming ${ROOT_USER}@`${HOSTNAME_CMD}` to ${targ} ${PKGBASE}."; \
                   1818:                ${ECHO_N} "`${ECHO} ${SU_CMD} | ${AWK} '{ print $$1 }'` ";\
                   1819:                ${SU_CMD} "cd ${.CURDIR}; ${SETENV} PATH=$${PATH}:${SU_CMD_PATH_APPEND} ${MAKE} $$args ${MAKEFLAGS} real-su-${targ} $$realflags"; \
                   1820:        fi
                   1821: .endfor
                   1822:
1.1540.2.1  tv       1823: ############################################################################
                   1824: # Package maintenance targets
                   1825: ############################################################################
1.1       agc      1826:
1.1540.2.1  tv       1827: # Checksumming utilities
1.1       agc      1828:
1.1540.2.1  tv       1829: .PHONY: makesum
                   1830: makesum: recurse-fetch uptodate-digest
                   1831:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   1832:        newfile=${DISTINFO_FILE}.$$$$;                                  \
                   1833:        if [ -f ${DISTINFO_FILE} ]; then                                \
                   1834:                ${GREP} '^.NetBSD' ${DISTINFO_FILE} > $$newfile ||      \
                   1835:                        (${ECHO_N} "$$" > $$newfile &&                  \
                   1836:                         ${ECHO_N} "NetBSD" >> $$newfile &&             \
                   1837:                         ${ECHO} "$$" >> $$newfile)                     \
                   1838:        else                                                            \
                   1839:                ${ECHO_N} "$$" > $$newfile;                             \
                   1840:                ${ECHO_N} "NetBSD" >> $$newfile;                        \
                   1841:                ${ECHO} "$$" >> $$newfile;                              \
                   1842:        fi;                                                             \
                   1843:        ${ECHO} "" >> $$newfile;                                        \
                   1844:        cd ${DISTDIR};                                                  \
                   1845:        for sumfile in "" ${_CKSUMFILES}; do                            \
                   1846:                if [ "X$$sumfile" = "X" ]; then continue; fi;           \
1.1540.2.24  tv       1847:                for a in "" ${DIGEST_ALGORITHMS}; do                    \
                   1848:                        if [ "X$$a" = "X" ]; then continue; fi;         \
                   1849:                        ${DIGEST} $$a $$sumfile >> $$newfile;           \
                   1850:                done;                                                   \
1.1540.2.1  tv       1851:                ${WC} -c $$sumfile | ${AWK} '{ print "Size (" $$2 ") = " $$1 " bytes" }' >> $$newfile; \
                   1852:        done;                                                           \
                   1853:        for ignore in "" ${_IGNOREFILES}; do                            \
                   1854:                if [ "X$$ignore" = "X" ]; then continue; fi;            \
1.1540.2.24  tv       1855:                for a in "" ${DIGEST_ALGORITHMS}; do                    \
                   1856:                        if [ "X$$a" = "X" ]; then continue; fi;         \
                   1857:                        ${ECHO} "$$a ($$ignore) = IGNORE" >> $$newfile; \
                   1858:                done;                                                   \
1.1540.2.1  tv       1859:        done;                                                           \
                   1860:        if [ -f ${DISTINFO_FILE} ]; then                                \
                   1861:                ${AWK} '$$2 ~ /\(patch-[a-z0-9]+\)/ { print $$0 }' < ${DISTINFO_FILE} >> $$newfile; \
                   1862:        fi;                                                             \
                   1863:        if ${CMP} -s $$newfile ${DISTINFO_FILE}; then                   \
                   1864:                ${RM} -f $$newfile;                                     \
                   1865:                ${ECHO_MSG} "=> distinfo: distfiles part unchanged.";   \
                   1866:        else                                                            \
                   1867:                ${MV} $$newfile ${DISTINFO_FILE};                       \
                   1868:        fi
                   1869:
                   1870: .PHONY: makepatchsum mps
                   1871: makepatchsum mps: uptodate-digest
                   1872:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   1873:        newfile=${DISTINFO_FILE}.$$$$;                                  \
                   1874:        if [ -f ${DISTINFO_FILE} ]; then                                \
                   1875:                ${AWK} '$$2 !~ /\(patch-[a-z0-9]+\)/ { print $$0 }' < ${DISTINFO_FILE} >> $$newfile; \
                   1876:        else \
                   1877:                ${ECHO_N} "$$" > $$newfile;                             \
                   1878:                ${ECHO_N} "NetBSD" >> $$newfile;                        \
                   1879:                ${ECHO} "$$" >> $$newfile;                              \
                   1880:                ${ECHO} "" >> $$newfile;                                \
                   1881:        fi;                                                             \
                   1882:        if [ -d ${PATCHDIR} ]; then                                     \
                   1883:                (cd ${PATCHDIR};                                        \
                   1884:                for sumfile in "" patch-*; do                           \
                   1885:                        if [ "X$$sumfile" = "X" ]; then continue; fi;   \
                   1886:                        if [ "X$$sumfile" = "Xpatch-*" ]; then break; fi; \
                   1887:                        case $$sumfile in                               \
                   1888:                                patch-local-*) ;;                       \
                   1889:                                *.orig|*.rej|*~) continue ;;            \
1.1540.2.24  tv       1890:                                *)      ${ECHO} "${PATCH_DIGEST_ALGORITHM} ($$sumfile) = `${SED} -e '/\$$NetBSD.*/d' $$sumfile | ${DIGEST} ${DIGEST_ALGORITHM}`" >> $$newfile;; \
1.1540.2.1  tv       1891:                        esac;                                           \
                   1892:                done);                                                  \
                   1893:        fi;                                                             \
                   1894:        if ${CMP} -s $$newfile ${DISTINFO_FILE}; then                   \
                   1895:                ${RM} -f $$newfile;                                     \
                   1896:                ${ECHO_MSG} "=> distinfo: patches part unchanged.";     \
                   1897:        else                                                            \
                   1898:                ${MV} $$newfile ${DISTINFO_FILE};                       \
                   1899:        fi
                   1900:
                   1901: makedistinfo mdi distinfo: makesum makepatchsum
                   1902:
                   1903: ############################################################################
                   1904: # XXXTV CUT
                   1905: ############################################################################
                   1906:
                   1907: UPDATE_RUNNING?=       NO
                   1908:
                   1909: #
                   1910: # _RESUME_TRANSFER:
                   1911: #
                   1912: # Macro to resume a previous transfer, needs to have defined
                   1913: # the following options in mk.conf:
                   1914: #
                   1915: # PKG_RESUME_TRANSFERS
                   1916: # FETCH_RESUME_ARGS (if FETCH_CMD != default)
                   1917: # FETCH_OUTPUT_ARGS (if FETCH_CMD != default)
                   1918: #
                   1919: # For example if you want to use wget (pkgsrc/net/wget):
                   1920: #
                   1921: # FETCH_CMD=wget
                   1922: # FETCH_RESUME_ARGS=-c
                   1923: # FETCH_OUTPUT_ARGS=-O
                   1924: #
                   1925: # How does it work?
                   1926: #
                   1927: # FETCH_CMD downloads the file and saves it temporally into $$bfile.temp
                   1928: # if the checksum match the correct one, $$bfile.temp is renamed to
                   1929: # the original name.
                   1930: #
1.1525    xtraeme  1931:
1.1477    xtraeme  1932: _RESUME_TRANSFER=                                                      \
1.1479    xtraeme  1933:        tsize=`${AWK} '/^Size/ && $$2 == '"\"($$file)\""' { print $$4 }' ${DISTINFO_FILE}` || ${TRUE}; \
1.1525    xtraeme  1934:        if [ ! -f "${DISTDIR}/${DIST_SUBDIR}/$$bfile.temp" ]; then      \
                   1935:                ${CP} ${DISTDIR}/${DIST_SUBDIR}/$$bfile ${DISTDIR}/${DIST_SUBDIR}/$$bfile.temp; \
1.1540.2.9  tv       1936:        fi;                                                             \
1.1525    xtraeme  1937:        dsize=`${WC} -c < ${DISTDIR}/${DIST_SUBDIR}/$$bfile.temp`;      \
1.1540.2.9  tv       1938:        if [ "$$dsize" -eq "$$tsize" -a -f "${DISTDIR}/${DIST_SUBDIR}/$$bfile.temp" ]; then \
1.1525    xtraeme  1939:                ${MV} ${DISTDIR}/${DIST_SUBDIR}/$$bfile.temp ${DISTDIR}/${DIST_SUBDIR}/$$bfile; \
1.1540.2.9  tv       1940:        fi;                                                             \
1.1478    agc      1941:        case "$$tsize" in                                               \
                   1942:        "")     ${ECHO_MSG} "No size in distinfo file (${DISTINFO_FILE})"; \
                   1943:                break ;;                                                \
                   1944:        esac;                                                           \
1.1525    xtraeme  1945:        if [ -n "$$ftp_proxy" -o -n "$$http_proxy" ]; then              \
1.1477    xtraeme  1946:                ${ECHO_MSG} "===> Resume is not supported by ftp(1) using http/ftp proxies.";   \
                   1947:                break;                                                  \
                   1948:        else                                                            \
1.1540.2.9  tv       1949:                if [ "$$dsize" -lt "$$tsize" ]; then                    \
1.1525    xtraeme  1950:                        if [ "${FETCH_CMD:T}" != "ftp" -a -z "${FETCH_RESUME_ARGS}" ]; then \
1.1479    xtraeme  1951:                                ${ECHO_MSG} "=> Resume transfers are not supported, FETCH_RESUME_ARGS is empty."; \
                   1952:                                break;                                  \
                   1953:                        else                                            \
1.1540.2.9  tv       1954:                                for res_site in $$sites; do             \
                   1955:                                        if [ -z "${FETCH_OUTPUT_ARGS}" ]; then \
                   1956:                                                ${ECHO_MSG} "=> FETCH_OUTPUT_ARGS has to be defined."; \
1.1525    xtraeme  1957:                                                break;                  \
                   1958:                                        fi;                             \
1.1540.2.9  tv       1959:                                        ${ECHO_MSG} "=> $$bfile not completed, resuming:"; \
                   1960:                                        ${ECHO_MSG} "=> Downloaded: $$dsize Total: $$tsize."; \
1.1525    xtraeme  1961:                                        ${ECHO_MSG};                    \
                   1962:                                        cd ${_DISTDIR};                 \
1.1540.2.9  tv       1963:                                        ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${FETCH_RESUME_ARGS} \
1.1525    xtraeme  1964:                                                ${FETCH_OUTPUT_ARGS} $${bfile}.temp $${res_site}$${bfile}; \
                   1965:                                        if [ $$? -eq 0 ]; then          \
1.1540.2.9  tv       1966:                                                ndsize=`${WC} -c < ${DISTDIR}/${DIST_SUBDIR}/$$bfile.temp`; \
                   1967:                                                if [ "$$tsize" -eq "$$ndsize" ]; then \
                   1968:                                                        ${MV} ${DISTDIR}/${DIST_SUBDIR}/$$bfile.temp ${DISTDIR}/${DIST_SUBDIR}/$$bfile; \
1.1525    xtraeme  1969:                                                fi;                     \
1.1479    xtraeme  1970:                                                break;                  \
                   1971:                                        fi;                             \
                   1972:                                done;                                   \
                   1973:                        fi;                                             \
1.1525    xtraeme  1974:                elif [ "$$dsize" -gt "$$tsize" ]; then                  \
1.1540.2.9  tv       1975:                        ${ECHO_MSG} "==> Downloaded file larger than the recorded size."; \
1.1479    xtraeme  1976:                        break;                                          \
1.1525    xtraeme  1977:                fi;                                                     \
1.1477    xtraeme  1978:        fi
1.1478    agc      1979:
1.895     fredb    1980: #
                   1981: # Define the elementary fetch macros.
                   1982: #
1.158     tron     1983: _FETCH_FILE=                                                           \
1.307     agc      1984:        if [ ! -f $$file -a ! -f $$bfile -a ! -h $$bfile ]; then        \
1.415     agc      1985:                ${ECHO_MSG} "=> $$bfile doesn't seem to exist on this system."; \
1.444     hubertf  1986:                if [ ! -w ${_DISTDIR}/. ]; then                         \
                   1987:                        ${ECHO_MSG} "=> Can't download to ${_DISTDIR} (permission denied?)."; \
                   1988:                        exit 1;                                         \
                   1989:                fi;                                                     \
1.175     agc      1990:                for site in $$sites; do                                 \
1.415     agc      1991:                        ${ECHO_MSG} "=> Attempting to fetch $$bfile from $${site}."; \
1.935     agc      1992:                        if [ -f ${DISTINFO_FILE} ]; then                \
                   1993:                                ${AWK} 'NF == 5 && $$1 == "Size" && $$2 == "('$$bfile')" { printf("=> [%s %s]\n", $$4, $$5) }' ${DISTINFO_FILE}; \
                   1994:                        fi;                                             \
1.175     agc      1995:                        if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${bfile} ${FETCH_AFTER_ARGS}; then \
1.753     wiz      1996:                                if [ -n "${FAILOVER_FETCH}" -a -f ${DISTINFO_FILE} -a -f ${_DISTDIR}/$$bfile ]; then \
1.1540.2.25! tv       1997:                                        alg=`${AWK} 'NF == 4 && $$2 == "('$$file')" && $$3 == "=" {print $$1; exit}' ${DISTINFO_FILE}`; \
1.699     agc      1998:                                        if [ -z "$$alg" ]; then         \
1.1540.2.24  tv       1999:                                                alg=${PATCH_DIGEST_ALGORITHM};\
1.699     agc      2000:                                        fi;                             \
1.676     agc      2001:                                        CKSUM=`${DIGEST} $$alg < ${_DISTDIR}/$$bfile`; \
1.753     wiz      2002:                                        CKSUM2=`${AWK} '$$1 == "'$$alg'" && $$2 == "('$$file')" {print $$4;}' <${DISTINFO_FILE}`; \
1.175     agc      2003:                                        if [ "$$CKSUM" = "$$CKSUM2" -o "$$CKSUM2" = "IGNORE" ]; then \
1.873     wiz      2004:                                                break;                  \
1.154     agc      2005:                                        else                            \
1.415     agc      2006:                                                ${ECHO_MSG} "=> Checksum failure - trying next site."; \
1.154     agc      2007:                                        fi;                             \
1.300     hubertf  2008:                                elif [ ! -f ${_DISTDIR}/$$bfile ]; then \
1.415     agc      2009:                                        ${ECHO_MSG} "=> FTP didn't fetch expected file, trying next site." ; \
1.175     agc      2010:                                else                                    \
1.873     wiz      2011:                                        break;                          \
1.175     agc      2012:                                fi;                                     \
                   2013:                        fi                                              \
                   2014:                done;                                                   \
1.1540.2.9  tv       2015:                if [ ! -f ${_DISTDIR}/$$bfile ]; then                   \
1.873     wiz      2016:                        ${ECHO_MSG} "=> Couldn't fetch $$bfile - please try to retrieve this";\
                   2017:                        ${ECHO_MSG} "=> file manually into ${_DISTDIR} and try again."; \
                   2018:                        exit 1;                                         \
                   2019:                fi;                                                     \
1.175     agc      2020:        fi
1.158     tron     2021:
1.305     agc      2022: _CHECK_DIST_PATH=                                                      \
                   2023:        if [ "X${DIST_PATH}" != "X" ]; then                             \
1.1540.2.9  tv       2024:                for d in "" ${DIST_PATH:S/:/ /g}; do                    \
1.305     agc      2025:                        if [ "X$$d" = "X" -o "X$$d" = "X${DISTDIR}" ]; then continue; fi; \
                   2026:                        if [ -f $$d/${DIST_SUBDIR}/$$bfile ]; then      \
                   2027:                                ${ECHO} "Using $$d/${DIST_SUBDIR}/$$bfile"; \
                   2028:                                ${RM} -f $$bfile;                       \
                   2029:                                ${LN} -s $$d/${DIST_SUBDIR}/$$bfile $$bfile; \
                   2030:                                break;                                  \
                   2031:                        fi;                                             \
                   2032:                done;                                                   \
                   2033:        fi
                   2034:
1.297     mjl      2035: #
1.941     fredb    2036: # Set up ORDERED_SITES to work out the exact list of sites for every file,
                   2037: # using the dynamic sites script, or sorting according to the master site
                   2038: # list or the patterns in MASTER_SORT or MASTER_SORT_REGEX as appropriate.
                   2039: # No actual sorting is done until ORDERED_SITES is expanded.
                   2040: #
1.944     fredb    2041: .if defined(MASTER_SORT) || defined(MASTER_SORT_REGEX)
1.297     mjl      2042: MASTER_SORT?=
                   2043: MASTER_SORT_REGEX?=
                   2044: MASTER_SORT_REGEX+= ${MASTER_SORT:S/./\\./g:C/.*/:\/\/[^\/]*&\//}
                   2045:
1.1338    wiz      2046: MASTER_SORT_AWK= BEGIN { RS = " "; ORS = " "; IGNORECASE = 1 ; gl = "${MASTER_SORT_REGEX:S/\\/\\\\/g}"; }
1.941     fredb    2047: .  for srt in ${MASTER_SORT_REGEX}
1.1338    wiz      2048: MASTER_SORT_AWK+= /${srt:C/\//\\\//g}/ { good["${srt:S/\\/\\\\/g}"] = good["${srt:S/\\/\\\\/g}"] " " $$0 ; next; }
1.941     fredb    2049: .  endfor
1.452     hubertf  2050: MASTER_SORT_AWK+= { rest = rest " " $$0; } END { n=split(gl, gla); for(i=1;i<=n;i++) { print good[gla[i]]; } print rest; }
                   2051:
1.895     fredb    2052: SORT_SITES_CMD= ${ECHO} $$unsorted_sites | ${AWK} '${MASTER_SORT_AWK}'
1.1338    wiz      2053: ORDERED_SITES= ${_MASTER_SITE_OVERRIDE} `${SORT_SITES_CMD:S/\\/\\\\/g:C/"/\"/g}`
1.895     fredb    2054: .else
1.896     fredb    2055: ORDERED_SITES= ${_MASTER_SITE_OVERRIDE} $$unsorted_sites
1.895     fredb    2056: .endif
1.297     mjl      2057:
1.895     fredb    2058: #
1.941     fredb    2059: # Associate each file to fetch with the correct site(s).
1.895     fredb    2060: #
1.944     fredb    2061: .if defined(DYNAMIC_MASTER_SITES)
                   2062: .  for fetchfile in ${_ALLFILES}
1.1060    rh       2063: SITES_${fetchfile:T:S/=/--/}?= `${SH} ${FILESDIR}/getsite.sh ${fetchfile:T}`
1.944     fredb    2064: .  endfor
                   2065: .endif
1.941     fredb    2066: .if !empty(_DISTFILES)
                   2067: .  for fetchfile in ${_DISTFILES}
1.1060    rh       2068: SITES_${fetchfile:T:S/=/--/}?= ${MASTER_SITES}
1.941     fredb    2069: .  endfor
                   2070: .endif
                   2071: .if !empty(_PATCHFILES)
                   2072: .  for fetchfile in ${_PATCHFILES}
1.1060    rh       2073: SITES_${fetchfile:T:S/=/--/}?= ${PATCH_SITES}
1.941     fredb    2074: .  endfor
                   2075: .endif
                   2076:
1.1003    agc      2077: # This code is only called in a batch case, to check for the presence of
                   2078: # the distfiles
1.1222    jmmv     2079: .PHONY: batch-check-distfiles
1.1003    agc      2080: batch-check-distfiles:
1.941     fredb    2081:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.1003    agc      2082:        gotfiles=yes;                                                   \
                   2083:        for file in "" ${_ALLFILES}; do                                 \
                   2084:                case "$$file" in                                        \
                   2085:                "")     continue ;;                                     \
                   2086:                *)      if [ ! -f ${DISTDIR}/$$file ]; then             \
                   2087:                                gotfiles=no;                            \
                   2088:                        fi ;;                                           \
                   2089:                esac;                                                   \
                   2090:        done;                                                           \
                   2091:        case "$$gotfiles" in                                            \
                   2092:        no)     ${ECHO} "*** This package requires user intervention to download the distfiles"; \
1.999     agc      2093:                ${ECHO} "*** Please fetch the distfiles manually and place them in"; \
                   2094:                ${ECHO} "*** ${DISTDIR}";                               \
                   2095:                [ ! -z "${MASTER_SITES}" ] &&                           \
                   2096:                        ${ECHO} "*** The distfiles are available from ${MASTER_SITES}"; \
                   2097:                [ ! -z "${HOMEPAGE}" ] &&                               \
                   2098:                        ${ECHO} "*** See ${HOMEPAGE} for more details"; \
                   2099:                ${ECHO};                                                \
1.1003    agc      2100:                ${FALSE} ;;                                             \
                   2101:        esac
                   2102:
1.1222    jmmv     2103: .PHONY: do-fetch
1.1003    agc      2104: .if !target(do-fetch)
                   2105: do-fetch:
                   2106: .  if !empty(_ALLFILES)
                   2107:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   2108:        ${TEST} -d ${_DISTDIR} || ${MKDIR} ${_DISTDIR}
                   2109: .    if ${INTERACTIVE_STAGE:Mfetch} == "fetch" && defined(BATCH)
                   2110:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   2111:        ${MAKE} ${MAKEFLAGS} batch-check-distfiles
1.999     agc      2112: .    else
                   2113: .      for fetchfile in ${_ALLFILES}
1.1159    grant    2114: .        if defined(_FETCH_MESSAGE)
1.941     fredb    2115:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   2116:        file="${fetchfile}";                                            \
                   2117:        if [ ! -f ${DISTDIR}/$$file ]; then                             \
                   2118:                ${_FETCH_MESSAGE};                                      \
                   2119:        fi
1.999     agc      2120: .        else
1.941     fredb    2121:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   2122:        cd ${_DISTDIR};                                                 \
1.924     abs      2123:        file="${fetchfile}";                                            \
                   2124:        bfile="${fetchfile:T}";                                         \
1.1060    rh       2125:        unsorted_sites="${SITES_${fetchfile:T:S/=/--/}} ${_MASTER_SITE_BACKUP}"; \
1.895     fredb    2126:        sites="${ORDERED_SITES}";                                       \
1.873     wiz      2127:        ${_CHECK_DIST_PATH};                                            \
1.1480    xtraeme  2128:         if ${TEST} "${PKG_RESUME_TRANSFERS:M[Yy][Ee][Ss]}" ; then      \
                   2129:                ${_FETCH_FILE}; ${_RESUME_TRANSFER};                    \
                   2130:         else                                                           \
                   2131:                ${_FETCH_FILE};                                         \
                   2132:         fi
1.999     agc      2133: .        endif # defined(_FETCH_MESSAGE)
                   2134: .      endfor
                   2135: .    endif # INTERACTIVE_STAGE == fetch
1.941     fredb    2136: .  endif # !empty(_ALLFILES)
1.646     dmcmahil 2137: .endif
                   2138:
1.929     jlam     2139: # Extract
                   2140:
                   2141: ${WRKDIR}:
                   2142: .if !defined(KEEP_WRKDIR)
                   2143: .  if ${PKGSRC_LOCKTYPE} == "sleep" || ${PKGSRC_LOCKTYPE} == "once"
                   2144: .    if !exists(${LOCKFILE})
                   2145:        ${_PKG_SILENT}${_PKG_DEBUG}${RM} -rf ${WRKDIR}
                   2146: .    endif
                   2147: .  endif
                   2148: .endif
                   2149:        ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${WRKDIR}
1.1540.2.19  tv       2150:        ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${PKG_DB_TMPDIR}
1.929     jlam     2151: .ifdef WRKOBJDIR
                   2152: .  if ${PKGSRC_LOCKTYPE} == "sleep" || ${PKGSRC_LOCKTYPE} == "once"
                   2153: .    if !exists(${LOCKFILE})
                   2154:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   2155:        ${RM} -f ${WRKDIR_BASENAME} || ${TRUE}
                   2156: .    endif
                   2157: .  endif
                   2158:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   2159:        if ${LN} -s ${WRKDIR} ${WRKDIR_BASENAME} 2>/dev/null; then      \
                   2160:                ${ECHO} "${WRKDIR_BASENAME} -> ${WRKDIR}";              \
                   2161:        fi
                   2162: .endif # WRKOBJDIR
1.1       agc      2163:
1.1396    wiz      2164: _EXTRACT_SUFFIXES=     .tar.gz .tgz .tar.bz2 .tbz .tar.Z .tar _tar.gz
                   2165: _EXTRACT_SUFFIXES+=    .shar.gz .shar.bz2 .shar.Z .shar
                   2166: _EXTRACT_SUFFIXES+=    .zip
                   2167: _EXTRACT_SUFFIXES+=    .lha .lzh
                   2168: _EXTRACT_SUFFIXES+=    .Z .bz2 .gz
                   2169: _EXTRACT_SUFFIXES+=    .zoo
1.1474    abs      2170: _EXTRACT_SUFFIXES+=    .bin
1.1396    wiz      2171: _EXTRACT_SUFFIXES+=    .rar
1.884     jlam     2172:
1.1540.2.1  tv       2173: .if (defined(PATCHFILES) && !empty(PATCHFILES:M*.bz2)) || \
                   2174:     !empty(EXTRACT_ONLY:M*.bz2) || !empty(EXTRACT_ONLY:M*.tbz) || \
1.918     jlam     2175:     !empty(EXTRACT_SUFX:M*.bz2) || !empty(EXTRACT_SUFX:M*.tbz)
1.884     jlam     2176: .  if exists(/usr/bin/bzcat)
                   2177: BZCAT=                 /usr/bin/bzcat <
                   2178: .  else
                   2179: BUILD_DEPENDS+=                bzip2>=0.9.0b:../../archivers/bzip2
                   2180: BZCAT=                 ${LOCALBASE}/bin/bzcat
                   2181: .  endif
                   2182: .endif
1.918     jlam     2183: .if !empty(EXTRACT_ONLY:M*.zip) || !empty(EXTRACT_SUFX:M*.zip)
1.917     jlam     2184: BUILD_DEPENDS+=                unzip-[0-9]*:../../archivers/unzip
1.884     jlam     2185: .endif
1.918     jlam     2186: .if !empty(EXTRACT_ONLY:M*.lzh) || !empty(EXTRACT_ONLY:M*.lha) || \
                   2187:     !empty(EXTRACT_SUFX:M*.lzh) || !empty(EXTRACT_SUFX:M*.lha)
1.1159    grant    2188: BUILD_DEPENDS+=                lha>=114.9:../../archivers/lha
1.1004    grant    2189: .endif
                   2190: .if !defined(GZCAT)
1.1540.2.1  tv       2191: .  if (defined(PATCHFILES) && !empty(PATCHFILES:M*.gz)) || \
                   2192: .     !empty(EXTRACT_ONLY:M*.gz) || !empty(EXTRACT_ONLY:M*.tgz) || \
1.1004    grant    2193:       !empty(EXTRACT_SUFX:M*.gz) || !empty(EXTRACT_SUFX:M*.tgz)
1.1516    tv       2194: BUILD_DEPENDS+=         gzip-base>=1.2.4b:../../archivers/gzip-base
1.1004    grant    2195: GZCAT=                  ${LOCALBASE}/bin/zcat
                   2196: .  endif
1.884     jlam     2197: .endif
1.1110    cjep     2198: .if !empty(EXTRACT_ONLY:M*.zoo) || !empty(EXTRACT_SUFX:M*.zoo)
                   2199: BUILD_DEPENDS+=                unzoo-[0-9]*:../../archivers/unzoo
                   2200: .endif
1.1393    xtraeme  2201: .if !empty(EXTRACT_ONLY:M*.rar) || !empty(EXTRACT_SUFX:M*.rar)
                   2202: BUILD_DEPENDS+=                unrar>=3.3.4:../../archivers/unrar
                   2203: .endif
1.884     jlam     2204:
                   2205: DECOMPRESS_CMD.tar.gz?=                ${GZCAT}
                   2206: DECOMPRESS_CMD.tgz?=           ${DECOMPRESS_CMD.tar.gz}
                   2207: DECOMPRESS_CMD.tar.bz2?=       ${BZCAT}
                   2208: DECOMPRESS_CMD.tbz?=           ${DECOMPRESS_CMD.tar.bz2}
1.930     jlam     2209: DECOMPRESS_CMD.tar.Z?=         ${GZCAT}
1.884     jlam     2210: DECOMPRESS_CMD.tar?=           ${CAT}
                   2211:
1.914     jlam     2212: DECOMPRESS_CMD.shar.gz?=       ${GZCAT}
                   2213: DECOMPRESS_CMD.shar.bz2?=      ${BZCAT}
                   2214: DECOMPRESS_CMD.shar.Z?=                ${GZCAT}
                   2215: DECOMPRESS_CMD.shar?=          ${CAT}
                   2216:
1.929     jlam     2217: DECOMPRESS_CMD.Z?=             ${GZCAT}
                   2218: DECOMPRESS_CMD.bz2?=           ${BZCAT}
                   2219: DECOMPRESS_CMD.gz?=            ${GZCAT}
                   2220:
1.884     jlam     2221: DECOMPRESS_CMD?=               ${GZCAT}
1.1396    wiz      2222: .for __suffix__ in ${_EXTRACT_SUFFIXES}
1.884     jlam     2223: .  if !defined(DECOMPRESS_CMD${__suffix__})
                   2224: DECOMPRESS_CMD${__suffix__}?=  ${DECOMPRESS_CMD}
                   2225: .  endif
                   2226: .endfor
                   2227:
                   2228: # If this is empty, then everything gets extracted.
                   2229: EXTRACT_ELEMENTS?=     # empty
                   2230:
1.929     jlam     2231: DOWNLOADED_DISTFILE=   $${extract_file}
1.240     agc      2232:
1.1304    jlam     2233: EXTRACT_CMD.zip?=      ${LOCALBASE}/bin/unzip ${EXTRACT_CMD_OPTS.zip} $${extract_file}
                   2234: EXTRACT_CMD_OPTS.zip?= -Laqo
                   2235: EXTRACT_CMD.lha?=      ${LOCALBASE}/bin/lha ${EXTRACT_CMD_OPTS.lha} $${extract_file}
                   2236: EXTRACT_CMD_OPTS.lha?= xq
1.929     jlam     2237: EXTRACT_CMD.lzh?=      ${EXTRACT_CMD.lha}
1.1304    jlam     2238: EXTRACT_CMD_OPTS.lzh?= ${EXTRACT_CMD_OPTS.lha}
                   2239: EXTRACT_CMD.zoo?=      ${LOCALBASE}/bin/unzoo ${EXTRACT_CMD_OPTS.zoo} $${extract_file}
                   2240: EXTRACT_CMD_OPTS.zoo?= -x
1.1393    xtraeme  2241: EXTRACT_CMD.rar?=      ${LOCALBASE}/bin/unrar ${EXTRACT_CMD_OPTS.rar} $${extract_file}
                   2242: EXTRACT_CMD_OPTS.rar?= x -inul
1.1511    tv       2243: EXTRACT_ENV.bin?=      # empty
                   2244: EXTRACT_CMD.bin?=      ${ECHO} yes | ${SETENV} ${EXTRACT_ENV.bin} $${extract_file} ${EXTRACT_CMD_OPTS.bin} >/dev/null
1.929     jlam     2245:
                   2246: .for __suffix__ in .gz .bz2 .Z
                   2247: EXTRACT_CMD${__suffix__}?=     ${DECOMPRESS_CMD${__suffix__}} $${extract_file} > `${BASENAME} $${extract_file} ${__suffix__}`
                   2248: .endfor
1.914     jlam     2249:
                   2250: .for __suffix__ in .shar.gz .shar.bz2 .shar.Z .shar
1.929     jlam     2251: EXTRACT_CMD${__suffix__}?=     ${DECOMPRESS_CMD${__suffix__}} $${extract_file} | ${SH}
1.914     jlam     2252: .endfor
1.884     jlam     2253:
1.1434    wiz      2254: # If EXTRACT_USING_PAX is defined, use pax in preference to (GNU) tar.
1.884     jlam     2255: #
                   2256: .if defined(EXTRACT_USING_PAX)
1.1434    wiz      2257: _DFLT_EXTRACT_CMD?=    ${DECOMPRESS_CMD} $${extract_file} | ${PAX} -O -r ${EXTRACT_ELEMENTS}
1.884     jlam     2258: .else
1.929     jlam     2259: _DFLT_EXTRACT_CMD?=    ${DECOMPRESS_CMD} $${extract_file} | ${GTAR} -xf - ${EXTRACT_ELEMENTS}
1.884     jlam     2260: .endif
                   2261:
1.1396    wiz      2262: .for __suffix__ in ${_EXTRACT_SUFFIXES}
1.884     jlam     2263: .  if !defined(EXTRACT_CMD${__suffix__})
                   2264: .    if defined(EXTRACT_USING_PAX)
1.1434    wiz      2265: EXTRACT_CMD${__suffix__}?=     ${DECOMPRESS_CMD${__suffix__}} $${extract_file} | ${PAX} -O -r ${EXTRACT_ELEMENTS}
1.884     jlam     2266: .  else
1.929     jlam     2267: EXTRACT_CMD${__suffix__}?=     ${DECOMPRESS_CMD${__suffix__}} $${extract_file} | ${GTAR} -xf - ${EXTRACT_ELEMENTS}
1.884     jlam     2268: .    endif
                   2269: .  endif
                   2270: .endfor
                   2271:
1.929     jlam     2272: # _SHELL_EXTRACT is a "subroutine" for extracting an archive.  It extracts
                   2273: # the contents of archive named by the shell variable "extract_file" based
                   2274: # on the file extension of the archive.
1.913     jlam     2275: #
1.929     jlam     2276: _SHELL_EXTRACT=                case $${extract_file} in
1.1396    wiz      2277: .for __suffix__ in ${_EXTRACT_SUFFIXES}
1.929     jlam     2278: _SHELL_EXTRACT+=       *${__suffix__}) ${EXTRACT_CMD${__suffix__}} ;;
1.913     jlam     2279: .endfor
1.929     jlam     2280: _SHELL_EXTRACT+=       *)              ${_DFLT_EXTRACT_CMD} ;;
                   2281: _SHELL_EXTRACT+=       esac
1.913     jlam     2282:
1.929     jlam     2283: EXTRACT_CMD?=          ${_SHELL_EXTRACT}
1.907     agc      2284:
1.1222    jmmv     2285: .PHONY: do-extract
1.907     agc      2286: .if !target(do-extract)
                   2287: do-extract: ${WRKDIR}
1.929     jlam     2288: .  for __file__ in ${EXTRACT_ONLY}
1.902     jlam     2289:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.929     jlam     2290:        extract_file="${_DISTDIR}/${__file__}"; export extract_file;    \
                   2291:        cd ${WRKDIR}; ${EXTRACT_CMD}
                   2292: .  endfor
1.1       agc      2293: .endif
                   2294:
                   2295: # Patch
                   2296:
1.968     jlam     2297: # LOCALPATCHES contains the location of local patches to packages
                   2298: #      that are maintained in a directory tree reflecting the same
                   2299: #      hierarchy as the pkgsrc tree, i.e. local patches for www/apache
                   2300: #      would be found as ${LOCALPATCHES}/www/apache/*.
                   2301: #
1.1168    grant    2302: .if defined(LOCALPATCHES)
1.968     jlam     2303: _DFLT_LOCALPATCHFILES= ${LOCALPATCHES}/${PKGPATH}/*
                   2304: _LOCALPATCHFILES=      ${_DFLT_LOCALPATCHFILES}
1.1168    grant    2305: .endif
1.968     jlam     2306:
1.1222    jmmv     2307: .PHONY: do-patch
1.1       agc      2308: .if !target(do-patch)
1.676     agc      2309: do-patch: uptodate-digest
1.789     hubertf  2310: .  if defined(PATCHFILES)
1.416     agc      2311:        @${ECHO_MSG} "${_PKGSRC_IN}> Applying distribution patches for ${PKGNAME}"
1.1488    jlam     2312: .    for i in ${PATCHFILES}
1.976     agc      2313:        ${_PKG_SILENT}${_PKG_DEBUG}cd ${_DISTDIR};                      \
1.1488    jlam     2314:        if [ ${PATCH_DEBUG_TMP} = yes ]; then                           \
                   2315:                ${ECHO_MSG} "${_PKGSRC_IN}> Applying distribution patch ${i}"; \
                   2316:        fi;                                                             \
                   2317:        ${PATCH_DIST_CAT.${i:S/=/--/}} |                                \
                   2318:        ${PATCH} ${PATCH_DIST_ARGS.${i:S/=/--/}}                        \
1.1493    schmonz  2319:                || { ${ECHO} "Patch ${i} failed"; ${PKGSRC_PATCH_FAIL}; }
1.1488    jlam     2320: .    endfor
1.789     hubertf  2321: .  endif
1.968     jlam     2322:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   2323:        patchlist="";                                                   \
                   2324:        if [ -d ${PATCHDIR} ]; then                                     \
1.167     agc      2325:                if [ "`${ECHO} ${PATCHDIR}/patch-*`" = "${PATCHDIR}/patch-*" ]; then \
1.416     agc      2326:                        ${ECHO_MSG} "${_PKGSRC_IN}> Ignoring empty patch directory"; \
1.293     agc      2327:                        if [ -d ${PATCHDIR}/CVS ]; then                 \
1.910     zuntum   2328:                                ${ECHO_MSG} "${_PKGSRC_IN}> Perhaps you forgot the -P flag to 'cvs checkout' or 'cvs update'?"; \
1.293     agc      2329:                        fi;                                             \
                   2330:                else                                                    \
1.968     jlam     2331:                        patchlist=`${ECHO} ${PATCHDIR}/patch-*`;        \
                   2332:                fi;                                                     \
                   2333:        fi;                                                             \
                   2334:        if [ "X${_LOCALPATCHFILES}" = "X${_DFLT_LOCALPATCHFILES}" ]; then \
                   2335:                localpatchfiles="`${ECHO} ${_LOCALPATCHFILES}`";        \
                   2336:                if [ "$${localpatchfiles}" != "${_LOCALPATCHFILES}" ]; then \
                   2337:                        patchlist="$${patchlist} $${localpatchfiles}";  \
                   2338:                fi;                                                     \
                   2339:        else                                                            \
                   2340:                patchlist=`${ECHO} $${patchlist} ${_LOCALPATCHFILES}`;  \
                   2341:        fi;                                                             \
                   2342:        if [ -n "$${patchlist}" ]; then                                 \
1.1092    jschauma 2343:                ${ECHO_MSG} "${_PKGSRC_IN}> Applying pkgsrc patches for ${PKGNAME}" ; \
1.968     jlam     2344:                fail="";                                                \
                   2345:                for i in $${patchlist}; do                              \
                   2346:                        if [ ! -f "$$i" ]; then                         \
                   2347:                                ${ECHO_MSG} "${_PKGSRC_IN}> $$i is not a valid patch file - skipping"; \
                   2348:                                continue;                               \
                   2349:                        fi;                                             \
                   2350:                        case $$i in                                     \
                   2351:                        *.orig|*.rej|*~)                                \
                   2352:                                ${ECHO_MSG} "${_PKGSRC_IN}> Ignoring patchfile $$i"; \
                   2353:                                continue;                               \
                   2354:                                ;;                                      \
                   2355:                        ${PATCHDIR}/patch-local-*)                      \
                   2356:                                ;;                                      \
                   2357:                        ${PATCHDIR}/patch-*)                            \
                   2358:                                if [ -f ${DISTINFO_FILE} ]; then        \
                   2359:                                        filename=`expr $$i : '.*/\(.*\)'`; \
                   2360:                                        algsum=`${AWK} 'NF == 4 && $$2 == "('$$filename')" && $$3 == "=" {print $$1 " " $$4}' ${DISTINFO_FILE} || ${TRUE}`; \
                   2361:                                        if [ "X$$algsum" != "X" ]; then \
                   2362:                                                alg=`${ECHO} $$algsum | ${AWK} '{ print $$1 }'`; \
                   2363:                                                recorded=`${ECHO} $$algsum | ${AWK} '{ print $$2 }'`; \
                   2364:                                                calcsum=`${SED} -e '/\$$NetBSD.*/d' $$i | ${DIGEST} $$alg`; \
                   2365:                                                if [ ${PATCH_DEBUG_TMP} = yes ]; then \
                   2366:                                                        ${ECHO_MSG} "=> Verifying $$filename (using digest algorithm $$alg)"; \
1.293     agc      2367:                                                fi;                     \
                   2368:                                        fi;                             \
1.968     jlam     2369:                                        if [ "X$$algsum" = "X" -o "X$$recorded" = "X" ]; then \
                   2370:                                                ${ECHO_MSG} "**************************************"; \
                   2371:                                                ${ECHO_MSG} "Ignoring unknown patch file: $$i"; \
                   2372:                                                ${ECHO_MSG} "**************************************"; \
                   2373:                                                continue;               \
                   2374:                                        fi;                             \
                   2375:                                        if [ "X$$calcsum" != "X$$recorded" ]; then \
                   2376:                                                ${ECHO_MSG} "**************************************"; \
                   2377:                                                ${ECHO_MSG} "Patch file $$i has been modified"; \
                   2378:                                                ${ECHO_MSG} "**************************************"; \
                   2379:                                                fail="$$fail $$filename"; \
                   2380:                                                continue;               \
                   2381:                                        fi;                             \
1.1302    cube     2382:                                else                                    \
                   2383:                                        ${ECHO_MSG} "**************************************"; \
                   2384:                                        ${ECHO_MSG} "Ignoring unknown patch file: $$i"; \
                   2385:                                        ${ECHO_MSG} "**************************************"; \
1.1303    cube     2386:                                        continue;                       \
1.305     agc      2387:                                fi;                                     \
1.968     jlam     2388:                                ;;                                      \
                   2389:                        esac;                                           \
                   2390:                        if [ ${PATCH_DEBUG_TMP} = yes ]; then           \
1.1092    jschauma 2391:                                ${ECHO_MSG} "${_PKGSRC_IN}> Applying pkgsrc patch $$i" ; \
1.303     agc      2392:                        fi;                                             \
1.968     jlam     2393:                        fuzz="";                                        \
                   2394:                        ${PATCH} -v > /dev/null 2>&1 && fuzz="${PATCH_FUZZ_FACTOR}"; \
                   2395:                        ${PATCH} $$fuzz ${PATCH_ARGS} < $$i ||          \
1.1493    schmonz  2396:                                { ${ECHO} Patch $$i failed ; ${PKGSRC_PATCH_FAIL}; }; \
1.968     jlam     2397:                done;                                                   \
                   2398:                if [ "X$$fail" != "X" ]; then                           \
                   2399:                        ${ECHO_MSG} "Patching failed due to modified patch file(s): $$fail"; \
1.1493    schmonz  2400:                        ${PKGSRC_PATCH_FAIL};                           \
1.293     agc      2401:                fi;                                                     \
1.1       agc      2402:        fi
1.870     jlam     2403: .endif
                   2404:
                   2405: # Configure
1.1       agc      2406:
1.871     jlam     2407: # _CONFIGURE_PREREQ is a list of targets to run after pre-configure but before
                   2408: #      do-configure.  These targets typically edit the files used by the
1.1205    agc      2409: #      do-configure target.  The targets are run as dependencies of
1.1204    chris    2410: #      pre-configure-override.
1.871     jlam     2411: #
                   2412: # _CONFIGURE_POSTREQ is a list of targets to run after do-configure but before
                   2413: #      post-configure.  These targets typically edit the files generated by
                   2414: #      the do-configure target that are used during the build phase.
                   2415:
1.1248    jlam     2416: .if defined(USE_PKGLOCALEDIR)
                   2417: _PKGLOCALEDIR=                 ${PREFIX}/${PKGLOCALEDIR}/locale
                   2418: REPLACE_LOCALEDIR_PATTERNS?=   # empty
                   2419: _REPLACE_LOCALEDIR_PATTERNS=   ${REPLACE_LOCALEDIR_PATTERNS}
                   2420: .  if defined(HAS_CONFIGURE) || defined(GNU_CONFIGURE)
1.1395    sketch   2421: _REPLACE_LOCALEDIR_PATTERNS+=  [Mm]akefile.in*
1.1248    jlam     2422: .  else
1.1395    sketch   2423: _REPLACE_LOCALEDIR_PATTERNS+=  [Mm]akefile*
1.1248    jlam     2424: .  endif
                   2425: _REPLACE_LOCALEDIR_PATTERNS_FIND= \
                   2426:        \( ${_REPLACE_LOCALEDIR_PATTERNS:S/$/!/:S/^/-o -name !/:S/!/"/g:S/-o//1} \)
                   2427: REPLACE_LOCALEDIR?=            # empty
                   2428: _REPLACE_LOCALEDIR=            \
                   2429:        ${REPLACE_LOCALEDIR}    \
                   2430:        `${FIND} . ${_REPLACE_LOCALEDIR_PATTERNS_FIND} -print | ${SED} -e 's|^\./||' | ${GREP} -v '\.orig' | ${SORT} -u`
                   2431:
                   2432: _CONFIGURE_PREREQ+=            subst-pkglocaledir
                   2433: .  if empty(USE_PKGLOCALEDIR:M[nN][oO])
                   2434: SUBST_CLASSES+=                        pkglocaledir
                   2435: .  endif
                   2436: SUBST_MESSAGE.pkglocaledir=    "Fixing locale directory references."
                   2437: SUBST_FILES.pkglocaledir=      ${_REPLACE_LOCALEDIR}
                   2438: SUBST_SED.pkglocaledir=                \
                   2439:        -e 's|^\(localedir[     :]*=\).*|\1 ${_PKGLOCALEDIR}|'          \
                   2440:        -e 's|^\(gnulocaledir[  :]*=\).*|\1 ${_PKGLOCALEDIR}|'          \
1.1470    salo     2441:        -e 's|\(-DLOCALEDIR[    ]*=\)[^         ]*\(\.\*\)|\1"\\"${_PKGLOCALEDIR}\\""\2|'
1.1248    jlam     2442: .endif
                   2443:
1.870     jlam     2444: .if defined(REPLACE_PERL)
1.1208    agc      2445: REPLACE_INTERPRETER+=  perl
1.1207    agc      2446: _REPLACE.perl.old=     .*/bin/perl
                   2447: _REPLACE.perl.new=     ${PERL5}
                   2448: _REPLACE_FILES.perl=   ${REPLACE_PERL}
                   2449: .endif
                   2450:
1.1347    jlam     2451: .if defined(REPLACE_INTERPRETER)
1.1207    agc      2452: _CONFIGURE_PREREQ+=    replace-interpreter
1.1222    jmmv     2453: .PHONY: replace-interpreter
1.1207    agc      2454: replace-interpreter:
                   2455: .  for lang in ${REPLACE_INTERPRETER}
1.1415    drochner 2456: .    for pattern in ${_REPLACE_FILES.${lang}}
1.870     jlam     2457:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   2458:        cd ${WRKSRC};                                                   \
1.1415    drochner 2459:        for f in ${pattern}; do                                         \
1.953     hubertf  2460:            if [ -f $${f} ]; then                                       \
1.1415    drochner 2461:                    ${SED} -e '1s|^#!${_REPLACE.${lang}.old}|#!${_REPLACE.${lang}.new}|' \
1.953     hubertf  2462:                            $${f} > $${f}.new;                          \
                   2463:                    if [ -x $${f} ]; then                               \
                   2464:                            ${CHMOD} a+x $${f}.new;                     \
                   2465:                    fi;                                                 \
                   2466:                    ${MV} -f $${f}.new $${f};                           \
                   2467:            fi;                                                         \
                   2468:        done
1.1415    drochner 2469: .    endfor
1.1207    agc      2470: .  endfor
1.770     zuntum   2471: .endif
1.522     wiz      2472:
1.1347    jlam     2473: .if defined(USE_LIBTOOL) && defined(LTCONFIG_OVERRIDE)
1.869     jlam     2474: _CONFIGURE_PREREQ+=    do-ltconfig-override
1.1222    jmmv     2475: .PHONY: do-ltconfig-override
1.869     jlam     2476: do-ltconfig-override:
1.828     jlam     2477: .  for ltconfig in ${LTCONFIG_OVERRIDE}
                   2478:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   2479:        if [ -f ${ltconfig} ]; then                                     \
                   2480:                ${RM} -f ${ltconfig};                                   \
1.1381    jlam     2481:                ${ECHO} "${RM} -f libtool; ${LN} -s ${_LIBTOOL} libtool" \
1.828     jlam     2482:                        > ${ltconfig};                                  \
                   2483:                ${CHMOD} +x ${ltconfig};                                \
1.375     sakamoto 2484:        fi
1.828     jlam     2485: .  endfor
1.1006    schmonz  2486: .endif
                   2487:
                   2488: _CONFIGURE_PREREQ+=    do-config-star-override
1.1222    jmmv     2489: .PHONY: do-config-star-override
1.1006    schmonz  2490: do-config-star-override:
1.1540.2.12  tv       2491: .if defined(GNU_CONFIGURE)
                   2492: .  if !empty(CONFIG_GUESS_OVERRIDE)
1.1403    jlam     2493: .    for _pattern_ in ${CONFIG_GUESS_OVERRIDE}
                   2494:        ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC};                        \
                   2495:        for file in ${_pattern_}; do                                    \
                   2496:                if [ -f "$$file" ]; then                                \
                   2497:                        ${RM} -f $$file;                                \
1.1510    jlam     2498:                        ${LN} -s ${PKGSRCDIR}/mk/gnu-config/config.guess \
1.1403    jlam     2499:                                $$file;                                 \
                   2500:                fi;                                                     \
1.1006    schmonz  2501:        done
1.1403    jlam     2502: .    endfor
1.1007    agc      2503: .  endif
1.1540.2.12  tv       2504: .  if !empty(CONFIG_SUB_OVERRIDE)
1.1403    jlam     2505: .    for _pattern_ in ${CONFIG_SUB_OVERRIDE}
                   2506:        ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC};                        \
                   2507:        for file in ${_pattern_}; do                                    \
                   2508:                if [ -f "$$file" ]; then                                \
                   2509:                        ${RM} -f $$file;                                \
1.1510    jlam     2510:                        ${LN} -s ${PKGSRCDIR}/mk/gnu-config/config.sub  \
1.1403    jlam     2511:                                $$file;                                 \
                   2512:                fi;                                                     \
1.1006    schmonz  2513:        done
1.1403    jlam     2514: .    endfor
1.1007    agc      2515: .  endif
1.1540.2.12  tv       2516: .  if !empty(CONFIG_RPATH_OVERRIDE)
                   2517: .    for _pattern_ in ${CONFIG_RPATH_OVERRIDE}
                   2518:        ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC};                        \
                   2519:        for file in ${_pattern_}; do                                    \
                   2520:                if [ -f "$$file" ]; then                                \
                   2521:                        ${RM} -f $$file;                                \
                   2522:                        ${LN} -s ${PKGSRCDIR}/mk/gnu-config/config.rpath \
                   2523:                                $$file;                                 \
                   2524:                fi;                                                     \
                   2525:        done
                   2526: .    endfor
                   2527: .  endif
1.1080    rh       2528: .endif
                   2529:
1.1248    jlam     2530: PKGCONFIG_OVERRIDE_SED= \
1.1523    jmmv     2531:        '/^Libs:.*[     ]/s|-L\([       ]*[^    ]*\)|${COMPILER_RPATH_FLAG}\1 -L\1|g'
                   2532: PKGCONFIG_OVERRIDE_STAGE?=     pre-configure
1.1248    jlam     2533:
                   2534: .if defined(PKGCONFIG_OVERRIDE) && !empty(PKGCONFIG_OVERRIDE)
1.1523    jmmv     2535: .  if ${PKGCONFIG_OVERRIDE_STAGE} == "pre-configure"
1.1248    jlam     2536: _CONFIGURE_PREREQ+=            subst-pkgconfig
1.1523    jmmv     2537: .  elif ${PKGCONFIG_OVERRIDE_STAGE} == "post-configure"
                   2538: _CONFIGURE_POSTREQ+=           subst-pkgconfig
                   2539: .  else
                   2540: SUBST_STAGE.pkgconfig=         ${PKGCONFIG_OVERRIDE_STAGE}
                   2541: .  endif
1.1248    jlam     2542: SUBST_CLASSES+=                        pkgconfig
                   2543: SUBST_MESSAGE.pkgconfig=       "Adding rpaths to pkgconfig files."
                   2544: SUBST_FILES.pkgconfig=         ${PKGCONFIG_OVERRIDE:S/^${WRKSRC}\///}
                   2545: SUBST_SED.pkgconfig=           ${PKGCONFIG_OVERRIDE_SED}
1.828     jlam     2546: .endif
                   2547:
1.1540.2.7  tv       2548: # By adding this target, it makes sure the above PREREQ's work.
1.1222    jmmv     2549: .PHONY: pre-configure-override
1.1204    chris    2550: pre-configure-override: ${_CONFIGURE_PREREQ}
                   2551:
1.1222    jmmv     2552: .PHONY: do-configure
1.828     jlam     2553: .if !target(do-configure)
1.1389    jlam     2554: do-configure:
1.789     hubertf  2555: .  if defined(HAS_CONFIGURE)
1.1032    jlam     2556: .    for DIR in ${CONFIGURE_DIRS}
1.1042    abs      2557:        ${_PKG_SILENT}${_PKG_DEBUG}${_ULIMIT_CMD}cd ${DIR} && ${SETENV} \
1.1358    grant    2558:            ${CONFIGURE_ENV} ${CONFIG_SHELL} \
                   2559:            ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
1.1032    jlam     2560: .    endfor
1.789     hubertf  2561: .  endif
                   2562: .  if defined(USE_IMAKE)
1.1119    jlam     2563: .    for DIR in ${CONFIGURE_DIRS}
                   2564:        ${_PKG_SILENT}${_PKG_DEBUG}cd ${DIR} && ${SETENV} ${SCRIPTS_ENV} XPROJECTROOT=${X11BASE} ${XMKMF}
                   2565: .    endfor
1.789     hubertf  2566: .  endif
1.871     jlam     2567: .endif
                   2568:
1.1347    jlam     2569: .if defined(USE_LIBTOOL) && \
                   2570:     (defined(LIBTOOL_OVERRIDE) || defined(SHLIBTOOL_OVERRIDE))
1.871     jlam     2571: _CONFIGURE_POSTREQ+=   do-libtool-override
1.1222    jmmv     2572: .PHONY: do-libtool-override
1.871     jlam     2573: do-libtool-override:
1.1126    jlam     2574: .  if defined(LIBTOOL_OVERRIDE)
1.1404    jlam     2575: .    for _pattern_ in ${LIBTOOL_OVERRIDE}
                   2576:        ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC};                        \
                   2577:        for file in ${_pattern_}; do                                    \
                   2578:                if [ -f "$$file" ]; then                                \
                   2579:                        ${RM} -f $$file;                                \
                   2580:                        (${ECHO} '#!${CONFIG_SHELL}';                   \
                   2581:                         ${ECHO} 'exec ${_LIBTOOL} "$$@"';              \
                   2582:                        ) > $$file;                                     \
                   2583:                        ${CHMOD} +x $$file;                             \
1.1368    jlam     2584:                fi;                                                     \
1.1404    jlam     2585:        done
1.1126    jlam     2586: .    endfor
                   2587: .  endif
                   2588: .  if defined(SHLIBTOOL_OVERRIDE)
1.1404    jlam     2589: .    for _pattern_ in ${SHLIBTOOL_OVERRIDE}
                   2590:        ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC};                        \
                   2591:        for file in ${_pattern_}; do                                    \
                   2592:                if [ -f "$$file" ]; then                                \
                   2593:                        ${RM} -f $$file;                                \
                   2594:                        (${ECHO} '#!${CONFIG_SHELL}';                   \
                   2595:                         ${ECHO} 'exec ${_SHLIBTOOL} "$$@"';            \
                   2596:                        ) > $$file;                                     \
                   2597:                        ${CHMOD} +x $$file;                             \
1.1382    jlam     2598:                fi;                                                     \
1.1404    jlam     2599:        done
1.1126    jlam     2600: .    endfor
                   2601: .  endif
1.1       agc      2602: .endif
1.871     jlam     2603:
1.1348    jlam     2604: .if defined(CONFIG_STATUS_OVERRIDE)
                   2605: _CONFIGURE_POSTREQ+=   do-config-status-override
                   2606: .PHONY: do-config-status-override
1.1389    jlam     2607: do-config-status-override:
1.1400    jlam     2608: .  for _pattern_ in ${CONFIG_STATUS_OVERRIDE}
1.1402    jlam     2609:        ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC};                        \
1.1400    jlam     2610:        for file in ${_pattern_}; do                                    \
1.1402    jlam     2611:                if [ -f "$$file" ]; then                                \
1.1408    jlam     2612:                        ${MV} -f $$file $$file.overridden;              \
1.1414    jdolecek 2613:                        ${AWK} '/ *-recheck *\| *--recheck.*\)/ {       \
1.1413    jlam     2614:                                        print;                          \
                   2615:                                        print "    exit 0";             \
                   2616:                                        next;                           \
                   2617:                                }                                       \
                   2618:                                { print }                               \
                   2619:                               ' $$file.overridden > $$file;            \
1.1402    jlam     2620:                        ${CHMOD} +x $$file;                             \
1.1400    jlam     2621:                fi;                                                     \
                   2622:        done
1.1389    jlam     2623: .  endfor
                   2624: .endif
1.1348    jlam     2625:
1.1222    jmmv     2626: .PHONY: post-configure
1.871     jlam     2627: post-configure: ${_CONFIGURE_POSTREQ}
1.1       agc      2628:
                   2629: # Build
                   2630:
1.1344    jlam     2631: BUILD_DIRS?=           ${WRKSRC}
                   2632: BUILD_MAKE_FLAGS?=     ${MAKE_FLAGS}
1.1045    jlam     2633:
1.1222    jmmv     2634: .PHONY: do-build
1.1       agc      2635: .if !target(do-build)
                   2636: do-build:
1.1045    jlam     2637: .  for DIR in ${BUILD_DIRS}
1.1540.2.7  tv       2638:        ${_PKG_SILENT}${_PKG_DEBUG}${_ULIMIT_CMD}cd ${DIR} && ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} -f ${MAKEFILE} ${BUILD_TARGET}
1.1045    jlam     2639: .  endfor
1.1       agc      2640: .endif
                   2641:
1.1081    dillo    2642: #Test
                   2643:
1.1344    jlam     2644: TEST_DIRS?=            ${BUILD_DIRS}
                   2645: TEST_ENV+=             ${MAKE_ENV}
                   2646: TEST_MAKE_FLAGS?=      ${MAKE_FLAGS}
1.1081    dillo    2647:
1.1222    jmmv     2648: .PHONY: do-test
1.1081    dillo    2649: .if !target(do-test)
                   2650: do-test:
1.1276    jlam     2651: .  if defined(TEST_TARGET) && !empty(TEST_TARGET)
1.1081    dillo    2652: .    for DIR in ${TEST_DIRS}
1.1344    jlam     2653:        ${_PKG_SILENT}${_PKG_DEBUG}${_ULIMIT_CMD}cd ${DIR} && ${SETENV} ${TEST_ENV} ${MAKE_PROGRAM} ${TEST_MAKE_FLAGS} -f ${MAKEFILE} ${TEST_TARGET}
1.1081    dillo    2654: .    endfor
                   2655: .  endif
                   2656: .endif
                   2657:
1.1       agc      2658: # Package
                   2659:
1.1222    jmmv     2660: .PHONY: real-su-package
1.810     agc      2661: real-su-package: ${PLIST} ${DESCR}
1.972     agc      2662:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.624     hubertf  2663:        ${ECHO_MSG} "${_PKGSRC_IN}> Building binary package for ${PKGNAME}"; \
1.1245    jlam     2664:        if ${PKG_INFO} -qe ${PKGNAME}; then                             \
                   2665:                : The package is installed. ;                           \
                   2666:        else                                                            \
                   2667:                ${ECHO_MSG} "=> ${PKGNAME} is not installed.";          \
                   2668:                exit 1;                                                 \
                   2669:        fi;                                                             \
1.972     agc      2670:        if [ ! -d ${PKGREPOSITORY} ]; then                              \
                   2671:                ${MKDIR} ${PKGREPOSITORY};                              \
                   2672:                if [ $$? -ne 0 ]; then                                  \
1.624     hubertf  2673:                        ${ECHO_MSG} "=> Can't create directory ${PKGREPOSITORY}."; \
1.972     agc      2674:                        exit 1;                                         \
                   2675:                fi;                                                     \
                   2676:        fi;                                                             \
                   2677:        if ${PKG_CREATE} ${PKG_ARGS_BINPKG} ${PKGFILE}; then            \
                   2678:                ${MAKE} ${MAKEFLAGS} package-links;                     \
                   2679:        else                                                            \
                   2680:                ${MAKE} ${MAKEFLAGS} delete-package;                    \
                   2681:                exit 1;                                                 \
1.1       agc      2682:        fi
1.1540.2.1  tv       2683: .if defined(NO_BIN_ON_CDROM)
1.512     rh       2684:        @${ECHO_MSG} "${_PKGSRC_IN}> Warning: ${PKGNAME} may not be put on a CD-ROM:"
1.547     hubertf  2685:        @${ECHO_MSG} "${_PKGSRC_IN}>         " ${NO_BIN_ON_CDROM:Q}
1.1540.2.1  tv       2686: .endif
                   2687: .if defined(NO_BIN_ON_FTP)
1.512     rh       2688:        @${ECHO_MSG} "${_PKGSRC_IN}> Warning: ${PKGNAME} may not be made available through FTP:"
1.547     hubertf  2689:        @${ECHO_MSG} "${_PKGSRC_IN}>         " ${NO_BIN_ON_FTP:Q}
1.1540.2.1  tv       2690: .endif
                   2691: .if defined(RECOMMENDED) && !empty(IGNORE_RECOMMENDED:M[yY][eE][sS])
1.1345    rh       2692:        @${ECHO_MSG} "${_PKGSRC_IN}> Warning: dependency recommendations are being ignored!"
                   2693:        @${ECHO_MSG} "${_PKGSRC_IN}>          ${PKGNAME} should not be uploaded nor"
                   2694:        @${ECHO_MSG} "${_PKGSRC_IN}>          otherwise be used as a binary package!"
1.1       agc      2695: .endif
                   2696:
1.810     agc      2697: # Some support rules for real-su-package
1.1       agc      2698:
1.1222    jmmv     2699: .PHONY: package-links
1.1540.2.1  tv       2700: package-links: delete-package-links
1.221     agc      2701:        ${_PKG_SILENT}${_PKG_DEBUG}for cat in ${CATEGORIES}; do         \
                   2702:                if [ ! -d ${PACKAGES}/$$cat ]; then                     \
1.222     agc      2703:                        ${MKDIR} ${PACKAGES}/$$cat;                     \
                   2704:                        if [ $$? -ne 0 ]; then                          \
1.415     agc      2705:                                ${ECHO_MSG} "=> Can't create directory ${PACKAGES}/$$cat."; \
1.221     agc      2706:                                exit 1;                                 \
                   2707:                        fi;                                             \
                   2708:                fi;                                                     \
1.468     tron     2709:                ${RM} -f ${PACKAGES}/$$cat/${PKGNAME}${PKG_SUFX};       \
1.221     agc      2710:                ${LN} -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \
1.1       agc      2711:        done;
                   2712:
1.1222    jmmv     2713: .PHONY: delete-package-links
1.1       agc      2714: delete-package-links:
1.440     hubertf  2715:        ${_PKG_SILENT}${_PKG_DEBUG}\
1.1360    heinz    2716:        ${FIND} ${PACKAGES} -type l -name ${PKGNAME}${PKG_SUFX} -print | ${XARGS} ${RM} -f
1.1       agc      2717:
1.1222    jmmv     2718: .PHONY: delete-package
1.1540.2.1  tv       2719: delete-package: delete-package-links
1.221     agc      2720:        ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${PKGFILE}
1.624     hubertf  2721:
1.488     hubertf  2722: # Check if all binaries and shlibs find their needed libs
                   2723: # Must be run after "make install", so that files are installed, and
                   2724: # ${PLIST} exists.
                   2725: #
1.1222    jmmv     2726: .PHONY: check-shlibs
1.488     hubertf  2727: check-shlibs:
1.678     hubertf  2728: .if !defined(NO_PKG_REGISTER)
1.972     agc      2729:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.706     hubertf  2730:        bins=`${PKG_INFO} -qL ${PKGNAME} | { ${EGREP} -h '/(bin|sbin|libexec)/' || ${TRUE}; }`; \
1.972     agc      2731:        if [ "${OBJECT_FMT}" = "ELF" ]; then                            \
1.706     hubertf  2732:                shlibs=`${PKG_INFO} -qL ${PKGNAME} | { ${EGREP} -h '/lib/lib.*.so' || ${TRUE}; }`; \
1.1244    grant    2733:        elif [ "${OBJECT_FMT}" = "Mach-O" ]; then                       \
                   2734:                shlibs=`${PKG_INFO} -qL ${PKGNAME} | { ${EGREP} -h '/lib/lib.*.dylib' || ${TRUE}; }`; \
1.972     agc      2735:        else                                                            \
                   2736:                shlibs="";                                              \
                   2737:        fi;                                                             \
1.1244    grant    2738:        if [ "X${LDD}" = X ]; then                                      \
1.1240    grant    2739:                ldd=`${TYPE} ldd 2>/dev/null | ${AWK} '{ print $$NF }'`;\
1.972     agc      2740:        else                                                            \
                   2741:                ldd="${LDD}";                                           \
                   2742:        fi;                                                             \
1.1240    grant    2743:        if [ -x "$$ldd" ]; then                                         \
                   2744:                for i in $${bins} $${shlibs}; do                        \
                   2745:                        err=`{ $$ldd $$i 2>&1 || ${TRUE}; } | { ${GREP} "not found" || ${TRUE}; }`; \
                   2746:                        if [ "${PKG_VERBOSE}" != "" ]; then             \
                   2747:                                ${ECHO} "$$ldd $$i";                    \
                   2748:                        fi;                                             \
                   2749:                        if [ "$$err" != "" ]; then                      \
                   2750:                                ${ECHO} "$$i: $$err";                   \
                   2751:                                error=1;                                \
                   2752:                        fi;                                             \
                   2753:                done;                                                   \
                   2754:        fi;                                                             \
1.972     agc      2755:        if [ "$$error" = 1 ]; then                                      \
1.488     hubertf  2756:                ${ECHO} "*** The above programs/libs will not find the listed shared libraries"; \
1.972     agc      2757:                ${ECHO} "    at runtime. Please fix the package (add -Wl,-R.../lib in the right places)!"; \
1.488     hubertf  2758:                ${SHCOMMENT} Might not error-out for non-pkg-developers; \
1.972     agc      2759:                exit 1;                                                 \
1.488     hubertf  2760:        fi
1.1540.2.15  tv       2761: .endif # !NO_PKG_REGISTER
1.488     hubertf  2762:
1.1540.2.14  tv       2763: # CHECK_FILES_SKIP is a list of file names that will be skipped when
                   2764: # analyzing file lists in the check-files target.  This is useful to
                   2765: # avoid getting errors triggered by changes in directories not really
                   2766: # handled by pkgsrc.
                   2767: #
                   2768: # We have to do this here, i.e., quite late in bsd.pkg.mk parsing, so
                   2769: # that the variables used in them are defined.  Otherwise we may get
                   2770: # problems with the 'for' expressions.
                   2771: .if defined(INFO_DIR)
                   2772: CHECK_FILES_SKIP+=     ${PREFIX}/${INFO_DIR}/dir
                   2773: .endif
                   2774: CHECK_FILES_SKIP+=     ${PREFIX}/emul/linux/proc
                   2775:
                   2776: .for e c in ${CONF_FILES} ${SUPPORT_FILES}
                   2777: CHECK_FILES_SKIP+=     ${c}/.pkgsrc
                   2778: .endfor
                   2779: .for e c o g m in ${CONF_FILES_PERMS} ${SUPPORT_FILES_PERMS}
                   2780: CHECK_FILES_SKIP+=     ${c}/.pkgsrc
                   2781: .endfor
                   2782: .for d in ${MAKE_DIRS} ${OWN_DIRS}
                   2783: CHECK_FILES_SKIP+=     ${d}
                   2784: .endfor
                   2785: .for d o g m in ${MAKE_DIRS_PERMS} ${OWN_DIRS_PERMS}
                   2786: CHECK_FILES_SKIP+=     ${d}
                   2787: .endfor
                   2788:
1.1540.2.16  tv       2789: CHECK_FILES_SKIP_CMD=  | ${GREP} -v ${CHECK_FILES_SKIP:@f@-e ${f:Q}@}
1.1540.2.14  tv       2790:
1.1540.2.13  tv       2791: # Check if the generated PLIST matches the list of really installed files.
                   2792: #
                   2793: .PHONY: check-files
                   2794: check-files:
                   2795: .if !defined(NO_PKG_REGISTER)
                   2796:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   2797:        errors=0;                                                       \
                   2798:        diff -u ${WRKDIR}/.prefix.pre ${WRKDIR}/.prefix.post            \
1.1540.2.14  tv       2799:                >${WRKDIR}/.files.diff || ${TRUE};                      \
                   2800:        ${GREP} '^+/' ${WRKDIR}/.files.diff | ${SED} "s|^+||" | ${SORT} \
                   2801:                >${WRKDIR}/.files.added;                                \
                   2802:        ${GREP} '^-/' ${WRKDIR}/.files.diff | ${SED} "s|^-||" | ${SORT} \
                   2803:                >${WRKDIR}/.files.deleted;                              \
1.1540.2.13  tv       2804:        if ${TEST} `${WC} -l ${WRKDIR}/.files.deleted |                 \
                   2805:                ${AWK} '{ print $$1; }'` -gt 0;                         \
                   2806:        then                                                            \
                   2807:                echo "*** The following files have been deleted from"   \
                   2808:                     "${PREFIX}!";                                      \
                   2809:                ${SED} "s|^|        |" <${WRKDIR}/.files.deleted;       \
                   2810:                errors=1;                                               \
                   2811:        fi;                                                             \
1.1540.2.14  tv       2812:        ${GREP} '^[A-Za-z]' ${PLIST} | ${SED} "s|^|${PREFIX}/|" |       \
                   2813:                ${SORT} >${WRKDIR}/.files.expected;                     \
1.1540.2.13  tv       2814:        if ! ${CMP} -s ${WRKDIR}/.files.expected ${WRKDIR}/.files.added; then \
                   2815:                echo "*** The PLIST does not match installed files!";   \
                   2816:                echo "    The following files were not expected in ${PREFIX}:";\
                   2817:                diff -u ${WRKDIR}/.files.expected ${WRKDIR}/.files.added | \
                   2818:                        ${GREP} '^+[^+]' | ${SED} "s|^+|        |";     \
                   2819:                errors=1;                                               \
                   2820:        fi;                                                             \
                   2821:        if [ ${CHECK_FILES_STRICT} = "YES" ] &&                         \
                   2822:           ! ${CMP} -s ${WRKDIR}/.sysconfdir.pre ${WRKDIR}/.sysconfdir.post; \
                   2823:        then                                                            \
                   2824:                echo "*** The package has modified ${PKG_SYSCONFDIR}"   \
                   2825:                     "contents directly!";                              \
                   2826:                echo "    The offending files/directories are:";        \
                   2827:                diff -u ${WRKDIR}/.sysconfdir.pre ${WRKDIR}/.sysconfdir.post | \
                   2828:                        ${GREP} '^+[^+]' | ${SED} "s|^+|        |";     \
                   2829:                errors=1;                                               \
                   2830:        fi;                                                             \
                   2831:        if [ ${CHECK_FILES_STRICT} = "YES" ] &&                         \
                   2832:           ! ${CMP} -s ${WRKDIR}/.varbase.pre ${WRKDIR}/.varbase.post; then \
                   2833:                echo "*** The package has modified ${VARBASE} contents" \
                   2834:                     "directly!";                                       \
                   2835:                echo "    The offending files/directories are:";        \
                   2836:                diff -u ${WRKDIR}/.varbase.pre ${WRKDIR}/.varbase.post |\
                   2837:                        ${GREP} '^+[^+]' | ${SED} "s|^+|        |";     \
                   2838:                errors=1;                                               \
                   2839:        fi;                                                             \
                   2840:        ${RM} -f ${WRKDIR}/.files.added ${WRKDIR}/.files.deleted        \
                   2841:                 ${WRKDIR}/.files.diff ${WRKDIR}/.files.expected;       \
                   2842:        ${TEST} $$errors -eq 0
                   2843: .endif
                   2844:
1.1540.2.1  tv       2845: LOCKFILE=      ${WRKDIR}/.lockfile
                   2846: .for targ in ${_PKG_PHASES_WRKDIR}
                   2847: .PHONY: acquire-${targ}-lock release-${targ}-lock
                   2848: acquire-${targ}-lock: .OPTIONAL
                   2849: release-${targ}-lock: .OPTIONAL
                   2850:
                   2851: .  if ${PKGSRC_LOCKTYPE} != "none"
                   2852: acquire-${targ}-lock:
                   2853:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   2854:        ppid=`${PS} -p $$$$ -o ppid | ${AWK} 'NR == 2 { print $$1 }'`;  \
                   2855:        if ${TEST} "$$ppid" = ""; then                                  \
                   2856:                ${ECHO} "No parent process ID found.";                  \
                   2857:                ${FALSE};                                               \
                   2858:        fi;                                                             \
                   2859:        while true; do                                                  \
1.1540.2.23  tv       2860:                : "Remove lock files older than the last reboot";       \
                   2861:                if ${TEST} -f /var/run/dmesg.boot -a -f ${LOCKFILE}; then \
                   2862:                        rebooted=`${FIND} /var/run/dmesg.boot -newer ${LOCKFILE} -print`; \
                   2863:                        if ${TEST} x"$$rebooted" != x; then             \
                   2864:                                ${ECHO} "=> Removing stale ${LOCKFILE}"; \
                   2865:                                ${RM} ${LOCKFILE};                      \
                   2866:                        fi;                                             \
1.1540.2.1  tv       2867:                fi;                                                     \
                   2868:                ${SHLOCK} -f ${LOCKFILE} -p $$ppid && break;            \
                   2869:                ${ECHO} "=> Lock is held by pid `cat ${LOCKFILE}`";     \
                   2870:                case "${PKGSRC_LOCKTYPE}" in                            \
                   2871:                once)   exit 1 ;;                                       \
                   2872:                sleep)  sleep ${PKGSRC_SLEEPSECS} ;;                    \
                   2873:                esac                                                    \
                   2874:        done;                                                           \
                   2875:        if [ "${PKG_VERBOSE}" != "" ]; then                             \
                   2876:                ${ECHO_MSG} "=> Lock acquired on behalf of process $$ppid"; \
                   2877:        fi
1.1342    grant    2878:
1.1540.2.1  tv       2879: release-${targ}-lock:
                   2880:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   2881:        if [ "${PKG_VERBOSE}" != "" ]; then                             \
                   2882:                ${ECHO_MSG} "=> Lock released on behalf of process `${CAT} ${LOCKFILE}`"; \
                   2883:        fi;                                                             \
                   2884:        ${RM} ${LOCKFILE}
                   2885: .  endif # PKGSRC_LOCKTYPE
                   2886: .endfor
1.1       agc      2887:
                   2888:
1.1540.2.1  tv       2889: # Empty pre-* and post-* targets
1.1       agc      2890:
1.1540.2.1  tv       2891: .for targ in fetch ${_PKG_PHASES_WRKDIR} install-script clean distclean
                   2892: .PHONY: pre-${targ} post-${targ}
                   2893: pre-${targ}: .OPTIONAL
                   2894: post-${targ}: .OPTIONAL
1.1       agc      2895: .endfor
                   2896:
                   2897: # Reinstall
                   2898: #
                   2899: # Special target to re-run install
                   2900:
1.1222    jmmv     2901: .PHONY: reinstall
1.560     hubertf  2902: reinstall:
1.1540.2.1  tv       2903:        ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${install_COOKIE} ${package_COOKIE} ${PLIST}
1.1437    xtraeme  2904:        ${_PKG_SILENT}${_PKG_DEBUG}DEPENDS_TARGET=${DEPENDS_TARGET:Q} ${MAKE} ${MAKEFLAGS} install
1.46      agc      2905:
                   2906: # Deinstall
                   2907: #
                   2908: # Special target to remove installation
1.221     agc      2909:
1.1540.2.1  tv       2910: .PHONY: deinstall
1.624     hubertf  2911: deinstall: do-su-deinstall
1.243     tron     2912:
1.1540.2.1  tv       2913: .if (${DEINSTALLDEPENDS} != "NO")
                   2914: .  if (${DEINSTALLDEPENDS} != "ALL")
1.336     hubertf  2915: # used for removing stuff in bulk builds
1.624     hubertf  2916: real-su-deinstall-flags+=      -r -R
1.336     hubertf  2917: # used for "update" target
1.1540.2.1  tv       2918: .  else
1.624     hubertf  2919: real-su-deinstall-flags+=      -r
1.789     hubertf  2920: .  endif
1.1540.2.1  tv       2921: .endif
                   2922: .ifdef PKG_VERBOSE
1.624     hubertf  2923: real-su-deinstall-flags+=      -v
1.1540.2.1  tv       2924: .endif
                   2925: .ifdef PKG_PRESERVE
                   2926: .  if (${UPDATE_RUNNING} == "YES")
1.1530    erh      2927: # used to update w/o removing any files
                   2928: real-su-deinstall-flags+=      -N -f
                   2929: .  endif
1.1540.2.1  tv       2930: .endif
1.317     hubertf  2931:
1.1222    jmmv     2932: .PHONY: real-su-deinstall
1.624     hubertf  2933: real-su-deinstall:
1.972     agc      2934:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.1261    jlam     2935:        found="`${PKG_INFO} -e \"${PKGNAME}\" || ${TRUE}`";             \
                   2936:        case "$$found" in                                               \
1.1275    jlam     2937:        "") found="`${PKG_BEST_EXISTS} \"${PKGWILDCARD}\" || ${TRUE}`" ;; \
1.1261    jlam     2938:        esac;                                                           \
1.972     agc      2939:        if [ "$$found" != "" ]; then                                    \
1.624     hubertf  2940:                ${ECHO} Running ${PKG_DELETE} ${real-su-deinstall-flags} $$found ; \
                   2941:                ${PKG_DELETE} ${real-su-deinstall-flags} $$found || ${TRUE} ; \
1.317     hubertf  2942:        fi
1.1540.2.1  tv       2943: .if (${DEINSTALLDEPENDS} != "NO") && (${DEINSTALLDEPENDS} != "ALL")
1.408     hubertf  2944:        @${SHCOMMENT} Also remove BUILD_DEPENDS:
1.1540.2.1  tv       2945: .  for pkg in ${BUILD_DEPENDS:C/:.*$//}
1.972     agc      2946:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.1275    jlam     2947:        found="`${PKG_BEST_EXISTS} \"${pkg}\" || ${TRUE}`";             \
1.972     agc      2948:        if [ "$$found" != "" ]; then                                    \
                   2949:                ${ECHO} Running ${PKG_DELETE} $$found;                  \
                   2950:                ${PKG_DELETE} ${real-su-deinstall-flags} $$found || ${TRUE}; \
1.408     hubertf  2951:        fi
1.1540.2.1  tv       2952: .  endfor
                   2953: .endif # DEINSTALLDEPENDS
                   2954:        @${RM} -f ${install_COOKIE} ${package_COOKIE}
1.220     hubertf  2955:
1.362     rh       2956:
1.1       agc      2957: ################################################################
                   2958: # Some more targets supplied for users' convenience
                   2959: ################################################################
1.327     rh       2960:
                   2961: # The 'update' target can be used to update a package and all
                   2962: # currently installed packages that depend upon this package.
1.362     rh       2963:
1.1222    jmmv     2964: .PHONY: update
1.958     rh       2965: .if !target(update)
1.362     rh       2966: .if exists(${DDIR})
                   2967: RESUMEUPDATE?= YES
1.509     rh       2968: CLEAR_DIRLIST?=        NO
1.362     rh       2969:
                   2970: update:
                   2971:        ${_PKG_SILENT}${_PKG_DEBUG}${ECHO_MSG}                          \
1.416     agc      2972:                "${_PKGSRC_IN}> Resuming update for ${PKGNAME}"
1.1178    rh       2973: .  if ${REINSTALL} != "NO" && ${UPDATE_TARGET} != "replace"
1.515     rh       2974:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.1530    erh      2975:                ${MAKE} ${MAKEFLAGS} deinstall UPDATE_RUNNING=YES DEINSTALLDEPENDS=ALL
1.789     hubertf  2976: .  endif
1.362     rh       2977: .else
                   2978: RESUMEUPDATE?= NO
1.509     rh       2979: CLEAR_DIRLIST?=        YES
1.362     rh       2980:
1.327     rh       2981: update:
1.452     hubertf  2982:        ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${MAKEFLAGS} ${DDIR}
1.1178    rh       2983: .  if ${UPDATE_TARGET} != "replace"
1.972     agc      2984:        ${_PKG_SILENT}${_PKG_DEBUG}if ${PKG_INFO} -qe ${PKGBASE}; then  \
1.1531    agc      2985:                ${MAKE} ${MAKEFLAGS} deinstall UPDATE_RUNNING=YES DEINSTALLDEPENDS=ALL \
1.972     agc      2986:                || (${RM} ${DDIR} && ${FALSE});                         \
1.952     tron     2987:        fi
1.1178    rh       2988: .  endif
1.362     rh       2989: .endif
1.327     rh       2990:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.590     rh       2991:                ${MAKE} ${MAKEFLAGS} ${UPDATE_TARGET} KEEP_WRKDIR=YES   \
1.1437    xtraeme  2992:                        DEPENDS_TARGET=${DEPENDS_TARGET:Q}
1.327     rh       2993:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.466     tron     2994:        [ ! -s ${DDIR} ] || for dep in `${CAT} ${DDIR}` ; do            \
1.972     agc      2995:                (if cd ../.. && cd "$${dep}" ; then                     \
1.976     agc      2996:                        ${ECHO_MSG} "${_PKGSRC_IN}> Installing in $${dep}" && \
1.1178    rh       2997:                        if [ "(" "${RESUMEUPDATE}" = "NO" -o            \
                   2998:                             "${REINSTALL}" != "NO" ")" -a              \
                   2999:                             "${UPDATE_TARGET}" != "replace" ] ; then   \
1.1531    agc      3000:                                ${MAKE} ${MAKEFLAGS} deinstall UPDATE_RUNNING=YES; \
1.362     rh       3001:                        fi &&                                           \
1.590     rh       3002:                        ${MAKE} ${MAKEFLAGS} ${UPDATE_TARGET}           \
1.1437    xtraeme  3003:                                DEPENDS_TARGET=${DEPENDS_TARGET:Q} ;    \
1.398     rh       3004:                else                                                    \
1.976     agc      3005:                        ${ECHO_MSG} "${_PKGSRC_IN}> Skipping removed directory $${dep}"; \
1.398     rh       3006:                fi) ;                                                   \
                   3007:        done
1.362     rh       3008: .if ${NOCLEAN} == "NO"
1.398     rh       3009:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.452     hubertf  3010:                ${MAKE} ${MAKEFLAGS} clean-update CLEAR_DIRLIST=YES
1.362     rh       3011: .endif
                   3012:
                   3013:
1.1222    jmmv     3014: .PHONY: clean-update
1.362     rh       3015: clean-update:
1.452     hubertf  3016:        ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${MAKEFLAGS} ${DDIR}
1.362     rh       3017:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3018:        if [ -s ${DDIR} ] ; then                                        \
                   3019:                for dep in `${CAT} ${DDIR}` ; do                        \
1.972     agc      3020:                        (if cd ../.. && cd "$${dep}" ; then             \
1.452     hubertf  3021:                                ${MAKE} ${MAKEFLAGS} clean ;            \
1.398     rh       3022:                        else                                            \
1.416     agc      3023:                                ${ECHO_MSG} "${_PKGSRC_IN}> Skipping removed directory $${dep}";\
1.398     rh       3024:                        fi) ;                                           \
1.362     rh       3025:                done ;                                                  \
                   3026:        fi
1.509     rh       3027: .if ${CLEAR_DIRLIST} != "NO"
1.452     hubertf  3028:        ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${MAKEFLAGS} clean
1.362     rh       3029: .else
1.398     rh       3030:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.452     hubertf  3031:                ${MAKE} ${MAKEFLAGS} clean update-dirlist               \
1.362     rh       3032:                DIRLIST="`${CAT} ${DDIR}`" PKGLIST="`${CAT} ${DLIST}`"
1.515     rh       3033:        ${_PKG_SILENT}${_PKG_DEBUG}${ECHO_MSG}                          \
                   3034:                "${_PKGSRC_IN}> Warning: preserved leftover directory list.  Your next";\
                   3035:                ${ECHO_MSG} "${_PKGSRC_IN}>          \`\`${MAKE} update'' may fail.  It is advised to use";\
                   3036:                ${ECHO_MSG} "${_PKGSRC_IN}>          \`\`${MAKE} update REINSTALL=YES'' instead!"
1.362     rh       3037: .endif
1.958     rh       3038:
                   3039: .endif # !target(update)
1.362     rh       3040:
                   3041:
1.1222    jmmv     3042: .PHONY: update-dirlist
1.362     rh       3043: update-dirlist:
                   3044:        ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} -p ${WRKDIR}
                   3045: .ifdef PKGLIST
1.789     hubertf  3046: .  for __tmp__ in ${PKGLIST}
1.362     rh       3047:        ${_PKG_SILENT}${_PKG_DEBUG}${ECHO} >>${DLIST} "${__tmp__}"
1.789     hubertf  3048: .  endfor
1.362     rh       3049: .endif
                   3050: .ifdef DIRLIST
1.789     hubertf  3051: .  for __tmp__ in ${DIRLIST}
1.362     rh       3052:        ${_PKG_SILENT}${_PKG_DEBUG}${ECHO} >>${DDIR} "${__tmp__}"
1.789     hubertf  3053: .  endfor
1.362     rh       3054: .endif
                   3055:
1.327     rh       3056:
                   3057: ${DDIR}: ${DLIST}
                   3058:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.655     wiz      3059:        ddir=`${SED} 's:-[^-]*$$::' ${DLIST}`;                          \
1.508     rh       3060:        ${ECHO} >${DDIR};                                               \
                   3061:        for pkg in $${ddir} ; do                                        \
1.1048    hubertf  3062:                if ${PKG_INFO} -b "$${pkg}" >/dev/null 2>&1 ; then      \
                   3063:                        ${PKG_INFO} -b "$${pkg}" | ${SED}       -ne     \
1.510     rh       3064:                            's,\([^/]*/[^/]*\)/Makefile:.*,\1,p' |      \
                   3065:                            ${HEAD} -1 >>${DDIR};                       \
1.508     rh       3066:                fi ;                                                    \
                   3067:        done
1.327     rh       3068:
1.965     agc      3069: ${DLIST}: ${WRKDIR}
1.327     rh       3070:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.1444    tv       3071:        { ${PKG_DELETE} -n "${PKGWILDCARD}" 2>&1 |                      \
1.1540.2.9  tv       3072:                ${GREP} '^      ' |                                     \
1.1444    tv       3073:                ${AWK} '{ l[NR]=$$0 } END { for (i=NR;i>0;--i) print l[i] }' \
                   3074:        || ${TRUE}; } > ${DLIST}
1.524     tron     3075:
1.784     tron     3076: # Create a binary package from an install package using "pkg_tarup"
1.1222    jmmv     3077: .PHONY: tarup
1.784     tron     3078: tarup:
1.1252    jlam     3079: .if ${PKG_INSTALLATION_TYPE} == "overwrite"
1.972     agc      3080:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3081:        ${RM} -f ${PACKAGES}/All/${PKGNAME}${PKG_SUFX};                 \
1.1540.2.9  tv       3082:        ${SETENV} PKG_DBDIR=${_PKG_DBDIR} PKG_SUFX=${PKG_SUFX}          \
1.972     agc      3083:                PKGREPOSITORY=${PACKAGES}/All                           \
                   3084:                ${LOCALBASE}/bin/pkg_tarup ${PKGNAME};                  \
                   3085:        for CATEGORY in ${CATEGORIES}; do                               \
                   3086:                ${MKDIR} ${PACKAGES}/$$CATEGORY;                        \
                   3087:                cd ${PACKAGES}/$$CATEGORY;                              \
                   3088:                ${RM} -f ${PKGNAME}${PKG_SUFX};                         \
                   3089:                ${LN} -s ../All/${PKGNAME}${PKG_SUFX};                  \
1.784     tron     3090:        done
1.1252    jlam     3091: .endif
1.939     agc      3092:
                   3093: # shared code for replace and undo-replace
                   3094: _REPLACE=                                                              \
1.1531    agc      3095:        if [ -f ${_PKG_DBDIR}/$$oldpkgname/+REQUIRED_BY ]; then         \
1.1252    jlam     3096:                ${MV} ${_PKG_DBDIR}/$$oldpkgname/+REQUIRED_BY ${WRKDIR}/.req; \
1.939     agc      3097:        fi;                                                             \
1.1531    agc      3098:        ${MAKE} deinstall UPDATE_RUNNING=YES;                           \
1.939     agc      3099:        $$replace_action;                                               \
                   3100:        if [ -f ${WRKDIR}/.req ]; then                                  \
1.1252    jlam     3101:                ${MV} ${WRKDIR}/.req ${_PKG_DBDIR}/$$newpkgname/+REQUIRED_BY; \
                   3102:                for pkg in `${CAT} ${_PKG_DBDIR}/$$newpkgname/+REQUIRED_BY`; do \
1.939     agc      3103:                        ${SETENV} NEWPKGNAME=$$newpkgname               \
                   3104:                                ${AWK} '/^@pkgdep '$$oldpkgname'/ { print "@pkgdep " ENVIRON["NEWPKGNAME"]; next } { print }' \
1.1252    jlam     3105:                                < ${_PKG_DBDIR}/$$pkg/+CONTENTS > ${_PKG_DBDIR}/$$pkg/+CONTENTS.$$$$ && \
                   3106:                        ${MV} ${_PKG_DBDIR}/$$pkg/+CONTENTS.$$$$ ${_PKG_DBDIR}/$$pkg/+CONTENTS; \
1.939     agc      3107:                done;                                                   \
                   3108:        fi
                   3109:
                   3110: # replace a package in place - not for the faint-hearted
1.1222    jmmv     3111: .PHONY: real-su-replace
1.939     agc      3112: real-su-replace:
1.972     agc      3113:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.939     agc      3114:        ${ECHO_MSG} "*** WARNING - experimental target - data loss may be experienced ***"; \
1.955     agc      3115:        if [ -x ${LOCALBASE}/bin/pkg_tarup ]; then                      \
                   3116:                ${SETENV} PKGREPOSITORY=${WRKDIR} ${LOCALBASE}/bin/pkg_tarup ${PKGBASE}; \
                   3117:        else                                                            \
                   3118:                ${ECHO} "No ${LOCALBASE}/bin/pkg_tarup binary - can't pkg_tarup ${PKGBASE}"; \
                   3119:                exit 1;                                                 \
                   3120:        fi
1.972     agc      3121:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.1281    jlam     3122:        oldpkgname=`${PKG_BEST_EXISTS} "${PKGWILDCARD}"`;               \
1.939     agc      3123:        newpkgname=${PKGNAME};                                          \
                   3124:        ${ECHO} "$$oldpkgname" > ${WRKDIR}/.replace;                    \
                   3125:        replace_action="${MAKE} install";                               \
                   3126:        ${_REPLACE}
                   3127:
                   3128: # undo the replacement of a package - not for the faint-hearted either
1.1222    jmmv     3129: .PHONY: real-su-undo-replace
1.939     agc      3130: real-su-undo-replace:
1.972     agc      3131:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.939     agc      3132:        if [ ! -f ${WRKDIR}/.replace ]; then                            \
                   3133:                ${ECHO_MSG} "No replacement to undo";                   \
                   3134:                exit 1;                                                 \
1.955     agc      3135:        fi
1.972     agc      3136:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.939     agc      3137:        ${ECHO_MSG} "*** WARNING - experimental target - data loss may be experienced ***"; \
                   3138:        oldpkgname=${PKGNAME};                                          \
                   3139:        newpkgname=`${CAT} ${WRKDIR}/.replace`;                         \
1.955     agc      3140:        replace_action="${SETENV} ${PKG_ADD} ${WRKDIR}/$$newpkgname${PKG_SUFX}"; \
1.939     agc      3141:        ${_REPLACE};                                                    \
                   3142:        ${RM} ${WRKDIR}/.replace
1.631     hubertf  3143:
1.251     hubertf  3144: # This is for the use of sites which store distfiles which others may
                   3145: # fetch - only fetch the distfile if it is allowed to be
                   3146: # re-distributed freely
1.1222    jmmv     3147: .PHONY: mirror-distfiles
1.251     hubertf  3148: mirror-distfiles:
1.547     hubertf  3149: .if !defined(NO_SRC_ON_FTP)
1.1481    seb      3150:        @${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${MAKEFLAGS} fetch NO_SKIP=yes
1.251     hubertf  3151: .endif
                   3152:
1.1       agc      3153:
                   3154: # Cleaning up
                   3155:
1.1222    jmmv     3156: .PHONY: clean
1.1       agc      3157: clean: pre-clean
1.1540.2.1  tv       3158: .if (${CLEANDEPENDS} != "NO") && (!empty(BUILD_DEPENDS) || !empty(DEPENDS))
1.452     hubertf  3159:        ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${MAKEFLAGS} clean-depends
1.1540.2.1  tv       3160: .endif
1.416     agc      3161:        @${ECHO_MSG} "${_PKGSRC_IN}> Cleaning for ${PKGNAME}"
1.463     mycroft  3162:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3163:        if [ -d ${WRKDIR} ]; then                                       \
1.221     agc      3164:                if [ -w ${WRKDIR} ]; then                               \
                   3165:                        ${RM} -rf ${WRKDIR};                            \
                   3166:                else                                                    \
1.416     agc      3167:                        ${ECHO_MSG} "${_PKGSRC_IN}> ${WRKDIR} not writable, skipping"; \
1.221     agc      3168:                fi;                                                     \
1.1       agc      3169:        fi
1.1540.2.1  tv       3170: .ifdef WRKOBJDIR
1.463     mycroft  3171:        -${_PKG_SILENT}${_PKG_DEBUG}                                    \
1.469     mycroft  3172:        ${RMDIR} ${BUILD_DIR} 2>/dev/null;                              \
1.463     mycroft  3173:        ${RM} -f ${WRKDIR_BASENAME}
1.1       agc      3174: .endif
                   3175:
1.446     hubertf  3176:
1.1222    jmmv     3177: .PHONY: clean-depends
1.446     hubertf  3178: clean-depends:
1.1540.2.1  tv       3179: .if !empty(BUILD_DEPENDS) || !empty(DEPENDS)
1.469     mycroft  3180:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.1540.2.1  tv       3181:        for i in `${_SHOW_ALL_DEPENDS_DIRS_EXCL}`; do                   \
1.490     dmcmahil 3182:                cd ${.CURDIR}/../../$$i &&                              \
                   3183:                ${MAKE} ${MAKEFLAGS} CLEANDEPENDS=NO clean;             \
1.446     hubertf  3184:        done
1.172     tron     3185: .endif
                   3186:
1.446     hubertf  3187:
1.1222    jmmv     3188: .PHONY: cleandir
1.172     tron     3189: cleandir: clean
1.1       agc      3190:
1.446     hubertf  3191:
1.1222    jmmv     3192: .PHONY: distclean
1.1       agc      3193: distclean: pre-distclean clean
1.416     agc      3194:        ${_PKG_SILENT}${ECHO_MSG} "${_PKGSRC_IN}> Dist cleaning for ${PKGNAME}"
1.451     hubertf  3195:        ${_PKG_SILENT}${_PKG_DEBUG}if [ -d ${_DISTDIR} ]; then          \
1.221     agc      3196:                cd ${_DISTDIR} &&                                       \
                   3197:                ${TEST} -z "${DISTFILES}" || ${RM} -f ${DISTFILES};     \
                   3198:                ${TEST} -z "${PATCHFILES}" || ${RM} -f ${PATCHFILES};   \
1.451     hubertf  3199:        fi
1.1540.2.1  tv       3200: .if defined(DIST_SUBDIR) && exists(DIST_SUBDIR)
1.1159    grant    3201:        -${_PKG_SILENT}${_PKG_DEBUG}${RMDIR} ${_DISTDIR}
1.1       agc      3202: .endif
1.1540.2.1  tv       3203:        -${_PKG_SILENT}${_PKG_DEBUG}${RM} -f README.html
1.1       agc      3204:
1.744     hubertf  3205: # List of sites carrying binary pkgs. Variables "rel" and "arch" are
                   3206: # replaced with OS release ("1.5", ...) and architecture ("mipsel", ...)
1.1082    hubertf  3207: BINPKG_SITES?= \
1.1412    grant    3208:        ftp://ftp.NetBSD.org/pub/NetBSD/packages/$${rel}/$${arch}
1.744     hubertf  3209:
1.1252    jlam     3210: # List of flags to pass to pkg_add(1) for bin-install:
                   3211:
1.744     hubertf  3212: BIN_INSTALL_FLAGS?=    # -v
1.1252    jlam     3213: .if ${PKG_INSTALLATION_TYPE} == "pkgviews"
1.1264    jlam     3214: PKG_ARGS_ADD=          -W ${LOCALBASE} -w ${DEFAULT_VIEW}
1.1252    jlam     3215: .endif
                   3216: _BIN_INSTALL_FLAGS=    ${BIN_INSTALL_FLAGS}
                   3217: _BIN_INSTALL_FLAGS+=   ${PKG_ARGS_ADD}
1.744     hubertf  3218:
1.499     hubertf  3219: # Install binary pkg, without strict uptodate-check first
1.1297    agc      3220: .PHONY: real-su-bin-install
                   3221: real-su-bin-install:
1.1275    jlam     3222:        @found="`${PKG_BEST_EXISTS} \"${PKGWILDCARD}\" || ${TRUE}`";    \
1.744     hubertf  3223:        if [ "$$found" != "" ]; then                                    \
1.1331    grant    3224:                ${ECHO_MSG} "${_PKGSRC_IN}> $$found is already installed - perhaps an older version?"; \
1.744     hubertf  3225:                ${ECHO_MSG} "*** If so, you may wish to \`\`pkg_delete $$found'' and install"; \
                   3226:                ${ECHO_MSG} "*** this package again by \`\`${MAKE} bin-install'' to upgrade it properly."; \
                   3227:                ${SHCOMMENT} ${ECHO_MSG} "*** or use \`\`${MAKE} bin-update'' to upgrade it and all of its dependencies."; \
                   3228:                exit 1;                                                 \
                   3229:        fi
1.499     hubertf  3230:        @if [ -f ${PKGFILE} ] ; then                                    \
                   3231:                ${ECHO_MSG} "Installing from binary pkg ${PKGFILE}" ;   \
1.1252    jlam     3232:                ${PKG_ADD} ${_BIN_INSTALL_FLAGS} ${PKGFILE} ;           \
1.499     hubertf  3233:        else                                                            \
1.972     agc      3234:                rel=`${UNAME} -r | ${SED} 's@\.\([0-9]*\)[\._].*@\.\1@'`; \
1.926     hubertf  3235:                arch=${MACHINE_ARCH};                                   \
1.1082    hubertf  3236:                for site in ${BINPKG_SITES} ; do                        \
1.756     jlam     3237:                        ${ECHO} Trying `eval ${ECHO} $$site`/All ;      \
1.1252    jlam     3238:                        ${SHCOMMENT} ${ECHO} ${SETENV} PKG_PATH="`eval ${ECHO} $$site`/All" ${PKG_ADD} ${_BIN_INSTALL_FLAGS} ${PKGNAME}${PKG_SUFX} ; \
1.756     jlam     3239:                        if ${SETENV} PKG_PATH="`eval ${ECHO} $$site`/All" ${PKG_ADD} ${BIN_INSTALL_FLAGS} ${PKGNAME}${PKG_SUFX} ; then \
1.972     agc      3240:                                ${ECHO} "${PKGNAME} successfully installed."; \
1.744     hubertf  3241:                                break ;                                 \
                   3242:                        fi ;                                            \
                   3243:                done ;                                                  \
1.1048    hubertf  3244:                if ! ${PKG_INFO} -qe "${PKGNAME}" ; then                \
1.744     hubertf  3245:                        ${SHCOMMENT} Cycle through some FTP server here ;\
                   3246:                        ${ECHO_MSG} "Installing from source" ;          \
1.969     hubertf  3247:                        ${MAKE} ${MAKEFLAGS} package                    \
1.1437    xtraeme  3248:                                DEPENDS_TARGET=${DEPENDS_TARGET:Q} &&   \
1.744     hubertf  3249:                        ${MAKE} ${MAKEFLAGS} clean ;                    \
                   3250:                fi ; \
1.499     hubertf  3251:        fi
1.1297    agc      3252:
                   3253: .PHONY: bin-install
                   3254: bin-install:
                   3255:        @${ECHO_MSG} "${_PKGSRC_IN}> Binary install for ${PKGNAME}"
                   3256:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.1540.2.9  tv       3257:        realtarget="real-su-bin-install";                               \
1.1297    agc      3258:        action="binary install";                                        \
                   3259:        ${_SU_TARGET}
                   3260:
1.1       agc      3261: ################################################################
                   3262: # The special package-building targets
                   3263: # You probably won't need to touch these
                   3264: ################################################################
                   3265:
                   3266: # Show (recursively) all the packages this package depends on.
1.414     hubertf  3267: # If PACKAGE_DEPENDS_WITH_PATTERNS is set, print as pattern (if possible)
1.399     hubertf  3268: PACKAGE_DEPENDS_WITH_PATTERNS?=true
1.1222    jmmv     3269: .PHONY: run-depends-list
1.532     hubertf  3270: run-depends-list:
1.1540.2.1  tv       3271: .for dep in ${DEPENDS}
1.747     agc      3272:        @pkg="${dep:C/:.*//}";                                          \
1.452     hubertf  3273:        dir="${dep:C/[^:]*://}";                                        \
1.472     hubertf  3274:        cd ${.CURDIR};                                                  \
1.482     hubertf  3275:        if ${PACKAGE_DEPENDS_WITH_PATTERNS}; then                       \
                   3276:                ${ECHO} "$$pkg";                                        \
                   3277:        else                                                            \
                   3278:                if cd $$dir 2>/dev/null; then                           \
1.458     hubertf  3279:                        ${MAKE} ${MAKEFLAGS} package-name PACKAGE_NAME_TYPE=${PACKAGE_NAME_TYPE}; \
1.482     hubertf  3280:                else                                                    \
                   3281:                        ${ECHO_MSG} "Warning: \"$$dir\" non-existent -- @pkgdep registration incomplete" >&2; \
1.221     agc      3282:                fi;                                                     \
1.458     hubertf  3283:        fi
1.1540.2.1  tv       3284: .endfor
1.1       agc      3285:
1.1540.2.6  tv       3286: # Set to "html" by the README.html target to generate HTML code,
                   3287: # or to "svr4" to print SVR4 (Solaris, ...) short package names, from
                   3288: # SVR4_PKGNAME variable.
                   3289: # This variable is passed down via build-depends-list and run-depends-list
                   3290: PACKAGE_NAME_TYPE?=    name
                   3291:
                   3292: # Nobody should want to override this unless PKGNAME is simply bogus.
                   3293: HTML_PKGNAME=<a href="../../${PKGPATH:S/&/\&amp;/g:S/>/\&gt;/g:S/</\&lt;/g}/README.html">${PKGNAME:S/&/\&amp;/g:S/>/\&gt;/g:S/</\&lt;/g}</A>
                   3294:
                   3295: .PHONY: package-name
                   3296: package-name:
                   3297: .if (${PACKAGE_NAME_TYPE} == "html")
                   3298:        @${ECHO} '<a href="../../${PKGPATH:S/&/\&amp;/g:S/>/\&gt;/g:S/</\&lt;/g}/README.html">${PKGNAME:S/&/\&amp;/g:S/>/\&gt;/g:S/</\&lt;/g}</A>'
                   3299: .elif (${PACKAGE_NAME_TYPE} == "svr4")
                   3300:        @${ECHO} ${SVR4_PKGNAME}
                   3301: .else
                   3302:        @${ECHO} ${PKGNAME}
                   3303: .endif # PACKAGE_NAME_TYPE
                   3304:
1.1       agc      3305: # Build a package but don't check the package cookie
                   3306:
1.1222    jmmv     3307: .PHONY: repackage
1.1       agc      3308: repackage: pre-repackage package
                   3309:
1.1222    jmmv     3310: .PHONY: pre-repackage
1.1       agc      3311: pre-repackage:
1.1540.2.1  tv       3312:        ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${package_COOKIE}
1.1       agc      3313:
                   3314: # Build a package but don't check the cookie for installation, also don't
                   3315: # install package cookie
                   3316:
1.1222    jmmv     3317: .PHONY: package-noinstall
1.1       agc      3318: package-noinstall:
1.452     hubertf  3319:        ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} PACKAGE_NOINSTALL=yes real-package
1.1       agc      3320:
                   3321: ################################################################
                   3322: # Dependency checking
                   3323: ################################################################
                   3324:
1.393     agc      3325: # Tells whether to halt execution if the object formats differ
                   3326: FATAL_OBJECT_FMT_SKEW?= yes
1.396     agc      3327: WARN_NO_OBJECT_FMT?= yes
1.393     agc      3328:
1.1540.2.5  tv       3329: do-depends:
1.1540.2.1  tv       3330: .for dep in ${DEPENDS} ${BUILD_DEPENDS}
1.701     hubertf  3331:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.454     mycroft  3332:        pkg="${dep:C/:.*//}";                                           \
                   3333:        dir="${dep:C/[^:]*://:C/:.*$//}";                               \
1.1275    jlam     3334:        found=`${PKG_BEST_EXISTS} "$$pkg" || ${TRUE}`;                  \
1.808     martin   3335:        if [ "X$$REBUILD_DOWNLEVEL_DEPENDS" != "X" ]; then              \
1.1540.2.1  tv       3336:                pkgname=`cd $$dir ; ${MAKE} ${MAKEFLAGS} show-var-noeval VARNAME=PKGNAME`; \
1.972     agc      3337:                if [ "X$$found" != "X" -a "X$$found" != "X$${pkgname}" ]; then \
                   3338:                        ${ECHO_MSG} "ignoring old installed package \"$$found\""; \
1.808     martin   3339:                        found="";                                       \
                   3340:                fi;                                                     \
                   3341:        fi;                                                             \
1.452     hubertf  3342:        if [ "$$found" != "" ]; then                                    \
1.1275    jlam     3343:                instobjfmt=`${PKG_INFO} -B "$$found" | ${AWK} -F'=[ \t]*' '/^OBJECT_FMT/ {print $$2; exit}'`; \
1.452     hubertf  3344:                if [ "$$instobjfmt" = "" ]; then                        \
1.396     agc      3345:                        if [ "X${WARN_NO_OBJECT_FMT}" != "Xno" ]; then  \
1.1275    jlam     3346:                                ${ECHO} "WARNING: Unknown object format for installed package $$found - continuing"; \
1.396     agc      3347:                        fi;                                             \
1.452     hubertf  3348:                elif [ "$$instobjfmt" != "${OBJECT_FMT}" ]; then        \
1.1275    jlam     3349:                        ${ECHO} "Installed package $$found is an $$instobjfmt package."; \
1.392     agc      3350:                        ${ECHO} "You are building an ${OBJECT_FMT} package, which will not inter-operate."; \
1.1275    jlam     3351:                        ${ECHO} "Please update the $$found package to ${OBJECT_FMT}"; \
1.537     fredb    3352:                        if [ "X${FATAL_OBJECT_FMT_SKEW}" != "Xno" ]; then \
1.393     agc      3353:                                exit 1;                                 \
                   3354:                        fi;                                             \
1.392     agc      3355:                fi;                                                     \
1.1279    jlam     3356:                ${ECHO_MSG} "${_PKGSRC_IN}> Required installed package $$pkg: $${found} found"; \
1.148     agc      3357:        else                                                            \
1.606     hubertf  3358:                ${ECHO_MSG} "${_PKGSRC_IN}> Required package $$pkg: NOT found"; \
1.1437    xtraeme  3359:                target=${DEPENDS_TARGET:Q};                             \
1.416     agc      3360:                ${ECHO_MSG} "${_PKGSRC_IN}> Verifying $$target for $$dir";      \
1.148     agc      3361:                if [ ! -d $$dir ]; then                                 \
1.415     agc      3362:                        ${ECHO_MSG} "=> No directory for $$dir.  Skipping.."; \
1.73      agc      3363:                else                                                    \
1.452     hubertf  3364:                        cd $$dir ;                                      \
1.1468    agc      3365:                        ${SETENV} _PKGSRC_DEPS=", ${PKGNAME}${_PKGSRC_DEPS}" ${MAKE} ${MAKEFLAGS} $$target PKGNAME_REQD=\'$$pkg\' || exit 1; \
1.416     agc      3366:                        ${ECHO_MSG} "${_PKGSRC_IN}> Returning to build of ${PKGNAME}"; \
1.275     tv       3367:                fi;                                                     \
                   3368:        fi
1.1540.2.1  tv       3369: .endfor        # DEPENDS
1.1       agc      3370:
1.1222    jmmv     3371: .PHONY: build-depends-list
1.532     hubertf  3372: build-depends-list:
1.1540.2.1  tv       3373:        @for dir in `${_SHOW_ALL_DEPENDS_DIRS_EXCL}`; do                \
1.937     wiz      3374:                (cd ../../$$dir &&                                      \
                   3375:                ${MAKE} ${MAKEFLAGS} package-name)                      \
                   3376:        done
1.1       agc      3377:
1.1159    grant    3378: # Stat all the files of one pkg and sum the sizes up.
                   3379: #
1.373     hubertf  3380: # XXX This is intended to be run before pkg_create is called, so the
1.577     agc      3381: # existence of ${PLIST} can be assumed.
1.1222    jmmv     3382: .PHONY: print-pkg-size-this
1.483     hubertf  3383: print-pkg-size-this:
1.485     hubertf  3384:        @${SHCOMMENT} "This pkg's files" ;                              \
1.424     hubertf  3385:        ${AWK} 'BEGIN { base = "${PREFIX}/" }                           \
                   3386:                /^@cwd/ { base = $$2 "/" }                              \
1.1328    seb      3387:                /^@/ { next }                                           \
                   3388:                { print base $$0 }'                                     \
1.488     hubertf  3389:                <${PLIST}                                               \
1.757     jlam     3390:        | ${SORT} -u                                                    \
1.1328    seb      3391:        | ${SED} -e "s/'/'\\\\''/g" -e "s/.*/'&'/"                      \
1.1383    jlam     3392:        | ${XARGS} -n 256 ${LS} -ld                                     \
1.1540.2.19  tv       3393:        | ${AWK} '{ s += $$5; } END { print s; }'                       \
1.386     hubertf  3394:
1.483     hubertf  3395: # Sizes of required pkgs (only)
1.1159    grant    3396: #
1.483     hubertf  3397: # XXX This is intended to be run before pkg_create is called, so the
1.1159    grant    3398: # dependencies are all installed.
1.1222    jmmv     3399: .PHONY: print-pkg-size-depends
1.483     hubertf  3400: print-pkg-size-depends:
1.1483    minskim  3401:        @pkglist=`${MAKE} ${MAKEFLAGS} run-depends-list`;               \
                   3402:        if [ "X$${pkglist}" != "X" ]; then                              \
                   3403:                ${ECHO} $${pkglist}                                     \
                   3404:                | ${XARGS} -n 1 ${SETENV} ${PKG_BEST_EXISTS}            \
                   3405:                | ${SORT} -u                                            \
                   3406:                | ${XARGS} -n 256 ${SETENV} ${PKG_INFO} -qs             \
1.1540.2.19  tv       3407:                | ${AWK} '/^[0-9]+$$/ { s += $$1; } END { print s; }';  \
1.1483    minskim  3408:        else                                                            \
                   3409:                ${ECHO} "0";                                            \
                   3410:        fi
1.480     hubertf  3411:
1.1252    jlam     3412: # By default, all packages attempt to link into the views.
                   3413: .if ${PKG_INSTALLATION_TYPE} == "pkgviews"
                   3414: BUILD_VIEWS?=  yes
                   3415: .endif
                   3416:
1.1272    jlam     3417: # DEFAULT_VIEW.${PKGBASE}      default view for ${PKGBASE}
                   3418: # VIEWBASE                     base location of files at run-time
                   3419: #
                   3420: DEFAULT_VIEW.${PKGBASE}?=      ${DEFAULT_VIEW}
                   3421: .if ${PKG_INSTALLATION_TYPE} == "pkgviews"
                   3422: .  if empty(DEFAULT_VIEW.${PKGBASE}:M"")
                   3423: VIEWBASE=      ${LOCALBASE}/${DEFAULT_VIEW.${PKGBASE}}
                   3424: .  else
                   3425: VIEWBASE=      ${LOCALBASE}
                   3426: .  endif
                   3427: .elif ${PKG_INSTALLATION_TYPE} == "overwrite"
                   3428: VIEWBASE=      ${PREFIX}
                   3429: .endif
1.1305    jlam     3430: MAKE_ENV+=     VIEWBASE=${VIEWBASE}
1.1272    jlam     3431:
                   3432: PKGVIEWS+=     ${DEFAULT_VIEW.${PKGBASE}}
1.373     hubertf  3433:
1.1540.2.15  tv       3434: .PHONY: pre-install-fake-pkg
                   3435: pre-install-fake-pkg:
1.1127    agc      3436:        ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${PRESERVE_FILE}
1.1540.2.1  tv       3437: .if defined(PKG_PRESERVE)
1.1127    agc      3438:        ${_PKG_SILENT}${_PKG_DEBUG}${DATE} > ${PRESERVE_FILE}
1.1540.2.1  tv       3439: .endif
1.932     agc      3440:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3441:        files="";                                                       \
1.948     tron     3442:        for f in ${.CURDIR}/Makefile ${FILESDIR}/* ${PKGDIR}/*; do      \
1.945     agc      3443:                if [ -f "$$f" ]; then                                   \
                   3444:                        files="$$files \"$$f\"";                        \
                   3445:                fi;                                                     \
                   3446:        done;                                                           \
1.753     wiz      3447:        if [ -f ${DISTINFO_FILE} ]; then                                \
                   3448:                for f in `${AWK} 'NF == 4 && $$3 == "=" { gsub("[()]", "", $$2); print $$2 }' < ${DISTINFO_FILE}`; do \
1.662     agc      3449:                        if [ -f ${PATCHDIR}/$$f ]; then                 \
1.945     agc      3450:                                files="$$files \"${PATCHDIR}/$$f\"";    \
1.334     tron     3451:                        fi;                                             \
1.315     agc      3452:                done;                                                   \
                   3453:        fi;                                                             \
1.186     agc      3454:        if [ -d ${PATCHDIR} ]; then                                     \
                   3455:                for f in ${PATCHDIR}/patch-*; do                        \
                   3456:                        case $$f in                                     \
                   3457:                        *.orig|*.rej|*~) ;;                             \
1.315     agc      3458:                        ${PATCHDIR}/patch-local-*)                      \
1.945     agc      3459:                                files="$$files \"$$f\"" ;;              \
1.186     agc      3460:                        esac;                                           \
                   3461:                done;                                                   \
                   3462:        fi;                                                             \
1.1510    jlam     3463:        eval ${GREP} '\$$NetBSD' $$files | ${SED} -e 's|^${PKGSRCDIR}/||' > ${BUILD_VERSION_FILE}
1.1540.2.15  tv       3464:        ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${BUILD_INFO_FILE}
1.1540.2.1  tv       3465: .for def in ${BUILD_DEFS} ${BUILD_DEFS_FIXED}
1.1193    grant    3466:        @${ECHO} ${def}=${${def}:Q} | ${SED} -e 's|^PATH=[^     ]*|PATH=...|' >> ${BUILD_INFO_FILE}
1.1540.2.1  tv       3467: .endfor
                   3468: .if defined(USE_LANGUAGES) && !empty(USE_LANGUAGES)
1.1294    grant    3469:        @${ECHO} "CC_VERSION=${CC_VERSION}" >> ${BUILD_INFO_FILE}
1.1540.2.1  tv       3470: .endif
                   3471: .if defined(USE_PERL5) && (${USE_PERL5} == "run")
1.1193    grant    3472:        @${ECHO} "PERL=`${PERL5} --version 2>/dev/null | ${GREP} 'This is perl'`" >> ${BUILD_INFO_FILE}
1.1540.2.1  tv       3473: .endif
                   3474: .if !empty(USE_GNU_TOOLS:Mmake)
1.1193    grant    3475:        @${ECHO} "GMAKE=`${GMAKE} --version | ${GREP} Make`" >> ${BUILD_INFO_FILE}
1.1540.2.1  tv       3476: .endif
1.1540.2.15  tv       3477:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3478:        ${ECHO} "_PKGTOOLS_VER=${PKGTOOLS_VERSION}" >> ${BUILD_INFO_FILE}
                   3479:
                   3480: .PHONY: post-install-fake-pkg
                   3481: post-install-fake-pkg: ${PLIST} ${DESCR} ${MESSAGE}
                   3482:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3483:        if [ ! -f ${PLIST} -o ! -f ${DESCR} ]; then                     \
                   3484:                ${ECHO} "** Missing package files for ${PKGNAME} - installation not recorded."; \
                   3485:                exit 1;                                                 \
                   3486:        fi
                   3487:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3488:        if [ ! -d ${_PKG_DBDIR} ]; then                                 \
                   3489:                ${RM} -f ${_PKG_DBDIR};                                 \
                   3490:                ${MKDIR} ${_PKG_DBDIR};                                 \
                   3491:        fi
                   3492: .if defined(FORCE_PKG_REGISTER)
                   3493:        ${_PKG_SILENT}${_PKG_DEBUG}${PKG_ADMIN} delete ${PKGNAME}
                   3494: .endif
                   3495:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3496:        ${ECHO} ${COMMENT:Q} > ${PKG_DB_TMPDIR}/+COMMENT
                   3497:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3498:        case "${DESCR}" in                                              \
                   3499:        ${PKG_DB_TMPDIR}/*|"") ;;                                       \
                   3500:        *)      if ${TEST} -f ${DESCR}; then                            \
                   3501:                        ${CP} ${DESCR} ${PKG_DB_TMPDIR}/+DESC;          \
                   3502:                fi ;;                                                   \
                   3503:        esac
                   3504:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3505:        case "${MESSAGE}" in                                            \
                   3506:        ${PKG_DB_TMPDIR}/*|"") ;;                                       \
                   3507:        *)      if ${TEST} -f ${MESSAGE}; then                          \
                   3508:                        ${CP} ${MESSAGE} ${PKG_DB_TMPDIR}/+DISPLAY;     \
                   3509:                fi ;;                                                   \
                   3510:        esac
                   3511:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3512:        case ${PKG_INSTALLATION_TYPE} in                                \
                   3513:        pkgview)        ${TOUCH} ${PKG_DB_TMPDIR}/+VIEWS ;;             \
                   3514:        esac
                   3515:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3516:        case "${INSTALL_FILE}" in                                       \
                   3517:        ${PKG_DB_TMPDIR}/*|"") ;;                                       \
                   3518:        *)      if ${TEST} -f ${INSTALL_FILE}; then                     \
                   3519:                        ${CP} ${INSTALL_FILE} ${PKG_DB_TMPDIR}/+INSTALL; \
                   3520:                fi ;;                                                   \
                   3521:        esac
                   3522:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3523:        case "${DEINSTALL_FILE}" in                                     \
                   3524:        ${PKG_DB_TMPDIR}/*|"") ;;                                       \
                   3525:        *)      if ${TEST} -f ${DEINSTALL_FILE}; then                   \
                   3526:                        ${CP} ${DEINSTALL_FILE} ${PKG_DB_TMPDIR}/+DEINSTALL; \
                   3527:                fi ;;                                                   \
                   3528:        esac
                   3529:        ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${SIZE_PKG_FILE} ${SIZE_ALL_FILE}
1.1540.2.1  tv       3530: .if ${SHLIB_HANDLING} == "YES" && ${CHECK_SHLIBS} == "YES"
1.1219    agc      3531:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.1244    grant    3532:        case "${LDD}" in                                                \
                   3533:        "")     ldd=`${TYPE} ldd 2>/dev/null | ${AWK} '{ print $$NF }'`;; \
                   3534:        *)      ldd="${LDD}";                                           \
                   3535:        esac;                                                           \
1.1219    agc      3536:        case "${OBJECT_FMT}" in                                         \
                   3537:        ELF)    bins=`${SETENV} PREFIX=${PREFIX} ${AWK} '/^(bin|sbin|libexec)\// { print ENVIRON["PREFIX"] "/" $$0 }' ${PLIST} || ${TRUE}`; \
                   3538:                libs=`${SETENV} PREFIX=${PREFIX} ${AWK} '/^lib\/lib.*\.so\.[0-9]+$$/ { print ENVIRON["PREFIX"] "/" $$0 }' ${PLIST} || ${TRUE}`; \
                   3539:                if ${TEST} "$$bins" != "" -o "$$libs" != ""; then       \
1.1220    agc      3540:                        requires=`($$ldd $$bins $$libs 2>/dev/null || ${TRUE}) | ${AWK} 'NF == 3 { print $$3 }' | ${SORT} -u`; \
1.1219    agc      3541:                fi;                                                     \
1.1529    tv       3542:                linklibs=`${SETENV} PREFIX=${PREFIX} ${AWK} '/^[^@].*\.so\.[0-9\.]+$$/ { print ENVIRON["PREFIX"] "/" $$0 }' ${PLIST} || ${TRUE}`; \
1.1518    tv       3543:                for i in $${linklibs}; do                               \
1.1527    tv       3544:                        if ${TEST} -r $$i -a ! -x $$i -a ! -h $$i; then \
1.1529    tv       3545:                                ${TEST} "${PKG_DEVELOPER:Uno}" = "no" || \
                   3546:                                        ${ECHO} "$$i: installed without execute permission; fixing (should use [BSD_]INSTALL_LIB)"; \
1.1518    tv       3547:                                ${CHMOD} +x $$i;                        \
                   3548:                        fi;                                             \
                   3549:                done;                                                   \
1.1244    grant    3550:                ;;                                                      \
                   3551:        Mach-O) bins=`${SETENV} PREFIX=${PREFIX} ${AWK} '/^(bin|sbin|libexec)\// { print ENVIRON["PREFIX"] "/" $$0 }' ${PLIST} || ${TRUE}`; \
                   3552:                libs=`${SETENV} PREFIX=${PREFIX} ${AWK} '/^lib\/lib.*\.dylib/ { print ENVIRON["PREFIX"] "/" $$0 }' ${PLIST} || ${TRUE}`; \
                   3553:                if ${TEST} "$$bins" != "" -o "$$libs" != ""; then       \
1.1334    grant    3554:                        requires=`($$ldd $$bins $$libs 2>/dev/null || ${TRUE}) | ${AWK} '/compatibility version/ { print $$1 }' | ${SORT} -u`; \
1.1244    grant    3555:                fi;                                                     \
                   3556:                ;;                                                      \
                   3557:        esac;                                                           \
                   3558:        for i in "" $$libs; do                                          \
                   3559:                ${TEST} "$$i" = "" && continue;                         \
                   3560:                ${ECHO} "PROVIDES=$$i" >> ${BUILD_INFO_FILE};           \
                   3561:        done;                                                           \
                   3562:        for req in "" $$requires; do                                    \
                   3563:                ${TEST} "$$req" = "" && continue;                       \
                   3564:                ${ECHO} "REQUIRES=$$req" >> ${BUILD_INFO_FILE};         \
                   3565:        done
1.1540.2.1  tv       3566: .endif
1.615     hubertf  3567:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.483     hubertf  3568:        size_this=`${MAKE} ${MAKEFLAGS} print-pkg-size-this`;           \
                   3569:        size_depends=`${MAKE} ${MAKEFLAGS} print-pkg-size-depends`;     \
1.488     hubertf  3570:        ${ECHO} $$size_this >${SIZE_PKG_FILE};                          \
1.1540.2.19  tv       3571:        ${ECHO} $$size_this $$size_depends                              \
                   3572:                | ${AWK} '{ print $$1 + $$2; }' >${SIZE_ALL_FILE}
1.1540.2.15  tv       3573:
                   3574: # Fake installation of package so that user can pkg_delete it later.
                   3575: # Also, make sure that an installed package is recognized correctly in
                   3576: # accordance to the @pkgdep directive in the packing lists.
                   3577: #
                   3578: .PHONY: register-pkg
                   3579: register-pkg: post-install-fake-pkg
1.452     hubertf  3580:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
1.1252    jlam     3581:        doit=yes;                                                       \
                   3582:        case ${PKG_INSTALLATION_TYPE} in                                \
                   3583:        overwrite)      if [ -d ${_PKG_DBDIR}/${PKGNAME} ]; then        \
                   3584:                                doit=no;                                \
                   3585:                        fi ;;                                           \
                   3586:        esac;                                                           \
                   3587:        case $$doit in                                                  \
                   3588:        yes)                                                            \
1.416     agc      3589:                ${ECHO_MSG} "${_PKGSRC_IN}> Registering installation for ${PKGNAME}"; \
1.1540.2.15  tv       3590:                ${PKG_CREATE} ${PKG_ARGS_INSTALL} -O ${PKGFILE} > ${PKG_DB_TMPDIR}/+CONTENTS; \
1.1435    tv       3591:                list="`${MAKE} ${MAKEFLAGS} run-depends-list ECHO_MSG=${TRUE} | ${SORT} -u`" ; \
1.1278    jlam     3592:                for realdep in `${ECHO} $$list | ${XARGS} -n 1 ${SETENV} ${PKG_BEST_EXISTS} | ${SORT} -u`; do \
1.380     hubertf  3593:                        if ${TEST} -z "$$realdep"; then                 \
1.568     wiz      3594:                                ${ECHO} "$$dep not installed - dependency NOT registered" ; \
1.1252    jlam     3595:                        elif [ -d ${_PKG_DBDIR}/$$realdep ]; then       \
1.1471    grant    3596:                                if ${TEST} ! -f ${_PKG_DBDIR}/$$realdep/+REQUIRED_BY; then \
1.1252    jlam     3597:                                        ${TOUCH} ${_PKG_DBDIR}/$$realdep/+REQUIRED_BY; \
1.221     agc      3598:                                fi;                                     \
                   3599:                                ${AWK} 'BEGIN { found = 0; }            \
                   3600:                                        $$0 == "${PKGNAME}" { found = 1; } \
                   3601:                                        { print $$0; }                  \
                   3602:                                        END { if (!found) { printf("%s\n", "${PKGNAME}"); }}' \
1.1252    jlam     3603:                                        < ${_PKG_DBDIR}/$$realdep/+REQUIRED_BY > ${_PKG_DBDIR}/$$realdep/reqby.$$$$; \
                   3604:                                ${MV} ${_PKG_DBDIR}/$$realdep/reqby.$$$$ ${_PKG_DBDIR}/$$realdep/+REQUIRED_BY; \
1.221     agc      3605:                                ${ECHO} "${PKGNAME} requires installed package $$realdep"; \
1.175     agc      3606:                        fi;                                             \
1.1540.2.15  tv       3607:                done;                                                   \
                   3608:                case ${PKG_INSTALLATION_TYPE} in                        \
                   3609:                overwrite)      ${RM} -rf ${_PKG_DBDIR}/${PKGNAME} ;;   \
                   3610:                esac;                                                   \
                   3611:                ${MKDIR} ${_PKG_DBDIR}/${PKGNAME};                      \
                   3612:                ${CP} ${PKG_DB_TMPDIR}/+* ${_PKG_DBDIR}/${PKGNAME};     \
                   3613:                ;;                                                      \
1.1252    jlam     3614:        esac
1.1540.2.1  tv       3615: .if (${PKG_INSTALLATION_TYPE} == "pkgviews") && \
1.1265    jlam     3616:       !empty(BUILD_VIEWS:M[yY][eE][sS])
1.1252    jlam     3617:        ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${MAKEFLAGS} build-views
1.1540.2.1  tv       3618: .endif # pkgviews
1.1252    jlam     3619:
                   3620: .PHONY: build-views
                   3621: build-views: do-su-build-views
                   3622:
                   3623: .PHONY: do-su-build-views
                   3624: do-su-build-views:
                   3625:        @${ECHO_MSG} "${_PKGSRC_IN}> Building views for ${PKGNAME}"
                   3626:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3627:        realtarget="real-su-build-views";                               \
                   3628:        action="build-views";                                           \
                   3629:        ${_SU_TARGET}
                   3630:
                   3631: .PHONY: real-su-build-views
                   3632: real-su-build-views:
1.1540.2.1  tv       3633: .if (${PKG_INSTALLATION_TYPE} == "pkgviews") && defined(PKGVIEWS)
1.1252    jlam     3634:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3635:        ${MKDIR} ${LOCALBASE};                                          \
                   3636:        for v in ${PKGVIEWS}; do                                        \
                   3637:                case "$$v" in                                           \
                   3638:                "")     dbdir=${PKG_DBDIR}; viewname=standard ;;        \
                   3639:                *)      dbdir=${LOCALBASE}/$$v/.dbdir; viewname=$$v ;;  \
                   3640:                esac;                                                   \
                   3641:                ${ECHO} "=> Performing package view clash check for ${PKGNAME} in $$viewname view"; \
                   3642:                pkg=`${PKG_INFO_CMD} -K $$dbdir -e ${PKGBASE} || ${TRUE}`; \
                   3643:                case "$$pkg" in                                         \
                   3644:                "")     ;;                                              \
                   3645:                *)      ${ECHO} "*** ${PKGBASE} exists in $$viewname view - package $$pkg ***"; \
                   3646:                        ${ECHO} "*** Not hoisting ${PKGNAME} into $$viewname view"; \
                   3647:                        continue ;;                                     \
                   3648:                esac;                                                   \
                   3649:                ${ECHO} "=> Performing package view overwrite check for ${PKGNAME} in $$viewname view"; \
                   3650:                dups=`${SETENV} PLIST_IGNORE_FILES="${_PLIST_IGNORE_FILES}" ${PKG_VIEW} --view=$$v check ${PKGNAME} || ${TRUE}`; \
                   3651:                case "$$dups" in                                        \
                   3652:                "")     ;;                                              \
                   3653:                *)      ${ECHO} "***********************************************************"; \
                   3654:                        ${ECHO} "**** The following symbolic links will be overwritten *****"; \
                   3655:                        for f in $$dups; do                             \
                   3656:                                ${LS} -l ${LOCALBASE}/$$v/$$f;          \
                   3657:                        done;                                           \
                   3658:                        ${ECHO} "***********************************************************"; \
                   3659:                        ;;                                              \
                   3660:                esac;                                                   \
                   3661:                ${ECHO} "=> Linking package into $$viewname view";      \
                   3662:                ${SETENV} PLIST_IGNORE_FILES="${_PLIST_IGNORE_FILES}" ${PKG_VIEW} --view=$$v add ${PKGNAME}; \
                   3663:        done
                   3664: .endif
                   3665:
                   3666: .PHONY: remove-views
                   3667: remove-views: do-su-remove-views
                   3668:
                   3669: .PHONY: do-su-remove-views
                   3670: do-su-remove-views:
                   3671:        @${ECHO_MSG} "${_PKGSRC_IN}> Removing ${PKGNAME} from views"
                   3672:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3673:        realtarget="real-su-remove-views";                              \
                   3674:        action="remove-views";                                          \
                   3675:        ${_SU_TARGET}
                   3676:
                   3677: .PHONY: real-su-remove-views
                   3678: real-su-remove-views:
1.1540.2.1  tv       3679: .if (${PKG_INSTALLATION_TYPE} == "pkgviews") && defined(PKGVIEWS)
1.1252    jlam     3680:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                   3681:        for v in ${PKGVIEWS}; do                                        \
                   3682:                case "$$v" in                                           \
                   3683:                "")     dbdir=${PKG_DBDIR}; viewname=standard ;;        \
                   3684:                *)      dbdir=${LOCALBASE}/$$v/.dbdir; viewname=$$v ;;  \
                   3685:                esac;                                                   \
                   3686:                ${ECHO} "=> Removing package from $$viewname view";     \
                   3687:                ${SETENV} PLIST_IGNORE_FILES="${_PLIST_IGNORE_FILES}" ${PKG_VIEW} --view=$$v delete ${PKGNAME}; \
                   3688:        done
1.1       agc      3689: .endif
                   3690:
1.1540.2.5  tv       3691: .include "../../mk/bsd.pkg.data.mk"
1.1248    jlam     3692: .include "../../mk/subst.mk"
1.521     hubertf  3693:
                   3694: #
                   3695: # For bulk build targets (bulk-install, bulk-package), the
1.529     hubertf  3696: # BATCH variable must be set in /etc/mk.conf:
1.521     hubertf  3697: #
                   3698: .if defined(BATCH)
1.789     hubertf  3699: .  include "../../mk/bulk/bsd.bulk-pkg.mk"
1.149     tsarna   3700: .endif

CVSweb <webmaster@jp.NetBSD.org>