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

dweber at macports.org dweber at macports.org
Fri May 22 17:40:22 PDT 2009


Revision: 51322
          http://trac.macports.org/changeset/51322
Author:   dweber at macports.org
Date:     2009-05-22 17:40:21 -0700 (Fri, 22 May 2009)
Log Message:
-----------
Revision 1; adding tweaks for the examples and testing variants; the wrapping seems to work now - at least for python

Revision Links:
--------------
    http://trac.macports.org/changeset/1

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

Modified: trunk/dports/graphics/InsightToolkit/Portfile
===================================================================
--- trunk/dports/graphics/InsightToolkit/Portfile	2009-05-23 00:39:58 UTC (rev 51321)
+++ trunk/dports/graphics/InsightToolkit/Portfile	2009-05-23 00:40:21 UTC (rev 51322)
@@ -5,8 +5,8 @@
 
 name            InsightToolkit
 version         3.12.0
-revision        0
-set branch	    [join [lrange [split ${version} .] 0 1] .]
+revision        1
+set branch      [join [lrange [split ${version} .] 0 1] .]
 
 categories      graphics math science devel
 
@@ -15,7 +15,7 @@
 description     Insight Segmentation and Registration Toolkit (ITK)
 
 long_description \
-ITK  is an open-source software toolkit for performing registration and segmentation. Segmentation is the process of identifying and classifying data found in a digitally sampled representation. Typically the sampled representation is an image acquired from such medical instrumentation as CT or MRI scanners. Registration is the task of aligning or developing correspondences between data. For example, in the medical environment, a CT scan may be aligned with an MRI scan in order to combine the information contained in both.
+ITK is an open-source software toolkit for performing registration and segmentation. Segmentation is the process of identifying and classifying data found in a digitally sampled representation. Typically the sampled representation is an image acquired from such medical instrumentation as CT or MRI scanners. Registration is the task of aligning or developing correspondences between data. For example, in the medical environment, a CT scan may be aligned with a MRI scan in order to combine the information contained in both.
 
 homepage        http://www.itk.org/
 master_sites    sourceforge:itk
@@ -33,9 +33,13 @@
                     sha1 04ab4f03a8e08267b9e78aafea055ef2a5058798 \
                     rmd160 5758c7ee205a53a205a8a72a721aafeff7c8b194
 
+extract.only    InsightToolkit-${version}.tar.gz \
+                CableSwig-ITK-${version}.tar.gz
+
 platforms       darwin
 
-depends_build   port:cmake
+depends_build   port:cmake \
+                port:gmake
 
 depends_lib     port:xorg-libs \
                 port:ossp-uuid
@@ -44,16 +48,33 @@
 build.type      gnu
 build.dir       ${workpath}/${distname}-build
 
-# Using this dummy stage to inspect MacPorts variables (using 'port -d fetch InsightToolkit')
-#fetch { system "echo ${distfiles} && echo ${checksums}" }
 
+# Global variables, used in variants, where a destroot prefix is appended, when necessary.
+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
+
+# Using this dummy stage to inspect MacPorts variables
+# (using 'port -d fetch InsightToolkit')
+#fetch { system "echo ${itkLibPath}" }
+
 post-extract {
-    move ${workpath}/InsightToolkit-${version} ${workpath}/${distname}
-    move ${workpath}/CableSwig-ITK-${version}  ${workpath}/${distname}/Utilities/CableSwig
+    move ${workpath}/InsightToolkit-${version} ${worksrcpath}
+    move ${workpath}/CableSwig-ITK-${version}  ${worksrcpath}/Utilities/CableSwig
 }
 
 configure {
-    xinstall -d -o root -g admin -m 0755 ${build.dir}
+    xinstall -d -m 0755 ${build.dir}
     system "cd ${build.dir} && cmake ${configure.args} ${worksrcpath}"
 }
 
@@ -78,12 +99,15 @@
     -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${distname} \
     -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
     -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-    -DITK_COMPUTER_MEMORY_SIZE:STRING=${gigabits} 
+    -DITK_COMPUTER_MEMORY_SIZE:STRING=${gigabits} \
+    -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}${prefix}/lib/${distname} 
-    move ${destroot}${prefix}/include/InsightToolkit ${destroot}${prefix}/include/${distname} 
+    move ${destroot}${prefix}/lib/InsightToolkit     ${destroot}/${itkLibPath}
+    move ${destroot}${prefix}/include/InsightToolkit ${destroot}/${itkIncPath}
 }
 
 
