summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Arnold <mat@FreeBSD.org>2015-11-05 12:35:26 +0000
committerMathieu Arnold <mat@FreeBSD.org>2015-11-05 12:35:26 +0000
commitec218a1332be3111b2cca8d13d52f6f7ad0691e0 (patch)
tree1ee3a703612ee2e6a2d97f2814c94a07701d832c
parent0c5564ff73663a8ef4ee46f9a8c1db52dbda4914 (diff)
downloadfreebsd-ports-ec218a1332be3111b2cca8d13d52f6f7ad0691e0.zip
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
-rw-r--r--CHANGES17
-rw-r--r--Mk/Uses/lha.mk2
-rw-r--r--Mk/Uses/pathfix.mk3
-rw-r--r--Mk/Uses/zip.mk2
-rw-r--r--Mk/bsd.linux-rpm.mk7
-rw-r--r--Mk/bsd.port.mk22
6 files changed, 40 insertions, 13 deletions
diff --git a/CHANGES b/CHANGES
index f91e8a2d46ca..9b7db386c938 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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
diff --git a/Mk/Uses/lha.mk b/Mk/Uses/lha.mk
index cca76bc4a365..e6a7203f7593 100644
--- a/Mk/Uses/lha.mk
+++ b/Mk/Uses/lha.mk
@@ -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
diff --git a/Mk/Uses/pathfix.mk b/Mk/Uses/pathfix.mk
index 6db22811ffca..f191f9ea4026 100644
--- a/Mk/Uses/pathfix.mk
+++ b/Mk/Uses/pathfix.mk
@@ -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 ; \
diff --git a/Mk/Uses/zip.mk b/Mk/Uses/zip.mk
index 61945eceb8e7..1110970b6896 100644
--- a/Mk/Uses/zip.mk
+++ b/Mk/Uses/zip.mk
@@ -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}
diff --git a/Mk/bsd.linux-rpm.mk b/Mk/bsd.linux-rpm.mk
index 225986e0c35c..a5b0c197c9ed 100644
--- a/Mk/bsd.linux-rpm.mk
+++ b/Mk/bsd.linux-rpm.mk
@@ -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
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index c37622b69d28..a674863197c2 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -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}