source: trunk/dports/graphics/InsightToolkit314/Portfile

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