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

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

CVSweb <webmaster@jp.NetBSD.org>