source: trunk/dports/graphics/InsightToolkit312/Portfile

Last change on this file was 146576, checked in by ryandesign@…, 19 months ago

InsightToolkit312, InsightToolkit314: make python25 the default variant only if the user has not already selected the python24 variant

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