[51478] trunk/dports/graphics/InsightToolkit/Portfile

dweber at macports.org dweber at macports.org
Mon May 25 22:51:36 PDT 2009


Revision: 51478
          http://trac.macports.org/changeset/51478
Author:   dweber at macports.org
Date:     2009-05-25 22:51:35 -0700 (Mon, 25 May 2009)
Log Message:
-----------
many bug fixes for wrapping, works for python25 and itkwish is working

Modified Paths:
--------------
    trunk/dports/graphics/InsightToolkit/Portfile

Modified: trunk/dports/graphics/InsightToolkit/Portfile
===================================================================
--- trunk/dports/graphics/InsightToolkit/Portfile	2009-05-26 03:35:16 UTC (rev 51477)
+++ trunk/dports/graphics/InsightToolkit/Portfile	2009-05-26 05:51:35 UTC (rev 51478)
@@ -5,7 +5,7 @@
 
 name            InsightToolkit
 version         3.12.0
-revision        1
+revision        2
 set branch      [join [lrange [split ${version} .] 0 1] .]
 
 categories      graphics math science devel
@@ -39,7 +39,9 @@
 platforms       darwin
 
 depends_build   port:cmake \
-                port:gmake
+                port:gmake \
+                port:gawk \
+                port:bison
 
 depends_lib     port:xorg-libs \
                 port:ossp-uuid
@@ -48,21 +50,23 @@
 build.type      gnu
 build.dir       ${workpath}/${distname}-build
 
+use_parallel_build  yes
 
 # Global variables, used in variants, where a destroot prefix is appended, when necessary.
+set itkBuildBin     ${build.dir}/bin
+set itkIncPath      ${prefix}/include/${distname}
 set itkLibPath      ${prefix}/lib/${distname}
-set itkIncPath      ${prefix}/include/${distname}
 set itkSharePath    ${prefix}/share/${distname}
 set itkDocFile      DoxygenInsightToolkit-${version}.tar.gz
 set itkDocPath      ${itkSharePath}/doc
 set itkDataPath     ${itkSharePath}/data
 set itkExamplePath  ${itkSharePath}/examples
 set itkTestingPath  ${itkSharePath}/testing
-set itkBuildBin     ${build.dir}/bin
 set itkExampleBin   ${itkExamplePath}/bin
 set itkTestingBin   ${itkTestingPath}/bin
 set itkExampleSrc   ${worksrcpath}/Examples
 set itkTestingSrc   ${worksrcpath}/Testing
+set itkWrapLibPath  ${itkLibPath}/WrapITK/lib
 
 # Using this dummy stage to inspect MacPorts variables
 # (using 'port -d fetch InsightToolkit')
@@ -103,7 +107,6 @@
     -DUUID_INCLUDE_DIR:PATH=${prefix}/include/uuid \
     -DUUID_LIBRARY:FILEPATH=${prefix}/lib/libuuid.dylib
 
