diff options
author | kris <kris@FreeBSD.org> | 2008-07-20 01:59:41 +0800 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2008-07-20 01:59:41 +0800 |
commit | f4a7331ea92dc85f499b56461e1268f6a8cb493b (patch) | |
tree | d77678ac5e6da376988b9dbc60eaa3a355ba7cf2 /Mk/bsd.python.mk | |
parent | fc6297769fb01f2fdb5ea8197e88cd90a4f2af84 (diff) | |
download | freebsd-ports-gnome-f4a7331ea92dc85f499b56461e1268f6a8cb493b.tar.gz freebsd-ports-gnome-f4a7331ea92dc85f499b56461e1268f6a8cb493b.tar.zst freebsd-ports-gnome-f4a7331ea92dc85f499b56461e1268f6a8cb493b.zip |
Major optimizations for 'make index' and other recursive traversal
targets.
* Use /rescue/sh for index builds instead of /bin/sh, when it exists.
The former is statically linked and faster to execute, which becomes
significant when executing it tens of thousands of times. This
trick can be used with other recursive targets by passing in
__MAKE_SHELL.
* Get rid of make variable assignments that use != command invocations
in the critical path, using several methods:
- rewriting logic to use shell or make builtins instead of external command executions
- macroizing commands and executing them in the targets where they
are needed instead of with every invocation of make
- precomputing the results of invariant commands in
bsd.port.subdir.mk and passing them in explicitly to child makes,
and using this to avoid recalculation in all the children. NB: the
commands are still run one per top-level subdirectory but this
does not currently seem to be a major issue. They could be moved
further up into the top-level Makefile at the cost of some
cleanliness.
- Committers are strongly discouraged from adding further "bare" !=
assignments to the ports tree, even in their own ports. One of
the above strategies should be used to avoid future bloat.
* Rewrite the core 'describe' target to work entirely within a single
shell process using only builtin commands. The old version is
retained as a backup for use on systems older than 603104, which
does not have the make :u modifier. This cuts down the number of
processes executed during the course of a 'make index' by an order
of magnitude, and we are essentially now amortized to the minimum of
a single make + sh instance per port, plus whatever commands the
port makefile itself executes (which are usually unnecessary and
bogus).
* Less validation of the WWW: target is performed; this can become
policed at a port level by portlint. Specifically we look at the
second word of the first line beginning with "WWW:" in pkg-descr,
and append "http://" to it unless it already begins with "http://",
"https://" or "ftp://". Thanks to dougb for the idea of how to
extract WWW: using shell builtins.
* Use the "true" shell builtin instead of echo > /dev/null for a
measurable decrease in CPU use.
* Add a note about dubious escaping strategy in bsd.port.subdir.mk
* Minor change in output of 'make describe': it no longer strips
trailing CR characters from pkg-descr files with MSDOS CR/LF
termination. Instead the makeindex perl script that post-processes
make describe into the INDEX is tweaked to strip on input.
The bottom line is that on my test hardware INDEX builds are now
faster by more than a factor of 2 and with a reduction in system time
by a factor of 4-8 depending on configuration.
Diffstat (limited to 'Mk/bsd.python.mk')
-rw-r--r-- | Mk/bsd.python.mk | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Mk/bsd.python.mk b/Mk/bsd.python.mk index 2d9256a1d96e..ea73267a6612 100644 --- a/Mk/bsd.python.mk +++ b/Mk/bsd.python.mk @@ -352,14 +352,24 @@ _PYTHON_VERSION= ${_PYTHON_PORTBRANCH} # just to avoid version sanity checking. PYTHON_VERSION?= python${_PYTHON_VERSION} PYTHON_CMD?= ${_PYTHON_CMD} +.if !defined(PYTHONBASE) PYTHONBASE!= (${PYTHON_CMD} -c 'import sys; print sys.prefix' \ 2> /dev/null || ${ECHO_CMD} ${LOCALBASE}) | ${TAIL} -1 +.endif DEPENDS_ARGS+= PYTHON_VERSION=${PYTHON_VERSION} + +# We can only use the cached version if we are using the default python version. Otherwise it +# should point to some other version we have installed, according to the port USE_PYTHON +# specification +.if !defined(PYTHON_DEFAULT_PORTVERSION) || (${PYTHON_VERSION} != ${PYTHON_DEFAULT_VERSION}) _PYTHON_PORTVERSION!= (${PYTHON_CMD} -c 'import string, sys; \ print string.split(sys.version)[0].replace("b",".b")' 2> /dev/null) | ${TAIL} -1 .if !defined(PYTHON_NO_DEPENDS) && !empty(_PYTHON_PORTVERSION) PYTHON_PORTVERSION= ${_PYTHON_PORTVERSION} .endif +.elif defined(PYTHON_DEFAULT_PORTVERSION) +PYTHON_PORTVERSION= ${PYTHON_DEFAULT_PORTVERSION} +.endif # Propagate the chosen python version to submakes. .MAKEFLAGS: PYTHON_VERSION=python${_PYTHON_VERSION} @@ -440,7 +450,9 @@ MAKE_ENV+= PYTHONPATH=${PYEASYINSTALL_SITELIBDIR} .endif .if defined(PYEASYINSTALL_ARCHDEP) +.if !defined(_OSRELEASE) _OSRELEASE!= ${UNAME} -r +.endif PYEASYINSTALL_OSARCH?= -${OPSYS:L}-${_OSRELEASE}-${ARCH} .endif PYEASYINSTALL_EGG?= ${PYDISTUTILS_PKGNAME:C/[^A-Za-z0-9.]+/_/g}-${PYDISTUTILS_PKGVERSION:C/[^A-Za-z0-9.]+/_/g}-${PYTHON_VERSION:S/thon//}${PYEASYINSTALL_OSARCH}.egg |