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