9231a3e5261a879f84ce7c434af977b517dc2906
[gentoo.git] / sci-physics / root / root-9999.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 CMAKE_BUILD_TYPE=Release
7 # ninja does not work due to fortran
8 CMAKE_MAKEFILE_GENERATOR=emake
9 FORTRAN_NEEDED="fortran"
10 PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
11
12 inherit cmake-utils eapi7-ver elisp-common eutils fortran-2 \
13         prefix python-single-r1 toolchain-funcs
14
15 if [[ ${PV} == "9999" ]] ; then
16         inherit git-r3
17         KEYWORDS=""
18         EGIT_REPO_URI="http://root.cern/git/root.git"
19         SLOT=0
20 else
21         KEYWORDS="~amd64 ~x86"
22         SRC_URI="https://root.cern/download/${PN}_v${PV}.source.tar.gz"
23         SLOT="$(ver_cut 1-2)/$(ver_cut 3)"
24 fi
25
26 DESCRIPTION="C++ data analysis framework and interpreter from CERN"
27 HOMEPAGE="https://root.cern"
28
29 IUSE="+X avahi aqua +asimage +davix emacs +examples fits fftw fortran
30         +gdml graphviz +gsl http jemalloc kerberos ldap libcxx memstat
31         +minuit mysql odbc +opengl oracle postgres prefix pythia6 pythia8
32         +python qt4 qt5 R +roofit root7 shadow sqlite +ssl table +tbb test
33         +threads +tiff +tmva +unuran vc xinetd +xml xrootd"
34
35 LICENSE="LGPL-2.1 freedist MSttfEULA LGPL-3 libpng UoI-NCSA"
36
37 REQUIRED_USE="
38         !X? ( !asimage !opengl !qt4 !qt5 !tiff )
39         python? ( ${PYTHON_REQUIRED_USE} )
40         tmva? ( gsl )
41         davix? ( ssl xml )
42 "
43
44 CDEPEND="
45         app-arch/lz4
46         app-arch/xz-utils
47         fortran? ( dev-lang/cfortran )
48         dev-libs/libpcre:3=
49         dev-libs/xxhash
50         media-fonts/dejavu
51         media-libs/freetype:2=
52         media-libs/libpng:0=
53         sys-devel/llvm:5=
54         sys-libs/ncurses:=
55         sys-libs/zlib
56         X? (
57                 x11-libs/libX11:0=
58                 x11-libs/libXext:0=
59                 x11-libs/libXft:0=
60                 x11-libs/libXpm:0=
61                 opengl? (
62                         media-libs/ftgl:0=
63                         media-libs/glew:0=
64                         virtual/opengl
65                         virtual/glu
66                         x11-libs/gl2ps:0=
67                 )
68                 qt4? (
69                         dev-qt/qtcore:4=
70                         dev-qt/qtgui:4=
71                 )
72                 qt5? (
73                         dev-qt/qtcore:5=
74                         dev-qt/qtgui:5=
75                         dev-qt/qtwebengine:5=
76                 )
77         )
78         asimage? ( || (
79                 media-libs/libafterimage[gif,jpeg,png,tiff?]
80                 >=x11-wm/afterstep-2.2.11[gif,jpeg,png,tiff?]
81         ) )
82         avahi? ( net-dns/avahi[mdnsresponder-compat] )
83         davix? ( net-libs/davix )
84         emacs? ( virtual/emacs )
85         fftw? ( sci-libs/fftw:3.0= )
86         fits? ( sci-libs/cfitsio:0= )
87         graphviz? ( media-gfx/graphviz:0= )
88         gsl? ( sci-libs/gsl )
89         http? ( dev-libs/fcgi:0= )
90         jemalloc? ( dev-libs/jemalloc )
91         kerberos? ( virtual/krb5 )
92         ldap? ( net-nds/openldap:0= )
93         libcxx? ( sys-libs/libcxx )
94         unuran? ( sci-mathematics/unuran:0= )
95         minuit? ( !sci-libs/minuit )
96         mysql? ( virtual/mysql )
97         odbc? ( || ( dev-db/libiodbc dev-db/unixODBC ) )
98         oracle? ( dev-db/oracle-instantclient-basic )
99         postgres? ( dev-db/postgresql:= )
100         pythia6? ( sci-physics/pythia:6= )
101         pythia8? ( sci-physics/pythia:8= )
102         python? ( ${PYTHON_DEPS} )
103         R? ( dev-lang/R )
104         shadow? ( virtual/shadow )
105         sqlite? ( dev-db/sqlite:3 )
106         ssl? ( dev-libs/openssl:0= )
107         tbb? ( dev-cpp/tbb )
108         tmva? ( dev-python/numpy[${PYTHON_USEDEP}] )
109         vc? ( dev-libs/vc )
110         xml? ( dev-libs/libxml2:2= )
111         xrootd? ( net-libs/xrootd:0= )
112 "
113
114 DEPEND="${CDEPEND}
115         virtual/pkgconfig"
116
117 RDEPEND="${CDEPEND}
118         xinetd? ( sys-apps/xinetd )"
119
120 PATCHES=(
121         "${FILESDIR}"/${PN}-6.12.04-no-ocaml.patch
122         "${FILESDIR}"/${PN}-6.13.02-hsimple.patch
123 )
124
125 pkg_setup() {
126         use fortran && fortran-2_pkg_setup
127         use python && python-single-r1_pkg_setup
128
129         echo
130         elog "There are extra options on packages not yet in Gentoo:"
131         elog "Afdsmgrd, AliEn, castor, Chirp, dCache, gfal, Globus, gLite,"
132         elog "HDFS, Monalisa, MaxDB/SapDB, SRP, VecCore."
133         elog "You can use the env variable EXTRA_ECONF variable for this."
134         elog "For example, for Chirp, you would set: "
135         elog "EXTRA_ECONF=\"-Dchirp=ON\""
136         echo
137 }
138
139 src_prepare() {
140         cmake-utils_src_prepare
141
142         sed -i "/CLING_BUILD_PLUGINS/d" interpreter/CMakeLists.txt || die
143
144         # CSS should use local images
145         sed -i -e 's,http://.*/,,' etc/html/ROOT.css || die "html sed failed"
146 }
147
148 # Note: ROOT uses bundled clang because it is patched and API-incompatible
149 #       with vanilla clang. The patches enable the C++ interpreter to work.
150 #       Since ROOT installs many small files into /etc (~100MB in total),
151 #       we install it into another directory to avoid making /etc too big.
152
153 src_configure() {
154         local mycmakeargs=(
155                 -DCMAKE_C_FLAGS="${CFLAGS}"
156                 -DCMAKE_CXX_FLAGS="${CXXFLAGS}"
157                 -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr/$(get_libdir)/${PN}/$(ver_cut 1-2)"
158                 -DCMAKE_INSTALL_MANDIR="${EPREFIX%/}/usr/$(get_libdir)/${PN}/$(ver_cut 1-2)/share/man"
159                 -DMCAKE_INSTALL_LIBDIR=$(get_libdir)
160                 -DDEFAULT_SYSROOT="${EPREFIX}"
161                 -DLLVM_CONFIG="${EPREFIX%/}/usr/lib/llvm/5/bin/llvm-config"
162                 -DCLING_BUILD_PLUGINS=OFF
163                 -Dexplicitlink=ON
164                 -Dexceptions=ON
165                 -Dfail-on-missing=ON
166                 -Dshared=ON
167                 -Dsoversion=ON
168                 -Dbuiltin_llvm=OFF
169                 -Dbuiltin_afterimage=OFF
170                 -Dbuiltin_cfitsio=OFF
171                 -Dbuiltin_davix=OFF
172                 -Dbuiltin_fftw3=OFF
173                 -Dbuiltin_freetype=OFF
174                 -Dbuiltin_ftgl=OFF
175                 -Dbuiltin_gl2ps=OFF
176                 -Dbuiltin_glew=OFF
177                 -Dbuiltin_gsl=OFF
178                 -Dbuiltin_lz4=OFF
179                 -Dbuiltin_lzma=OFF
180                 -Dbuiltin_openssl=OFF
181                 -Dbuiltin_pcre=OFF
182                 -Dbuiltin_tbb=OFF
183                 -Dbuiltin_unuran=OFF
184                 -Dbuiltin_vc=OFF
185                 -Dbuiltin_vdt=OFF
186                 -Dbuiltin_veccore=OFF
187                 -Dbuiltin_xrootd=OFF
188                 -Dbuiltin_xxhash=OFF
189                 -Dbuiltin_zlib=OFF
190                 -Dx11=$(usex X)
191                 -Dxft=$(usex X)
192                 -Dafdsmgrd=OFF
193                 -Dafs=OFF # not implemented
194                 -Dalien=OFF
195                 -Dasimage=$(usex asimage)
196                 -Dastiff=$(usex tiff)
197                 -Dbonjour=$(usex avahi)
198                 -Dlibcxx=$(usex libcxx)
199                 -Dccache=OFF # use ccache via portage
200                 -Dcastor=OFF
201                 -Dchirp=OFF
202                 -Dcling=ON # cling=OFF is broken
203                 -Dcocoa=$(usex aqua)
204                 -Dcxx14=$(usex root7)
205                 -Dcxxmodules=OFF # requires clang, unstable
206                 -Ddavix=$(usex davix)
207                 -Ddcache=OFF
208                 -Dfftw3=$(usex fftw)
209                 -Dfitsio=$(usex fits)
210                 -Dfortran=$(usex fortran)
211                 -Dftgl=$(usex opengl)
212                 -Dgdml=$(usex gdml)
213                 -Dgenvector=ON # genvector=OFF ignored
214                 -Dgeocad=OFF
215                 -Dgfal=OFF
216                 -Dgl2ps=$(usex opengl)
217                 -Dglite=OFF # not implemented
218                 -Dglobus=OFF
219                 -Dgminimal=OFF
220                 -Dgnuinstall=OFF
221                 -Dgsl_shared=$(usex gsl)
222                 -Dgviz=$(usex graphviz)
223                 -Dhdfs=OFF
224                 -Dhttp=$(usex http)
225                 -Dimt=$(usex tbb)
226                 -Djemalloc=$(usex jemalloc)
227                 -Dkrb5=$(usex kerberos)
228                 -Dldap=$(usex ldap)
229                 -Dmathmore=$(usex gsl)
230                 -Dmemstat=$(usex memstat)
231                 -Dminimal=OFF
232                 -Dminuit2=$(usex minuit)
233                 -Dminuit=$(usex minuit)
234                 -Dmonalisa=OFF
235                 -Dmysql=$(usex mysql)
236                 -Dodbc=$(usex odbc)
237                 -Dopengl=$(usex opengl)
238                 -Doracle=$(usex oracle)
239                 -Dpch=ON # pch=OFF is broken
240                 -Dpgsql=$(usex postgres)
241                 -Dpythia6=$(usex pythia6)
242                 -Dpythia8=$(usex pythia8)
243                 -Dpython=$(usex python)
244                 -Dqt5web=$(usex qt5)
245                 -Dqtgsi=$(usex qt4)
246                 -Dqt=$(usex qt4)
247                 -Drfio=OFF
248                 -Droofit=$(usex roofit)
249                 -Droot7=$(usex root7)
250                 -Drootbench=OFF
251                 -Droottest=$(usex test)
252                 -Drpath=ON # needed for multi-slot to work
253                 -Druby=OFF # deprecated and broken
254                 -Druntime_cxxmodules=OFF # does not work yet
255                 -Dr=$(usex R)
256                 -Dsapdb=OFF # not implemented
257                 -Dshadowpw=$(usex shadow)
258                 -Dsqlite=$(usex sqlite)
259                 -Dsrp=OFF # not implemented
260                 -Dssl=$(usex ssl)
261                 -Dtable=$(usex table)
262                 -Dtbb=$(usex tbb)
263                 -Dtcmalloc=OFF
264                 -Dtesting=$(usex test)
265                 -Dthread=$(usex threads)
266                 -Dtmva-cpu=$(usex tmva)
267                 -Dtmva-gpu=OFF
268                 -Dtmva=$(usex tmva)
269                 -Dunuran=$(usex unuran)
270                 -Dvc=$(usex vc)
271                 -Dvdt=OFF
272                 -Dveccore=OFF
273                 -Dxml=$(usex xml)
274                 -Dxrootd=$(usex xrootd)
275                 ${EXTRA_ECONF}
276         )
277
278         cmake-utils_src_configure
279 }
280
281 src_install() {
282         cmake-utils_src_install
283
284         ROOTSYS=${EPREFIX%/}/usr/$(get_libdir)/${PN}/$(ver_cut 1-2)
285         ROOTENV=9999${PN}-$(ver_cut 1-2)
286
287         # ROOT fails without this symlink because it only looks in lib
288         if [[ ! -d ${D}/${ROOTSYS}/lib ]]; then
289                 dosym $(get_libdir) /usr/$(get_libdir)/${PN}/$(ver_cut 1-2)/lib
290         fi
291
292         cat > ${ROOTENV} <<- EOF || die
293         MANPATH="${ROOTSYS}/share/man"
294         PATH="${ROOTSYS}/bin"
295         ROOTPATH="${ROOTSYS}/bin"
296         LDPATH="${ROOTSYS}/$(get_libdir)"
297         EOF
298
299         if use python; then
300                 echo "PYTHONPATH=${ROOTSYS}/$(get_libdir)" >> ${ROOTENV} || die
301         fi
302
303         doenvd ${ROOTENV}
304
305         pushd "${D}/${ROOTSYS}" > /dev/null
306
307         if use emacs; then
308                 elisp-install ${PN}-$(ver_cut 1-2) "${BUILD_DIR}"/root-help.el
309         fi
310
311         if ! use gdml; then
312                 rm -r geom || die
313         fi
314
315         if ! use examples; then
316                 rm -r test tutorials || die
317         fi
318
319         if use tmva; then
320                 rm -r tmva || die
321         fi
322
323         # clean up unnecessary files from installation
324         rm -r bin/clang* config emacs etc/vmc || die
325 }