source: trunk/dports/science/root/Portfile @ 118376

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

root: clang 3.0 3.1 3.2 works ok

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 22.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 118376 2014-04-01 09:59:07Z mojca@macports.org $
3
4PortSystem          1.0
5
6name                root
7version             5.34.18
8
9categories          science
10maintainers         gmail.com:mattiafrancescomoro hep.phy.cam.ac.uk:jonesc
11license             LGPL-2.1+
12description         ROOT is a data analysis framework from CERN
13long_description    The ROOT system provides a set of frameworks with all \
14                    the functionality needed to handle and analyze large amounts \
15                    of data in a very efficient way
16homepage            http://root.cern.ch/
17platforms           darwin
18distname            ${name}_v${version}.source
19master_sites        http://root.cern.ch/download/ \
20                    ftp://root.cern.ch/root/
21
22checksums           rmd160  2fbaff8f831611779b42480fcb86cbde34ef72bd \
23                    sha256  9196dce7d76b31e5bcabd985bd31bc4d9b7c8c4d0c7ce84f730efa4ef82a3567
24
25worksrcdir          root
26
27depends_lib         port:xz \
28                    port:pcre \
29                    port:zlib \
30                    port:jpeg \
31                    port:libpng \
32                    port:giflib \
33                    port:tiff \
34                    port:gmp \
35                    port:expat
36                  # port:freetype
37
38post-patch {
39#   reinplace "s|-lfreetype| \`freetype-config --libs\`|g" ${worksrcpath}/config/root-config.in
40    reinplace "s|\"/usr/include\"|\"${prefix}/include /usr/include\"|g" ${worksrcpath}/configure
41    reinplace "s|/usr/lib |${prefix}/lib /usr/lib |g" ${worksrcpath}/configure
42    reinplace "s|/usr/include |${prefix}/include /usr/include |g" ${worksrcpath}/configure
43    reinplace "s|\"/usr/lib\"|\"${prefix}/lib /usr/lib\"|g" ${worksrcpath}/configure
44}
45
46pre-configure {
47    configure.args-append \
48        --with-cc=${configure.cc} \
49        --with-cxx=${configure.cxx} \
50        --with-ld=${configure.cxx} \
51        --with-f77=${configure.f77}
52    # the build type (32 or 64 bit) -must- be for first argument
53    if {${build_arch} eq "i386" || ${build_arch} eq "ppc"} {
54        configure.pre_args macosx --prefix=${prefix}
55    } else {
56        configure.pre_args macosx64 --prefix=${prefix}
57    }
58}
59
60configure.args      --docdir=${prefix}/share/doc/${name} \
61                    --libdir=${prefix}/lib/${name} \
62                    --testdir=${prefix}/share/${name}/test \
63                    --tutdir=${prefix}/share/${name}/tutorials \
64                    --etcdir=${prefix}/etc/${name} \
65                    --disable-builtin-glew \
66                    --disable-builtin-pcre \
67                    --disable-builtin-zlib \
68                    --disable-builtin-lzma \
69                    --disable-fftw3 \
70                    --disable-krb5 \
71                    --disable-ldap \
72                    --disable-mysql \
73                    --disable-sqlite \
74                    --disable-odbc \
75                    --disable-opengl \
76                    --disable-pythia6 \
77                    --disable-pythia8 \
78                    --disable-roofit \
79                    --disable-ssl \
80                    --disable-xml \
81                    --disable-python \
82                    --disable-fitsio \
83                    --disable-gsl-shared \
84                    --disable-pgsql \
85                    --disable-dcache \
86                    --disable-chirp \
87                    --disable-hdfs \
88                    --disable-ruby \
89                    --disable-minuit2 \
90                    --disable-tmva \
91                    --disable-qt \
92                    --disable-qtgsi \
93                    --disable-bonjour \
94                    --disable-gviz \
95                    --disable-soversion \
96                    --disable-c++11 \
97                    --disable-xrootd \
98                    --enable-builtin-ftgl \
99                    --enable-mathmore \
100                    --enable-genvector \
101                    --enable-memstat \
102                    --enable-unuran \
103                    --enable-reflex \
104                    --enable-table \
105                    --enable-fink \
106                    --enable-gdml \
107                    --enable-builtin-freetype
108
109# TODO: Check ${configure.cxx_stdlib} directly once MacPorts 2.3 is released
110platform darwin {
111    set cxxstdlib {}
112
113    if {[info exists configure.cxx_stdlib] &&
114        ${configure.cxx_stdlib} ne {} &&
115        [string match *clang* ${configure.cxx}]} {
116        set cxxstdlib ${configure.cxx_stdlib}
117    } elseif {[string match *clang* ${configure.cxx}] &&
118              ${os.major} >= 13} {
119        set cxxstdlib libc++
120    } else {
121        set cxxstdlib libstdc++
122    }
123
124    if {${cxxstdlib} eq "libc++"} {
125        configure.args-delete --disable-c++11
126        configure.args-append --enable-c++11
127    }
128}
129
130universal_variant   no
131
132default_variants    +ssl +xml +gsl +minuit2 +tmva +roofit +graphviz +opengl +soversion
133
134# Since ROOT 5.34.15 the cocoa backend is default on OSX 10.8 or newer
135# We also make it default on 10.7
136if {${os.major} > 10} {
137    set default_gui_variant +cocoa
138} else {
139    set default_gui_variant +x11
140}
141
142post-destroot {
143    reinplace "s|lib/python/genreflex|lib/root/python/genreflex|g" ${destroot}${prefix}/bin/genreflex
144}
145
146variant debug description {Enable a debug build} {
147    configure.args-append --build=debug
148}
149
150variant xrootd description {Build with XRootD support} {
151    configure.args-delete   --disable-xrootd
152    configure.args-append   --enable-xrootd \
153                            --with-xrootd-incdir="${prefix}/include/xrootd" \
154                            --with-xrootd-libdir="${prefix}/lib"
155    depends_lib-append      port:xrootd
156}
157
158variant soversion description {Build with soversion support} {
159    configure.args-delete   --disable-soversion
160    configure.args-append   --enable-soversion
161}
162
163variant graphviz description {Build with graphviz support} {
164    configure.args-delete   --disable-gviz
165    configure.args-append   --enable-gviz \
166                            --with-gviz-incdir="${prefix}/include/graphviz" \
167                            --with-gviz-libdir="${prefix}/lib"
168    depends_lib-append      path:bin/dot:graphviz
169}
170
171variant avahi description {Build with avahi support} {
172    configure.args-delete   --disable-bonjour
173    configure.args-append   --enable-bonjour \
174                            --with-avahi-incdir="${prefix}/include" \
175                            --with-avahi-libdir="${prefix}/lib"
176    depends_lib-append      port:avahi
177}
178
179variant fftw3 description {Build with fftw3 support} {
180    configure.args-delete   --disable-fftw3
181    configure.args-append   --enable-fftw3 \
182                            --with-fftw3-incdir="${prefix}/include" \
183                            --with-fftw3-libdir="${prefix}/lib"
184    depends_lib-append      port:fftw-3
185}
186
187variant gsl description {Build with gsl support} {
188    configure.args-delete   --disable-gsl-shared
189    configure.args-append   --enable-gsl-shared \
190                            --with-gsl-incdir="${prefix}/include" \
191                            --with-gsl-libdir="${prefix}/lib"
192    depends_lib-append      port:gsl
193}
194
195variant fitsio description {Build with fitsio support} {
196    configure.args-delete   --disable-fitsio
197    configure.args-append   --enable-fitsio \
198                            --with-cfitsio-incdir="${prefix}/include" \
199                            --with-cfitsio-libdir="${prefix}/lib"
200    depends_lib-append      port:cfitsio
201}
202
203variant odbc description {Build with odbc support} {
204    configure.args-delete   --disable-odbc
205    configure.args-append   --enable-odbc \
206                            --with-odbc-incdir="${prefix}/include" \
207                            --with-odbc-libdir="${prefix}/lib"
208    depends_lib-append      port:libiodbc
209}
210
211variant ldap description {Build with ldap support} {
212    configure.args-delete   --disable-ldap
213    configure.args-append   --enable-ldap \
214                            --with-ldap-incdir="${prefix}/include" \
215                            --with-ldap-libdir="${prefix}/lib"
216    depends_lib-append      port:openldap
217}
218
219variant roofit description {Build the RooFit advanced fitting package} {
220    configure.args-delete   --disable-roofit
221    configure.args-append   --enable-roofit
222}
223
224variant tmva description {Build the TMVA package} {
225    configure.args-delete   --disable-tmva
226    configure.args-append   --enable-tmva
227    post-destroot {
228        set tmvaTuts ${destroot}${prefix}/share/${name}/tutorials/tmva
229        file mkdir ${tmvaTuts}
230        foreach f [glob ${worksrcpath}/tmva/test/*] { file copy $f ${tmvaTuts}/ }
231    }
232}
233
234variant minuit2 description {Build with minuit2 support} {
235    configure.args-delete   --disable-minuit2
236    configure.args-append   --enable-minuit2
237}
238
239variant opengl description {Build with opengl support} {
240    configure.args-delete   --disable-opengl
241    configure.args-delete   --disable-builtin-glew
242    configure.args-append   --enable-opengl --enable-builtin-glew
243}
244
245# ========================================================================================
246# Setup various python variants
247# ========================================================================================
248
249# List of possible python versions
250set python_versions { 2.6 2.7 3.1 3.2 3.3 3.4 }
251
252# Define the available variants
253foreach ver ${python_versions} {
254    set ver_no_dot [join [split ${ver} "."] ""]
255    set variant_line {variant python${ver_no_dot} description "Build with python ${ver} support"}
256    foreach over ${python_versions} {
257        if { ${ver} == ${over} } { continue }
258        set over_no_dot [join [split ${over} "."] ""]
259        append variant_line " conflicts python${over_no_dot}"
260    }
261    append variant_line { {} }
262    eval $variant_line
263}
264
265# Is a variant active ?
266set active_python_variant ""
267foreach ver ${python_versions} {
268    set ver_no_dot [join [split ${ver} "."] ""]
269    if {[variant_isset python${ver_no_dot}]} {
270        set active_python_variant ${ver}
271    }
272}
273
274# If so, set it up.
275if { ${active_python_variant} != "" } {
276    set ver_no_dot [join [split ${active_python_variant} "."] ""]
277    set mypydir ${prefix}/Library/Frameworks/Python.framework/Versions/${active_python_variant}
278    configure.args-delete   --disable-python
279    configure.args-append   --enable-python \
280                            --with-python-incdir="${mypydir}/Headers" \
281                            --with-python-libdir="${mypydir}"
282    depends_lib-append      port:python${ver_no_dot}
283    post-destroot {
284        set mypylibdir  ${prefix}/Library/Frameworks/Python.framework/Versions/${active_python_variant}/lib/python${active_python_variant}
285        set mypysitedir ${mypylibdir}/site-packages/
286        file mkdir ${destroot}${mypysitedir}
287        foreach pyfile [glob ${destroot}${prefix}/lib/root/*.py*] { move $pyfile ${destroot}${mypysitedir} }
288        ln -sf ${prefix}/lib/root/libPyROOT.so ${destroot}${mypylibdir}/
289    }
290}
291
292# ========================================================================================
293
294variant ruby description {Build with ruby support} {
295    configure.args-delete   --disable-ruby
296    configure.args-append   --enable-ruby
297    depends_lib-append      port:ruby
298}
299
300variant ssl description {Build with ssl support} {
301    configure.args-delete   --disable-ssl
302    configure.args-append   --enable-ssl \
303                            --with-ssl-shared=yes \
304                            --with-ssl-incdir="${prefix}/include" \
305                            --with-ssl-libdir="${prefix}/lib"
306    depends_lib-append      port:openssl
307}
308
309variant xml description {Build with xml support} {
310    configure.args-delete   --disable-xml
311    configure.args-append   --enable-xml \
312                            --with-xml-incdir="${prefix}/include/libxml2" \
313                            --with-xml-libdir="${prefix}/lib"
314    depends_lib-append      port:libxml2
315}
316
317variant sqlite3 description {Build with sqlite3 support} {
318    configure.args-delete   --disable-sqlite
319    configure.args-append   --enable-sqlite \
320                            --with-sqlite-incdir="${prefix}/include" \
321                            --with-sqlite-libdir="${prefix}/lib"
322    depends_lib-append      port:sqlite3
323}
324
325variant mysql conflicts mysql51 mysql55 mariadb percona description {Build with mysql5 support} {
326    configure.args-delete   --disable-mysql
327    configure.args-append   --enable-mysql \
328                            --with-mysql-incdir="${prefix}/include/mysql5/mysql" \
329                            --with-mysql-libdir="${prefix}/lib/mysql5/mysql"
330    depends_lib-append      port:mysql5
331}
332
333variant mysql51 conflicts mysql mysql55 mariadb percona description {Build with mysql51 support} {
334    configure.args-delete   --disable-mysql
335    configure.args-append   --enable-mysql \
336                            --with-mysql-incdir="${prefix}/include/mysql51/mysql" \
337                            --with-mysql-libdir="${prefix}/lib/mysql51/mysql"
338    depends_lib-append      port:mysql51
339}
340
341variant mysql55 conflicts mysql mysql51 mariadb percona description {Build with mysql55 support} {
342    configure.args-delete   --disable-mysql
343    configure.args-append   --enable-mysql \
344                            --with-mysql-incdir="${prefix}/include/mysql55/mysql" \
345                            --with-mysql-libdir="${prefix}/lib/mysql55/mysql"
346    depends_lib-append      port:mysql55
347}
348
349variant mariadb conflicts mysql mysql51 mysql55 percona description {Build with mariadb support} {
350    configure.args-delete   --disable-mysql
351    configure.args-append   --enable-mysql \
352                            --with-mysql-incdir="${prefix}/include/mariadb/mysql" \
353                            --with-mysql-libdir="${prefix}/lib/mariadb/mysql"
354    depends_lib-append      port:mariadb
355}
356
357variant percona conflicts mysql mysql51 mysql55 mariadb description {Build with percona support} {
358    configure.args-delete   --disable-mysql
359    configure.args-append   --enable-mysql \
360                            --with-mysql-incdir="${prefix}/include/percona/mysql" \
361                            --with-mysql-libdir="${prefix}/lib/percona/mysql"
362    depends_lib-append      port:percona
363}
364
365variant postgresql90 conflicts postgresql92 description {Build with PostgreSQL 9.0 support} {
366    configure.args-delete   --disable-pgsql
367    configure.args-append   --enable-pgsql \
368                            --with-pgsql-incdir="${prefix}/include/postgresql90" \
369                            --with-pgsql-libdir="${prefix}/lib/postgresql90"
370    depends_lib-append      port:libpqxx port:postgresql90
371}
372
373variant postgresql92 conflicts postgresql90 description {Build with PostgreSQL 9.2 support} {
374    configure.args-delete   --disable-pgsql
375    configure.args-append   --enable-pgsql \
376                            --with-pgsql-incdir="${prefix}/include/postgresql92" \
377                            --with-pgsql-libdir="${prefix}/lib/postgresql92"
378    depends_lib-append      port:libpqxx port:postgresql92
379}
380
381variant pythia description {Pythia 8 support for root} {
382    configure.args-delete   --disable-pythia8
383    configure.args-append   --enable-pythia8 \
384                            --with-pythia8-incdir=${prefix}/include/pythia \
385                            --with-pythia8-libdir=${prefix}/lib
386    depends_lib-append      port:pythia
387}
388
389# The cocoa variant doesn't work on 10.6; source code uses functions first introduced in 10.7,
390# but fixing the code is doable if someone had sufficient motivation
391variant cocoa conflicts x11 description {Enables native OSX graphical backend} {
392    # Force a compatible clang compiler
393    PortGroup compiler_blacklist_versions 1.0
394    # it works with clang 3.0 and later (clang < 425 might not be exact)
395    compiler.blacklist-append {clang < 425} *gcc* macports-clang-2.9
396    # compiler fallback is probably only relevant on 10.6 (where +cocoa doesn't work at all)
397    compiler.fallback-append macports-clang-3.2 macports-clang-3.1 macports-clang-3.4 macports-clang-3.3
398    # Enable cocoa support in configure
399    configure.args-delete --disable-cocoa
400    configure.args-append --enable-cocoa
401    # patch afterimage build to make sure TIFF suport is disabled. Causes problems with cocoa...
402    patchfiles-append patch-builtin-afterimage-disabletiff.diff
403}
404
405variant x11 conflicts cocoa description {Enables X11 graphical backend} {
406    # Dependencies on X11 ports
407    depends_lib-append port:xorg-libX11 port:mesa port:Xft2 port:xpm
408    # Disable cocoa
409    configure.args-append --disable-cocoa
410}
411
412# If neither graphical variant is set, use default
413if { ![variant_isset cocoa] && ![variant_isset x11] } {
414    default_variants-append ${default_gui_variant}
415}
416
417# ========================================================================================
418# Setup various clang variants, to provide alternative C++ compilers that support cocoa
419# ========================================================================================
420
421# List of possible clang versions that work
422set clang_versions { 3.0 3.1 3.2 3.3 3.4 3.5 }
423
424# Define the available variants
425foreach ver ${clang_versions} {
426    set ver_no_dot [join [split ${ver} "."] ""]
427    set variant_line {variant clang${ver_no_dot} description "Compile using MacPorts clang ${ver}"}
428    foreach over ${clang_versions} {
429        if { ${ver} == ${over} } { continue }
430        set over_no_dot [join [split ${over} "."] ""]
431        append variant_line " conflicts clang${over_no_dot}"
432    }
433    append variant_line { { } }
434    eval $variant_line
435}
436
437# Is a variant active ?
438set active_clang_variant ""
439foreach ver ${clang_versions} {
440    set ver_no_dot [join [split ${ver} "."] ""]
441    if {[variant_isset clang${ver_no_dot}]} {
442        set active_clang_variant ${ver}
443    }
444}
445
446# If so, set it up.
447if { ${active_clang_variant} != "" } {
448    configure.compiler      macports-clang-${active_clang_variant}
449    configure.args-append   --with-llvm-config="${prefix}/bin/llvm-config-mp-"${active_clang_variant}
450    depends_run-append      port:clang-${active_clang_variant}
451}
452
453# ========================================================================================
454
455variant qt_mac description {Build with Qt support via Mac UI} {
456    post-patch {
457        # fix where "qglobal.h" is found in all files that use or reference it
458        foreach tpf { configure graf2d/qt/src/TGQt.cxx } {
459            reinplace "s@Qt/qglobal\\.h@QtCore/qglobal\\.h@g" \
460                ${worksrcpath}/${tpf}
461        }
462        reinplace "/qttestdir/s@Qt@QtCore@g" ${worksrcpath}/configure
463
464        # fix library search extensions to include ".la"
465        # for Qt framework libraries (only)
466        reinplace "s@\\(\\.so \\.sl \\.dylib \\.dll\\.a\\)@\\1 \\.la@g" \
467            ${worksrcpath}/configure
468    }
469
470    configure.args-delete   --disable-qt
471    configure.args-delete   --disable-qtgsi
472    configure.args-append   --enable-qt --enable-qtgsi \
473                            --with-qt-incdir="${prefix}/include" \
474                            --with-qt-libdir="${prefix}/lib"
475    depends_lib-append      port:qt4-mac
476
477    post-configure {
478        # patch up the Makefile.config to handle the QTLIB frameworks correctly
479        reinplace "/QTLIB\[ \]/s@:= @:= -F${qt_libs_dir} @" \
480            ${worksrcpath}/config/Makefile.config
481        reinplace "/QTLIB\[ \]/s@\\(Qt\[^ \]*\\).la@-framework \\1@g" \
482            ${worksrcpath}/config/Makefile.config
483    }
484}
485
486if {[variant_isset qt_mac]} {
487    PortGroup qt4 1.0
488}
489
490# ========================================================================================
491# Following is for fortran support
492# Might eventually move to a portgroup, or similar, so could be simplified.
493# Based on recipe from https://trac.macports.org/wiki/PortfileRecipes#fortran
494# Note that g95 does not work here, so that variant is removed
495# ========================================================================================
496
497set gcc_versions {4.3 4.4 4.5 4.6 4.7 4.8 4.9}
498set default_fortran_variant +gcc48
499
500foreach ver ${gcc_versions} {
501    set ver_no_dot [join [split ${ver} "."] ""]
502
503    set variant_line {variant gcc${ver_no_dot} description "Build with gfortran from gcc${ver_no_dot}"}
504
505    foreach over ${gcc_versions} {
506        if {${ver} == ${over}} {
507            continue
508        }
509
510        set over_no_dot [join [split ${over} "."] ""]
511        append variant_line " conflicts gcc${over_no_dot}"
512    }
513    append variant_line { {}}
514
515    eval $variant_line
516
517    if {[variant_isset gcc${ver_no_dot}]} {
518        if {${default_fortran_variant} != "+gcc${ver_no_dot}"} {
519            set default_fortran_variant ""
520        }
521    }
522}
523
524if {${default_fortran_variant} != ""} {
525    default_variants-append "${default_fortran_variant}"
526}
527
528foreach ver ${gcc_versions} {
529    set ver_no_dot [join [split ${ver} "."] ""]
530
531    if {[variant_isset gcc${ver_no_dot}]} {
532        depends_lib-append path:lib/libgcc/libgcc_s.1.dylib:libgcc
533        depends_build-append port:gcc${ver_no_dot}
534
535        configure.fc  ${prefix}/bin/gfortran-mp-${ver}
536        configure.f77 ${prefix}/bin/gfortran-mp-${ver}
537        configure.f90 ${prefix}/bin/gfortran-mp-${ver}
538    }
539}
540
541# ========================================================================================
542
543livecheck.type              regex
544livecheck.url               [lindex ${master_sites} 0]
545livecheck.regex             ${name}_v(\[0-9a-z.\]+)\\.source
546
547# ========================================================================================
548# The following have build issues, are obsolete or experimental.
549# ========================================================================================
550
551# Intefers with builtin freetype build (enforced by cocoa variant)
552# Also do not seem to be actually needed any more
553#pre-build {
554#    build.args      CC=${configure.cc} \
555#                    CXX=${configure.cxx} \
556#                    F77=${configure.f77}
557#}
558
559# variant kerberos5 description {Build with kerberos5 support} {
560#     configure.args-delete   --disable-krb5
561#     configure.args-append   --enable-krb5 \
562#                             --with-krb5-incdir="${prefix}/include" \
563#                             --with-krb5-libdir="${prefix}/lib"
564#      depends_lib-append      port:kerberos5
565# }
566
567# variant ftgl description {Build with ftgl support} {
568#     configure.args-delete   --enable-builtin-ftgl
569#     configure.args-append   --disable-builtin-ftgl \
570#     configure.args-append   --with-ftgl-incdir="${prefix}/include" \
571#                             --with-ftgl-libdir="${prefix}/lib"
572#     depends_lib-append      port:ftgl
573# }
574
575# variant qt_x11 conflicts qt_mac description {Build with Qt support via X11 UI} {
576#     # fix where "qglobal.h" is found in all files that use or reference it
577#     post-patch {
578#         foreach tpf { configure graf2d/qt/src/TGQt.cxx } {
579#             reinplace "s@Qt/qglobal\\.h@QtCore/qglobal\\.h@g" \
580#                 ${worksrcpath}/${tpf}
581#         }
582#         reinplace "/qttestdir/s@Qt@QtCore@g" ${worksrcpath}/configure
583#     }
584
585#     configure.env-append    QTDIR=${prefix}/libexec/qt4-x11
586#     configure.args-delete   --disable-qt
587#     configure.args-delete   --disable-qtgsi
588#     configure.args-append   --enable-qt --enable-qtgsi \
589#                             --with-qt-incdir="${prefix}/include" \
590#                             --with-qt-libdir="${prefix}/lib"
591#     depends_lib-append      port:qt4-x11
592# }
Note: See TracBrowser for help on using the repository browser.