svn commit: r400846 - in head: . Mk Mk/Uses

Mathieu Arnold mat at FreeBSD.org
Thu Nov 5 12:35:28 UTC 2015


Author: mat
Date: Thu Nov  5 12:35:26 2015
New Revision: 400846
URL: https://svnweb.freebsd.org/changeset/ports/400846

Log:
  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

Modified:
  head/CHANGES
  head/Mk/Uses/lha.mk
  head/Mk/Uses/pathfix.mk
  head/Mk/Uses/zip.mk
  head/Mk/bsd.linux-rpm.mk
  head/Mk/bsd.port.mk

Modified: head/CHANGES
==============================================================================
--- head/CHANGES	Thu Nov  5 12:11:32 2015	(r400845)
+++ head/CHANGES	Thu Nov  5 12:35:26 2015	(r400846)
@@ -10,6 +10,23 @@ in the release notes and/or placed into 
 
 All ports committers are allowed to commit to this file.
 
+20151105:
+AUTHOR: mat at 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 at FreeBSD.org
 

Modified: head/Mk/Uses/lha.mk
==============================================================================
--- head/Mk/Uses/lha.mk	Thu Nov  5 12:11:32 2015	(r400845)
+++ head/Mk/Uses/lha.mk	Thu Nov  5 12:35:26 2015	(r400846)
@@ -16,7 +16,7 @@ IGNORE=	Incorrect 'USES+=lha:${lha_ARGS}
 
 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

Modified: head/Mk/Uses/pathfix.mk
==============================================================================
--- head/Mk/Uses/pathfix.mk	Thu Nov  5 12:11:32 2015	(r400845)
+++ head/Mk/Uses/pathfix.mk	Thu Nov  5 12:35:26 2015	(r400846)
@@ -17,10 +17,11 @@ IGNORE=	USES=pathfix does not require ar
 .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 ; \

Modified: head/Mk/Uses/zip.mk
==============================================================================
--- head/Mk/Uses/zip.mk	Thu Nov  5 12:11:32 2015	(r400845)
+++ head/Mk/Uses/zip.mk	Thu Nov  5 12:35:26 2015	(r400846)
@@ -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}

Modified: head/Mk/bsd.linux-rpm.mk
==============================================================================
--- head/Mk/bsd.linux-rpm.mk	Thu Nov  5 12:11:32 2015	(r400845)
+++ head/Mk/bsd.linux-rpm.mk	Thu Nov  5 12:35:26 2015	(r400846)
@@ -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

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Thu Nov  5 12:11:32 2015	(r400845)
+++ head/Mk/bsd.port.mk	Thu Nov  5 12:35:26 2015	(r400846)
@@ -521,12 +521,12 @@ FreeBSD_MAINTAINER=	portmgr at 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-f
 				${_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}


More information about the svn-ports-all mailing list