[51840] users/dweber/graphics/InsightToolkit/Portfile

dweber at macports.org dweber at macports.org
Thu Jun 4 19:27:12 PDT 2009


Revision: 51840
          http://trac.macports.org/changeset/51840
Author:   dweber at macports.org
Date:     2009-06-04 19:27:12 -0700 (Thu, 04 Jun 2009)
Log Message:
-----------
"This update works, can be merged into dports trunk; notes about symlinks that can be modified by a new port, InsightToolkitSelect, to be defined."

Modified Paths:
--------------
    users/dweber/graphics/InsightToolkit/Portfile

Modified: users/dweber/graphics/InsightToolkit/Portfile
===================================================================
--- users/dweber/graphics/InsightToolkit/Portfile	2009-06-04 23:53:38 UTC (rev 51839)
+++ users/dweber/graphics/InsightToolkit/Portfile	2009-06-05 02:27:12 UTC (rev 51840)
@@ -8,6 +8,10 @@
 revision        0
 set branch      [join [lrange [split ${version} .] 0 1] .]
 
+# Online documentation on the 3.14 release:
+# http://www.kitware.com/news/home/browse/ITK?2009_05_28&ITK+3.14+Released
+# http://www.itk.org/Wiki/ITK_Release_3.14
+
 categories      graphics math science devel
 
 maintainers     dweber openmaintainer
@@ -118,7 +122,8 @@
     # For some reason, cmake does not install into the CMAKE_INSTALL_NAME_DIR
     move ${destroot}${prefix}/lib/${itkName}       ${destroot}${itkLibPath}
     move ${destroot}${prefix}/include/${itkName}   ${destroot}${itkIncPath}
-    # Create a symlink from the generic lib and include for InsightToolkit to this version
+    # Create a symlink from the generic lib and include for InsightToolkit to
+    # this version; this should be done by InsightToolkitSelect
     ln -sf ${distname} ${destroot}${prefix}/lib/${itkName}
     ln -sf ${distname} ${destroot}${prefix}/include/${itkName}
     # copy FindITK.cmake to a version specific file, which might persist even
@@ -138,6 +143,14 @@
     # Change the content of ITKConfig.cmake
     reinplace "s|${itkName}|${distname}|g" ${destroot}${itkLibPath}/ITKConfig.cmake
     copy ${destroot}${itkLibPath}/ITKConfig.cmake ${destroot}${itkLibPath}/itk-${branch}-config.cmake
+    # Move binaries to version specific binaries
+    foreach f [list ImageCompare  ImageCompareCommand  ImageCopy  itkTestDriver] {
+        if [file isfile ${destroot}${prefix}/bin/$f] {
+            move ${destroot}${prefix}/bin/$f ${destroot}${prefix}/bin/${f}-${branch}
+            # This should be done by InsightToolkitSelect
+            ln -sf ${f}-${branch} ${destroot}${prefix}/bin/$f
+        }
+    }
 }
 
 
@@ -157,18 +170,18 @@
                         ripemd160 9b91ff286a6dfd0f9674219641adde1eb3f3a19a
     post-destroot {
         set itkDocPathLink ${prefix}/share/doc/${distname}
-        xinstall -d -o root -g admin -m 0755 ${destroot}/${itkDocPath}
-        xinstall -d -o root -g admin -m 0755 ${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}"
+        system "tar --strip-components 1 -C ${destroot}${itkDocPath} -zxf ${distpath}/${itkDocFile}"
         # Add basic documentation
-        file copy ${worksrcpath}/Copyright     ${destroot}/${itkDocPath}/
-        file copy ${worksrcpath}/Copyright.txt ${destroot}/${itkDocPath}/
-        file copy ${worksrcpath}/README.html   ${destroot}/${itkDocPath}/
+        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 -Fns ${itkDocPath} ${destroot}/${itkDocPathLink}"
+        system "ln -Fns ${itkDocPath} ${destroot}${itkDocPathLink}"
     }
 }
 
@@ -232,9 +245,9 @@
     configure.args-append \
         -DITK_BRAINWEB_DATA_ROOT:PATH=${itkDataPath}
     post-destroot {
-        xinstall -d -o root -g admin -m 0755 ${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}"
+            system "tar -C ${destroot}${itkDataPath} -zxf ${tgz}"
         }
     }
 }
