[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.20

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

CVSweb <webmaster@jp.NetBSD.org>