@@ -93,40 +117,31 @@
 
 default_variants \
     +doc \
-    +shared
+    +examples \
+    +shared \
+    +testing \
+    +wrap +py26
 
-# Global variables
-#
-# See doc variant for details
-set itkDocFile  DoxygenInsightToolkit-${version}.tar.gz
-set itkDocPath  ${prefix}/share/${distname}/doc
-# See data variants for details 
-set itkDataPath ${prefix}/share/${distname}/data
-
-
-variant doc description {provide doxygen documentation [default: ${prefix}/share/${distname}/doc]} {
-    global itkDocFile
+variant doc description "provide doxygen documentation in ${itkDocPath}" {
     distfiles-append    ${itkDocFile}
     checksums-append    ${itkDocFile} \
                         md5  99dcad9f8e7a3d0acb9da62efdf5fd13 \
                         sha1 e6800094f493e6ef2b1484ce2da578a19a978c40 \
                         rmd160 a20167892a6e91e6f530313c3c057e4d08999d62
     post-destroot {
-        global itkDocFile
-        set itkDocPathMain ${prefix}/share/${distname}/doc
         set itkDocPathLink ${prefix}/share/doc/${distname}
-        xinstall -d -o root -g admin -m 0755 ${destroot}/${itkDocPathMain}
-        xinstall -d -o root -g admin -m 0755 ${destroot}/${itkDocPathLink}
+        xinstall -d -o root -g admin -m 755 ${destroot}/${itkDocPath}
+        xinstall -d -o root -g admin -m 755 ${destroot}/${itkDocPathLink}
         # Add the doxygen documentation 
-        system "tar --strip-components 1 -C ${destroot}/${itkDocPathMain} -zxf ${distpath}/${itkDocFile}"
+        system "tar --strip-components 1 -C ${destroot}/${itkDocPath} -zxf ${distpath}/${itkDocFile}"
         # Add basic documentation
-        file copy ${worksrcpath}/Copyright     ${destroot}/${itkDocPathMain}/
-        file copy ${worksrcpath}/Copyright.txt ${destroot}/${itkDocPathMain}/
-        file copy ${worksrcpath}/README.html   ${destroot}/${itkDocPathMain}/
+        file copy ${worksrcpath}/Copyright     ${destroot}/${itkDocPath}/
+        file copy ${worksrcpath}/Copyright.txt ${destroot}/${itkDocPath}/
+        file copy ${worksrcpath}/README.html   ${destroot}/${itkDocPath}/
         # Create a symlink to the $prefix path (not the destroot path); use the
         # system to do this because the $prefix path doesn't exist yet and the
         # tcl ln command fails, whereas this system command will allow it.
-        system "ln -Fhs ${itkDocPathMain} ${destroot}/${itkDocPathLink}"
+        system "ln -Fns ${itkDocPath} ${destroot}/${itkDocPathLink}"
     }
 }
 
@@ -137,10 +152,9 @@
 
 ##// Directory with data taken from http://public.kitware.com/pub/itk/Data/BrainWeb/
 ##ITK_BRAINWEB_DATA_ROOT:PATH=ITK_BRAINWEB_DATA_ROOT-NOTFOUND
-variant brainweb description {provide ITK BrainWeb data: ${prefix}/share/${distname}/data]} {
+variant brainweb description "provide ITK BrainWeb data in ${itkDataPath}" {
     master_sites-append \
         http://public.kitware.com/pub/itk/Data/BrainWeb:brainweb
-    eval extract.only ${distfiles}
     distfiles-append \
         BrainPart1.tgz:brainweb \
         BrainPart1Rotated10Translated15.tgz:brainweb \
@@ -188,12 +202,10 @@
             md5  db63c7567d1c021860d59812eb41dfa9 \
             sha1 2e14b66beef00acc8cd17942d9bf0c155841a934 \
             rmd160 42d403505116e8b9885d00964376cee909711bd0
-    global itkDataPath
     configure.args-append \
         -DITK_BRAINWEB_DATA_ROOT:PATH=${itkDataPath}
     post-destroot {
-        global itkDataPath
-        xinstall -d -o root -g admin -m 0755 ${destroot}/${itkDataPath}
+        xinstall -d -o root -g admin -m 755 ${destroot}/${itkDataPath}
         foreach tgz [exec find ${distpath} -name "BrainPart*.tgz"] {
             system "tar -C ${destroot}/${itkDataPath} -zxf ${tgz}"
         }
@@ -217,45 +229,6 @@
 #http://pubimage.hcuge.ch:8080/
 
 
-variant examples description {provide ITK examples [default: ${prefix}/share/${distname}/examples]} {
-    configure.args-delete \
-        -DBUILD_EXAMPLES:BOOL=OFF
-    configure.args-append \
-        -DBUILD_EXAMPLES:BOOL=ON
-    #post-destroot {
-    #    set itkExamplePath ${prefix}/share/${distname}/examples
-    #    xinstall -d -o root -g admin -m 0755 ${destroot}/${itkExamplePath}/bin
-    #    foreach f [glob ${worksrcpath}/Examples/*] {
-    #        file copy ${f} ${destroot}/${itkExamplePath}/
-    #    }
-    #    # Installations for the example binaries are in ${build.dir}/bin/.
-    #    set buildBinPath ${build.dir}/bin
-    #    foreach f [glob ${buildBinPath}/*] {
-    #        if {![string match {*.dylib} ${f}]} {
-    #          file copy ${f} ${destroot}/${itkExamplePath}/bin/
-    #        }
-    #    }
-    #    # All the rpath settings for these binaries point to the build.dir, so
-    #    # they are reset using install_name_tool.
-    #    set itkLibPath ${prefix}/lib/${distname}
-    #    foreach f [glob ${destroot}/${itkExamplePath}/bin/*] {
-    #        if [string equal [file extension ${f}] ".app"] {
-    #            set exeName [file rootname [lindex [file split ${f}] end]]
-    #            set f [format "%s/Contents/MacOS/%s" ${f} ${exeName}]
-    #        }
-    #        if [expr [file isfile ${f}] && [file executable ${f}]] {
-    #            foreach dep [exec otool -L ${f}] {
-    #                if [string match "*/libitk*.dylib" ${dep}] {
-    #                    set newdep [strsed ${dep} #${buildBinPath}#${itkLibPath}#]
-    #                    system "install_name_tool -change ${dep} ${newdep} ${f}"
-    #                }
-    #            }
-    #        }
-    #    }
-    #}
-}
-
-
 # Notes on RPATH settings for the shared dylib build and install:
 #
 # CMake book, Appendix A, p 234: "CMAKE_SKIP_BUILD_RPATH: Do not include RPATHs
@@ -277,78 +250,343 @@
 # CMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF.  After the build, at the destroot
 # phase, all the installation candidates (which excludes the examples and
 # testing binaries) have their rpath settings reset to the INSTALL_RPATH (which
-# should point to $prefix..., not the $destroot location).  VTK_USE_RPATH
-# is required to ensure that rpath is set for all the installed executables and
-# dylibs.
+# should point to $prefix..., not the $destroot location).
 
-variant shared description {build shared libraries [default]} {
+variant shared description "build shared libraries (default)" {
     configure.args-delete \
         -DBUILD_SHARED_LIBS:BOOL=OFF
     configure.args-append \
         -DBUILD_SHARED_LIBS:BOOL=ON \
         -DCMAKE_SKIP_RPATH:BOOL=OFF \
         -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF \
-        -DCMAKE_INSTALL_RPATH:STRING=${prefix}/lib/${distname}
+        -DCMAKE_INSTALL_RPATH:STRING=${itkLibPath}
 }
 
 
-variant testing description {provide ITK testing [default: ${prefix}/share/${distname}/testing]} {
+proc resetLibLinks { inputPath } {
+    # The example and testing binaries are built, but they are not "installed".
+    # All their rpath settings point to the build.dir, so they must be
+    # reset using install_name_tool for the destroot install.
+    global itkBuildBin itkLibPath
+    foreach f [glob ${inputPath}/*] {
+        if [string equal [file extension ${f}] ".app"] {
+            set exeName [file rootname [lindex [file split ${f}] end]]
+            set f [format "%s/Contents/MacOS/%s" ${f} ${exeName}]
+        }
+        if [expr [file isfile ${f}] && [file executable ${f}]] {
+            foreach dep [exec otool -L ${f}] {
+                if [string match -nocase "*/libitk*.dylib" ${dep}] {
+                    set newdep [strsed ${dep} #${itkBuildBin}#${itkLibPath}#]
+                    system "install_name_tool -change ${dep} ${newdep} ${f}"
+                }
+            }
+        }
+    }
+}
+
+
+variant examples description "provide ITK examples in ${itkExamplePath}" {
     configure.args-delete \
+        -DBUILD_EXAMPLES:BOOL=OFF
+    configure.args-append \
+        -DBUILD_EXAMPLES:BOOL=ON
+    post-destroot {
+        xinstall -d -o root -g admin -m 755 ${destroot}/${itkExampleBin}
+        foreach f [glob ${itkExampleSrc}/*] {
+            file copy ${f} ${destroot}/${itkExamplePath}/
+        }
+        # Find all the example executables by parsing all the
+        # CMakeLists.txt files within the src Examples path
+        set exe {}
+        foreach f [exec find ${itkExampleSrc} -name "CMakeLists.txt"] {
+            catch {exec grep -e "ADD_EXECUTABLE" ${f}} results
+            if [expr ![string match "*child process*" ${results}]] {
+                # Remove the string "ADD_EXECUTABLE(", with or without whitespace
+                regsub -all "\[ \t\]*ADD_EXECUTABLE\[(\]\[ \t\]*" ${results} "" results
+                # Remove the string ".cxx)", with or without whitespace
+                regsub -all ".cxx\[ \t\]*\[)\]" ${results} "" results
+                set exe [concat ${exe} ${results}]
+            }
+        }
+        set exe [lsort -unique ${exe}]
+        # Installations for the example binaries are in ${itkBuildBin}.
+        # Copy them into the destroot example bin.
+        foreach f $exe {
+            set f ${itkBuildBin}/${f}
+            if [expr [file isfile ${f}] && [file executable ${f}]] {
+                file copy ${f} ${destroot}/${itkExampleBin}
+            }
+        }
+        resetLibLinks ${destroot}/${itkExampleBin}
+    }
+}
+
+
+variant testing description "provide ITK testing in ${itkTestingPath}" {
+    configure.args-delete \
         -DBUILD_TESTING:BOOL=OFF
     configure.args-append \
         -DBUILD_TESTING:BOOL=ON
-    #post-destroot {
-    #    set itkExamplePath ${prefix}/share/${distname}/examples
-    #    xinstall -d -o root -g admin -m 0755 ${destroot}/${itkExamplePath}/bin
-    #    foreach f [glob ${worksrcpath}/Examples/*] {
-    #        file copy ${f} ${destroot}/${itkExamplePath}/
-    #    }
-    #    # Installations for the example binaries are in ${build.dir}/bin/.
-    #    set buildBinPath ${build.dir}/bin
-    #    foreach f [glob ${buildBinPath}/*] {
-    #        if {![string match {*.dylib} ${f}]} {
-    #          file copy ${f} ${destroot}/${itkExamplePath}/bin/
-    #        }
-    #    }
-    #    # All the rpath settings for these binaries point to the build.dir, so
-    #    # they are reset using install_name_tool.
-    #    set itkLibPath ${prefix}/lib/${distname}
-    #    foreach f [glob ${destroot}/${itkExamplePath}/bin/*] {
-    #        if [string equal [file extension ${f}] ".app"] {
-    #            set exeName [file rootname [lindex [file split ${f}] end]]
-    #            set f [format "%s/Contents/MacOS/%s" ${f} ${exeName}]
-    #        }
-    #        if [expr [file isfile ${f}] && [file executable ${f}]] {
-    #            foreach dep [exec otool -L ${f}] {
-    #                if [string match "*/libitk*.dylib" ${dep}] {
-    #                    set newdep [strsed ${dep} #${buildBinPath}#${itkLibPath}#]
-    #                    system "install_name_tool -change ${dep} ${newdep} ${f}"
-    #                }
-    #            }
-    #        }
-    #    }
-    #}
+    post-destroot {
+        xinstall -d -o root -g admin -m 755 ${destroot}/${itkTestingBin}
+        foreach f [glob ${itkTestingSrc}/*] {
+            file copy ${f} ${destroot}/${itkTestingPath}/
+        }
+        # Find all the testing executables by parsing all the
+        # CMakeLists.txt files within the itkTestingSrc path
+        set exe {}
+        foreach f [exec find ${itkTestingSrc} -name "CMakeLists.txt"] {
+            catch {exec grep -e "ADD_EXECUTABLE" ${f}} results
+            if [expr ![string match "*child process*" ${results}]] {
+                # Remove the string "ADD_EXECUTABLE(", with or without whitespace
+                regsub -all "\[ \t\]*ADD_EXECUTABLE\[(\]\[ \t\]*" ${results} "" results
+                # Remove the string ".cxx)", with or without whitespace
+                regsub -all ".cxx\[ \t\]*\[)\]" ${results} "" results
+                set exe [concat ${exe} ${results}]
+            }
+        }
+        set exe [lsort -unique ${exe}]
+        # Installations for the testing binaries are in ${itkBuildBin}.
+        # Copy them into the destroot testing bin.
+        foreach f $exe {
+            set f ${itkBuildBin}/${f}
+            if [expr [file isfile ${f}] && [file executable ${f}]] {
+                file copy ${f} ${destroot}/${itkTestingBin}
+            }
+        }
+        resetLibLinks ${destroot}/${itkTestingBin}
+    }
 }
 
+
 # --- external languages support
-#
-#variant wrap requires shared {
-#    depends_lib-append \
-#        port:guile
+
+
+# Some of the wrapper libs are built, but they are not "installed".
+# 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
+    foreach f [glob ${filepattern}] {
+        foreach dep [exec otool -L ${f}] {
+            if [string match -nocase "*libSwigRuntime*" ${dep}] {
+                set newdep [strsed ${dep} #${itkBuildBin}#${itkSwigLibPath}#]
+                system "install_name_tool -change ${dep} ${newdep} ${f}"
+            } elseif [string match -nocase "${itkBuildBin}*" ${dep}] {
+                set newdep [strsed ${dep} #${itkBuildBin}#${itkLibPath}#]
+                system "install_name_tool -change ${dep} ${newdep} ${f}"
+            }
+        }
+    }
+}
+
+
+variant wrap requires shared description "USE_WRAP_ITK for external language support" {
+    depends_lib-append \
+        port:guile \
+        port:tcl
+    configure.args-append \
+        -DUSE_WRAP_ITK:BOOL=ON \
+        -DITK_USE_REVIEW:BOOL=ON \
+        -DWRAP_ITK_INSTALL_PREFIX:PATH=${itkLibPath}/WrapITK \
+        -DCMAKE_CXX_FLAGS:STRING=-fpermissive \
+        -DGUILE_EXECUTABLE:FILEPATH=${prefix}/bin/guile \
+        -DGUILE_LIBRARY:FILEPATH=${prefix}/lib/libguile.dylib \
+        -DGUILE_INCLUDE_PATH:PATH=${prefix}/include/guile \
+        -DTCL_TCLSH:FILEPATH=${prefix}/bin/tclsh \
+        -DTCL_INCLUDE_PATH:PATH=${prefix}/include \
+        -DTCL_LIBRARY:FILEPATH=${prefix}/lib/libtcl.dylib \
+        -DTK_INCLUDE_PATH:PATH=${prefix}/include \
+        -DTK_LIBRARY:FILEPATH=${prefix}/lib/libtk.dylib
+        #-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} 
+        ln -s itkwish-${branch} ${destroot}/${prefix}/bin/itkwish
+        # 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
+    }
+}
+
+# The following were possiblilities identified by ccmake
+
+#-DPERL_EXECUTABLE                 /opt/local/bin/perl
+#-DPERL_INCLUDE_PATH               PERL_INCLUDE_PATH-NOTFOUND
+#-DPERL_LIBRARY                    PERL_LIBRARY-NOTFOUND
+
+#-DPHP4_EXECUTABLE                 /opt/local/bin/php
+#-DPHP4_FOUND_INCLUDE_PATH         PHP4_FOUND_INCLUDE_PATH-NOTFOUND
+
+#-DPIKE_EXECUTABLE                 PIKE_EXECUTABLE-NOTFOUND
+#-DPIKE_INCLUDE_PATH               PIKE_INCLUDE_PATH-NOTFOUND
+
+#-DRUBY_EXECUTABLE                 RUBY_EXECUTABLE-NOTFOUND
+#-DRUBY_INCLUDE_PATH               /System/Library/Frameworks/Ruby.framework/Headers
+#-DRUBY_LIBRARY                    RUBY_LIBRARY-NOTFOUND
+
+# Note for Ruby include path:
+# exec ruby -r rbconfig -e {puts Config::CONFIG["archdir"]}
+
+# Some default WrapITK settings:
+
+ #WRAP_BinaryMorphology            ON
+ #WRAP_Calculators                 ON
+ #WRAP_Compose                     ON
+ #WRAP_DeformableTransforms        ON
+ #WRAP_Denoising                   ON
+ #WRAP_DistanceMap                 ON
+ #WRAP_EdgesAndContours            ON
+ #WRAP_FFT                         ON
+ #WRAP_FFTW                        OFF
+ #WRAP_Filtering                   ON
+ #WRAP_IO                          ON
+ #WRAP_ITK_DIMS                    2;3
+ #WRAP_ITK_INSTALL_PREFIX          /lib/InsightToolkit/WrapITK
+ #WRAP_ITK_JAVA                    ON
+ #WRAP_ITK_PYTHON                  ON
+ #WRAP_ITK_TCL                     ON
+ #WRAP_IntensityFilters            ON
+ #WRAP_Interpolators               ON
+ #WRAP_Iterators                   OFF
+ #WRAP_LevelSet                    ON
+ #WRAP_Morphology                  ON
+ #WRAP_PixelMath                   ON
+ #WRAP_Registration                ON
+ #WRAP_Resize                      ON
+ #WRAP_Review                      ON
+ #WRAP_SegmentationAndThreshold    ON
+ #WRAP_SegmentationValidation      ON
+ #WRAP_SimpleFilters               ON
+ #WRAP_UnaryPixelMath              ON
+ #WRAP_complex_double              OFF
+ #WRAP_complex_float               ON
+ #WRAP_covariant_vector_double     OFF
+ #WRAP_covariant_vector_float      ON
+ #WRAP_double                      OFF
+ #WRAP_float                       ON
+ #WRAP_rgb_unsigned_char           OFF
+ #WRAP_rgb_unsigned_short          ON
+ #WRAP_rgba_unsigned_char          OFF
+ #WRAP_rgba_unsigned_short         ON
+ #WRAP_signed_char                 OFF
+ #WRAP_signed_long                 OFF
+ #WRAP_signed_short                OFF
+ #WRAP_unsigned_char               OFF
+ #WRAP_unsigned_long               OFF
+ #WRAP_unsigned_short              ON
+ #WRAP_vector_double               OFF
+ #WRAP_vector_float                ON
+
+
+
+
+
+
+# -----------------------------------------------------------------------------
+# 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.
+
+
+proc setPython { {major 2} {minor 6} } {
+    global pyVer python pyPort pyBin pyLib pyInc pyFrame pySite
+    set pyVer       ${major}.${minor}
+    set python      python${pyVer}
+    set pyPort      python${major}${minor}
+    set pyFrame     Library/Frameworks/Python.framework/Versions/${pyVer}
+    set pyLib       ${pyFrame}/Python
+    set pyBin       bin/${python}
+    set pyInc       include/${python}
+    set pySite      lib/${python}/site-packages
+    if [string match "2.6" ${pyVer}] {
+        # python2.6 is a true framework installation; whereas installs for 2.4
+        # and 2.5 contain symlinks in the framework path to the prefix path; and
+        # those symlinks can break the file_map stage of port activation.
+        set pyBin   ${pyFrame}/bin/${python}
+        set pyInc   ${pyFrame}/include/${python}
+        set pySite  ${pyFrame}/lib/${python}/site-packages
+    }
+}
+setPython
+
+
+variant py24 requires wrap conflicts py25 py26 description "python 2.4 wrapper" {
+    setPython 2 4
+    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 {
+        #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
+    }
+}
+
+variant py25 requires wrap conflicts py24 py26 description "python 2.5 wrapper" {
+    setPython 2 5
+    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 {
+        #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
+    }
+}
+
+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
+    }
+}
+
+
+#variant java requires wrap description "provide java wrapper" {
 #    configure.args-append \
-#        -DUSE_WRAP_ITK:BOOL=ON \
-#        -DITK_USE_REVIEW:BOOL=ON \
-#        -DGUILE_EXECUTABLE:FILEPATH=${prefix}/bin/guile \
-#        -DGUILE_LIBRARY:FILEPATH=${prefix}/lib/libguile.dylib \
-#        -DGUILE_INCLUDE_PATH:PATH=${prefix}/include/guile \
-#        -DSWIG_BUILD_EXAMPLES:BOOL=ON
-#}
-#
-#
-#variant java requires wrap {
-#    configure.args-append \
-#        -DITK_CSWIG_JAVA:BOOL=ON
 #        # The following variables are defined automatically by cmake:
+#        #-DJAVACOMMAND                     /usr/bin/java
 #        #-DJAVA_ARCHIVE                    /usr/bin/jar
 #        #-DJAVA_AWT_INCLUDE_PATH           /System/Library/Frameworks/JavaVM.framework/Headers
 #        #-DJAVA_AWT_LIBRARY                -framework
@@ -358,27 +596,10 @@
 #        #-DJAVA_JVM_LIBRARY                -framework
 #        #-DJAVA_RUNTIME                    /usr/bin/java
 #}
-#
-#variant py26 requires wrap description {python 2.6 wrapper} {
-#    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}
+
+
+#variant tcl requires wrap description "tcl wrapper (MacPorts tcl/tk)" {
 #    depends_lib-append \
-#        port:${pyport}
-#    configure.args-append \
-#        -DITK_CSWIG_PYTHON:BOOL=ON \
-#        -DPYTHON_DEBUG_LIBRARY:FILEPATH=-framework \
-#        -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/${python} \
-#        -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/Library/Frameworks/Python.framework/Headers \
-#        -DPYTHON_LIBRARY:FILEPATH=-framework
-#        #-DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/lib${python}.dylib \
-#        #-DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/lib/lib${python}.dylib \
-#        #-DVTK_PYTHON_SETUP_ARGS:STRING='--prefix=${pyframe} --root=${destroot}'
-#}
-#
-#variant tcl requires wrap description {tcl wrapper (MacPorts tcl/tk)} {
-#    depends_lib-append \
 #        port:tcl \
 #        port:tk
 #    configure.args-append \
@@ -388,34 +609,15 @@
 #        -DTK_INCLUDE_PATH:PATH=${prefix}/include \
 #        -DTK_LIBRARY:FILEPATH=${prefix}/lib/libtk.dylib
 #}
-        #-DITK_CSWIG_TCL:BOOL=ON \
 
 
-# The following were possibilities identified by ccmake
 
-#-DPERL_EXECUTABLE                 /opt/local/bin/perl
-#-DPERL_INCLUDE_PATH               PERL_INCLUDE_PATH-NOTFOUND
-#-DPERL_LIBRARY                    PERL_LIBRARY-NOTFOUND
 
-#-DPHP4_EXECUTABLE                 /opt/local/bin/php
-#-DPHP4_FOUND_INCLUDE_PATH         PHP4_FOUND_INCLUDE_PATH-NOTFOUND
+# -----------------------------------------------------------------------------
+# Additional possibilities for variants, not yet evaluated.
 
-#-DPIKE_EXECUTABLE                 PIKE_EXECUTABLE-NOTFOUND
-#-DPIKE_INCLUDE_PATH               PIKE_INCLUDE_PATH-NOTFOUND
-
-#-DRUBY_EXECUTABLE                 RUBY_EXECUTABLE-NOTFOUND
-#-DRUBY_INCLUDE_PATH               /System/Library/Frameworks/Ruby.framework/Headers
-#-DRUBY_LIBRARY                    RUBY_LIBRARY-NOTFOUND
-
-
-
-
-
-
-
 #ITK_USE_LIBXML2
 #ITK_USE_MINC2
-#
 
 #VNL_CONFIG_*
 
@@ -430,24 +632,20 @@
 
 #// Use an outside build of GDCM.
 #ITK_USE_SYSTEM_GDCM:BOOL=OFF
-#
 #// Use the system's libxml2 library.
 #ITK_USE_SYSTEM_LIBXML2:BOOL=OFF
-#
 #// Use the system's png library.
 #ITK_USE_SYSTEM_PNG:BOOL=OFF
-#
 #// Use the system's tiff library.
 #ITK_USE_SYSTEM_TIFF:BOOL=OFF
-#
 #// Use an outside build of VXL.
 #ITK_USE_SYSTEM_VXL:BOOL=OFF
-#
 #// Use the system's zlib library.
 #ITK_USE_SYSTEM_ZLIB:BOOL=OFF
 
 
 
+# -----------------------------------------------------------------------------
 #livecheck.check     sourceforge
 #livecheck.regex     <title>itk InsightToolkit-(.*) released.*</title>
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090522/f32cc8d3/attachment-0001.html>


More information about the macports-changes mailing list