Can we create proc{} Portfile?
Darren Weber
dweber at macports.org
Tue May 12 16:39:09 PDT 2009
On Tue, May 12, 2009 at 3:52 PM, Darren Weber <dweber at macports.org> wrote:
>
> Can we create a proc within a Portfile?
>
> I'm currently using this in several places for the vtk-devel port (to set
> different python version variables):
>
> set pyver 2.6
> set python python${pyver}
> set pyport [join [lrange [split ${python} .] 0 1] ""]
> set pyframe
> ${prefix}/Library/Frameworks/Python.framework/Versions/${pyver}
>
>
> Can we create a global proc in a Portfile? Something like this:
>
> proc setPython { major minor } {
> global pyver python pyport pyframe
> set pyver ${major}.${minor}
> set python python${pyver}
> set pyport python${major}${minor}
> set pyframe
> ${prefix}/Library/Frameworks/Python.framework/Versions/${pyver}
> }
>
>
> Regards,
> Darren
>
>
I've tried something that is not working (it doesn't crash, but it's not
effective), i.e.:
# Set some default python variables
set pyver 2.6
set python python${pyver}
set pyport [join [lrange [split ${python} .] 0 1] ""]
set pyframe Library/Frameworks/Python.framework/Versions/${pyver}
global pyver python pyport pyframe
# A function to reset the python variables
proc setPython { major minor } {
global pyver python pyport pyframe
set pyver ${major}.${minor}
set python python${pyver}
set pyport python${major}${minor}
set pyframe Library/Frameworks/Python.framework/Versions/${pyver}
}
variant py25 conflicts py26 requires shared description {python 2.5 wrapper}
{
pre-configure {
setPython 2 5
}
#set pyver 2.5
#set python python${pyver}
#set pyport [join [lrange [split ${python} .] 0 1] ""]
#set pyframe
${prefix}/Library/Frameworks/Python.framework/Versions/${pyver}
depends_lib-append \
port:${pyport}
configure.args-delete \
-DVTK_WRAP_PYTHON:BOOL=OFF
configure.args-append \
-DVTK_WRAP_PYTHON:BOOL=ON \
-DVTK_NO_PYTHON_THREADS:BOOL=OFF \
-DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/include/${python} \
-DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/lib${python}.dylib \
-DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/lib/lib${python}.dylib \
-DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/${python} \
-DVTK_PYTHON_SETUP_ARGS:STRING='--prefix=${prefix}
--root=${destroot}'
# The VTK_PYTHON_SETUP_ARGS *MUST* be in single quotes
post-destroot {
# Redefine all the python variables in this clause (they are not
carried
# through from the definitions above in the variant).
#set pyver 2.5
#set python python${pyver}
#set pyport [join [lrange [split ${python} .] 0 1] ""]
#set pyframe
${prefix}/Library/Frameworks/Python.framework/Versions/${pyver}
# Reset the name of the vtkpython binary (create a symlink to the
# version specific installation, in case other apps look for
vtkpython)
move ${destroot}${prefix}/bin/vtkpython
${destroot}${prefix}/bin/vtk-${branch}-${pyport}
ln -f -s ${destroot}${prefix}/bin/vtk-${branch}-${pyport}
${destroot}${prefix}/bin/vtkpython
# Is it possible to change the python site-package name and have it
all work OK?
# from: /opt/local/lib/python2.6/site-packages/vtk
# to: /opt/local/lib/python2.6/site-packages/vtk-5.4
# Reset the RPATH for all the python .so files
set buildBinPath ${build.dir}/bin
set vtkLibPath ${prefix}/lib/${distname}
set vtkPythonPackage
${destroot}${prefix}/lib/${python}/site-packages/vtk
foreach f [glob ${vtkPythonPackage}/*.so] {
foreach dep [exec otool -L ${f}] {
if [string match "*libvtk*.dylib" ${dep}] {
set newdep [strsed ${dep}
#${buildBinPath}#${vtkLibPath}#]
system "install_name_tool -change ${dep} ${newdep} ${f}"
}
}
}
}
}
What is wrong here? Does it require global declarations in the variant?
Thanks in advance,
Darren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20090512/d5f827a5/attachment.html>
More information about the macports-dev
mailing list