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 jemalloc
20 libcxx memstat +minuit mysql nosplash odbc +opengl oracle postgres
21 prefix pythia6 pythia8 +python qt5 R +roofit root7 shadow sqlite
22 +ssl +tbb test +threads +tiff +tmva +unuran vc +vmc +xml xrootd"
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 !tiff )
34 python? ( ${PYTHON_REQUIRED_USE} )
36 root7? ( || ( c++14 c++17 ) )
43 fortran? ( dev-lang/cfortran )
66 dev-qt/qtwebengine:5[widgets]
69 asimage? ( media-libs/libafterimage[gif,jpeg,png,tiff?] )
70 cuda? ( >=dev-util/nvidia-cuda-toolkit-9.0 )
71 davix? ( net-libs/davix )
72 emacs? ( >=app-editors/emacs-23.1:* )
73 fftw? ( sci-libs/fftw:3.0= )
74 fits? ( sci-libs/cfitsio:0= )
75 graphviz? ( media-gfx/graphviz )
76 gsl? ( sci-libs/gsl:= )
77 http? ( dev-libs/fcgi:0= )
78 jemalloc? ( dev-libs/jemalloc )
79 libcxx? ( sys-libs/libcxx )
80 unuran? ( sci-mathematics/unuran:0= )
81 minuit? ( !sci-libs/minuit )
82 mysql? ( dev-db/mysql-connector-c )
83 odbc? ( || ( dev-db/libiodbc dev-db/unixODBC ) )
84 oracle? ( dev-db/oracle-instantclient-basic )
85 postgres? ( dev-db/postgresql:= )
86 pythia6? ( sci-physics/pythia:6 )
87 pythia8? ( sci-physics/pythia:8 )
88 python? ( ${PYTHON_DEPS} )
90 shadow? ( virtual/shadow )
91 sqlite? ( dev-db/sqlite:3 )
92 ssl? ( dev-libs/openssl:0= )
93 tbb? ( >=dev-cpp/tbb-2018 )
94 tmva? ( dev-python/numpy[${PYTHON_USEDEP}] )
96 xml? ( dev-libs/libxml2:2= )
97 xrootd? ( net-libs/xrootd:0= )
106 "${FILESDIR}"/${PN}-6.12.06_cling-runtime-sysroot.patch
110 use fortran && fortran-2_pkg_setup
111 use python && python-single-r1_pkg_setup
113 elog "There are extra options on packages not available in Gentoo."
114 elog "You can use the environment variable EXTRA_ECONF to enable"
115 elog "these packages. For example, for Vdt you would set:"
116 elog "EXTRA_ECONF=\"-Dbuiltin_vdt=ON -Dvdt=ON\""
120 cmake-utils_src_prepare
122 sed -i "/CLING_BUILD_PLUGINS/d" interpreter/CMakeLists.txt || die
124 # CSS should use local images
125 sed -i -e 's,http://.*/,,' etc/html/ROOT.css || die "html sed failed"
127 if use nosplash; then
128 sed -i -e '/bool gNoLogo/s@false@true@' rootx/src/rootx.cxx
132 # Note: ROOT uses bundled clang because it is patched and API-incompatible
133 # with vanilla clang. The patches enable the C++ interpreter to work.
134 # Since ROOT installs many files into /etc (>100MB in total) that don't
135 # really belong there, we install it into another directory to avoid
136 # making /etc too big.
140 -DCMAKE_C_FLAGS="${CFLAGS}"
141 -DCMAKE_CXX_FLAGS="${CXXFLAGS}"
142 -DCMAKE_CXX_STANDARD=$((usev c++11 || usev c++14 || usev c++17) | cut -c4-)
143 -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr/lib/${PN}/$(ver_cut 1-2)"
144 -DCMAKE_INSTALL_MANDIR="${EPREFIX%/}/usr/lib/${PN}/$(ver_cut 1-2)/share/man"
145 -DCMAKE_INSTALL_LIBDIR="lib"
146 -DDEFAULT_SYSROOT="${EPREFIX}"
147 -DCLING_BUILD_PLUGINS=OFF
156 -Dbuiltin_afterimage=OFF
157 -Dbuiltin_cfitsio=OFF
160 -Dbuiltin_freetype=OFF
167 -Dbuiltin_openssl=OFF
173 -Dbuiltin_veccore=OFF
181 -Dasimage=$(usex asimage)
182 -Dastiff=$(usex tiff)
183 -Dlibcxx=$(usex libcxx)
184 -Dccache=OFF # use ccache via portage
188 -Dcling=ON # cling=OFF is broken
191 -Dcxxmodules=OFF # requires clang, unstable
192 -Ddavix=$(usex davix)
195 -Dfitsio=$(usex fits)
196 -Dfortran=$(usex fortran)
197 -Dftgl=$(usex opengl)
199 -Dgenvector=ON # genvector=OFF ignored
202 -Dgl2ps=$(usex opengl)
204 -Dgsl_shared=$(usex gsl)
205 -Dgviz=$(usex graphviz)
208 -Djemalloc=$(usex jemalloc)
209 -Dmathmore=$(usex gsl)
210 -Dmemstat=$(usex memstat)
212 -Dminuit2=$(usex minuit)
213 -Dminuit=$(usex minuit)
215 -Dmysql=$(usex mysql)
217 -Dopengl=$(usex opengl)
218 -Doracle=$(usex oracle)
219 -Dpch=ON # pch=OFF is broken
220 -Dpgsql=$(usex postgres)
221 -Dpythia6=$(usex pythia6)
222 -Dpythia8=$(usex pythia8)
223 -Dpython=$(usex python)
225 -Droofit=$(usex roofit)
226 -Droot7=$(usex root7)
230 -Druntime_cxxmodules=OFF # does not work yet
232 -Dshadowpw=$(usex shadow)
233 -Dsqlite=$(usex sqlite)
236 -Dtesting=$(usex test)
237 -Dthread=$(usex threads)
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)"