HEADS UP multi processor compilations for everyone
Dmitry Marakasov
amdmi3 at amdmi3.ru
Thu Mar 26 18:03:38 PDT 2009
* Pav Lucistnik (pav at FreeBSD.org) wrote:
> > Btw, this change broke build failures. If vendor's make fails,
> > .build_done.xxx._usr_local is still created in work and $? = 0 as if it
> > have succeeded.
>
> Can you give me a hard example?
Test port consisting of a sole Makefile attached.
I've made two patches for bsd.port.mk.
First one fixes this issue by adding some false's to do-build, second
also improves MAKE_JOBS_* handling, shortening it a bit and exposing
MAKE_JOBS_NUMBER to the ports, so it can be used for other build systems
without having to parse out -j from _MAKE_JOBS (and defaults to 1 if
jobs support is disabled).
Also, [ x != x${BUILD_FAIL_MESSAGE} ] thing seems to be a bit unsafe,
and inconsistent to IGNORE/BROKEN/... vars, in which we don't use
quotes.
---
root at hades:test# make
===> Extracting for test-1.0
===> Patching for test-1.0
===> Configuring for test-1.0
(echo "all:"; echo " false") > /usr/home/amdmi3/projects/ports/test/work/Makefile
===> Building for test-1.0
false
*** Error code 1
Stop in /usr/home/amdmi3/projects/ports/test/work.
root at hades:test# echo $?
0
root at hades:test# ls work
.build_done.test._usr_local
.configure_done.test._usr_local
.extract_done.test._usr_local
.patch_done.test._usr_local
Makefile
---
--
Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D
amdmi3 at amdmi3.ru ..: jabber: amdmi3 at jabber.ru http://www.amdmi3.ru
-------------- next part --------------
# New ports collection makefile for: test
# Date created: 27 Mar 2009
# Whom: Dmitry Marakasov <amdmi3 at FreeBSD.org>
#
# $FreeBSD$
#
PORTNAME= test
PORTVERSION= 1.0
CATEGORIES= sysutils
MASTER_SITES= #none
DISTFILES= #none
MAINTAINER= amdmi3 at FreeBSD.org
COMMENT= Empty comment
NO_WRKSUBDIR= yes
do-configure:
(echo "all:"; echo " false") > ${WRKSRC}/Makefile
.include <bsd.port.mk>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: port.mk.patch
Type: text/x-diff
Size: 1142 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20090327/2d8f9831/port.mk.bin
-------------- next part --------------
Index: bsd.port.mk
===================================================================
RCS file: /home/amdmi3/projects/freebsd/FreeBSD.cvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.614
diff -u -r1.614 bsd.port.mk
--- bsd.port.mk 22 Mar 2009 10:28:53 -0000 1.614
+++ bsd.port.mk 27 Mar 2009 01:00:38 -0000
@@ -2177,18 +2177,17 @@
# Multiple make jobs support
.if defined(DISABLE_MAKE_JOBS) || defined(MAKE_JOBS_UNSAFE)
_MAKE_JOBS= #
-.else
-.if defined(MAKE_JOBS_SAFE) || defined(FORCE_MAKE_JOBS)
-.if defined(MAKE_JOBS_NUMBER)
-_MAKE_JOBS= -j${MAKE_JOBS_NUMBER}
-.else
-_MAKE_JOBS= -j`${SYSCTL} -n kern.smp.cpus`
+.elif defined(MAKE_JOBS_SAFE) || defined(FORCE_MAKE_JOBS)
+.if !defined(MAKE_JOBS_NUMBER)
+MAKE_JOBS_NUMBER!= ${SYSCTL} -n kern.smp.cpus
.endif
+_MAKE_JOBS= -j${MAKE_JOBS_NUMBER}
.if defined(FORCE_MAKE_JOBS)
BUILD_FAIL_MESSAGE+= "You have chosen to use multiple make jobs (parallelization) for all ports. This port was not tested for this setting. Please remove FORCE_MAKE_JOBS and retry the build before reporting the failure to the maintainer."
.endif
.endif
-.endif
+
+MAKE_JOBS_NUMBER?= 1
PTHREAD_CFLAGS?=
PTHREAD_LIBS?= -pthread
@@ -3693,16 +3692,18 @@
@(cd ${BUILD_WRKSRC}; if ! ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${_MAKE_JOBS} ${MAKE_ARGS} ${ALL_TARGET}; then \
if [ x != x${BUILD_FAIL_MESSAGE} ] ; then \
${ECHO_MSG} "===> Compilation failed unexpectedly."; \
- (${ECHO_CMD} ${BUILD_FAIL_MESSAGE}) | ${FMT} 75 79 ; \
+ ${ECHO_CMD} ${BUILD_FAIL_MESSAGE} | ${FMT} 75 79 ; \
fi; \
- fi)
+ fi; \
+ false)
.else
@(cd ${BUILD_WRKSRC}; if ! ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${_MAKE_JOBS} ${MAKE_ARGS} ${ALL_TARGET}; then \
if [ x != x${BUILD_FAIL_MESSAGE} ] ; then \
${ECHO_MSG} "===> Compilation failed unexpectedly."; \
- (${ECHO_CMD} ${BUILD_FAIL_MESSAGE}) | ${FMT} 75 79 ; \
+ ${ECHO_CMD} ${BUILD_FAIL_MESSAGE} | ${FMT} 75 79 ; \
fi; \
- fi)
+ fi; \
+ false)
.endif
.endif
More information about the freebsd-ports
mailing list