[51841] users/dweber/graphics/InsightToolkit312/Portfile

dweber at macports.org dweber at macports.org
Thu Jun 4 19:29:35 PDT 2009


Revision: 51841
          http://trac.macports.org/changeset/51841
Author:   dweber at macports.org
Date:     2009-06-04 19:29:35 -0700 (Thu, 04 Jun 2009)
Log Message:
-----------
Testing version specific modifications for InsightToolkit @3.12.0, now developed in this port called InsightToolkit312; contains notes about symlinks that might be replaced by a new port, InsightToolkitSelect, to be developed.

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

Modified: users/dweber/graphics/InsightToolkit312/Portfile
===================================================================
--- users/dweber/graphics/InsightToolkit312/Portfile	2009-06-05 02:27:12 UTC (rev 51840)
+++ users/dweber/graphics/InsightToolkit312/Portfile	2009-06-05 02:29:35 UTC (rev 51841)
@@ -3,9 +3,9 @@
 
 PortSystem      1.0
 
-name            InsightToolkit
+name            InsightToolkit312
 version         3.12.0
-revision        3
+revision        0
 set branch      [join [lrange [split ${version} .] 0 1] .]
 
 categories      graphics math science devel
@@ -118,7 +118,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 +139,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 +166,18 @@
                         rmd160 a20167892a6e91e6f530313c3c057e4d08999d62
     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 +241,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 +327,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 +350,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 +365,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 +388,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 +446,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 +571,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 +610,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 +626,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 +648,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/c18d0fc9/attachment.html>


More information about the macports-changes mailing list