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.

PR:		204056
Submitted by:	mat
Reviewed by:	bapt
Exp-run:	antoine
Sponsored by:	Absolight
Differential Revision:	https://reviews.freebsd.org/D2735
This commit is contained in:
Mathieu Arnold 2015-11-05 12:35:26 +00:00
parent 0c5564ff73
commit ec218a1332
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=400846
6 changed files with 40 additions and 13 deletions

17
CHANGES
View File

@ -10,6 +10,23 @@ in the release notes and/or placed into UPDATING.
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

View File

@ -16,7 +16,7 @@ IGNORE= Incorrect 'USES+=lha:${lha_ARGS}' expecting 'USES+=lha'
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

View File

@ -17,10 +17,11 @@ IGNORE= USES=pathfix does not require args
.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 ; \

View File

@ -13,7 +13,7 @@ _INCLUDE_USES_ZIP_MK= yes
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}

View File

@ -114,6 +114,7 @@ DISTFILES?= ${DISTNAME}${EXTRACT_SUFX}
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 @@ pre-install: linux-rpm-generate-plist
. 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 @@ do-install:
. 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

View File

@ -521,12 +521,12 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org
# 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 @@ WRKDIR?= ${WRKDIRPREFIX}${.CURDIR}/work
.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 @@ options-message:
@${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 @@ clean-wrkdir:
.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 @@ _FETCH_SEQ= 150:fetch-depends 300:pre-fetch 450:pre-fetch-script \
${_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}