Index: head/CHANGES =================================================================== --- head/CHANGES +++ head/CHANGES @@ -10,6 +10,23 @@ All ports committers are allowed to commit to this file. +20151105: +AUTHOR: mat@FreeBSD.org + + Change the meaning of NO_WRKSUBDIR to force a WRKDIR != WRKSRC. + + Right now, NO_WRKSUBDIR means that the extraction does not produce a + subdirectory, and that everything goes straight into WRKDIR. It is + problematic, because during the build of a port, quite a few files + are created in there, and then, a stage directory, where everything + is installed, and then a pkg directory where the package is created, + and those often conflict, or get in the way, of the building + process. + + With this, NO_WRKSUBDIR will extract the distfiles directly into + WRKSRC instead of WRKDIR. In this case, WRKSRC is artificial and is + based on PKGNAME and not DISTNAME, mitigate conflicts with rc files. + 20151022: AUTHOR: amdmi3@FreeBSD.org Index: head/Mk/Uses/lha.mk =================================================================== --- head/Mk/Uses/lha.mk +++ head/Mk/Uses/lha.mk @@ -16,7 +16,7 @@ EXTRACT_DEPENDS+= lha:${PORTSDIR}/archivers/lha EXTRACT_CMD?= ${LHA_CMD} -EXTRACT_BEFORE_ARGS?= xfpw=${WRKDIR} +EXTRACT_BEFORE_ARGS?= xfpw=${EXTRACT_WRKDIR} EXTRACT_AFTER_ARGS?= .endif Index: head/Mk/Uses/pathfix.mk =================================================================== --- head/Mk/Uses/pathfix.mk +++ head/Mk/Uses/pathfix.mk @@ -17,10 +17,11 @@ .endif PATHFIX_MAKEFILEIN?= Makefile.in +PATHFIX_WRKSRC?= ${WRKSRC} _USES_patch+= 190:pathfix pathfix: - @${FIND} ${WRKSRC} -name "${PATHFIX_MAKEFILEIN}" -type f | ${XARGS} ${REINPLACE_CMD} -e \ + @${FIND} ${PATHFIX_WRKSRC} -name "${PATHFIX_MAKEFILEIN}" -type f | ${XARGS} ${REINPLACE_CMD} -e \ 's|[(]libdir[)]/locale|(prefix)/share/locale|g ; \ s|[(]libdir[)]/pkgconfig|(prefix)/libdata/pkgconfig|g ; \ s|[(]LIBDIR[)]/pkgconfig|(PREFIX)/libdata/pkgconfig|g ; \ Index: head/Mk/Uses/zip.mk =================================================================== --- head/Mk/Uses/zip.mk +++ head/Mk/Uses/zip.mk @@ -13,7 +13,7 @@ EXTRACT_SUFX?= .zip EXTRACT_BEFORE_ARGS?= -qo -EXTRACT_AFTER_ARGS?= -d ${WRKDIR} +EXTRACT_AFTER_ARGS?= -d ${EXTRACT_WRKDIR} .if empty(zip_ARGS) EXTRACT_CMD?= ${UNZIP_NATIVE_CMD} Index: head/Mk/bsd.linux-rpm.mk =================================================================== --- head/Mk/bsd.linux-rpm.mk +++ head/Mk/bsd.linux-rpm.mk @@ -114,6 +114,7 @@ BIN_DISTFILES:= ${DISTFILES} SRC_DISTFILES?= ${DISTNAME}${SRC_SUFX}:SOURCE EXTRACT_ONLY?= ${BIN_DISTFILES:C/:[^:]+$//} +WRKSRC:= ${WRKSRC:S/-${RPMVERSION}$//} . if defined(PACKAGE_BUILDING) DISTFILES+= ${SRC_DISTFILES} @@ -175,7 +176,7 @@ . if !target(linux-rpm-generate-plist) linux-rpm-generate-plist: cd ${WRKSRC} && \ - ${FIND} * ! -path "stage/*" ! -type d | ${SORT} > ${PLIST} + ${FIND} * ! -type d | ${SORT} > ${PLIST} . endif . endif @@ -189,7 +190,7 @@ . if ${BRANDELF_FILES} @cd ${WRKSRC} && ${BRANDELF} -t Linux ${BRANDELF_FILES} . endif - cd ${WRKSRC} && ${FIND} * ! -path "stage*" -type d -exec ${MKDIR} "${STAGEDIR}${PREFIX}/{}" \; - cd ${WRKSRC} && ${FIND} * ! -path "stage/*" ! -type d | ${CPIO} -pm -R root:wheel ${STAGEDIR}${PREFIX} + cd ${WRKSRC} && ${FIND} * -type d -exec ${MKDIR} "${STAGEDIR}${PREFIX}/{}" \; + cd ${WRKSRC} && ${FIND} * ! -type d | ${CPIO} -pm -R root:wheel ${STAGEDIR}${PREFIX} . endif .endif Index: head/Mk/bsd.port.mk =================================================================== --- head/Mk/bsd.port.mk +++ head/Mk/bsd.port.mk @@ -521,12 +521,12 @@ # Default: ${WRKDIRPREFIX}${.CURDIR}/work # WRKSRC - A subdirectory of ${WRKDIR} where the distribution actually # unpacks to. -# Default: ${WRKDIR}/${DISTNAME} unless NO_WRKSUBDIR is set, -# in which case simply ${WRKDIR} +# Default: ${WRKDIR}/${DISTNAME} # WRKSRC_SUBDIR - A subdirectory of ${WRKSRC} where the distribution actually # builds in. # Default: not set -# NO_WRKSUBDIR - Assume port unpacks directly into ${WRKDIR}. +# NO_WRKSUBDIR - Assume port unpacks without a subdirectory, and extract it in +# ${WRKSRC} instead of ${WRKDIR}. # PATCHDIR - A directory containing any additional patches you made # to port this software to FreeBSD. # Default: ${MASTERDIR}/files @@ -1577,10 +1577,18 @@ .if !defined(IGNORE_MASTER_SITE_GITHUB) && defined(USE_GITHUB) WRKSRC?= ${WRKDIR}/${GH_PROJECT}-${GH_TAGNAME_EXTRACT} .endif +# If the distname is not extracting into a specific subdirectory, have the +# ports framework force extract into a subdirectory so that metadata files +# do not get in the way of the build, and vice-versa. .if defined(NO_WRKSUBDIR) -WRKSRC?= ${WRKDIR} +# Some ports have DISTNAME=PORTNAME, and USE_RC_SUBR=PORTNAME, in those case, +# the rc file will conflict with WRKSRC, as WRKSRC is artificial, make it the +# most unlikely to conflict as we can. +WRKSRC?= ${WRKDIR}/${PKGNAME} +EXTRACT_WRKDIR:= ${WRKSRC} .else WRKSRC?= ${WRKDIR}/${DISTNAME} +EXTRACT_WRKDIR:= ${WRKDIR} .endif .if defined(WRKSRC_SUBDIR) WRKSRC:= ${WRKSRC}/${WRKSRC_SUBDIR} @@ -3022,7 +3030,7 @@ @${ECHO_MSG} "===> Found saved configuration for ${_OPTIONS_READ}" .endif -${PKG_DBDIR} ${PREFIX} ${WRKDIR} ${WRKSRC}: +${PKG_DBDIR} ${PREFIX} ${WRKDIR} ${EXTRACT_WRKDIR} ${WRKSRC}: @${MKDIR} ${.TARGET} # Warn user about deprecated packages. Advisory only. @@ -3245,7 +3253,7 @@ .if !target(do-extract) do-extract: @for file in ${EXTRACT_ONLY}; do \ - if ! (cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\ + if ! (cd ${EXTRACT_WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\ then \ exit 1; \ fi; \ @@ -5685,7 +5693,7 @@ ${_OPTIONS_fetch} ${_USES_fetch} _EXTRACT_DEP= fetch _EXTRACT_SEQ= 010:check-build-conflicts 050:extract-message 100:checksum \ - 150:extract-depends 190:clean-wrkdir 200:${WRKDIR} \ + 150:extract-depends 190:clean-wrkdir 200:${EXTRACT_WRKDIR} \ 300:pre-extract 450:pre-extract-script 500:do-extract \ 700:post-extract 850:post-extract-script \ ${_OPTIONS_extract} ${_USES_extract}