Ticket #33465: vtk5-python.patch

File vtk5-python.patch, 4.7 KB (added by seanfarley (Sean Farley), 13 years ago)

patch to fix the upstream bug of incorrect library search directories and also add all compatible python variants

  • Portfile

     
    6767    default_variants +x11 +tcltk
    6868}
    6969
    70 if {![variant_isset python25] && ![variant_isset python26]} {
    71     default_variants +python27
    72 }
    73 
    7470post-destroot {
    7571    set vtkdest ${destroot}${prefix}/share/doc/${name}
    7672    xinstall -d ${vtkdest}
     
    108104        -DVTK_USE_CARBON:BOOL=ON
    109105}
    110106
    111 variant python requires python25 description {Compatibility variant, requires +python25} {}
     107set pythons_suffixes {25 26 27}
    112108
    113 variant python25 description {Build Python 2.5 wrappers} conflicts python26 python27 {
    114     depends_build-append    port:python25
    115     configure.args-delete   \
    116         -DVTK_WRAP_PYTHON:BOOL=OFF
    117     configure.args-append   \
    118         -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/lib/libpython2.5.dylib \
    119         -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/python2.5 \
    120         -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/include/python2.5 \
    121         -DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/libpython2.5.dylib \
    122         -DVTK_WRAP_PYTHON:BOOL=ON \
    123         -DVTK_INSTALL_NO_PYTHON:BOOL=ON
    124     post-destroot {
    125         file mkdir ${destroot}${prefix}/lib/python2.5/site-packages
    126         system "cd ${worksrcpath}/Wrapping/Python && ${prefix}/bin/python2.5 setup.py install --prefix=${prefix} --root=${destroot}"
    127     }
     109set pythons_ports {}
     110foreach s ${pythons_suffixes} {
     111    lappend pythons_ports python${s}
    128112}
    129113
    130 variant python26 description {Build Python 2.6 wrappers} conflicts python25 python27 {
    131     depends_build-append    port:python26
    132     configure.args-delete   \
    133         -DVTK_WRAP_PYTHON:BOOL=OFF
    134     configure.args-append   \
    135         -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/lib/libpython2.6.dylib \
    136         -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/python2.6 \
    137         -DPYTHON_INCLUDE_PATH:FILEPATH=${frameworks_dir}/Python.framework/Versions/2.6/include/python2.6 \
    138         -DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/libpython2.6.dylib \
    139         -DVTK_WRAP_PYTHON:BOOL=ON \
    140         -DVTK_INSTALL_NO_PYTHON:BOOL=ON
    141     post-destroot {
    142         system "cd ${worksrcpath}/Wrapping/Python && ${prefix}/bin/python2.6 setup.py install --prefix=${frameworks_dir}/Python.framework/Versions/2.6/ --root=${destroot}"
    143     }
    144 }
     114foreach s ${pythons_suffixes} {
     115    set p python${s}
     116    set v [string index ${s} 0].[string index ${s} 1]
     117    set i [lsearch -exact ${pythons_ports} ${p}]
     118    set c [lreplace ${pythons_ports} ${i} ${i}]
     119    eval [subst {
     120        variant ${p} description "Build Python ${v} wrappers" conflicts ${c} {
    145121
    146 variant python27 description {Build Python 2.7 wrappers} conflicts python25 python26 {
    147     depends_build-append    port:python27
    148     configure.args-delete   \
    149         -DVTK_WRAP_PYTHON:BOOL=OFF
    150     configure.args-append   \
    151         -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/lib/libpython2.7.dylib \
    152         -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/python2.7 \
    153         -DPYTHON_INCLUDE_PATH:FILEPATH=${frameworks_dir}/Python.framework/Versions/2.7/include/python2.7 \
    154         -DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/libpython2.7.dylib \
    155         -DVTK_WRAP_PYTHON:BOOL=ON \
    156         -DVTK_INSTALL_NO_PYTHON:BOOL=ON
    157     post-destroot {
    158         system "cd ${worksrcpath}/Wrapping/Python && ${prefix}/bin/python2.7 setup.py install --prefix=${frameworks_dir}/Python.framework/Versions/2.7/ --root=${destroot}"
    159     }
     122            configure.args-delete   \
     123                -DVTK_WRAP_PYTHON:BOOL=OFF
     124            configure.args-append   \
     125                -DPYTHON_DEBUG_LIBRARY:FILEPATH=${frameworks_dir}/Python.framework/Versions/${v}/lib/libpython${v}.dylib \
     126                -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/python${v} \
     127                -DPYTHON_INCLUDE_PATH:FILEPATH=${frameworks_dir}/Python.framework/Versions/${v}/Headers \
     128                -DPYTHON_LIBRARY:FILEPATH=${frameworks_dir}/Python.framework/Versions/${v}/lib/libpython${v}.dylib \
     129                -DVTK_WRAP_PYTHON:BOOL=ON \
     130                -DVTK_INSTALL_NO_PYTHON:BOOL=ON
     131
     132            post-configure {
     133                system -W ${worksrcpath}/Wrapping/Python/CMakeFiles/vtkpython.dir "echo `cat link.txt` -L../../bin > link.txt"
     134                system -W ${worksrcpath}/Wrapping/Python/CMakeFiles/vtkPythonCore.dir "echo `cat link.txt` -L../../bin > link.txt"
     135            }
     136
     137            post-destroot {
     138                file mkdir ${destroot}${prefix}/lib/python${v}/site-packages
     139                system "cd ${worksrcpath}/Wrapping/Python && ${prefix}/bin/python${v} setup.py install --prefix=${frameworks_dir}/Python.framework/Versions/${v} --root=${destroot}"
     140            }
     141
     142        }
     143    }]
    160144}
    161145
    162146if {[variant_isset qt4_mac]} {