source: trunk/dports/science/root6/Portfile @ 120764

Last change on this file since 120764 was 120764, checked in by mojca@…, 6 years ago

root6: fix configure.cxx_stdlib and compiler blacklist (#43917)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 20.9 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 120764 2014-06-06 14:30:14Z 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# Essentially 6.00.00, but with some bug fixes to the build system
13github.setup        root-mirror root aaf9b65
14#github.setup       root-mirror root 6-00-00 v
15version             6.00.00
16checksums           rmd160  e0b7080d897469f421dd5ee44ca570a4774dc5d4 \
17                    sha256  58692b7e2c970df5eac0dd298ab7d1ac5352e4ed549d61c29578d71915e831be
18
19name                root6
20set version_major   6
21categories          science
22maintainers         hep.phy.cam.ac.uk:jonesc mojca
23license             LGPL-2.1+
24
25description         ROOT is a data analysis framework from CERN
26long_description    The ROOT system provides a set of frameworks with all \
27                    the functionality needed to handle and analyze large amounts \
28                    of data in a very efficient way. ROOT6 is a development release, \
29                    for a more stable release install the ROOT5 port instead.
30
31homepage            http://root.cern.ch/
32platforms           darwin
33
34dist_subdir         root
35configure.dir       ${workpath}/build
36build.dir           ${configure.dir}
37
38post-extract {
39    file mkdir ${configure.dir}
40}
41
42depends_lib         port:expat \
43                    port:gmp \
44                    port:giflib \
45                    port:jpeg \
46                    port:libpng \
47                    port:lzma \
48                    port:pcre \
49                    port:tiff \
50                    port:zlib \
51                    port:xz
52                  # port:freetype
53
54depends_run         port:root_select
55
56# TODO: the file ${filespath}/${name} would have to be generated on the fly instead
57select.group        root
58select.file         ${filespath}/${name}
59
60# Force a compatible compiler
61# (macports-clang-3.3 works; it's blacklisted only to give the preference to 3.4)
62compiler.blacklist-append *gcc* {clang < 500} macports-clang-2.9 macports-clang-3.0 macports-clang-3.1 macports-clang-3.2 macports-clang-3.3
63compiler.fallback-append macports-clang-3.4 macports-clang-3.5
64
65# port specific location
66set install_prefix ${prefix}/libexec/root${version_major}
67
68configure.args-append \
69                    -Dgnuinstall=ON \
70                    -DCMAKE_INSTALL_PREFIX="${install_prefix}" \
71                    -DCMAKE_INSTALL_SYSCONFDIR="${install_prefix}/etc/root" \
72                    -Dfortran=OFF \
73                    -Dbuiltin_freetype=ON \
74                    -Dbuiltin_glew=OFF \
75                    -Dbuiltin_pcre=OFF \
76                    -Dbuiltin_zlib=OFF \
77                    -Dbuiltin_lzma=OFF \
78                    -Dfftw3=OFF \
79                    -Dkrb5=OFF \
80                    -Dldap=OFF \
81                    -Dmysql=OFF \
82                    -Dsqlite=OFF \
83                    -Dodbc=OFF \
84                    -Dopengl=OFF \
85                    -Dpythia6=OFF \
86                    -Dpythia8=OFF \
87                    -Droofit=OFF \
88                    -Dssl=OFF \
89                    -Dxml=OFF \
90                    -Dpython=OFF \
91                    -Dfitsio=OFF \
92                    -Dgsl_shared=OFF \
93                    -Dpgsql=OFF \
94                    -Ddcache=OFF \
95                    -Dchirp=OFF \
96                    -Dhdfs=OFF \
97                    -Druby=OFF \
98                    -Dminuit2=OFF \
99                    -Dtmva=OFF \
100                    -Dqt=OFF \
101                    -Dqtgsi=OFF \
102                    -Dbonjour=OFF \
103                    -Dgviz=OFF \
104                    -Dsoversion=OFF \
105                    -Dc++11=ON \
106                    -Dlibcxx=ON \
107                    -Dxrootd=OFF \
108                    -Dbuiltin_ftgl=ON \
109                    -Dmathmore=ON \
110                    -Dgenvector=ON \
111                    -Dmemstat=ON \
112                    -Dunuran=ON \
113                    -Dtable=ON \
114                    -Dgdml=ON \
115                    -DPNG_LIBRARY=${prefix}/lib/libpng.dylib \
116                    -DPNG_PNG_INCLUDE_DIR=${prefix}/include
117
118configure.post_args ${worksrcpath}
119
120# TODO: temporary:
121configure.args-append       -DCMAKE_INCLUDE_PATH=${prefix}/include
122configure.cppflags-delete   -I${prefix}/include
123
124platform darwin {
125    # Note that we are forcing this choice.  This means that anything linking
126    # against root6 needs to also be using libc++.  This is possibly
127    # problematic, but luckily there is just a limited set of such dependents.
128    # Another problem is that all dependencies might need to be built-in
129    # to make sure that they all use libc++.
130    if { ${configure.cxx_stdlib} ne "libc++" } {
131        configure.cxx_stdlib libc++
132        depends_lib-append port:libcxx
133    }
134}
135
136post-destroot {
137    # create versioned symlinks for the content of libexec
138    # bin dir
139    foreach f [glob -directory ${destroot}${install_prefix}/bin *] {
140        set filename  [file tail $f]
141        set extension [file extension $filename]
142        set base      [file rootname $filename]
143        set versioned_filename ${base}${version_major}${extension}
144        ln -s ${install_prefix}/bin/${filename} ${destroot}${prefix}/bin/${versioned_filename}
145    }
146    # lib dir
147    ln -s ${install_prefix}/lib/root ${destroot}${prefix}/lib/root${version_major}
148    # include dir
149    ln -s ${install_prefix}/include/root ${destroot}${prefix}/include/root${version_major}
150    # etc dir
151    ln -s ${install_prefix}/etc/root ${destroot}${prefix}/etc/root${version_major}
152    # share dir
153    ln -s ${install_prefix}/share ${destroot}${prefix}/share/root${version_major}
154    # Compress manpages in custom location (borrowed from mariadb)
155    set manpath ${install_prefix}/share/man
156    set gzip [findBinary gzip ${portutil::autoconf::gzip_path}]
157    foreach manpage [glob -type f ${destroot}${manpath}/man1/*] {
158        # Zip the man file
159        system "$gzip -9vf ${manpage}"
160        # Create man pages for versioned files
161        set filename  [file tail $manpage]
162        set extension [file extension $filename]
163        set base      [file rootname $filename]
164        set versioned_filename ${base}${version_major}${extension}.gz
165        set d [file tail $manpage]
166        ln -s ${manpath}/man1/${d}.gz ${destroot}${prefix}/share/man/man1/${versioned_filename}
167    }
168}
169
170set run_port_select "No"
171pre-activate {
172  if { ![file exists ${prefix}/bin/root]  &&
173       ![file exists ${prefix}/bin/root5] &&
174       ![file exists ${prefix}/bin/root6] } {
175     set run_port_select "Yes"
176  }
177}
178
179post-activate {
180  ui_msg "======================================================================================"
181  if { ${run_port_select} == "Yes" } {
182      ui_msg "  Making root${version_major} your default root version. To change this run 'sudo port select root'"
183      catch { system "port select root root${version_major}" }
184  } else {
185      ui_msg "  To make root${version_major} your default root version, run 'sudo port select root root${version_major}'"
186  }
187  ui_msg "======================================================================================"
188}
189
190universal_variant   no
191
192default_variants    +ssl +xml +gsl +minuit2 +tmva +roofit +graphviz +opengl +soversion
193
194# Since ROOT 5.34.15 the cocoa backend is default on OSX 10.8 or newer
195# We also make it default on 10.7
196if {${os.major} > 10} {
197    set default_gui_variant +cocoa
198} else {
199    set default_gui_variant +x11
200}
201
202variant xrootd description {Build with XRootD support} {
203    configure.args-replace  -Dxrootd=OFF -Dxrootd=ON
204#   configure.args-append   -Dbuiltin_xrootd=ON
205    configure.args-append   -DXROOTD_INCLUDE_DIR="${prefix}/include/xrootd"
206    depends_lib-append      port:xrootd
207}
208
209variant soversion description {Build with soversion support} {
210    configure.args-replace  -Dsoversion=OFF -Dsoversion=ON
211}
212
213variant graphviz description {Build with graphviz support} {
214    configure.args-replace  -Dgviz=OFF -Dgviz=ON
215    configure.args-append   -DGRAPHVIZ_INCLUDE_DIR="${prefix}/include"
216#                           -DGRAPHVIZ_CDT_LIBRARY="${prefix}/lib/libcdt.dylib" \
217#                           -DGRAPHVIZ_GRAPH_LIBRARY="${prefix}/lib/libcgraph.dylib" \
218#                           -DGRAPHVIZ_GVC_LIBRARY="${prefix}/lib/libgvc.dylib" \
219#                           -DGRAPHVIZ_PATHPLAN_LIBRARY="${prefix}/lib/libpathplan.dylib"
220    depends_lib-append      path:bin/dot:graphviz
221}
222
223variant avahi description {Build with avahi support} {
224    configure.args-replace  -Dbonjour=OFF -Dbonjour=ON
225#   configure.args-append   -DAVAHI_INCLUDE_DIR="${prefix}/include" \
226#                           -DAVAHI_client_LIBRARY="${prefix}/lib"
227    depends_lib-append      port:avahi
228}
229
230variant fftw3 description {Build with fftw3 support} {
231    configure.args-replace  -Dfftw3=OFF -Dfftw3=ON
232    configure.args-append   -DFFTW_INCLUDE_DIR="${prefix}/include" \
233                            -DFFTW_LIBRARY="${prefix}/lib/libfftw3.dylib"
234    depends_lib-append      port:fftw-3
235}
236
237variant gsl description {Build with gsl support} {
238    configure.args-replace  -Dgsl_shared=OFF -Dgsl_shared=ON
239    configure.args-append   -DGSL_CONFIG_EXECUTABLE="${prefix}/bin/gsl-config"
240    depends_lib-append      port:gsl
241}
242
243variant fitsio description {Build with fitsio support} {
244    configure.args-replace  -Dfitsio=OFF -Dfitsio=ON
245    configure.args-append   -DCFITSIO_INCLUDE_DIR="${prefix}/include" \
246                            -DCFITSIO_LIBRARIES="${prefix}/lib"
247    depends_lib-append      port:cfitsio
248}
249
250variant odbc description {Build with odbc support} {
251    configure.args-replace  -Dodbc=OFF -Dodbc=ON
252    configure.args-append   -DODBC_INCLUDE_DIR="${prefix}/include" \
253                            -DODBC_LIBRARY="${prefix}/lib/libiodbc.dylib"
254    depends_lib-append      port:libiodbc
255}
256
257variant ldap description {Build with ldap support} {
258    configure.args-replace  -Dldap=OFF -Dldap=ON
259#   configure.args-append   -DLDAP_INCLUDE_DIR="${prefix}/include" \
260#                           -DLDAP_LIBRARY="${prefix}/lib"
261    depends_lib-append      port:openldap
262}
263
264variant roofit description {Build the RooFit advanced fitting package} {
265    configure.args-replace  -Droofit=OFF -Droofit=ON
266}
267
268variant tmva description {Build the TMVA package} {
269    configure.args-replace  -Dtmva=OFF -Dtmva=ON
270    post-destroot {
271        set tmvaTuts ${destroot}${install_prefix}/share/root/tutorial/tmva
272        file mkdir ${tmvaTuts}
273        foreach f [glob ${worksrcpath}/tmva/test/*] { file copy $f ${tmvaTuts}/ }
274    }
275}
276
277variant minuit2 description {Build with minuit2 support} {
278    configure.args-replace  -Dminuit2=OFF -Dminuit2=ON
279}
280
281variant opengl description {Build with opengl support} {
282    configure.args-delete   -Dopengl=OFF
283    configure.args-delete   -Dbuiltin_glew=OFF
284    configure.args-append   -Dopengl=ON -Dbuiltin_glew=ON
285}
286
287# ========================================================================================
288# Setup various python variants
289# ========================================================================================
290
291# List of possible python versions ( 3.x does not seem to work yet )
292set python_versions { 2.6 2.7 }
293
294# Define the available variants
295foreach ver ${python_versions} {
296    set ver_no_dot [join [split ${ver} "."] ""]
297    set variant_line {variant python${ver_no_dot} description "Build with python ${ver} support"}
298    foreach over ${python_versions} {
299        if { ${ver} == ${over} } { continue }
300        set over_no_dot [join [split ${over} "."] ""]
301        append variant_line " conflicts python${over_no_dot}"
302    }
303    append variant_line { { } }
304    eval $variant_line
305}
306
307# Is a variant active ?
308set active_python_variant ""
309foreach ver ${python_versions} {
310    set ver_no_dot [join [split ${ver} "."] ""]
311    if {[variant_isset python${ver_no_dot}]} {
312        set active_python_variant ${ver}
313    }
314}
315
316# If so, set it up.
317if { ${active_python_variant} != "" } {
318    set ver_no_dot [join [split ${active_python_variant} "."] ""]
319    set portname root5
320    if {![catch {set result [active_variants ${portname} python${ver_no_dot}]}]} {
321        if {$result} {
322            ui_error "Cannot install ${name} with +python${ver_no_dot} variant"
323            return -code error "${portname} port is already installed with +python${ver_no_dot} and both cannot be active at once. Pick a different python variant."
324        }
325    }
326    set mypydir ${prefix}/Library/Frameworks/Python.framework/Versions/${active_python_variant}
327    configure.args-replace  -Dpython=OFF -Dpython=ON
328    configure.args-append   -DPYTHON_INCLUDE_DIR="${mypydir}/Headers" \
329                            -DPYTHON_LIBRARY="${prefix}/lib/libpython${active_python_variant}.dylib" \
330                            -DPYTHON_EXECUTABLE="${prefix}/bin/python${active_python_variant}"
331    depends_lib-append      port:python${ver_no_dot}
332    post-destroot {
333        set mypylibdir  ${prefix}/Library/Frameworks/Python.framework/Versions/${active_python_variant}/lib/python${active_python_variant}
334        set mypysitedir ${mypylibdir}/site-packages/
335        file mkdir ${destroot}${mypysitedir}
336        foreach pyfile [glob ${destroot}${install_prefix}/lib/root/*.py*] { move $pyfile ${destroot}${mypysitedir}/ }
337        ln -sf ${install_prefix}/lib/root/libPyROOT.so ${destroot}${mypylibdir}/
338    }
339}
340
341# ========================================================================================
342
343variant ssl description {Build with ssl support} {
344    configure.args-replace  -Dssl=OFF -Dssl=ON
345#   configure.args-append   -DOPENSSL_INCLUDE_DIR="${prefix}/include" \
346#                           -DOPENSSL_SSL_LIBRARY="${prefix}/lib/libssl.dylib" \
347#                           -DOPENSSL_CRYPTO_LIBRARY="${prefix}/lib/libcrypto.dylib"
348    depends_lib-append      port:openssl
349}
350
351variant xml description {Build with xml support} {
352    configure.args-replace  -Dxml=OFF -Dxml=ON
353    configure.args-append   -DLIBXML2_INCLUDE_DIR="${prefix}/include/libxml2" \
354                            -DLIBXML2_LIBRARIES="${prefix}/lib/libxml2.dylib" \
355                            -DLIBXML2_XMLLINT_EXECUTABLE="${prefix}/bin/xmllint"
356    depends_lib-append      port:libxml2
357}
358
359variant mysql conflicts mysql51 mysql55 mariadb percona description {Build with mysql5 support} {
360    configure.args-replace  -Dmysql=OFF -Dmysql=ON
361    configure.args-append   -DMYSQL_CONFIG_EXECUTABLE=${prefix}"/lib/mysql5/bin/mysql_config"
362    depends_lib-append      port:mysql5
363}
364
365variant mysql51 conflicts mysql mysql55 mariadb percona description {Build with mysql51 support} {
366    configure.args-replace  -Dmysql=OFF -Dmysql=ON
367    configure.args-append   -DMYSQL_CONFIG_EXECUTABLE=${prefix}"/lib/mysql51/bin/mysql_config"
368    depends_lib-append      port:mysql51
369}
370
371variant mysql55 conflicts mysql mysql51 mariadb percona description {Build with mysql55 support} {
372    configure.args-replace  -Dmysql=OFF -Dmysql=ON
373    configure.args-append   -DMYSQL_CONFIG_EXECUTABLE=${prefix}"/lib/mysql55/bin/mysql_config"
374    depends_lib-append      port:mysql55
375}
376
377variant mariadb conflicts mysql mysql51 mysql55 percona description {Build with mariadb support} {
378    configure.args-replace  -Dmysql=OFF -Dmysql=ON
379    configure.args-append   -DMYSQL_CONFIG_EXECUTABLE=${prefix}"/lib/mariadb/bin/mysql_config"
380    depends_lib-append      port:mariadb
381}
382
383variant percona conflicts mysql mysql51 mysql55 mariadb description {Build with percona support} {
384    configure.args-replace  -Dmysql=OFF -Dmysql=ON
385    configure.args-append   -DMYSQL_CONFIG_EXECUTABLE=${prefix}"/lib/percona/bin/mysql_config"
386    depends_lib-append      port:percona
387}
388
389# TODO - Doesn't seem to work. To be reported upstream..
390# variant postgresql90 conflicts postgresql92 description {Build with PostgreSQL 9.0 support} {
391#     configure.args-replace -Dpgsql=OFF -Dpgsql=ON
392#     configure.args-append  -DPOSTGRESQL_INCLUDE_DIR="${prefix}/include/postgresql90" \
393#                            -DPOSTGRESQL_LIBRARIES="${prefix}/lib/postgresql90"
394#     depends_lib-append      port:libpqxx port:postgresql90
395# }
396
397# TODO - Doesn't seem to work. To be reported upstream..
398# variant postgresql92 conflicts postgresql90 description {Build with PostgreSQL 9.2 support} {
399#     configure.args-replace -Dpgsql=OFF -Dpgsql=ON
400#     configure.args-append  -DPOSTGRESQL_INCLUDE_DIR="${prefix}/include/postgresql92" \
401#                            -DPOSTGRESQL_LIBRARIES="${prefix}/lib/postgresql92"
402#     depends_lib-append      port:libpqxx port:postgresql92
403# }
404
405# variant oracle description {Build with Oracle support} {
406#     configure.args-replace --disable-oracle --enable-oracle
407#     configure.args-append  -DORACLE_PATH_INCLUDES="${prefix}/lib/oracle/sdk/include" \
408#                            -DORACLE_PATH_LIB="${prefix}/lib/oracle" \
409#                            -DORACLE_OCI_VERSION=8
410#     depends_lib-append     port:oracle-instantclient
411# }
412
413variant pythia description {Enables Pythia 8 support} {
414    configure.args-replace  -Dpythia8=OFF -Dpythia8=ON
415    configure.args-append   -DPYTHIA8_INCLUDE_DIR=${prefix}/include/pythia \
416                            -DPYTHIA8_LIBRARY=${prefix}/lib/libpythia8.dylib
417    depends_lib-append      port:pythia
418}
419
420variant cocoa conflicts x11 description {Enables native OSX graphical backend} {
421    # Enable cocoa support in configure
422    configure.args-append   -Dcocoa=ON
423}
424
425variant x11 conflicts cocoa description {Enables X11 graphical backend} {
426    # Dependencies on X11 ports
427    depends_lib-append      port:xorg-libX11 port:mesa port:Xft2 port:xpm
428    # Disable cocoa
429    configure.args-append   -Dcocoa=OFF
430}
431
432# If neither graphical variant is set, use default
433if { ![variant_isset cocoa] && ![variant_isset x11] } {
434    default_variants-append ${default_gui_variant}
435}
436
437# ========================================================================================
438# Setup various clang variants, to provide alternative C++ compilers that support cocoa
439# ========================================================================================
440
441# List of possible clang versions that work
442set clang_versions { 3.3 3.4 3.5 }
443
444# Define the available variants
445foreach ver ${clang_versions} {
446    set ver_no_dot [join [split ${ver} "."] ""]
447    set variant_line {variant clang${ver_no_dot} description "Compile using MacPorts clang ${ver}"}
448    foreach over ${clang_versions} {
449        if { ${ver} == ${over} } { continue }
450        set over_no_dot [join [split ${over} "."] ""]
451        append variant_line " conflicts clang${over_no_dot}"
452    }
453    append variant_line { { } }
454    eval $variant_line
455}
456
457# Is a variant active ?
458set active_clang_variant ""
459foreach ver ${clang_versions} {
460    set ver_no_dot [join [split ${ver} "."] ""]
461    if {[variant_isset clang${ver_no_dot}]} {
462        set active_clang_variant ${ver}
463    }
464}
465
466# If so, set it up.
467if { ${active_clang_variant} != "" } {
468    configure.compiler      macports-clang-${active_clang_variant}
469    # TODO
470    # configure.args-append   --with-llvm-config="${prefix}/bin/llvm-config-mp-"${active_clang_variant}
471    depends_run-append      port:clang-${active_clang_variant}
472}
473
474# ========================================================================================
475# Following is for fortran support
476# Might eventually move to a portgroup, or similar, so could be simplified.
477# Based on recipe from https://trac.macports.org/wiki/PortfileRecipes#fortran
478# Note that g95 does not work here, so that variant is removed
479# ========================================================================================
480
481set gcc_versions { 4.7 4.8 4.9 }
482set default_fortran_variant +gcc48
483
484foreach ver ${gcc_versions} {
485    set ver_no_dot [join [split ${ver} "."] ""]
486
487    set variant_line {variant gcc${ver_no_dot} description "Build with gfortran from gcc${ver_no_dot}"}
488
489    foreach over ${gcc_versions} {
490        if {${ver} == ${over}} {
491            continue
492        }
493
494        set over_no_dot [join [split ${over} "."] ""]
495        append variant_line " conflicts gcc${over_no_dot}"
496    }
497    append variant_line { {} }
498
499    eval $variant_line
500
501    if {[variant_isset gcc${ver_no_dot}]} {
502        if {${default_fortran_variant} != "+gcc${ver_no_dot}"} {
503            set default_fortran_variant ""
504        }
505    }
506}
507
508if {${default_fortran_variant} != ""} {
509    default_variants-append "${default_fortran_variant}"
510}
511
512foreach ver ${gcc_versions} {
513    set ver_no_dot [join [split ${ver} "."] ""]
514
515    if {[variant_isset gcc${ver_no_dot}]} {
516        depends_lib-append path:lib/libgcc/libgcc_s.1.dylib:libgcc
517        depends_build-append port:gcc${ver_no_dot}
518
519        configure.fc  ${prefix}/bin/gfortran-mp-${ver}
520        configure.f77 ${prefix}/bin/gfortran-mp-${ver}
521        configure.f90 ${prefix}/bin/gfortran-mp-${ver}
522
523        configure.args-replace -Dfortran=OFF -Dfortran=ON
524    }
525}
526
527# ========================================================================================
528
529# Problems finding includes ...
530# variant ruby description {Build with ruby support} {
531#     configure.args-replace  -Druby=OFF -Druby=ON
532#     depends_lib-append      port:ruby
533# }
534
535# TODO
536# livecheck.type              regex
537# livecheck.url               http://root.cern.ch/svn/root/trunk
538# livecheck.regex             ${name}_v(\[0-9a-z.\]+)\\.source
Note: See TracBrowser for help on using the repository browser.