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

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

root6: no cppflags (#42872), use proper clang variant (#43917), set version_major automatically

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