about python build dependencies (and a permissions/ownership question)
René J.V. Bertin
rjvbertin at gmail.com
Wed Mar 18 15:04:34 PDT 2015
Hi,
I'm updating my infinality variant to port:fontconfig, and I've stumbled upon a build dependency that's either new or that I simply never noticed. It may be new, because the current Infinality-Ultimate patches bump fontconfig to version 2.11.93, kind of a 2.12.0 RC .
The build process uses Python scripts that import py-lxml to parse certain files. It doesn't appear to matter what version that is, i.e. the resulting files that get installed do not depend on what Python version was used. There are thus no concerns about reproducible builds (and the variant isn't the default either).
What's the best and leanest way to pull in this build dependency and point the configure script to the correct python interpreter? Ideally I would like to avoid pulling in a python version unnecessarily, or even a py-lxml version, but I guess there's no support for this and I'd have to do something (probably "not done") like below?
Note also the chown call in the pre-patch below. Apparently something in the pre-patch block creates files and/or directories that are owned by root instead of ${macportsuser}, which leads to permissions errors during the actual configure run.
Thanks,
R.
{{{
variant infinality description *{*patched *for* improved *font* rendering, bohoomil ultimate *style}* *{*
version 2.11.93
worksrcdir ${name}-${fversion}
distname ${name}-${fversion}
#revision [expr ${revision} + 1]
depends_lib-*append* port:fontconfig-ultimate
# point configure to the MacPorts python interpreter that has the lxml package:
*if* *{[file* exists ${prefix}/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/lxml*]}* *{*
depends_build-*append* port:py34-lxml
*set* PYTHON ${prefix}/bin/python3.4
*}* *elseif* *{[file* exists ${prefix}/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml*]* \
|| (*[file* exists ${prefix}/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7*]* && \
!*[file* exists ${prefix}/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4*]*) *}* *{*
# lxml installed for py2.7 *or* py2.7 is installed and py3.4 is not
depends_build-*append* port:py27-lxml
*set* PYTHON ${prefix}/bin/python2.7
*}* *else* *{*
depends_build-*append* port:py34-lxml
*set* PYTHON ${prefix}/bin/python3.4
*}*
pre-patch *{*
ui_msg "Patching fontconfig v${fversion} to v2.11.93"
*catch* *{eval* *exec* sh -c "\"cd ${worksrcpath} ; ${patch.cmd} -Np1 -i ${filespath}/upstream_2.11.93.patch\""*}* result
ui_debug "Applying upstream patches to 2.11.93: $result"
*catch* *{eval* *exec* sh -c "\"cd ${worksrcpath} ; autoreconf -vfi\""*}* result
ui_debug "automake: $result"
# not sure how these should have been created:
*catch* *{eval* *exec* sh -c "\"cd ${worksrcpath}/doc ; touch FcRangeCopy.3 FcRangeCreateDouble.3 \
FcRangeCreateInteger.3 FcRangeDestroy.3 FcRangeGetDouble.3 FcWeightFromOpenType.3 FcWeightToOpenType.3\""*}* result
ui_debug "Creating stubs for missing manpages: $result"
# apparently something in the above commands can create directories owned by root
*catch* *{eval* *exec* sh -c "\"cd ${worksrcpath} ; chown -R ${macportsuser} .\""*}* result
ui_debug "chown ${macportsuser}: $result"
*}*
patchfiles-*append* 00-fonts.conf.in-${INFRELEASE}.patch \
01-configure-${INFRELEASE}.patch \
02-configure.ac-${INFRELEASE}.patch \
03-Makefile.in-${INFRELEASE}.patch \
04-Makefile.conf.d-${INFRELEASE}.patch \
05-Makefile.am.in-${INFRELEASE}-automake115.patch
pre-configure *{*
configure.args-*append* --with-templatedir=${prefix}/etc/fonts/conf.avail --with-templateinfdir=${TEMPLINFDIR} PYTHON=${PYTHON}
*if* *{[file* exists ${prefix}/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml*]}* *{*
configure.args-*append* PYTHON=${prefix}/bin/python2.7
*}* *elseif* *{[file* exists ${prefix}/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/lxml*]}* *{*
configure.args-*append* PYTHON=${prefix}/bin/python3.4
*}*
delete ${worksrcpath}/conf.d.infinality
copy ${prefix}/share/fonts/fontconfig-ultimate/${INFRELEASE}/conf.d.infinality ${worksrcpath}
*catch* *{eval* *exec* sh -c "\"cd ${worksrcpath} ; autoreconf -vfi\""*}* result
ui_debug "automake: $result"
*}*
notes-*append* "Be sure to call fc-presets as root to select one of the provided font configuration presets!"
*}*
}}}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-dev/attachments/20150318/52c2c276/attachment-0001.html>
More information about the macports-dev
mailing list