1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 # ninja does not work due to fortran
7 CMAKE_MAKEFILE_GENERATOR=emake
8 FORTRAN_NEEDED="fortran"
9 PYTHON_COMPAT=( python2_7 python3_{6,7} )
11 inherit cmake-utils cuda eapi7-ver elisp-common eutils fortran-2 \
12 prefix python-single-r1 toolchain-funcs
14 DESCRIPTION="C++ data analysis framework and interpreter from CERN"
15 HOMEPAGE="https://root.cern"
16 SRC_URI="https://root.cern/download/${PN}_v${PV}.source.tar.gz"
18 IUSE="+X aqua +asimage +c++11 c++14 c++17 cuda +davix debug emacs
19 +examples fits fftw fortran +gdml graphviz +gsl http libcxx +minuit
20 mpi mysql odbc +opengl oracle postgres prefix pythia6 pythia8 +python
21 qt5 R +roofit root7 shadow sqlite +ssl +tbb test +tmva +unuran vc
23 RESTRICT="!test? ( test )"
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"
30 ^^ ( c++11 c++14 c++17 )
32 !X? ( !asimage !opengl !qt5 )
34 python? ( ${PYTHON_REQUIRED_USE} )
36 root7? ( || ( c++14 c++17 ) )
44 fortran? ( dev-lang/cfortran )
67 dev-qt/qtwebengine:5[widgets]
70 asimage? ( media-libs/libafterimage[gif,jpeg,png,tiff] )
71 cuda? ( >=dev-util/nvidia-cuda-toolkit-9.0 )
72 davix? ( net-libs/davix )
73 emacs? ( >=app-editors/emacs-23.1:* )
74 fftw? ( sci-libs/fftw:3.0= )
75 fits? ( sci-libs/cfitsio:0= )
76 graphviz? ( media-gfx/graphviz )
77 gsl? ( sci-libs/gsl:= )
78 http? ( dev-libs/fcgi:0= )
79 libcxx? ( sys-libs/libcxx )
80 unuran? ( sci-mathematics/unuran:0= )
81 minuit? ( !sci-libs/minuit )
83 mysql? ( dev-db/mysql-connector-c )
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} )
91 shadow? ( sys-apps/shadow )
92 sqlite? ( dev-db/sqlite:3 )
93 ssl? ( dev-libs/openssl:0= )
94 tbb? ( >=dev-cpp/tbb-2018 )
96 $(python_gen_cond_dep '
97 dev-python/numpy[${PYTHON_MULTI_USEDEP}]
100 vc? ( dev-libs/vc:= )
101 xml? ( dev-libs/libxml2:2= )
102 xrootd? ( net-libs/xrootd:0= )
111 "${FILESDIR}"/${PN}-6.12.06_cling-runtime-sysroot.patch
115 use fortran && fortran-2_pkg_setup
116 use python && python-single-r1_pkg_setup
118 elog "There are extra options on packages not available in Gentoo."
119 elog "You can use the environment variable EXTRA_ECONF to enable"
120 elog "these packages. For example, for Vdt you would set:"
121 elog "EXTRA_ECONF=\"-Dbuiltin_vdt=ON -Dvdt=ON\""
125 use cuda && cuda_src_prepare
127 cmake-utils_src_prepare
129 sed -i "/CLING_BUILD_PLUGINS/d" interpreter/CMakeLists.txt || die
131 # CSS should use local images
132 sed -i -e 's,http://.*/,,' etc/html/ROOT.css || die "html sed failed"
135 # Note: ROOT uses bundled clang because it is patched and API-incompatible
136 # with vanilla clang. The patches enable the C++ interpreter to work.
137 # Since ROOT installs many files into /etc (>100MB in total) that don't
138 # really belong there, we install it into another directory to avoid
139 # making /etc too big.
143 -DCMAKE_C_FLAGS="${CFLAGS}"
144 -DCMAKE_CXX_FLAGS="${CXXFLAGS}"
145 -DCMAKE_CXX_STANDARD=$((usev c++11 || usev c++14 || usev c++17) | cut -c4-)
146 -DPYTHON_EXECUTABLE="${EPREFIX}/usr/bin/${EPYTHON}"
147 -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/${PN}/$(ver_cut 1-2)"
148 -DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/${PN}/$(ver_cut 1-2)/share/man"
149 -DCMAKE_INSTALL_LIBDIR="lib"
150 -DDEFAULT_SYSROOT="${EPREFIX}"
151 -DCLING_BUILD_PLUGINS=OFF
160 -Dbuiltin_afterimage=OFF
161 -Dbuiltin_cfitsio=OFF
164 -Dbuiltin_freetype=OFF
171 -Dbuiltin_openssl=OFF
177 -Dbuiltin_veccore=OFF
185 -Dasimage=$(usex asimage)
186 -Dlibcxx=$(usex libcxx)
187 -Dccache=OFF # use ccache via portage
192 -Dcxxmodules=OFF # requires clang, unstable
193 -Ddavix=$(usex davix)
198 -Dfitsio=$(usex fits)
199 -Dfortran=$(usex fortran)
200 -Dftgl=$(usex opengl)
203 -Dgl2ps=$(usex opengl)
205 -Dgsl_shared=$(usex gsl)
206 -Dgviz=$(usex graphviz)
209 -Dmathmore=$(usex gsl)
210 -Dmemstat=OFF # deprecated
212 -Dminuit2=$(usex minuit)
213 -Dminuit=$(usex minuit)
217 -Dmysql=$(usex mysql)
219 -Dopengl=$(usex opengl)
220 -Doracle=$(usex oracle)
221 -Dpgsql=$(usex postgres)
222 -Dpythia6=$(usex pythia6)
223 -Dpythia8=$(usex pythia8)
224 -Dpython=$(usex python)
226 -Droofit=$(usex roofit)
227 -Droot7=$(usex root7)
231 -Druntime_cxxmodules=OFF # does not work yet
233 -Dshadowpw=$(usex shadow)
234 -Dsqlite=$(usex sqlite)
237 -Dtesting=$(usex test)
239 -Dtmva-cpu=$(usex tmva)
240 -Dtmva-gpu=$(usex cuda)
241 -Dunuran=$(usex unuran)
247 -Dxrootd=$(usex xrootd)
251 CMAKE_BUILD_TYPE=$(usex debug Debug Release) \
252 cmake-utils_src_configure
256 # needed for hsimple.root
258 cmake-utils_src_compile
262 cmake-utils_src_install
264 ROOTSYS=${EPREFIX}/usr/lib/${PN}/$(ver_cut 1-2)
265 ROOTENV="$((9999 - $(ver_cut 2)))${PN}-$(ver_cut 1-2)"
267 cat > ${ROOTENV} <<- EOF || die
268 MANPATH="${ROOTSYS}/share/man"
269 PATH="${ROOTSYS}/bin"
270 ROOTPATH="${ROOTSYS}/bin"
271 LDPATH="${ROOTSYS}/lib"
275 echo "PYTHONPATH=\"${ROOTSYS}/lib\"" >> ${ROOTENV} || die
281 elisp-install ${PN}-$(ver_cut 1-2) "${BUILD_DIR}"/root-help.el
284 pushd "${D}/${ROOTSYS}" > /dev/null
286 rm -r emacs bin/*.{csh,sh,fish} || die
288 if ! use examples; then
289 rm -r tutorials || die
292 # create versioned symlinks for binaries
295 dosym "${exe}" "/usr/lib/${PN}/$(ver_cut 1-2)/bin/${exe}-$(ver_cut 1-2)"