-#ITK_EXPLICIT_INSTANTIATION
 
 post-destroot {
     move ${destroot}${prefix}/lib/InsightToolkit     ${destroot}/${itkLibPath}
@@ -117,10 +120,7 @@
 
 default_variants \
     +doc \
-    +examples \
-    +shared \
-    +testing \
-    +wrap +py26
+    +py25
 
 variant doc description "provide doxygen documentation in ${itkDocPath}" {
     distfiles-append    ${itkDocFile}
@@ -130,8 +130,8 @@
                         rmd160 a20167892a6e91e6f530313c3c057e4d08999d62
     post-destroot {
         set itkDocPathLink ${prefix}/share/doc/${distname}
-        xinstall -d -o root -g admin -m 755 ${destroot}/${itkDocPath}
-        xinstall -d -o root -g admin -m 755 ${destroot}/${itkDocPathLink}
+        xinstall -d -o root -g admin -m 0755 ${destroot}/${itkDocPath}
+        xinstall -d -o root -g admin -m 0755 ${destroot}/${itkDocPathLink}
         # Add the doxygen documentation 
         system "tar --strip-components 1 -C ${destroot}/${itkDocPath} -zxf ${distpath}/${itkDocFile}"
         # Add basic documentation
@@ -205,7 +205,7 @@
     configure.args-append \
         -DITK_BRAINWEB_DATA_ROOT:PATH=${itkDataPath}
     post-destroot {
-        xinstall -d -o root -g admin -m 755 ${destroot}/${itkDataPath}
+        xinstall -d -o root -g admin -m 0755 ${destroot}/${itkDataPath}
         foreach tgz [exec find ${distpath} -name "BrainPart*.tgz"] {
             system "tar -C ${destroot}/${itkDataPath} -zxf ${tgz}"
         }
@@ -291,7 +291,7 @@
     configure.args-append \
         -DBUILD_EXAMPLES:BOOL=ON
     post-destroot {
-        xinstall -d -o root -g admin -m 755 ${destroot}/${itkExampleBin}
+        xinstall -d -o root -g admin -m 0755 ${destroot}/${itkExampleBin}
         foreach f [glob ${itkExampleSrc}/*] {
             file copy ${f} ${destroot}/${itkExamplePath}/
         }
@@ -317,6 +317,7 @@
                 file copy ${f} ${destroot}/${itkExampleBin}
             }
         }
+        # Only do this if the shared variant is selected?
         resetLibLinks ${destroot}/${itkExampleBin}
     }
 }
@@ -328,7 +329,7 @@
     configure.args-append \
         -DBUILD_TESTING:BOOL=ON
     post-destroot {
-        xinstall -d -o root -g admin -m 755 ${destroot}/${itkTestingBin}
+        xinstall -d -o root -g admin -m 0755 ${destroot}/${itkTestingBin}
         foreach f [glob ${itkTestingSrc}/*] {
             file copy ${f} ${destroot}/${itkTestingPath}/
         }
@@ -354,6 +355,7 @@
                 file copy ${f} ${destroot}/${itkTestingBin}
             }
         }
+        # Only do this if the shared variant is selected?
         resetLibLinks ${destroot}/${itkTestingBin}
     }
 }
@@ -366,12 +368,11 @@
 # All their rpath settings point to the build.dir, so they must be
 # reset using install_name_tool after the destroot phase.
 proc resetWrapLibs { filepattern } {
-    global itkBuildBin itkLibPath
-    set itkSwigLibPath ${itkLibPath}/WrapITK/lib
+    global itkBuildBin itkLibPath itkWrapLibPath 
     foreach f [glob ${filepattern}] {
         foreach dep [exec otool -L ${f}] {
             if [string match -nocase "*libSwigRuntime*" ${dep}] {
-                set newdep [strsed ${dep} #${itkBuildBin}#${itkSwigLibPath}#]
+                set newdep [strsed ${dep} #${itkBuildBin}#${itkWrapLibPath}#]
                 system "install_name_tool -change ${dep} ${newdep} ${f}"
             } elseif [string match -nocase "${itkBuildBin}*" ${dep}] {
                 set newdep [strsed ${dep} #${itkBuildBin}#${itkLibPath}#]
@@ -382,14 +383,19 @@
 }
 
 
-variant wrap requires shared description "USE_WRAP_ITK for external language support" {
+variant wrap requires shared description "USE_WRAP_ITK for external language support (includes shared)" {
     depends_lib-append \
         port:guile \
         port:tcl
+    # The WrapITK install path assumes a prefix of ${prefix}, but without this
+    # variable setting, it will default to "lib/${name}/WrapITK" without the
+    # version specific ${distname}
+    set itkWrapInstallPath /lib/${distname}/WrapITK
     configure.args-append \
         -DUSE_WRAP_ITK:BOOL=ON \
         -DITK_USE_REVIEW:BOOL=ON \
-        -DWRAP_ITK_INSTALL_PREFIX:PATH=${itkLibPath}/WrapITK \
+        -DWRAP_ITK_JAVA:BOOL=ON \
+        -DWRAP_ITK_TCL:BOOL=ON \
         -DCMAKE_CXX_FLAGS:STRING=-fpermissive \
         -DGUILE_EXECUTABLE:FILEPATH=${prefix}/bin/guile \
         -DGUILE_LIBRARY:FILEPATH=${prefix}/lib/libguile.dylib \
@@ -399,17 +405,30 @@
         -DTCL_LIBRARY:FILEPATH=${prefix}/lib/libtcl.dylib \
         -DTK_INCLUDE_PATH:PATH=${prefix}/include \
         -DTK_LIBRARY:FILEPATH=${prefix}/lib/libtk.dylib
+        # The following config option seems more trouble than useful:
+        #-DWRAP_ITK_INSTALL_PREFIX:PATH=${itkWrapInstallPath} \
+        # Could enable this if the example variant is selected:
         #-DSWIG_BUILD_EXAMPLES:BOOL=ON
     post-destroot {
-        # Fix the executable permissions on tclwish and move it to a
-        # distribution specific file name
-        file attributes ${destroot}/${prefix}/bin/itkwish -permissions 00755
-        move ${destroot}/${prefix}/bin/itkwish ${destroot}/${prefix}/bin/itkwish-${branch} 
+        # Fix executable permissions and move tclwish to version specific file
+        set itkwishSh ${destroot}/${prefix}/bin/itkwish-${branch}
+        move ${destroot}/${prefix}/bin/itkwish ${itkwishSh}
+        file attributes ${itkwishSh} -permissions 0755
         ln -s itkwish-${branch} ${destroot}/${prefix}/bin/itkwish
+        # Change the content of itkwish
+        reinplace "s|${name}|${distname}|g" ${itkwishSh}
+        reinplace "s|//|/|g" ${itkwishSh}
+        # Reset dynamic library dependency paths for itkwish binary
+        set itkwishBin ${destroot}/${itkLibPath}/WrapITK/bin/itkwish
+        foreach dep [exec otool -L ${itkwishBin}] {
+            if [string match "*Tcl.dylib" ${dep}] {
+                set newdep [strsed ${dep} #${itkLibPath}#${itkWrapLibPath}#]
+                system "install_name_tool -change ${dep} ${newdep} ${itkwishBin}"
+            }
+        }
         # Reset dynamic library dependency paths (see proc above)
-        #resetWrapLibs ${destroot}/${itkLibPath}/WrapITK/lib/*.dylib
-        #resetWrapLibs ${destroot}/${itkLibPath}/WrapITK/lib/*.jnilib
-        #resetWrapLibs ${destroot}/${itkLibPath}/WrapITK/lib/*.so
+        resetWrapLibs ${destroot}/${itkLibPath}/WrapITK/lib/*.dylib
+        resetWrapLibs ${destroot}/${itkLibPath}/WrapITK/lib/*.jnilib
     }
 }
 
@@ -488,9 +507,6 @@
 
 
 # -----------------------------------------------------------------------------
-# The following wrapper variants modify the wrap variant, to specify
-# specific versions of external languages, such as python25 or python26
-
 # The USE_WRAP_ITK will configure a default tcl and java wrapping.  Only enable
 # and modify the variants below to provide version specific language
 # wrappers.  Each of these variants should require the wrap variant.
@@ -503,6 +519,7 @@
     set pyPort      python${major}${minor}
     set pyFrame     Library/Frameworks/Python.framework/Versions/${pyVer}
     set pyLib       ${pyFrame}/Python
+    #set pyLib       lib/${python}
     set pyBin       bin/${python}
     set pyInc       include/${python}
     set pySite      lib/${python}/site-packages
@@ -518,71 +535,84 @@
 setPython
 
 
-variant py24 requires wrap conflicts py25 py26 description "python 2.4 wrapper" {
+variant py24 requires wrap conflicts py25 description "python 2.4 wrapper (includes wrap)" {
     setPython 2 4
+    # Hereafter py24 and py25 are the same, but how to abstract this?  Maybe
+    # a general pyXY variant that is required by py24 and py25, but not clear on
+    # how the require precedence works with regard to the setPython proc.
     depends_lib-append \
         port:${pyPort}
     configure.args-append \
+        -DWRAP_ITK_PYTHON:BOOL=ON \
         -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/${pyBin} \
         -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/${pyInc} \
         -DPYTHON_LIBRARY:FILEPATH=${prefix}/${pyLib} \
         -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/${pyLib} \
         -DPY_SITE_PACKAGES_PATH:PATH=${prefix}/${pySite}
     post-destroot {
-        #if [expr [string match "2.4" ${pyVer}] | [string match "2.5" ${pyVer}]] {
-        #    # Change the location of WrapITK.pth; This is only for
-        #    # python24 or python25 because they "pretend" to be a framework
-        #    # installation with a lot of symlinks that are not handled by the
-        #    # port file_map process.
-        #    xinstall -d -m 0755 ${destroot}/${prefix}/${pySite}
-        #    move ${destroot}/${prefix}/${pyFrame}/lib/${python}/site-packages/WrapITK.pth ${destroot}/${prefix}/${pySite}/
-        #}
         # Change the content of WrapITK.pth (for any python version)
         reinplace "s|${name}|${distname}|g" ${destroot}/${prefix}/${pySite}/WrapITK.pth
+        reinplace "s|//|/|g" ${destroot}/${prefix}/${pySite}/WrapITK.pth
+        # Change the content of FindWrapITK.cmake (for any python version)
+        set findWrapITK [glob ${destroot}/${prefix}/share/cmake-*/Modules/FindWrapITK.cmake]
+        reinplace "s|${name}|${distname}|g" ${findWrapITK}
+        reinplace "s|//|/|g" ${findWrapITK}
+        # Reset dynamic library dependency paths (see proc above)
+        resetWrapLibs ${destroot}/${itkLibPath}/WrapITK/lib/*.so
     }
 }
 
-variant py25 requires wrap conflicts py24 py26 description "python 2.5 wrapper" {
+variant py25 requires wrap conflicts py24 description "python 2.5 wrapper (includes wrap)" {
     setPython 2 5
     depends_lib-append \
         port:${pyPort}
     configure.args-append \
+        -DWRAP_ITK_PYTHON:BOOL=ON \
         -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/${pyBin} \
         -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/${pyInc} \
         -DPYTHON_LIBRARY:FILEPATH=${prefix}/${pyLib} \
         -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/${pyLib} \
         -DPY_SITE_PACKAGES_PATH:PATH=${prefix}/${pySite}
     post-destroot {
-        #if [expr [string match "2.4" ${pyVer}] | [string match "2.5" ${pyVer}]] {
-        #    # Change the location of WrapITK.pth; This is only for
-        #    # python24 or python25 because they "pretend" to be a framework
-        #    # installation with a lot of symlinks that are not handled by the
-        #    # port file_map process.
-        #    xinstall -d -m 0755 ${destroot}/${prefix}/${pySite}
-        #    move ${destroot}/${prefix}/${pyFrame}/lib/${python}/site-packages/WrapITK.pth ${destroot}/${prefix}/${pySite}/
-        #}
         # Change the content of WrapITK.pth (for any python version)
         reinplace "s|${name}|${distname}|g" ${destroot}/${prefix}/${pySite}/WrapITK.pth
+        reinplace "s|//|/|g" ${destroot}/${prefix}/${pySite}/WrapITK.pth
+        # Change the content of FindWrapITK.cmake (for any python version)
+        set findWrapITK [glob ${destroot}/${prefix}/share/cmake-*/Modules/FindWrapITK.cmake]
+        reinplace "s|${name}|${distname}|g" ${findWrapITK}
+        reinplace "s|//|/|g" ${findWrapITK}
+        # Reset dynamic library dependency paths (see proc above)
+        resetWrapLibs ${destroot}/${itkLibPath}/WrapITK/lib/*.so
     }
 }
 
-variant py26 requires wrap conflicts py24 py25 description "python 2.6 wrapper" {
-    setPython 2 6
-    depends_lib-append \
-        port:${pyPort}
-    configure.args-append \
-        -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/${pyBin} \
-        -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/${pyInc} \
-        -DPYTHON_LIBRARY:FILEPATH=${prefix}/${pyLib} \
-        -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/${pyLib} \
-        -DPY_SITE_PACKAGES_PATH:PATH=${prefix}/${pySite}
-    post-destroot {
-        # Change the content of WrapITK.pth (for any python version)
-        reinplace "s|${name}|${distname}|g" ${destroot}/${prefix}/${pySite}/WrapITK.pth
-    }
-}
 
+# Regardless of the pyLib setting for py26, cmake or the wrap config sets
+# the string "-framework Python", but this "-framework Python" setting actually
+# gets resolved by the link process into the Apple system /Framework path rather
+# than macports!  I'm not clear about how to control this, so the py26 variant
+# must be disabled for now.  If it's enabled, add the py26 variant to the
+# conflicts of py24 and py25.
+#variant py26 requires wrap conflicts py24 py25 description "python 2.6 wrapper (includes wrap)" {
+#    setPython 2 6
+#    depends_lib-append \
+#        port:${pyPort}
+#    configure.args-append \
+#        -DWRAP_ITK_PYTHON:BOOL=ON \
+#        -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/${pyBin} \
+#        -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/${pyInc} \
+#        -DPYTHON_LIBRARY:FILEPATH=${prefix}/${pyLib} \
+#        -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/${pyLib} \
+#        -DPY_SITE_PACKAGES_PATH:PATH=${prefix}/${pySite}
+#    post-destroot {
+#        # Change the content of WrapITK.pth (for any python version)
+#        reinplace "s|${name}|${distname}|g" ${destroot}/${prefix}/${pySite}/WrapITK.pth
+#        # Reset dynamic library dependency paths (see proc above)
+#        resetWrapLibs ${destroot}/${itkLibPath}/WrapITK/lib/*.so
+#    }
+#}
 
+
 #variant java requires wrap description "provide java wrapper" {
 #    configure.args-append \
 #        # The following variables are defined automatically by cmake:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090525/a758b36a/attachment-0001.html>


More information about the macports-changes mailing list