source: trunk/dports/graphics/InsightToolkit/Portfile

Last change on this file was 123696, checked in by mf2k@…, 3 years ago

cableswig gdb HexFiend HexFiend-framework InsightToolkit InsightToolkit312 InsightToolkit314 libpqxx libpqxx26 py25-pydb py26-pydb vtk-devel: Ports abandoned by dweber. (#43834)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mergeinfo set to (toggle deleted branches)
    /users/dweber/graphics/InsightToolkit/Portfile58681-58861
File size: 31.8 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 123696 2014-08-12 21:43:57Z ryandesign@macports.org $
3
4PortSystem      1.0
5
6name            InsightToolkit
7version         3.16.0
8revision        3
9set branch      [join [lrange [split ${version} .] 0 1] .]
10
11# Online documentation on the 3.16 release:
12# http://www.kitware.com/news/home/browse/CMake?2009_09_16&ITK+3.16+Released
13# http://www.itk.org/Wiki/ITK_Release_3.16
14
15categories      graphics math science devel
16
17maintainers     nomaintainer
18
19description     Insight Segmentation and Registration Toolkit (ITK)
20
21long_description \
22ITK 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.
23
24homepage        http://www.itk.org/
25master_sites    sourceforge:itk
26
27distname        InsightToolkit-${branch}
28distfiles       InsightToolkit-${version}.tar.gz \
29                CableSwig-ITK-${version}.tar.gz
30
31# Also update checksums for the documentation in the doc variant.
32checksums       InsightToolkit-${version}.tar.gz \
33                    md5 e532b419530645bd88da0efb1815d8f7 \
34                    sha1 4131f12471366d0e5f3a6d13155c419be5fceba8 \
35                    rmd160 eeb63df6bdb86aa82943375dbcfcf4da0bdac7a3 \
36                CableSwig-ITK-${version}.tar.gz \
37                    md5 02161e59567bff4eaa7305c022bec230 \
38                    sha1 be596fcff68c65ec45979166e56b2627e765988f \
39                    rmd160 abf686dd34b6d9445340037f54ad9e27f82ffa76
40
41extract.only    InsightToolkit-${version}.tar.gz \
42                CableSwig-ITK-${version}.tar.gz
43
44patchfiles      oom.patch
45
46platforms       darwin
47
48depends_build   port:gmake \
49                port:gawk \
50                port:cmake \
51                port:bison
52
53depends_lib     port:ossp-uuid
54
55# Use gmake and build in a separate directory from the source
56build.type      gnu
57build.dir       ${workpath}/${distname}-build
58
59# The parallel build would be nice, but it's not reliable.
60use_parallel_build  no
61
62# Global variables, used in variants, where a destroot prefix is appended,
63# when necessary.  There are numerous default build assumptions in both cmake
64# and ITK that use the 'InsightToolkit' name, and many post-destroot hacks in
65# this port that assume this name also.  If the port is renamed, say
66# InsightToolkit312, the post-destroot hacks must use ${itkName}.
67set itkName         InsightToolkit
68set itkBuildBin     ${build.dir}/bin
69set itkIncPath      ${prefix}/include/${distname}
70set itkLibPath      ${prefix}/lib/${distname}
71set itkSharePath    ${prefix}/share/${distname}
72set itkDocFile      DoxygenInsightToolkit-${version}.tar.gz
73set itkDocPath      ${itkSharePath}/doc
74set itkDataPath     ${itkSharePath}/data
75set itkExamplePath  ${itkSharePath}/examples
76set itkTestingPath  ${itkSharePath}/testing
77set itkExampleBin   ${itkExamplePath}/bin
78set itkTestingBin   ${itkTestingPath}/bin
79set itkExampleSrc   ${worksrcpath}/Examples
80set itkTestingSrc   ${worksrcpath}/Testing
81set itkWrapLibPath  ${itkLibPath}/WrapITK/lib
82
83# Using this dummy stage to inspect MacPorts variables
84# (using 'port -d fetch InsightToolkit')
85#fetch { system "echo ${itkLibPath}" }
86
87post-extract {
88    move ${workpath}/InsightToolkit-${version} ${worksrcpath}
89    move ${workpath}/CableSwig-ITK-${version}  ${worksrcpath}/Utilities/CableSwig
90    ui_msg "***************************************************"
91    ui_msg "InsightToolkit is a very long config/build process."
92    ui_msg "It can take several hours, even on a fast system."
93    ui_msg "Parallel builds are disabled, on purpose.  It can"
94    ui_msg "fail sometimes.  First try to run the build several"
95    ui_msg "times to see if it will complete.  A fall-back "
96    ui_msg "install is just the c++ libs (no tcl/java/py wrapping),"
97    ui_msg "port install InsightToolkit -doc -python25 +shared"
98    ui_msg "***************************************************"
99}
100
101configure {
102    xinstall -d -m 0755 ${build.dir}
103    system "cd ${build.dir} && cmake ${configure.args} ${worksrcpath}"
104}
105
106# To double-check all the cmake variable settings after the configure
107#cd ${build.dir}
108#sudo cmake -LAH ../itk-${branch} > ~/cmake_vars.txt
109# Similarly, for an interactive configuration with ccmake, try:
110#cd ${build.dir}
111#sudo ccmake ../itk-${branch}
112
113# Get the size of RAM in Gigabits
114set gigabits ""
115catch {set gigabits [expr [sysctl hw.memsize] / pow(1024,3)]}
116
117configure.args-append \
118    -DBUILD_DOXYGEN:BOOL=OFF \
119    -DBUILD_EXAMPLES:BOOL=OFF \
120    -DBUILD_TESTING:BOOL=OFF \
121    -DBUILD_SHARED_LIBS:BOOL=OFF \
122    -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
123    -DCMAKE_INCLUDE_PATH:PATH=${prefix}/include \
124    -DCMAKE_LIBRARY_PATH:PATH=${prefix}/lib \
125    -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${distname} \
126    -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
127    -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
128    -DITK_COMPUTER_MEMORY_SIZE:STRING=${gigabits} \
129    -DITK_USE_REVIEW:BOOL=ON \
130    -DITK_USE_OPTIMIZED_REGISTRATION_METHODS:BOOL=ON \
131    -DUUID_INCLUDE_DIR:PATH=${prefix}/include/uuid \
132    -DUUID_LIBRARY:FILEPATH=${prefix}/lib/libuuid.dylib
133
134
135post-destroot {
136    # For some reason, cmake does not install into the CMAKE_INSTALL_NAME_DIR
137    move ${destroot}${prefix}/lib/${itkName}       ${destroot}${itkLibPath}
138    move ${destroot}${prefix}/include/${itkName}   ${destroot}${itkIncPath}
139    # Create a symlink from the generic lib, include, and share for InsightToolkit to
140    # this version; this should be done by InsightToolkitSelect
141    ln -sf ${distname} ${destroot}${prefix}/lib/${itkName}
142    ln -sf ${distname} ${destroot}${prefix}/include/${itkName}
143    ln -sf ${distname} ${destroot}${prefix}/share/${itkName}
144    # copy FindITK.cmake to a version specific file, which might persist even
145    # when cmake is updated, deactivated, etc.
146    set cmakePath [lrange [lsort [glob ${prefix}/share/cmake-*]] end end]
147    set findITK [glob ${cmakePath}/Modules/FindITK.cmake]
148    set findITKbranch [strsed ${findITK} #FindITK#FindITK-${branch}#]
149    xinstall -d -m 0755 ${destroot}${cmakePath}/Modules
150    copy ${findITK} ${destroot}${findITKbranch}
151    # Change the content of $findITKbranch, to find  this port installation,
152    # then a generic ITK installation within MacPorts ${prefix}/lib, and
153    # then other generic installation locations
154    set stdlib /usr/local/lib/InsightToolkit
155    set maclib ${prefix}/lib/InsightToolkit
156    # First replace any generic MacPorts lib paths
157    reinplace "\$!N;s|^.*${maclib}.*\\n||g" ${destroot}${findITKbranch}
158    # Now insert all the additional library paths, with the right precedence
159    reinplace "s|${stdlib}|${maclib}-${branch}\\\n    ${maclib}\\\n    ${stdlib}|g" ${destroot}${findITKbranch}
160    # Change the content of ITKConfig.cmake
161    reinplace "s|${itkName}|${distname}|g" ${destroot}${itkLibPath}/ITKConfig.cmake
162    copy ${destroot}${itkLibPath}/ITKConfig.cmake ${destroot}${itkLibPath}/itk-${branch}-config.cmake
163    # Move binaries to version specific binaries
164    foreach f [list ImageCompare  ImageCompareCommand  ImageCopy  itkTestDriver] {
165        if [file isfile ${destroot}${prefix}/bin/$f] {
166            move ${destroot}${prefix}/bin/$f ${destroot}${prefix}/bin/${f}-${branch}
167            # This should be done by InsightToolkitSelect
168            ln -sf ${f}-${branch} ${destroot}${prefix}/bin/$f
169        }
170    }
171}
172
173
174# -----------------------------------------------------------------------------
175# VARIANTS
176# variant name [requires variant] [conflicts variant] [description description]
177
178default_variants \
179    +doc
180
181# Test the python26 variant ASAP.
182#if {![variant_isset python24] && ![variant_isset python25] && ![variant_isset python26]} {
183if {![variant_isset python24] && ![variant_isset python25]} {
184        default_variants-append    +python25
185}
186
187# universal variant is failing, so let's disable it
188universal_variant no
189
190variant doc description "provide doxygen documentation in ${itkDocPath}" {
191    distfiles-append    ${itkDocFile}
192    checksums-append    ${itkDocFile} \
193                        md5 d36591eeeb66d083b2e89aabec48e34a \
194                        sha1 5175b3ed01d1875979d6f66d0b1d02f39e3f4b34 \
195                        rmd160 3eaa6d0fae62b6ecf92be0cf61c8c86f9162623e
196    post-destroot {
197        set itkDocPathLink ${prefix}/share/doc/${distname}
198        xinstall -d -o root -g admin -m 0755 ${destroot}${itkDocPath}
199        xinstall -d -o root -g admin -m 0755 ${destroot}${itkDocPathLink}
200        # Add the doxygen documentation
201        system "tar --strip-components 1 -C ${destroot}${itkDocPath} -zxf ${distpath}/${itkDocFile}"
202        # Add basic documentation
203        file copy ${worksrcpath}/Copyright     ${destroot}${itkDocPath}/
204        file copy ${worksrcpath}/Copyright.txt ${destroot}${itkDocPath}/
205        file copy ${worksrcpath}/README.html   ${destroot}${itkDocPath}/
206        # Create a symlink to the $prefix path (not the destroot path); use the
207        # system to do this because the $prefix path doesn't exist yet and the
208        # tcl ln command fails, whereas this system command will allow it.
209        system "ln -Fns ${itkDocPath} ${destroot}${itkDocPathLink}"
210    }
211}
212
213# --- Data variants
214
215# Change this to the itkDataPath and use post-destroot to relocate all this data
216#-DITK_DATA_ROOT:PATH=${worksrcpath}/Testing/Data
217
218##// Directory with data taken from http://public.kitware.com/pub/itk/Data/BrainWeb/
219##ITK_BRAINWEB_DATA_ROOT:PATH=ITK_BRAINWEB_DATA_ROOT-NOTFOUND
220variant brainweb description "provide ITK BrainWeb data in ${itkDataPath}" {
221    master_sites-append \
222        http://public.kitware.com/pub/itk/Data/BrainWeb:brainweb
223    distfiles-append \
224        BrainPart1.tgz:brainweb \
225        BrainPart1Rotated10Translated15.tgz:brainweb \
226        BrainPart1Rotated20Translated20.tgz:brainweb \
227        BrainPart2.tgz:brainweb \
228        BrainPart2Rotated10Translated15.tgz:brainweb \
229        BrainPart2Rotated20Translated20.tgz:brainweb \
230        BrainPart3.tgz:brainweb \
231        BrainPart3Rotated10Translated15.tgz:brainweb \
232        BrainPart3Rotated20Translated20.tgz:brainweb
233    checksums-append \
234        BrainPart1.tgz \
235            md5  e722d697f9d0b51023652b3fe7348658 \
236            sha1 e91f5c4928c880b944e1559eee015170c1badc4b \
237            rmd160 b5cbb557df0b019afe3f411deea72ef464626ace \
238        BrainPart1Rotated10Translated15.tgz \
239            md5  9d052710929477b1ddb5095575a5d7f9 \
240            sha1 effc10374f1e70ded967fb55237cd600b6ef51ca \
241            rmd160 3e1f19dbe48b7912f46f255459330fde50f96b62 \
242        BrainPart1Rotated20Translated20.tgz \
243            md5  36af81caf9ea7ce9b72987ff6d08ddf3 \
244            sha1 4c10b5ab612282361f344d1432664067bc94c736 \
245            rmd160 d6d23117fbf8803b0488b4fd5bddb739576d983f \
246        BrainPart2.tgz \
247            md5  458b0903a2fb52a1cae616eddf817142 \
248            sha1 21659b5ee37a9ed0958c79a1943dd5ebafbe27ec \
249            rmd160 dc85b393c8dfbf04ba2aa0690237acfb185ada4e \
250        BrainPart2Rotated10Translated15.tgz \
251            md5  8c978a660e442e4ed06e77bc4f769af2 \
252            sha1 58c1b5a6d9e8a965f3e73febca012747b0246702 \
253            rmd160 3867b0d006fa8b5af084a78fa812aff69c2ad0c1 \
254        BrainPart2Rotated20Translated20.tgz \
255            md5  5f53d805ab4346b933ce52c7b34e67b2 \
256            sha1 f29740e4760ffc602e9a6b2aa2b96efabcff1aa6 \
257            rmd160 2441747f0c98e9f2fa24a1c7ca9294bed729dcc0 \
258        BrainPart3.tgz \
259            md5  c6f5edccbb2c0ba418e4666fe989eb15 \
260            sha1 20cdee786c710aed0df6943bcbaa9c62bb82e773 \
261            rmd160 3f730bf426a6509c73c58902220b64cb3324b136 \
262        BrainPart3Rotated10Translated15.tgz \
263            md5  61893ca3df13d24530275758de702fef \
264            sha1 4f6ba74d68a7e477fd43237213d4d4e4ce839503 \
265            rmd160 ba408d2ff6297af7f76af82ae24e9afe519bb80c \
266        BrainPart3Rotated20Translated20.tgz \
267            md5  db63c7567d1c021860d59812eb41dfa9 \
268            sha1 2e14b66beef00acc8cd17942d9bf0c155841a934 \
269            rmd160 42d403505116e8b9885d00964376cee909711bd0
270    configure.args-append \
271        -DITK_BRAINWEB_DATA_ROOT:PATH=${itkDataPath}
272    post-destroot {
273        xinstall -d -o root -g admin -m 0755 ${destroot}${itkDataPath}
274        foreach tgz [exec find ${distpath} -name "BrainPart*.tgz"] {
275            system "tar -C ${destroot}${itkDataPath} -zxf ${tgz}"
276        }
277    }
278}
279
280
281##// Directory with data taken from http://public.kitware.com/pub/itk/Data/HealthyVolunteersMRIDatabase/
282##ITK_MRI_UNC_DATABASE_DATA_ROOT:PATH=ITK_MRI_UNC_DATABASE_DATA_ROOT-NOTFOUND
283#http://public.kitware.com/pub/itk/Data/HealthyVolunteersMRIDatabase/Brain_MRA_From_UNC_Collection.zip
284#http://public.kitware.com/pub/itk/Data/HealthyVolunteersMRIDatabase/LICENSE.txt
285# During install, use a message to echo the LICENSE.txt file
286
287
288##// Directory with data taken from http://www.osirix-viewer.com/Downloads.html
289##ITK_OSIRIX_DATA_ROOT:PATH=ITK_OSIRIX_DATA_ROOT-NOTFOUND
290# sourceforge downloads:
291#http://prdownloads.sourceforge.net/osirix/CardiacCT.zip?download
292#http://prdownloads.sourceforge.net/osirix/PET-CT.zip?download
293# More datasets available from:
294#http://pubimage.hcuge.ch:8080/
295
296
297# Notes on RPATH settings for the shared dylib build and install:
298#
299# CMake book, Appendix A, p 234: "CMAKE_SKIP_BUILD_RPATH: Do not include RPATHs
300# in the build tree.  Normally CMake uses the build tree for the RPATH when
301# building executables etc. on systems that use RPATH.  When the software is
302# installed the executables etc.  are relinked by CMake to have the install
303# RPATH.  If this variable is set to true then the software is always built with
304# no RPATH."
305#
306# CMake book, Appendix B, p. 301: "... SKIP_BUILD_RPATH is a boolean specifying
307# whether to skip automatic generation of an rpath allowing the target to run
308# from the build tree.  BUILD_WITH_INSTALL_RPATH is a boolean specifying whether
309# to link the target in the build tree with the INSTALL_RPATH.  This takes
310# precedence over SKIP_BUILD_RPATH and avoids the need for relinking before
311# installation."
312#
313# Using CMAKE_SKIP_BUILD_RPATH:BOOL=OFF, we get all the executables and dylibs
314# built with the $build.dir in the rpath.  For this to work, we must also have
315# CMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF.  After the build, at the destroot
316# phase, all the installation candidates (which excludes the examples and
317# testing binaries) have their rpath settings reset to the INSTALL_RPATH (which
318# should point to $prefix..., not the $destroot location).
319
320variant shared description "build shared libraries" {
321    configure.args-delete \
322        -DBUILD_SHARED_LIBS:BOOL=OFF
323    configure.args-append \
324        -DBUILD_SHARED_LIBS:BOOL=ON \
325        -DCMAKE_SKIP_RPATH:BOOL=OFF \
326        -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF \
327        -DCMAKE_INSTALL_RPATH:STRING=${itkLibPath}
328}
329
330
331proc resetLibLinks { inputPath } {
332    # The example and testing binaries are built, but they are not "installed".
333    # All their rpath settings point to the build.dir, so they must be
334    # reset using install_name_tool for the destroot install.
335    global itkBuildBin itkLibPath
336    foreach f [glob ${inputPath}/*] {
337        if [string equal [file extension ${f}] ".app"] {
338            set exeName [file rootname [lindex [file split ${f}] end]]
339            set f [format "%s/Contents/MacOS/%s" ${f} ${exeName}]
340        }
341        if [expr [file isfile ${f}] && [file executable ${f}]] {
342            foreach dep [exec otool -L ${f}] {
343                if [string match -nocase "*/libitk*.dylib" ${dep}] {
344                    set newdep [strsed ${dep} #${itkBuildBin}#${itkLibPath}#]
345                    system "install_name_tool -change ${dep} ${newdep} ${f}"
346                }
347            }
348        }
349    }
350}
351
352
353variant examples description "provide ITK examples in ${itkExamplePath}" {
354    configure.args-delete \
355        -DBUILD_EXAMPLES:BOOL=OFF
356    configure.args-append \
357        -DBUILD_EXAMPLES:BOOL=ON
358    post-destroot {
359        xinstall -d -o root -g admin -m 0755 ${destroot}${itkExampleBin}
360        foreach f [glob ${itkExampleSrc}/*] {
361            file copy ${f} ${destroot}${itkExamplePath}/
362        }
363        # Find all the example executables by parsing all the
364        # CMakeLists.txt files within the src Examples path
365        set exe {}
366        foreach f [exec find ${itkExampleSrc} -name "CMakeLists.txt"] {
367            catch {exec grep -e "ADD_EXECUTABLE" ${f}} results
368            if [expr ![string match "*child process*" ${results}]] {
369                # Remove the string "ADD_EXECUTABLE(", with or without whitespace
370                regsub -all "\[ \t\]*ADD_EXECUTABLE\[(\]\[ \t\]*" ${results} "" results
371                # Remove the string ".cxx)", with or without whitespace
372                regsub -all ".cxx\[ \t\]*\[)\]" ${results} "" results
373                set exe [concat ${exe} ${results}]
374            }
375        }
376        set exe [lsort -unique ${exe}]
377        # Installations for the example binaries are in ${itkBuildBin}.
378        # Copy them into the destroot example bin.
379        foreach f $exe {
380            set f ${itkBuildBin}/${f}
381            if [expr [file isfile ${f}] && [file executable ${f}]] {
382                file copy ${f} ${destroot}${itkExampleBin}
383            }
384        }
385        # Only do this if the shared variant is selected?
386        resetLibLinks ${destroot}${itkExampleBin}
387    }
388}
389
390
391variant testing description "provide ITK testing in ${itkTestingPath}" {
392    configure.args-delete \
393        -DBUILD_TESTING:BOOL=OFF
394    configure.args-append \
395        -DBUILD_TESTING:BOOL=ON
396    post-destroot {
397        xinstall -d -o root -g admin -m 0755 ${destroot}${itkTestingBin}
398        foreach f [glob ${itkTestingSrc}/*] {
399            file copy ${f} ${destroot}${itkTestingPath}/
400        }
401        # Find all the testing executables by parsing all the
402        # CMakeLists.txt files within the itkTestingSrc path
403        set exe {}
404        foreach f [exec find ${itkTestingSrc} -name "CMakeLists.txt"] {
405            catch {exec grep -e "ADD_EXECUTABLE" ${f}} results
406            if [expr ![string match "*child process*" ${results}]] {
407                # Remove the string "ADD_EXECUTABLE(", with or without whitespace
408                regsub -all "\[ \t\]*ADD_EXECUTABLE\[(\]\[ \t\]*" ${results} "" results
409                # Remove the string ".cxx)", with or without whitespace
410                regsub -all ".cxx\[ \t\]*\[)\]" ${results} "" results
411                set exe [concat ${exe} ${results}]
412            }
413        }
414        set exe [lsort -unique ${exe}]
415        # Installations for the testing binaries are in ${itkBuildBin}.
416        # Copy them into the destroot testing bin.
417        foreach f $exe {
418            set f ${itkBuildBin}/${f}
419            if [expr [file isfile ${f}] && [file executable ${f}]] {
420                file copy ${f} ${destroot}${itkTestingBin}
421            }
422        }
423        # Only do this if the shared variant is selected?
424        resetLibLinks ${destroot}${itkTestingBin}
425    }
426}
427
428
429# --- external languages support
430
431
432# Some of the wrapper libs are built, but they are not "installed".
433# All their rpath settings point to the build.dir, so they must be
434# reset using install_name_tool after the destroot phase.
435proc resetWrapLibs { filepattern } {
436    global itkBuildBin itkLibPath itkWrapLibPath
437    foreach f [glob ${filepattern}] {
438        foreach dep [exec otool -L ${f}] {
439            if [string match -nocase "*libSwigRuntime*" ${dep}] {
440                set newdep [strsed ${dep} #${itkBuildBin}#${itkWrapLibPath}#]
441                system "install_name_tool -change ${dep} ${newdep} ${f}"
442            } elseif [string match -nocase "${itkBuildBin}*" ${dep}] {
443                set newdep [strsed ${dep} #${itkBuildBin}#${itkLibPath}#]
444                system "install_name_tool -change ${dep} ${newdep} ${f}"
445            }
446        }
447    }
448}
449
450
451variant wrap requires shared description "USE_WRAP_ITK for external language support (includes shared)" {
452    depends_lib-append \
453        port:guile \
454        port:tk
455    # The WrapITK install path assumes a prefix of ${prefix}, but without this
456    # variable setting, it will default to "lib/${itkName}/WrapITK" without the
457    # version specific ${distname}
458    set itkWrapInstallPath /lib/${distname}/WrapITK
459    configure.args-append \
460        -DUSE_WRAP_ITK:BOOL=ON \
461        -DWRAP_ITK_JAVA:BOOL=ON \
462        -DWRAP_ITK_TCL:BOOL=ON \
463        -DCMAKE_CXX_FLAGS:STRING=-fpermissive \
464        -DGUILE_EXECUTABLE:FILEPATH=${prefix}/bin/guile \
465        -DGUILE_LIBRARY:FILEPATH=${prefix}/lib/libguile.dylib \
466        -DGUILE_INCLUDE_PATH:PATH=${prefix}/include/guile \
467        -DTCL_TCLSH:FILEPATH=${prefix}/bin/tclsh \
468        -DTCL_INCLUDE_PATH:PATH=${prefix}/include \
469        -DTCL_LIBRARY:FILEPATH=${prefix}/lib/libtcl.dylib \
470        -DTK_INCLUDE_PATH:PATH=${prefix}/include \
471        -DTK_LIBRARY:FILEPATH=${prefix}/lib/libtk.dylib
472        # The following config option seems more trouble than useful:
473        #-DWRAP_ITK_INSTALL_PREFIX:PATH=${itkWrapInstallPath} \
474        # Could enable this if the example variant is selected:
475        #-DSWIG_BUILD_EXAMPLES:BOOL=ON
476    post-destroot {
477        # Reset dynamic library dependency paths (see proc above)
478        resetWrapLibs ${destroot}${itkLibPath}/WrapITK/lib/*.dylib
479        resetWrapLibs ${destroot}${itkLibPath}/WrapITK/lib/*.jnilib
480        # Fix executable permissions and move itkwish to version specific file
481        set itkwishSh ${destroot}${prefix}/bin/itkwish-${branch}
482        move ${destroot}${prefix}/bin/itkwish ${itkwishSh}
483        file attributes ${itkwishSh} -permissions 0755
484        # This should be done by InsightToolkitSelect
485        ln -s itkwish-${branch} ${destroot}${prefix}/bin/itkwish
486        # Change the content of itkwish
487        reinplace "s|${itkName}|${distname}|g" ${itkwishSh}
488        reinplace "s|//|/|g" ${itkwishSh}
489        # Reset dynamic library dependency paths for itkwish binary
490        set itkwishBin ${destroot}${itkLibPath}/WrapITK/bin/itkwish
491        foreach dep [exec otool -L ${itkwishBin}] {
492            if [string match "*Tcl.dylib" ${dep}] {
493                set newdep [strsed ${dep} #${itkLibPath}#${itkWrapLibPath}#]
494                system "install_name_tool -change ${dep} ${newdep} ${itkwishBin}"
495            }
496        }
497    }
498}
499
500# The following were possiblilities identified by ccmake
501
502#-DPERL_EXECUTABLE                 ${prefix}/bin/perl
503#-DPERL_INCLUDE_PATH               PERL_INCLUDE_PATH-NOTFOUND
504#-DPERL_LIBRARY                    PERL_LIBRARY-NOTFOUND
505
506#-DPHP4_EXECUTABLE                 ${prefix}/bin/php
507#-DPHP4_FOUND_INCLUDE_PATH         PHP4_FOUND_INCLUDE_PATH-NOTFOUND
508
509#-DPIKE_EXECUTABLE                 PIKE_EXECUTABLE-NOTFOUND
510#-DPIKE_INCLUDE_PATH               PIKE_INCLUDE_PATH-NOTFOUND
511
512#-DRUBY_EXECUTABLE                 RUBY_EXECUTABLE-NOTFOUND
513#-DRUBY_INCLUDE_PATH               /System/Library/Frameworks/Ruby.framework/Headers
514#-DRUBY_LIBRARY                    RUBY_LIBRARY-NOTFOUND
515
516# Note for Ruby include path:
517# exec ruby -r rbconfig -e {puts Config::CONFIG["archdir"]}
518
519# Some default WrapITK settings:
520
521 #WRAP_BinaryMorphology            ON
522 #WRAP_Calculators                 ON
523 #WRAP_Compose                     ON
524 #WRAP_DeformableTransforms        ON
525 #WRAP_Denoising                   ON
526 #WRAP_DistanceMap                 ON
527 #WRAP_EdgesAndContours            ON
528 #WRAP_FFT                         ON
529 #WRAP_FFTW                        OFF
530 #WRAP_Filtering                   ON
531 #WRAP_IO                          ON
532 #WRAP_ITK_DIMS                    2;3
533 #WRAP_ITK_INSTALL_PREFIX          /lib/InsightToolkit/WrapITK
534 #WRAP_ITK_JAVA                    ON
535 #WRAP_ITK_PYTHON                  ON
536 #WRAP_ITK_TCL                     ON
537 #WRAP_IntensityFilters            ON
538 #WRAP_Interpolators               ON
539 #WRAP_Iterators                   OFF
540 #WRAP_LevelSet                    ON
541 #WRAP_Morphology                  ON
542 #WRAP_PixelMath                   ON
543 #WRAP_Registration                ON
544 #WRAP_Resize                      ON
545 #WRAP_Review                      ON
546 #WRAP_SegmentationAndThreshold    ON
547 #WRAP_SegmentationValidation      ON
548 #WRAP_SimpleFilters               ON
549 #WRAP_UnaryPixelMath              ON
550 #WRAP_complex_double              OFF
551 #WRAP_complex_float               ON
552 #WRAP_covariant_vector_double     OFF
553 #WRAP_covariant_vector_float      ON
554 #WRAP_double                      OFF
555 #WRAP_float                       ON
556 #WRAP_rgb_unsigned_char           OFF
557 #WRAP_rgb_unsigned_short          ON
558 #WRAP_rgba_unsigned_char          OFF
559 #WRAP_rgba_unsigned_short         ON
560 #WRAP_signed_char                 OFF
561 #WRAP_signed_long                 OFF
562 #WRAP_signed_short                OFF
563 #WRAP_unsigned_char               OFF
564 #WRAP_unsigned_long               OFF
565 #WRAP_unsigned_short              ON
566 #WRAP_vector_double               OFF
567 #WRAP_vector_float                ON
568
569
570
571
572
573
574# -----------------------------------------------------------------------------
575# The USE_WRAP_ITK will configure a default tcl and java wrapping.  Only enable
576# and modify the variants below to provide version specific language
577# wrappers.  Each of these variants should require the wrap variant.
578
579
580proc setPython { {major 2} {minor 6} } {
581    global pyVer python pyPort pyBin pyLib pyInc pyFrame pySite
582    set pyVer       ${major}.${minor}
583    set python      python${pyVer}
584    set pyPort      python${major}${minor}
585    set pyFrame     Library/Frameworks/Python.framework/Versions/${pyVer}
586    set pyLib       ${pyFrame}/Python
587    #set pyLib       lib/${python}
588    set pyBin       bin/${python}
589    set pyInc       include/${python}
590    set pySite      lib/${python}/site-packages
591    if [string match "2.6" ${pyVer}] {
592        # python2.6 is a true framework installation; whereas installs for 2.4
593        # and 2.5 contain symlinks in the framework path to the prefix path; and
594        # those symlinks can break the file_map stage of port activation.
595        set pyBin   ${pyFrame}/bin/${python}
596        set pyInc   ${pyFrame}/include/${python}
597        set pySite  ${pyFrame}/lib/${python}/site-packages
598    }
599}
600setPython
601
602proc pyPostDestroot {} {
603    # This procedure applies for python24 and python25 (maybe python26)
604    global  destroot prefix branch \
605            itkLibPath itkName distname pySite
606    # Reset dynamic library dependency paths (see proc above)
607    resetWrapLibs ${destroot}${itkLibPath}/WrapITK/lib/*.so
608    # Move WrapITK.pth to version specific file
609    set wrapITKpth ${destroot}${prefix}/${pySite}/WrapITK-${branch}.pth
610    move ${destroot}${prefix}/${pySite}/WrapITK.pth ${wrapITKpth}
611    # This symlink should be done with InsightToolkitSelect
612    ln -s WrapITK-${branch}.pth ${destroot}${prefix}/${pySite}/WrapITK.pth
613    # Change the content of WrapITK.pth (for any python version)
614    reinplace "s|${itkName}|${distname}|g" ${wrapITKpth}
615    reinplace "s|//|/|g" ${wrapITKpth}
616    # Change the content of FindWrapITK.cmake (for any python version)
617    set findWrapITK [glob ${destroot}${prefix}/share/cmake-*/Modules/FindWrapITK.cmake]
618    regsub FindWrapITK.cmake ${findWrapITK} FindWrapITK-${branch}.cmake findWrapITK-branch
619    move ${findWrapITK} ${findWrapITK-branch}
620    reinplace "s|${itkName}|${distname}|g" ${findWrapITK-branch}
621    reinplace "s|//|/|g" ${findWrapITK-branch}
622    # This symlink should be done with InsightToolkitSelect
623    ln -s FindWrapITK-${branch}.cmake ${findWrapITK}
624}
625
626variant python24 requires wrap conflicts python25 description "python 2.4 wrapper (includes wrap)" {
627    setPython 2 4
628    # Hereafter python24 and python25 are the same, but how to abstract this?  Maybe
629    # a general pyXY variant that is required by python24 and python25, but not clear on
630    # how the require precedence works with regard to the setPython proc.
631    depends_lib-append \
632        port:${pyPort}
633    configure.args-append \
634        -DWRAP_ITK_PYTHON:BOOL=ON \
635        -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/${pyBin} \
636        -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/${pyInc} \
637        -DPYTHON_LIBRARY:FILEPATH=${prefix}/${pyLib} \
638        -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/${pyLib} \
639        -DPY_SITE_PACKAGES_PATH:PATH=${prefix}/${pySite}
640    post-destroot {
641        pyPostDestroot
642    }
643}
644
645variant python25 requires wrap conflicts python24 description "python 2.5 wrapper (includes wrap)" {
646    setPython 2 5
647    depends_lib-append \
648        port:${pyPort}
649    configure.args-append \
650        -DWRAP_ITK_PYTHON:BOOL=ON \
651        -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/${pyBin} \
652        -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/${pyInc} \
653        -DPYTHON_LIBRARY:FILEPATH=${prefix}/${pyLib} \
654        -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/${pyLib} \
655        -DPY_SITE_PACKAGES_PATH:PATH=${prefix}/${pySite}
656    post-destroot {
657        pyPostDestroot
658    }
659}
660
661# Regardless of the pyLib setting for python26, cmake or the wrap config sets
662# the string "-framework Python", but this "-framework Python" setting actually
663# gets resolved by the link process into the Apple system /Framework path rather
664# than macports!  I'm not clear about how to control this, so the python26 variant
665# must be disabled for now.  If it's enabled, add the python26 variant to the
666# conflicts of python24 and python25.
667#variant python26 requires wrap conflicts python24 python25 description "python 2.6 wrapper (includes wrap)" {
668#    setPython 2 6
669#    depends_lib-append \
670#        port:${pyPort}
671#    configure.args-append \
672#        -DWRAP_ITK_PYTHON:BOOL=ON \
673#        -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/${pyBin} \
674#        -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/${pyInc} \
675#        -DPYTHON_LIBRARY:FILEPATH=${prefix}/${pyLib} \
676#        -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/${pyLib} \
677#        -DPY_SITE_PACKAGES_PATH:PATH=${prefix}/${pySite}
678#    post-destroot {
679#        pyPostDestroot
680#    }
681#}
682
683
684#variant java requires wrap description "provide java wrapper" {
685#    configure.args-append \
686#        # The following variables are defined automatically by cmake:
687#        #-DJAVACOMMAND                     /usr/bin/java
688#        #-DJAVA_ARCHIVE                    /usr/bin/jar
689#        #-DJAVA_AWT_INCLUDE_PATH           /System/Library/Frameworks/JavaVM.framework/Headers
690#        #-DJAVA_AWT_LIBRARY                -framework
691#        #-DJAVA_COMPILE                    /usr/bin/javac
692#        #-DJAVA_INCLUDE_PATH               /System/Library/Frameworks/JavaVM.framework/Headers
693#        #-DJAVA_INCLUDE_PATH2              /System/Library/Frameworks/JavaVM.framework/Headers
694#        #-DJAVA_JVM_LIBRARY                -framework
695#        #-DJAVA_RUNTIME                    /usr/bin/java
696#}
697
698
699#variant tcl requires wrap description "tcl wrapper (MacPorts tcl/tk)" {
700#    depends_lib-append \
701#        port:tcl \
702#        port:tk
703#    configure.args-append \
704#        -DTCL_TCLSH:FILEPATH=${prefix}/bin/tclsh \
705#        -DTCL_INCLUDE_PATH:PATH=${prefix}/include \
706#        -DTCL_LIBRARY:FILEPATH=${prefix}/lib/libtcl.dylib \
707#        -DTK_INCLUDE_PATH:PATH=${prefix}/include \
708#        -DTK_LIBRARY:FILEPATH=${prefix}/lib/libtk.dylib
709#}
710
711
712
713
714# -----------------------------------------------------------------------------
715# Additional possibilities for variants, not yet evaluated.
716
717#ITK_USE_LIBXML2
718#ITK_USE_MINC2
719
720#VNL_CONFIG_*
721
722#VXL_UPDATE_CONFIGURATION
723
724#variant kwstyle description {provide Kitware Style checking} {
725#    depends_lib-append \
726#        port:kwstyle
727#    configure.args-append \
728#        -DITK_USE_KWSTYLE:BOOL=ON
729#}
730
731#// Use an outside build of GDCM.
732#ITK_USE_SYSTEM_GDCM:BOOL=OFF
733#// Use the system's libxml2 library.
734#ITK_USE_SYSTEM_LIBXML2:BOOL=OFF
735#// Use the system's png library.
736#ITK_USE_SYSTEM_PNG:BOOL=OFF
737#// Use the system's tiff library.
738#ITK_USE_SYSTEM_TIFF:BOOL=OFF
739#// Use an outside build of VXL.
740#ITK_USE_SYSTEM_VXL:BOOL=OFF
741#// Use the system's zlib library.
742#ITK_USE_SYSTEM_ZLIB:BOOL=OFF
743
744
745
746# -----------------------------------------------------------------------------
747#livecheck.type      sourceforge
748#livecheck.regex     <title>itk InsightToolkit-(.*) released.*</title>
749
Note: See TracBrowser for help on using the repository browser.