[50870] trunk/dports/graphics/vtk-devel/Portfile

Darren Weber dweber at macports.org
Tue May 12 12:39:14 PDT 2009


On Tue, May 12, 2009 at 12:04 AM, Ryan Schmidt <ryandesign at macports.org>wrote:

> On May 11, 2009, at 20:59, dweber at macports.org wrote:
>
>  Revision: 50870
>>          http://trac.macports.org/changeset/50870
>> Author:   dweber at macports.org
>> Date:     2009-05-11 18:59:13 -0700 (Mon, 11 May 2009)
>> Log Message:
>> -----------
>> bug-fix for py26 library path; currently working on database support
>>
>> Modified Paths:
>> --------------
>>    trunk/dports/graphics/vtk-devel/Portfile
>>
>> Modified: trunk/dports/graphics/vtk-devel/Portfile
>> ===================================================================
>> --- trunk/dports/graphics/vtk-devel/Portfile    2009-05-12 01:57:43 UTC
>> (rev 50869)
>> +++ trunk/dports/graphics/vtk-devel/Portfile    2009-05-12 01:59:13 UTC
>> (rev 50870)
>> @@ -38,7 +38,7 @@
>>  build.type      gnu
>>  build.dir       ${workpath}/${distname}-build
>>
>> -# Using this dummy stage to inspect MacPorts variables (using 'port -d
>> fetch vtk-devel')
>> +# Using this dummy stage to inspect macport variables (using 'port -d
>> fetch vtk-devel')
>>  #fetch { system "echo ${distfiles} && echo ${checksums}" }
>>
>>  post-extract {
>> @@ -344,11 +344,11 @@
>>
>>  # --- Language wrappers: java, python, tcl
>>  #
>> -# VTK has its own language parser, it doesn't depend on swig or cableswig
>> (as
>> +# VTK has it's own language parser, it doesn't depend on swig or
>> cableswig (as
>>  # of May 2009).  Since the VTK CVS repository and source distributions
>> include
>>  # the output of byacc and flex, there is no need for a dependency on
>> these
>>  # to build VTK.  If that were to change at some point, use byacc and not
>> bison,
>> -# i.e.: depends_build-append port:byacc port:flex
>> +# ie: depends_build-append port:byacc port:flex
>>
>>
>>  variant java description {java wrapper} {
>> @@ -358,7 +358,7 @@
>>         -DVTK_WRAP_JAVA:BOOL=ON
>>     #
>>     # All of the following were detected automatically by cmake.  They use
>> the
>> -    # system java framework.  To replace them with a MacPorts java, reset
>> +    # system java framework.  To replace them with a macports java, reset
>>     # these variables and add the required dependencies.
>>     #
>>     #JAVA_ARCHIVE:FILEPATH=/usr/bin/jar
>> @@ -376,7 +376,7 @@
>>  # that may require separate ports because the build and install process
>> for vtk
>>  # can only work with one at a time.  The build is a lengthy process and
>> there
>>  # may be no easy way to short-circuit it with a dependency on a prior
>> binary
>> -# install of vtk.  If there are separate ports of vtk for different
>> versions of
>> +# install of vtk.  If there are seperate ports of vtk for different
>> versions of
>>  # python, each port will incur a lengthy build process.  Moreover, it's
>> not
>>  # clear that the install process can be specifically selected for python
>> only,
>>  # without also installing all of vtk.  For that reason, it may be best to
>> avoid
>>
>
> The above part of your commit undid the changes I made in r50785 and
> r50786. I redid them in r50880. Please be careful to look at the diff before
> you commit and make sure every change listed is in fact one you intend to
> make with that commit.
>
>
>  @@ -387,6 +387,16 @@
>>  # py25 variant could disappear.  Likewise py26 could disappear if vtk
>> works in
>>  # python 3.x
>>
>> +# Note: currently vtkpython depends on libutil and finds it in:
>> +# // Utility library needed for vtkpython
>> +# PYTHON_UTIL_LIBRARY:FILEPATH=/usr/lib/libutil.dylib
>> +# I don't see a macport for libutil.  If one arises, it should become a
>> +# dependency for any python variant.
>> +#
>> +#// Extra libraries to link when linking to python (such as "z" for
>> zlib).  Separate multiple libraries with semicolons.
>> +#PYTHON_EXTRA_LIBS:STRING=
>> +#
>> +
>>  variant py25 conflicts py26 requires shared description {python 2.5
>> wrapper} {
>>     set pyver        2.5
>>     set python       python${pyver}
>> @@ -444,7 +454,7 @@
>>     configure.args-append \
>>         -DVTK_WRAP_PYTHON:BOOL=ON \
>>         -DVTK_NO_PYTHON_THREADS:BOOL=OFF \
>> -
>>  -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/Library/Frameworks/Python.framework/Headers
>> \
>> +
>>  -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/Library/Frameworks/Python.framework/Versions/${pyver}/Headers
>> \
>>         -DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/lib${python}.dylib \
>>         -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/lib/lib${python}.dylib \
>>         -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/${python} \
>> @@ -518,35 +528,67 @@
>>
>>  # --- Database variants
>>
>> -#
>> -#variant mysql description {build the MySQL driver for vtkSQLDatabase} {
>> -#    depends_lib-append \
>> -#        port:mysql5
>> -#    configure.args-append \
>> -#        -DVTK_USE_MYSQL:BOOL=ON
>> -#        #MYSQL_INCLUDE_DIRECTORIES
>> -#        #MYSQL_LIBRARY
>> -#}
>> -#
>> -#
>> -#variant pgsql description {build the PostgreSQL driver for
>> vtkSQLDatabase} {
>> -#    depends_lib-append \
>> -#        port:libpqxx
>> -#    configure.args-append \
>> -#        -DVTK_USE_POSTGRES:BOOL=ON
>> -#        #POSTGRES_INCLUDE_DIRECTORIES
>> -#        #POSTGRES_LIBRARIES
>> -#}
>> -#
>> -#
>> -#variant odbc description {build the ODBC database interface} {
>> -#    depends_lib-append \
>> -#        port:unixODBC
>> -#    configure.args-append \
>> -#        -DVTK_USE_ODBC:BOOL=ON
>> -#}
>>
>> +variant mysql5 description {build the MySQL driver for vtkSQLDatabase} {
>> +    # Find the directory containing mysql.h
>> +    set includePath [exec ${prefix}/bin/mysql_config5 --include]
>> +    set includePath [exec ${prefix}/bin/mysql_config5 --include]
>> +    set includePath [string trim ${includePath} -I ]
>> +    #if [ exec find $includePath -name "mysql.h" ]
>> +    set libs [exec ${prefix}/bin/mysql_config5 --libs]
>> +    set libIdx [lsearch -regex $libs "${prefix}/lib/mysql"]
>> +    set libPath [lindex $libs $libIdx]
>> +    set libPath [string trim ${libPath} -L ]
>> +    set libFile [exec find ${libPath} -name "libmysqlclient.dylib"]
>>
>
> Note that you shouldn't call mysql_config5 here, because mysql5 might not
> yet be installed. If it is not, an error will occur, because variants are
> evaluated before dependencies are computed.
>
>
> $ sudo port deactivate mysql5
> Password:
> --->  Deactivating mysql5
> $ port install vtk-devel +mysql5
> Error: Error executing mysql5: couldn't execute "/mp/bin/mysql_config5": no
> such file or directory
> Error: Unable to open port: Error evaluating variants
> $
>
>
> To fix this, all the above and the configure.args-append below can be moved
> into a pre-configure block in this variant. I made this change in r50884.
>
>
>  +    depends_build-append \
>> +        path:bin/mysql_config5:mysql5
>> +    depends_lib-append \
>> +        port:mysql5 \
>> +        port:zlib
>>
>
> Adding something to depends_lib is the same as adding it to depends_build
> and depends_run. Therefore there's no need to add mysql5 to depends_build
> since it's already in depends_lib. The preferred dependency style to use is
> the path: one, not the port: one, so that mysql5-devel could also satisfy
> the dependency. I fixed this in r50881.
>
>
>  +    configure.args-append \
>> +        -DVTK_USE_MYSQL:BOOL=ON \
>> +        -DMYSQL_INCLUDE_DIRECTORIES:PATH=${includePath} \
>> +        -DMYSQL_LIBRARY:FILEPATH=${libFile} \
>> +        -DMYSQL_EXTRA_LIBRARIES:FILEPATH=${prefix}/lib/libz.dylib
>> +        # A URL for a MySQL server of the form
>> +        # mysql://[[username[:password]@]hostname[:port]]/[dbname]
>> +        #VTK_MYSQL_TEST_URL:STRING=
>> +}
>>
>> +
>> +variant pgsql83 description {build the PostgreSQL 8.3 driver for
>> vtkSQLDatabase} {
>> +    set pgconf [exec ${prefix}/lib/postgresql83/bin/pg_config ]
>> +    set includeIdx [lsearch -regex ${pgconf} "^INCLUDEDIR"]
>> +    set includePath [lindex ${pgconf} [expr ${includeIdx} + 2]]
>> +    set libIdx [lsearch -regex $pgconf "^LIBDIR"]
>> +    set libPath [lindex $pgconf [expr $libIdx + 2]]
>> +    set libFile [exec find ${libPath} -name "libpq.dylib"]
>> +    depends_build-append \
>> +        path:lib/postgresql83/bin/pg_config:postgresql83
>> +    depends_lib-append \
>> +        port:postgresql83
>> +    configure.args-append \
>> +        -DVTK_USE_POSTGRES:BOOL=ON \
>> +        -DPOSTGRES_INCLUDE_DIRECTORIES:PATH=${includePath} \
>> +        -DPOSTGRES_LIBRARIES:FILEPATH=${libFile}
>> +        #// A URL for a PostgreSQL server of the form
>> +        #// psql://[[username[:password]@]hostname[:port]]/[dbname]
>> +        #VTK_PSQL_TEST_URL:STRING=
>> +}
>>
>
> The same comments as for the mysql5 variant apply to the pgsql83 variant
> and were also fixed by r50884 and r50881.
>
>
>  +
>> +
>> +variant odbc description {build the ODBC database interface} {
>> +    depends_lib-append \
>> +        port:unixODBC
>> +    configure.args-append \
>> +        -DVTK_USE_ODBC:BOOL=ON \
>> +        -DODBC_INCLUDE_DIRECTORIES:PATH=/opt/local/include \
>> +        -DODBC_LIBRARY:FILEPATH=/opt/local/lib/libodbc.dylib
>> +        #// A data source name (DSN) for an ODBC database connection to
>> use for testing.
>> +        #-DVTK_ODBC_TEST_DSN:STRING=
>> +}
>>
>
> /opt/local should not be hardcoded. I changed this to ${prefix} in r50883.
>
>
>
>

Great, thanks for the careful review Ryan!

I was wondering about the tcl exec code and whether that would work.  Maybe
it's overkill and all those paths should be coded directly for a version
specific install of mysqlX or postgresqlXY.  I was dreaming that by using
the tcl exec, with maybe a prior find within $prefix, that I could get a
version independent config for mysql and postgresql from their respective
config utilities.  There may be still a way to do that, as you point out,
using the pre-config.  The issue still remains of how to specify dependency
on version-independent mysql or postgresql - maybe it's just a dream.

Sorry about the loss of your prior changes.  I assume you did all the
updating (some of it again), so now it's all up-to-date in svn?  I'll run an
svn update and get on board with your changes.  My development practice is
to copy the svn trunk version into a local repo and work on that.  Once it's
at a point that can be checked in again, I've copied it back into the svn
checkout (overwriting the svn Portfile) and then do the svn commit.  I did
run a colordiff to check changes between my local repo and the svn update,
but I didn't notice any significant conflicts.  I'll take more time to check
it carefully.  I know this is clunky, maybe I will work directly on the svn
trunk.

Best, Darren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20090512/5f010913/attachment-0001.html>


More information about the macports-dev mailing list