@@ -318,9 +331,9 @@
     configure.args-append \
         -DBUILD_EXAMPLES:BOOL=ON
     post-destroot {
-        xinstall -d -o root -g admin -m 0755 ${destroot}/${itkExampleBin}
+        xinstall -d -o root -g admin -m 0755 ${destroot}${itkExampleBin}
         foreach f [glob ${itkExampleSrc}/*] {
-            file copy ${f} ${destroot}/${itkExamplePath}/
+            file copy ${f} ${destroot}${itkExamplePath}/
         }
         # Find all the example executables by parsing all the
         # CMakeLists.txt files within the src Examples path
@@ -341,11 +354,11 @@
         foreach f $exe {
             set f ${itkBuildBin}/${f}
             if [expr [file isfile ${f}] && [file executable ${f}]] {
-                file copy ${f} ${destroot}/${itkExampleBin}
+                file copy ${f} ${destroot}${itkExampleBin}
             }
         }
         # Only do this if the shared variant is selected?
-        resetLibLinks ${destroot}/${itkExampleBin}
+        resetLibLinks ${destroot}${itkExampleBin}
     }
 }
 
@@ -356,9 +369,9 @@
     configure.args-append \
         -DBUILD_TESTING:BOOL=ON
     post-destroot {
-        xinstall -d -o root -g admin -m 0755 ${destroot}/${itkTestingBin}
+        xinstall -d -o root -g admin -m 0755 ${destroot}${itkTestingBin}
         foreach f [glob ${itkTestingSrc}/*] {
-            file copy ${f} ${destroot}/${itkTestingPath}/
+            file copy ${f} ${destroot}${itkTestingPath}/
         }
         # Find all the testing executables by parsing all the
         # CMakeLists.txt files within the itkTestingSrc path
@@ -379,11 +392,11 @@
         foreach f $exe {
             set f ${itkBuildBin}/${f}
             if [expr [file isfile ${f}] && [file executable ${f}]] {
-                file copy ${f} ${destroot}/${itkTestingBin}
+                file copy ${f} ${destroot}${itkTestingBin}
             }
         }
         # Only do this if the shared variant is selected?
-        resetLibLinks ${destroot}/${itkTestingBin}
+        resetLibLinks ${destroot}${itkTestingBin}
     }
 }
 
@@ -437,25 +450,26 @@
         # Could enable this if the example variant is selected:
         #-DSWIG_BUILD_EXAMPLES:BOOL=ON
     post-destroot {
-        # Fix executable permissions and move tclwish to version specific file
-        set itkwishSh ${destroot}/${prefix}/bin/itkwish-${branch}
-        move ${destroot}/${prefix}/bin/itkwish ${itkwishSh}
+        # Reset dynamic library dependency paths (see proc above)
+        resetWrapLibs ${destroot}${itkLibPath}/WrapITK/lib/*.dylib
+        resetWrapLibs ${destroot}${itkLibPath}/WrapITK/lib/*.jnilib
+        # Fix executable permissions and move itkwish 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
+        # This should be done by InsightToolkitSelect
+        ln -s itkwish-${branch} ${destroot}${prefix}/bin/itkwish
         # Change the content of itkwish
         reinplace "s|${itkName}|${distname}|g" ${itkwishSh}
         reinplace "s|//|/|g" ${itkwishSh}
         # Reset dynamic library dependency paths for itkwish binary
-        set itkwishBin ${destroot}/${itkLibPath}/WrapITK/bin/itkwish
+        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
     }
 }
 
@@ -561,6 +575,29 @@
 }
 setPython
 
+proc pyPostDestroot {} {
+    # This procedure applies for py25 and py25 (maybe py26)
+    global  destroot prefix branch \
+            itkLibPath itkName distname pySite
+    # Reset dynamic library dependency paths (see proc above)
+    resetWrapLibs ${destroot}${itkLibPath}/WrapITK/lib/*.so
+    # Move WrapITK.pth to version specific file
+    set wrapITKpth ${destroot}${prefix}/${pySite}/WrapITK-${branch}.pth
+    move ${destroot}${prefix}/${pySite}/WrapITK.pth ${wrapITKpth}
+    # This symlink should be done with InsightToolkitSelect
+    ln -s WrapITK-${branch}.pth ${destroot}${prefix}/${pySite}/WrapITK.pth
+    # Change the content of WrapITK.pth (for any python version)
+    reinplace "s|${itkName}|${distname}|g" ${wrapITKpth}
+    reinplace "s|//|/|g" ${wrapITKpth}
+    # Change the content of FindWrapITK.cmake (for any python version)
+    set findWrapITK [glob ${destroot}${prefix}/share/cmake-*/Modules/FindWrapITK.cmake]
+    regsub FindWrapITK.cmake ${findWrapITK} FindWrapITK-${branch}.cmake findWrapITK-branch
+    move ${findWrapITK} ${findWrapITK-branch}
+    reinplace "s|${itkName}|${distname}|g" ${findWrapITK-branch}
+    reinplace "s|//|/|g" ${findWrapITK-branch}
+    # This symlink should be done with InsightToolkitSelect
+    ln -s FindWrapITK-${branch}.cmake ${findWrapITK}
+}
 
 variant py24 requires wrap conflicts py25 description "python 2.4 wrapper (includes wrap)" {
     setPython 2 4
@@ -577,15 +614,7 @@
         -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|${itkName}|${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|${itkName}|${distname}|g" ${findWrapITK}
-        reinplace "s|//|/|g" ${findWrapITK}
-        # Reset dynamic library dependency paths (see proc above)
-        resetWrapLibs ${destroot}/${itkLibPath}/WrapITK/lib/*.so
+        pyPostDestroot
     }
 }
 
@@ -601,19 +630,10 @@
         -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|${itkName}|${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|${itkName}|${distname}|g" ${findWrapITK}
-        reinplace "s|//|/|g" ${findWrapITK}
-        # Reset dynamic library dependency paths (see proc above)
-        resetWrapLibs ${destroot}/${itkLibPath}/WrapITK/lib/*.so
+        pyPostDestroot
     }
 }
 
-
 # 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
@@ -632,10 +652,7 @@
 #        -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|${itkName}|${distname}|g" ${destroot}/${prefix}/${pySite}/WrapITK.pth
-#        # Reset dynamic library dependency paths (see proc above)
-#        resetWrapLibs ${destroot}/${itkLibPath}/WrapITK/lib/*.so
+#        pyPostDestroot
 #    }
 #}
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090604/babfc2fd/attachment-0001.html>


More information about the macports-changes mailing list