[51636] trunk/dports/graphics/InsightToolkit/Portfile
dweber at macports.org
dweber at macports.org
Fri May 29 15:45:09 PDT 2009
Revision: 51636
http://trac.macports.org/changeset/51636
Author: dweber at macports.org
Date: 2009-05-29 15:45:08 -0700 (Fri, 29 May 2009)
Log Message:
-----------
ensure post-destroot and any other hacks do not depend on the port name, so the port can be renamed; created to serve as a global variable to identify the conventional library name for ITK; assume that cmake port will create FindITK.cmake with a generic MacPorts library path, then copy the file into FindITK-3.12.cmake and modify the paths so this port version will have precedence in the search path. Project files should use FIND_PACKAGE(ITK-3.12 REQUIRED) to link to this version specific port installation.
Modified Paths:
--------------
trunk/dports/graphics/InsightToolkit/Portfile
Modified: trunk/dports/graphics/InsightToolkit/Portfile
===================================================================
--- trunk/dports/graphics/InsightToolkit/Portfile 2009-05-29 22:32:58 UTC (rev 51635)
+++ trunk/dports/graphics/InsightToolkit/Portfile 2009-05-29 22:45:08 UTC (rev 51636)
@@ -5,7 +5,7 @@
name InsightToolkit
version 3.12.0
-revision 2
+revision 3
set branch [join [lrange [split ${version} .] 0 1] .]
categories graphics math science devel
@@ -50,9 +50,15 @@
build.type gnu
build.dir ${workpath}/${distname}-build
-use_parallel_build yes
+# The parallel build would be nice, but it's not reliable.
+#use_parallel_build yes
-# Global variables, used in variants, where a destroot prefix is appended, when necessary.
+# Global variables, used in variants, where a destroot prefix is appended,
+# when necessary. There are numerous default build assumptions in both cmake
+# and ITK that use the 'InsightToolkit' name, and many post-destroot hacks in
+# this port that assume this name also. If the port is renamed, say
+# InsightToolkit312, the post-destroot hacks must use ${itkName}.
+set itkName InsightToolkit
set itkBuildBin ${build.dir}/bin
set itkIncPath ${prefix}/include/${distname}
set itkLibPath ${prefix}/lib/${distname}
@@ -109,8 +115,29 @@
post-destroot {
- move ${destroot}${prefix}/lib/InsightToolkit ${destroot}/${itkLibPath}
- move ${destroot}${prefix}/include/InsightToolkit ${destroot}/${itkIncPath}
+ # 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
+ 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
+ # when cmake is updated, deactivated, etc.
+ set findITK [glob ${prefix}/share/cmake-*/Modules/FindITK.cmake]
+ set findITKbranch [strsed ${findITK} #FindITK#FindITK-${branch}#]
+ copy ${findITK} ${destroot}${findITKbranch}
+ # Change the content of $findITKbranch, to find this port installation,
+ # then a generic ITK installation within MacPorts ${prefix}/lib, and
+ # then other generic installation locations
+ set stdlib /usr/local/lib/InsightToolkit
+ set maclib ${prefix}/lib/InsightToolkit
+ # First replace any generic MacPorts lib paths
+ reinplace "\$!N;s|^.*${maclib}.*\\n||g" ${destroot}${findITKbranch}
+ # Now insert all the additional library paths, with the right precedence
+ reinplace "s|${stdlib}|${maclib}-${branch}\\\n ${maclib}\\\n ${stdlib}|g" ${destroot}${findITKbranch}
+ # 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
}
@@ -388,7 +415,7 @@
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
+ # variable setting, it will default to "lib/${itkName}/WrapITK" without the
# version specific ${distname}
set itkWrapInstallPath /lib/${distname}/WrapITK
configure.args-append \
@@ -416,7 +443,7 @@
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|${itkName}|${distname}|g" ${itkwishSh}
reinplace "s|//|/|g" ${itkwishSh}
# Reset dynamic library dependency paths for itkwish binary
set itkwishBin ${destroot}/${itkLibPath}/WrapITK/bin/itkwish
@@ -551,11 +578,11 @@
-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
+ 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|${name}|${distname}|g" ${findWrapITK}
+ reinplace "s|${itkName}|${distname}|g" ${findWrapITK}
reinplace "s|//|/|g" ${findWrapITK}
# Reset dynamic library dependency paths (see proc above)
resetWrapLibs ${destroot}/${itkLibPath}/WrapITK/lib/*.so
@@ -575,11 +602,11 @@
-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
+ 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|${name}|${distname}|g" ${findWrapITK}
+ reinplace "s|${itkName}|${distname}|g" ${findWrapITK}
reinplace "s|//|/|g" ${findWrapITK}
# Reset dynamic library dependency paths (see proc above)
resetWrapLibs ${destroot}/${itkLibPath}/WrapITK/lib/*.so
@@ -606,7 +633,7 @@
# -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
+# reinplace "s|${itkName}|${distname}|g" ${destroot}/${prefix}/${pySite}/WrapITK.pth
# # Reset dynamic library dependency paths (see proc above)
# resetWrapLibs ${destroot}/${itkLibPath}/WrapITK/lib/*.so
# }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090529/c64167f3/attachment-0001.html>
More information about the macports-changes
mailing list