Ticket #45265: Portfile

File Portfile, 25.1 KB (added by cjones051073 (Chris Jones), 10 years ago)
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 121606 2014-07-01 22:26:24Z mojca@macports.org $
3
4PortSystem          1.0
5
6PortGroup           active_variants 1.1
7PortGroup           cmake 1.0
8PortGroup           compiler_blacklist_versions 1.0
9PortGroup           github 1.0
10PortGroup           select 1.0
11
12# don't forget to update both the git tag and the version
13#github.setup        root-mirror root 6-02-00 v
14# tag below is 6.02/00 + a small fix for the GNU install option ...
15github.setup        root-mirror root 058aa8d4949b392da69ff496cfa9ac87fbec47e2
16version             6.02.00
17
18# this could be a better way to set the version (unless we use a sha sum for the git tag ;)
19# version           [string map {- .} $version]
20set version_major   [lindex [split ${version} .] 0]
21
22checksums           rmd160  900448b5e8ef39d763bee11224e7f40aa564a7f7 \
23                    sha256  63dd1b0ca3c511ffa9da2433ed085df3b12d1d5f48eb91da3709fe5a3cd56910
24
25name                root${version_major}
26categories          science
27maintainers         hep.phy.cam.ac.uk:jonesc mojca
28license             LGPL-2.1+
29
30description         ROOT is a data analysis framework from CERN
31long_description    The ROOT system provides a set of frameworks with all \
32                    the functionality needed to handle and analyze large amounts \
33                    of data in a very efficient way. ROOT6 is a development release, \
34                    for a more stable release install the ROOT5 port instead.
35
36homepage            http://root.cern.ch/
37platforms           darwin
38
39dist_subdir         root
40configure.dir       ${workpath}/build
41build.dir           ${configure.dir}
42
43post-extract {
44    file mkdir ${configure.dir}
45}
46
47depends_lib         port:expat \
48                    port:gmp \
49                    port:giflib \
50                    port:jpeg \
51                    port:libpng \
52                    port:lzma \
53                    port:pcre \
54                    port:tiff \
55                    port:zlib \
56                    port:xz
57                  # port:freetype
58
59depends_run         port:root_select
60
61# TODO: the file ${filespath}/${name} would have to be generated on the fly instead
62select.group        root
63select.file         ${filespath}/${name}
64
65# Force a compatible compiler
66compiler.blacklist-append *gcc* {clang < 500} macports-clang-2.9 macports-clang-3.0 macports-clang-3.1 macports-clang-3.2
67compiler.fallback-append macports-clang-3.4 macports-clang-3.5
68
69# port specific location
70set install_prefix ${prefix}/libexec/root${version_major}
71
72configure.args-append \
73                    -Dgnuinstall=ON \
74                    -DCMAKE_INSTALL_PREFIX="${install_prefix}" \
75                    -DCMAKE_INSTALL_SYSCONFDIR="${install_prefix}/etc/root" \
76                    -Dfortran=OFF \
77                    -Dbuiltin_freetype=ON \
78                    -Dbuiltin_glew=OFF \
79                    -Dbuiltin_pcre=OFF \
80                    -Dbuiltin_zlib=OFF \
81                    -Dbuiltin_lzma=OFF \
82                    -Dfftw3=OFF \
83                    -Dkrb5=OFF \
84                    -Dldap=OFF \
85                    -Dmysql=OFF \
86                    -Dsqlite=OFF \
87                    -Dodbc=OFF \
88                    -Dopengl=OFF \
89                    -Dpythia6=OFF \
90                    -Dpythia8=OFF \
91                    -Droofit=OFF \
92                    -Dssl=OFF \
93                    -Dxml=OFF \
94                    -Dpython=OFF \
95                    -Dfitsio=OFF \
96                    -Dgsl_shared=OFF \
97                    -Dpgsql=OFF \
98                    -Ddcache=OFF \
99                    -Dchirp=OFF \
100                    -Dhdfs=OFF \
101                    -Druby=OFF \
102                    -Dminuit2=OFF \
103                    -Dtmva=OFF \
104                    -Dqt=OFF \
105                    -Dqtgsi=OFF \
106                    -Dbonjour=OFF \
107                    -Dgviz=OFF \
108                    -Dsoversion=OFF \
109                    -Dc++11=ON \
110                    -Dlibcxx=ON \
111                    -Dxrootd=OFF \
112                    -Dbuiltin_ftgl=ON \
113                    -Dmathmore=ON \
114                    -Dgenvector=ON \
115                    -Dmemstat=ON \
116                    -Dunuran=ON \
117                    -Dtable=ON \
118                    -Dgdml=ON \
119                    -Dhttp=OFF \
120                    -Dvc=OFF \
121                    -DPNG_LIBRARY=${prefix}/lib/libpng.dylib \
122                    -DPNG_PNG_INCLUDE_DIR=${prefix}/include
123
124configure.post_args ${worksrcpath}
125
126platform darwin {
127
128    if {${os.major} < 10} {
129        pre-fetch {
130            ui_error "${name} requires C++11 and modifications of the package."
131            return -code error "C++11 needed"
132        }
133    } elseif {${os.major} == 10} {
134        # an ugly workaround for lack of __thread on 10.6 (and earlier)
135        # it has to be patched properly upstream
136        # https://sft.its.cern.ch/jira/browse/ROOT-6394
137        patchfiles-append patch-montecarlo-vmc-inc-TMCtls.h.diff
138    }
139
140    # Note that we are forcing this choice.  This means that anything linking
141    # against root6 needs to also be using libc++.  This is possibly
142    # problematic, but luckily there is just a limited set of such dependents.
143    # Another problem is that all dependencies might need to be built-in
144    # to make sure that they all use libc++.
145    if { ${configure.cxx_stdlib} ne "libc++" } {
146        configure.cxx_stdlib libc++
147        depends_lib-append port:libcxx
148    }
149
150    # replace
151    #   -DCMAKE_OSX_SYSROOT="/Developer/SDKs/MacOSX10.6.sdk"
152    #   -DCMAKE_OSX_DEPLOYMENT_TARGET="10.6"
153    # with
154    #   -DCMAKE_OSX_SYSROOT="/"
155    #   -DCMAKE_OSX_DEPLOYMENT_TARGET=""
156    pre-configure {
157        configure.args-strsed "s|CMAKE_OSX_SYSROOT=\[^\[:blank:\]\]*|CMAKE_OSX_SYSROOT=\"/\"|"
158        configure.args-strsed "s|CMAKE_OSX_DEPLOYMENT_TARGET=\[^\[:blank:\]\]*|CMAKE_OSX_DEPLOYMENT_TARGET=\"\"|"
159    }
160}
161
162post-destroot {
163    # Work around for bug in 6.02.00 that incorrectly installs some 'build' files ...
164    # Hopefully fixed in a future release, so this can be removed...
165    set dirToRemove ${destroot}${prefix}/var/macports/build
166    if { [ file exists ${dirToRemove} ] } { delete ${dirToRemove} }
167    # create versioned symlinks for the content of libexec
168    # bin dir
169    foreach f [glob -directory ${destroot}${install_prefix}/bin *] {
170        set filename  [file tail $f]
171        set extension [file extension $filename]
172        set base      [file rootname $filename]
173        set versioned_filename ${base}${version_major}${extension}
174        ln -s ${install_prefix}/bin/${filename} ${destroot}${prefix}/bin/${versioned_filename}
175    }
176    # lib dir
177    ln -s ${install_prefix}/lib/root ${destroot}${prefix}/lib/root${version_major}
178    # include dir
179    ln -s ${install_prefix}/include/root ${destroot}${prefix}/include/root${version_major}
180    # etc dir
181    ln -s ${install_prefix}/etc/root ${destroot}${prefix}/etc/root${version_major}
182    # share dir
183    ln -s ${install_prefix}/share ${destroot}${prefix}/share/root${version_major}
184    # Compress manpages in custom location (borrowed from mariadb)
185    set manpath ${install_prefix}/share/man
186    set gzip [findBinary gzip ${portutil::autoconf::gzip_path}]
187    foreach manpage [glob -type f ${destroot}${manpath}/man1/*] {
188        # Zip the man file
189        system "$gzip -9vf ${manpage}"
190        # Create man pages for versioned files
191        set filename  [file tail $manpage]
192        set extension [file extension $filename]
193        set base      [file rootname $filename]
194        set versioned_filename ${base}${version_major}${extension}.gz
195        set d [file tail $manpage]
196        ln -s ${manpath}/man1/${d}.gz ${destroot}${prefix}/share/man/man1/${versioned_filename}
197    }
198}
199
200set run_port_select "No"
201pre-activate {
202  if { ![file exists ${prefix}/bin/root]  &&
203       ![file exists ${prefix}/bin/root5] &&
204       ![file exists ${prefix}/bin/root6] } {
205     set run_port_select "Yes"
206  }
207}
208
209post-activate {
210  ui_msg "======================================================================================"
211  if { ${run_port_select} == "Yes" } {
212      ui_msg "  Making root${version_major} your default root version. To change this run 'sudo port select root'"
213      catch { system "port select root root${version_major}" }
214  } else {
215      ui_msg "  To make root${version_major} your default root version, run 'sudo port select root root${version_major}'"
216  }
217  ui_msg "======================================================================================"
218}
219
220universal_variant   no
221
222default_variants    +ssl +xml +gsl +minuit2 +tmva +roofit +graphviz +opengl +soversion +http
223
224# Since ROOT 5.34.15 the cocoa backend is default on OSX 10.8 or newer
225# We also make it default on 10.7
226if {${os.major} > 10} {
227    set default_gui_variant +cocoa
228} else {
229    set default_gui_variant +x11
230}
231
232variant valgrind description {Build internal LLVM library with valgrind support} {
233    depends_lib-append      port:valgrind
234}
235
236variant http description {Build with HTTP Server library support} {
237    configure.args-replace -Dhttp=OFF -Dhttp=ON
238}
239
240variant vc description {Build with Vc library support} {
241    configure.args-replace -Dvc=OFF -Dvc=ON
242}
243
244variant debug description {Enable a debug build} {
245    configure.args-append -DCMAKE_BUILD_TYPE=Debug
246}
247
248variant xrootd description {Build with XRootD support} {
249    configure.args-replace  -Dxrootd=OFF -Dxrootd=ON
250#   configure.args-append   -Dbuiltin_xrootd=ON
251    configure.args-append   -DXROOTD_INCLUDE_DIR="${prefix}/include/xrootd"
252    depends_lib-append      port:xrootd
253}
254
255variant soversion description {Build with soversion support} {
256    configure.args-replace  -Dsoversion=OFF -Dsoversion=ON
257}
258
259variant graphviz description {Build with graphviz support} {
260    configure.args-replace  -Dgviz=OFF -Dgviz=ON
261    configure.args-append   -DGRAPHVIZ_INCLUDE_DIR="${prefix}/include"
262#                           -DGRAPHVIZ_CDT_LIBRARY="${prefix}/lib/libcdt.dylib" \
263#                           -DGRAPHVIZ_GRAPH_LIBRARY="${prefix}/lib/libcgraph.dylib" \
264#                           -DGRAPHVIZ_GVC_LIBRARY="${prefix}/lib/libgvc.dylib" \
265#                           -DGRAPHVIZ_PATHPLAN_LIBRARY="${prefix}/lib/libpathplan.dylib"
266    depends_lib-append      path:bin/dot:graphviz
267}
268
269variant avahi description {Build with avahi support} {
270    configure.args-replace  -Dbonjour=OFF -Dbonjour=ON
271#   configure.args-append   -DAVAHI_INCLUDE_DIR="${prefix}/include" \
272#                           -DAVAHI_client_LIBRARY="${prefix}/lib"
273    depends_lib-append      port:avahi
274}
275
276variant fftw3 description {Build with fftw3 support} {
277    configure.args-replace  -Dfftw3=OFF -Dfftw3=ON
278    configure.args-append   -DFFTW_INCLUDE_DIR="${prefix}/include" \
279                            -DFFTW_LIBRARY="${prefix}/lib/libfftw3.dylib"
280    depends_lib-append      port:fftw-3
281}
282
283variant gsl description {Build with gsl support} {
284    configure.args-replace  -Dgsl_shared=OFF -Dgsl_shared=ON
285    configure.args-append   -DGSL_CONFIG_EXECUTABLE="${prefix}/bin/gsl-config"
286    depends_lib-append      port:gsl
287}
288
289variant fitsio description {Build with fitsio support} {
290    configure.args-replace  -Dfitsio=OFF -Dfitsio=ON
291    configure.args-append   -DCFITSIO_INCLUDE_DIR="${prefix}/include" \
292                            -DCFITSIO_LIBRARIES="${prefix}/lib"
293    depends_lib-append      port:cfitsio
294}
295
296variant odbc description {Build with odbc support} {
297    configure.args-replace  -Dodbc=OFF -Dodbc=ON
298    configure.args-append   -DODBC_INCLUDE_DIR="${prefix}/include" \
299                            -DODBC_LIBRARY="${prefix}/lib/libiodbc.dylib"
300    depends_lib-append      port:libiodbc
301}
302
303variant ldap description {Build with ldap support} {
304    configure.args-replace  -Dldap=OFF -Dldap=ON
305#   configure.args-append   -DLDAP_INCLUDE_DIR="${prefix}/include" \
306#                           -DLDAP_LIBRARY="${prefix}/lib"
307    depends_lib-append      port:openldap
308}
309
310variant roofit description {Build the RooFit advanced fitting package} {
311    configure.args-replace  -Droofit=OFF -Droofit=ON
312}
313
314variant tmva description {Build the TMVA package} {
315    configure.args-replace  -Dtmva=OFF -Dtmva=ON
316    post-destroot {
317        set tmvaTuts ${destroot}${install_prefix}/share/root/tutorial/tmva
318        file mkdir ${tmvaTuts}
319        foreach f [glob ${worksrcpath}/tmva/test/*] { file copy $f ${tmvaTuts}/ }
320    }
321}
322
323variant minuit2 description {Build with minuit2 support} {
324    configure.args-replace  -Dminuit2=OFF -Dminuit2=ON
325}
326
327variant opengl description {Build with opengl support} {
328    configure.args-delete   -Dopengl=OFF
329    configure.args-delete   -Dbuiltin_glew=OFF
330    configure.args-append   -Dopengl=ON -Dbuiltin_glew=ON
331}
332
333# ========================================================================================
334# Setup various python variants
335# ========================================================================================
336
337# List of possible python versions
338set python_versions { 2.6 2.7 3.1 3.2 3.3 3.4 }
339set default_python_variant +python27
340
341# Define the available variants
342foreach py_ver ${python_versions} {
343    set py_ver_no_dot [join [split ${py_ver} "."] ""]
344    set variant_line {variant python${py_ver_no_dot} description "Build with python ${py_ver} support"}
345    foreach py_over ${python_versions} {
346        if { ${py_ver} == ${py_over} } { continue }
347        set py_over_no_dot [join [split ${py_over} "."] ""]
348        append variant_line " conflicts python${py_over_no_dot}"
349    }
350    append variant_line { { } }
351    eval $variant_line
352    if {[variant_isset python${py_ver_no_dot}]} {
353        if {${default_python_variant} != "+python${py_ver_no_dot}"} {
354            set default_python_variant ""
355        }
356    }
357}
358
359if {${default_python_variant} != ""} {
360    default_variants-append "${default_python_variant}"
361}
362
363# If a python variant is enabled, activate it
364set active_python_version ""
365foreach py_ver ${python_versions} {
366    set py_ver_no_dot [join [split ${py_ver} "."] ""]
367    if {[variant_isset python${py_ver_no_dot}]} {
368
369        set active_python_version        ${py_ver}
370        set active_python_version_no_dot ${py_ver_no_dot}
371
372        # Check root5 variants
373        pre-activate {
374            set portname root5
375            if {![catch {set result [active_variants ${portname} python${active_python_version_no_dot}]}]} {
376                if {$result} {
377                    ui_error "Cannot install ${name} with +python${active_python_version_no_dot} variant"
378                    return -code error "${portname} port is already installed with +python${active_python_version_no_dot} and both cannot be active at once. Pick a different python variant."
379                }
380            }
381        }
382
383        # Setup python
384        set mypydir ${prefix}/Library/Frameworks/Python.framework/Versions/${py_ver}
385        configure.args-replace  -Dpython=OFF -Dpython=ON
386        configure.args-append   -DPYTHON_INCLUDE_DIR="${mypydir}/Headers" \
387                                -DPYTHON_EXECUTABLE="${mypydir}/bin/python${py_ver}"
388        # Explicitly set python library
389        if       { [ file exists "${mypydir}/lib/libpython${py_ver}.dylib" ] } {
390            configure.args-append -DPYTHON_LIBRARY="${mypydir}/lib/libpython${py_ver}.dylib"
391        } elseif { [ file exists "${prefix}/lib/libpython${py_ver}.dylib" ] } {
392            configure.args-append -DPYTHON_LIBRARY="${prefix}/lib/libpython${py_ver}.dylib"
393        }
394        depends_lib-append      port:python${py_ver_no_dot}
395       
396        post-destroot {
397            set mypylibdir  ${prefix}/Library/Frameworks/Python.framework/Versions/${active_python_version}/lib/python${active_python_version}
398            set mypysitedir ${mypylibdir}/site-packages/
399            file mkdir ${destroot}${mypysitedir}
400            foreach pyfile [glob ${destroot}${install_prefix}/lib/root/*.py*] { move $pyfile ${destroot}${mypysitedir}/ }
401            ln -sf ${install_prefix}/lib/root/libPyROOT.so ${destroot}${mypylibdir}/
402        }
403
404    }
405}
406
407# ========================================================================================
408
409variant ssl description {Build with ssl support} {
410    configure.args-replace  -Dssl=OFF -Dssl=ON
411    depends_lib-append      port:openssl
412}
413
414variant xml description {Build with xml support} {
415    configure.args-replace  -Dxml=OFF -Dxml=ON
416    configure.args-append   -DLIBXML2_INCLUDE_DIR="${prefix}/include/libxml2" \
417                            -DLIBXML2_LIBRARIES="${prefix}/lib/libxml2.dylib" \
418                            -DLIBXML2_XMLLINT_EXECUTABLE="${prefix}/bin/xmllint"
419    depends_lib-append      port:libxml2
420}
421
422variant sqlite3 description {Build with sqlite3 support} {
423    configure.args-replace  -Dsqlite=OFF -Dsqlite=ON
424    depends_lib-append      port:sqlite3
425}
426
427variant mysql conflicts mysql51 mysql55 mariadb percona description {Build with mysql5 support} {
428    configure.args-replace  -Dmysql=OFF -Dmysql=ON
429    configure.args-append   -DMYSQL_CONFIG_EXECUTABLE=${prefix}"/lib/mysql5/bin/mysql_config"
430    depends_lib-append      port:mysql5
431}
432
433variant mysql51 conflicts mysql mysql55 mariadb percona description {Build with mysql51 support} {
434    configure.args-replace  -Dmysql=OFF -Dmysql=ON
435    configure.args-append   -DMYSQL_CONFIG_EXECUTABLE=${prefix}"/lib/mysql51/bin/mysql_config"
436    depends_lib-append      port:mysql51
437}
438
439variant mysql55 conflicts mysql mysql51 mariadb percona description {Build with mysql55 support} {
440    configure.args-replace  -Dmysql=OFF -Dmysql=ON
441    configure.args-append   -DMYSQL_CONFIG_EXECUTABLE=${prefix}"/lib/mysql55/bin/mysql_config"
442    depends_lib-append      port:mysql55
443}
444
445variant mariadb conflicts mysql mysql51 mysql55 percona description {Build with mariadb support} {
446    configure.args-replace  -Dmysql=OFF -Dmysql=ON
447    configure.args-append   -DMYSQL_CONFIG_EXECUTABLE=${prefix}"/lib/mariadb/bin/mysql_config"
448    depends_lib-append      port:mariadb
449}
450
451variant percona conflicts mysql mysql51 mysql55 mariadb description {Build with percona support} {
452    configure.args-replace  -Dmysql=OFF -Dmysql=ON
453    configure.args-append   -DMYSQL_CONFIG_EXECUTABLE=${prefix}"/lib/percona/bin/mysql_config"
454    depends_lib-append      port:percona
455}
456
457variant postgresql90 conflicts postgresql92 description {Build with PostgreSQL 9.0 support} {
458    configure.args-replace -Dpgsql=OFF -Dpgsql=ON
459    configure.args-append  -DPOSTGRESQL_INCLUDE_DIR="${prefix}/include/postgresql90"\
460                           -DPOSTGRESQL_LIBRARIES="${prefix}/lib/postgresql90/libpq.dylib"
461    depends_lib-append      port:libpqxx port:postgresql90
462}
463
464variant postgresql92 conflicts postgresql90 description {Build with PostgreSQL 9.2 support} {
465    configure.args-replace -Dpgsql=OFF -Dpgsql=ON
466    configure.args-append  -DPOSTGRESQL_INCLUDE_DIR="${prefix}/include/postgresql92" \
467                           -DPOSTGRESQL_LIBRARIES="${prefix}/lib/postgresql92/libpq.dylib"
468    depends_lib-append      port:libpqxx port:postgresql92
469}
470
471# variant oracle description {Build with Oracle support} {
472#     configure.args-replace --disable-oracle --enable-oracle
473#     configure.args-append  -DORACLE_PATH_INCLUDES="${prefix}/lib/oracle/sdk/include" \
474#                            -DORACLE_PATH_LIB="${prefix}/lib/oracle" \
475#                            -DORACLE_OCI_VERSION=8
476#     depends_lib-append     port:oracle-instantclient
477# }
478
479variant pythia description {Enables Pythia 8 support} {
480    configure.args-replace  -Dpythia8=OFF -Dpythia8=ON
481    configure.args-append   -DPYTHIA8_INCLUDE_DIR=${prefix}/include/pythia \
482                            -DPYTHIA8_LIBRARY=${prefix}/lib/libpythia8.dylib
483    depends_lib-append      port:pythia
484}
485
486variant cocoa conflicts x11 description {Enables native OSX graphical backend} {
487    # Enable cocoa support in configure
488    configure.args-append   -Dcocoa=ON -Dx11=OFF
489}
490
491variant x11 conflicts cocoa description {Enables X11 graphical backend} {
492    # Dependencies on X11 ports
493    depends_lib-append      port:xorg-libX11 port:mesa port:Xft2 port:xpm
494    # Disable cocoa
495    configure.args-append   -Dcocoa=OFF -Dx11=ON \
496                            -DOPENGL_INCLUDE_DIR=${prefix}/include \
497                            -DOPENGL_gl_LIBRARY=${prefix}/lib/libGL.dylib \
498                            -DX11_ICE_INCLUDE_PATH=${prefix}/include \
499                            -DX11_SM_INCLUDE_PATH=${prefix}/include \
500                            -DX11_X11_INCLUDE_PATH=${prefix}/include \
501                            -DX11_Xext_INCLUDE_PATH=${prefix}/include \
502                            -DX11_Xft_INCLUDE_PATH=${prefix}/include \
503                            -DX11_Xpm_INCLUDE_PATH=${prefix}/include \
504                            -DX11_ICE_LIB=${prefix}/lib/libICE.dylib \
505                            -DX11_SM_LIB=${prefix}/lib/libSM.dylib \
506                            -DX11_X11_LIB=${prefix}/lib/libX11.dylib \
507                            -DX11_Xext_LIB=${prefix}/lib/libXext.dylib \
508                            -DX11_Xft_LIB=${prefix}/lib/libXft.dylib \
509                            -DX11_Xpm_LIB=${prefix}/lib/libXpm.dylib \
510                            -DOPENGL_glu_LIBRARY=${prefix}/lib/libGLU.dylib
511}
512
513# If neither graphical variant is set, use default
514if { ![variant_isset cocoa] && ![variant_isset x11] } {
515    default_variants-append ${default_gui_variant}
516}
517
518# ========================================================================================
519# Setup various clang variants, to provide alternative C++ compilers that support cocoa
520# ========================================================================================
521
522# List of possible clang versions that work
523set clang_versions { 3.3 3.4 3.5 }
524
525# Define the available variants
526foreach clang_ver ${clang_versions} {
527    set clang_ver_no_dot [join [split ${clang_ver} "."] ""]
528    set variant_line {variant clang${clang_ver_no_dot} description "Compile using MacPorts clang ${clang_ver}"}
529    foreach clang_over ${clang_versions} {
530        if { ${clang_ver} == ${clang_over} } { continue }
531        set clang_over_no_dot [join [split ${clang_over} "."] ""]
532        append variant_line " conflicts clang${clang_over_no_dot}"
533    }
534    append variant_line { { } }
535    eval $variant_line
536}
537
538# make sure that the proper variant is automatically selected
539# (ROOT crashes if the compiler it was built with doesn't exist)
540if {![variant_isset clang33] && ![variant_isset clang34] && ![variant_isset clang35]} {
541    if { ${configure.compiler} eq "macports-clang-3.3" } {
542        default_variants-append +clang33
543    } elseif { ${configure.compiler} eq "macports-clang-3.4" } {
544        default_variants-append +clang34
545    } elseif { ${configure.compiler} eq "macports-clang-3.5" } {
546        default_variants-append +clang35
547    }
548}
549
550# Is a variant active ?
551set active_clang_variant ""
552foreach clang_ver ${clang_versions} {
553    set clang_ver_no_dot [join [split ${clang_ver} "."] ""]
554    if {[variant_isset clang${clang_ver_no_dot}]} {
555        set active_clang_variant ${clang_ver}
556    }
557}
558
559# If so, set it up.
560if { ${active_clang_variant} != "" } {
561    configure.compiler      macports-clang-${active_clang_variant}
562    # TODO
563    # configure.args-append   --with-llvm-config="${prefix}/bin/llvm-config-mp-"${active_clang_variant}
564    depends_run-append      port:clang-${active_clang_variant}
565}
566
567# ========================================================================================
568# Following is for fortran support
569# Might eventually move to a portgroup, or similar, so could be simplified.
570# Based on recipe from https://trac.macports.org/wiki/PortfileRecipes#fortran
571# Note that g95 does not work here, so that variant is removed
572# ========================================================================================
573
574set gcc_versions { 4.7 4.8 4.9 4.10 }
575set default_fortran_variant +gcc48
576
577foreach gcc_ver ${gcc_versions} {
578    set gcc_ver_no_dot [join [split ${gcc_ver} "."] ""]
579
580    set variant_line {variant gcc${gcc_ver_no_dot} description "Build with gfortran from gcc${gcc_ver_no_dot}"}
581
582    foreach gcc_over ${gcc_versions} {
583        if {${gcc_ver} == ${gcc_over}} {
584            continue
585        }
586        set gcc_over_no_dot [join [split ${gcc_over} "."] ""]
587        append variant_line " conflicts gcc${gcc_over_no_dot}"
588    }
589
590    append variant_line { {} }
591
592    eval $variant_line
593
594    if {[variant_isset gcc${gcc_ver_no_dot}]} {
595        if {${default_fortran_variant} != "+gcc${gcc_ver_no_dot}"} {
596            set default_fortran_variant ""
597        }
598    }
599}
600
601if {${default_fortran_variant} != ""} {
602    default_variants-append "${default_fortran_variant}"
603}
604
605foreach gcc_ver ${gcc_versions} {
606    set gcc_ver_no_dot [join [split ${gcc_ver} "."] ""]
607
608    if {[variant_isset gcc${gcc_ver_no_dot}]} {
609        depends_lib-append path:lib/libgcc/libgcc_s.1.dylib:libgcc
610        depends_build-append port:gcc${gcc_ver_no_dot}
611
612        configure.fc  ${prefix}/bin/gfortran-mp-${gcc_ver}
613        configure.f77 ${prefix}/bin/gfortran-mp-${gcc_ver}
614        configure.f90 ${prefix}/bin/gfortran-mp-${gcc_ver}
615
616        configure.args-replace -Dfortran=OFF -Dfortran=ON
617    }
618}
619
620# ========================================================================================
621
622# Problems finding includes ...
623# variant ruby description {Build with ruby support} {
624#     configure.args-replace  -Druby=OFF -Druby=ON
625#     depends_lib-append      port:ruby
626# }
627
628# TODO
629# livecheck.type              regex
630# livecheck.url               http://root.cern.ch/svn/root/trunk
631# livecheck.regex             ${name}_v(\[0-9a-z.\]+)\\.source