summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 85679459406b5fafd9a716a37944d63564ad1c3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# Maintainer: Konstantin Gizdov < arch at kge dot pw >
# Contributor: Frank Siegert < frank.siegert at googlemail dot com >
# Contributor: Scott Lawrence < bytbox at gmail dot com >
# Contributor: Thomas Dziedzic < gostrc at gmail dot com >
# Contributor: Sebastian Voecking < voeck at web dot de >

pkgbase=root-py2
pkgname=('root-py2' 'root-cuda-py2')
_pkgbase=root
pkgver=6.16.00
pkgrel=2
pkgdesc='C++ data analysis framework and interpreter from CERN'
arch=('x86_64')
url='https://root.cern.ch'
license=('LGPL2.1')
makedepends=('ccache'
             'cern-vdt'
             'cfitsio'
             'cmake'
             'cuda'
             'fcgi'
             'fftw'
             'ftgl'
             'blas'
             'gcc-fortran'
             'giflib'
             'git'
             'gl2ps'
             'glew'
             'go-pie'
             'gsl'
             'hicolor-icon-theme'
             'intel-tbb'
             'libafterimage'
             'libmariadbclient'
             'librsvg'
             'libxpm'
             'ocaml'
             'ocaml-ctypes'
             'openssl'
             'postgresql-libs'
             'pythia8>=8.2.40-1'
             'python2'
             'python2-numpy'
             'sqlite'
             'tex-gyre-fonts'
             'unuran'
             'vc'
             'xmlrpc-c'
             'xrootd>=4.6.0-2'
             'xxhash>=0.6.5-1'
             'z3')
depends=('blas'
         'desktop-file-utils'
         'fcgi'
         'fftw'
         'ftgl'
         'giflib'
         'gl2ps'
         'glew'
         'gsl'
         'hicolor-icon-theme'
         'intel-tbb'
         'libafterimage'
         'librsvg'
         'libxpm'
         'tex-gyre-fonts'
         'xxhash>=0.6.5-1')
optdepends=('cfitsio: Read images and data from FITS files'
            'cern-vdt: Add a set of fast and vectorisable mathematical functions'
            'libmariadbclient: MySQL support'
            'openssl: OpenSSL support'
            'postgresql-libs: PostgreSQL support'
            'pythia8>=8.2.40-1: Pythia8 EG support'
            'sqlite: SQLite support'
            'tcsh: Legacy CSH support'
            'unuran: Support non-uniform random numbers'
            'vc: Add types for portable and intuitive SIMD programming'
            'libxml2: XML parser interface'
            'xrootd: Support remote file server and client')
source=("https://root.cern.ch/download/root_v${pkgver}.source.tar.gz"
        'root.xml'
        'rootd'
        'settings.cmake'
        'settings-cuda.cmake'
        'fix_compile_time_install_clad.patch'
        'adding_directories_needed_to_use_libxml.patch'
        'rename_based_fix_for_rconfig_on_case_sensitive_systems.patch')
sha256sums=('2a45055c6091adaa72b977c512f84da8ef92723c30837c7e2643eecc9c5ce4d8'
            '50c08191a5b281a39aa05ace4feb8d5405707b4c54a5dcba061f954649c38cb0'
            '3c45b03761d5254142710b7004af0077f18efece7c95511910140d0542c8de8a'
            '0110fd393a6de68c9d65abad7ec626b298e0bb4431210e6cd75285078052a39a'
            '114c6ae5ac03ebed30f93ccf9431475eb797086e1a9d97d45f84e59c7212b09d'
            'de32dcc6c9d8527cb08360a2703c1ca1e586a5b7cc12ea12fd07125795ea5104'
            '51e5de01a423b89c113d19918c731a060e6d9b018d086c97b3dde10818cbd1fe'
            '09fabd3927a57b9a1e0cda7dfe3a53e82eea5ae1fe1c47f778e751603b1c0549')
get_py2ver () {
    python2 -c 'import sys; print(str(sys.version_info[0]) + "." + str(sys.version_info[1]))'
}
prepare() {
    # cd "${srcdir}/${_pkgbase}-${pkgver}"

    2to3 -w "${srcdir}/${_pkgbase}-${pkgver}"/etc/dictpch/makepch.py 2>&1 > /dev/null

    patch -d "${srcdir}/${_pkgbase}-${pkgver}" -Np1 -i "${srcdir}/fix_compile_time_install_clad.patch"
    patch -d "${srcdir}/${_pkgbase}-${pkgver}" -Np1 -i "${srcdir}/adding_directories_needed_to_use_libxml.patch"
    patch -d "${srcdir}/${_pkgbase}-${pkgver}" -Np1 -i "${srcdir}/rename_based_fix_for_rconfig_on_case_sensitive_systems.patch"

    # don't let ROOT play around with lib paths
    sed -i -e 's@SetLibraryPath();@@g' \
        "${srcdir}/${_pkgbase}-${pkgver}/rootx/src/rootx.cxx"

    # trust system to find GSL
    rm "${srcdir}/${_pkgbase}-${pkgver}/cmake/modules/FindGSL.cmake"

    cp -r "${_pkgbase}-${pkgver}" "${_pkgbase}-${pkgver}-cuda"
}

build() {
    ## ROOT
    mkdir -p "${srcdir}/build"
    cd "${srcdir}/build"

    CFLAGS="${CFLAGS} -pthread" \
    CXXFLAGS="${CXXFLAGS} -pthread" \
    LDFLAGS="${LDFLAGS} -pthread -Wl,--no-undefined" \
    cmake -C "${srcdir}/settings.cmake" -DTARGET_ARCHITECTURE:STRING=generic -DPYTHON_EXECUTABLE:PATH=/usr/bin/python2 \
    "${srcdir}/${_pkgbase}-${pkgver}"

    cd "${srcdir}/build"
    make

    ## ROOT with CUDA
    mkdir -p "${srcdir}/build-cuda"
    cd "${srcdir}/build-cuda"

    CFLAGS="${CFLAGS} -pthread" \
    CXXFLAGS="${CXXFLAGS} -pthread" \
    LDFLAGS="${LDFLAGS} -pthread -Wl,--no-undefined" \
    cmake -C "${srcdir}/settings-cuda.cmake" -DTARGET_ARCHITECTURE:STRING=generic -DPYTHON_EXECUTABLE:PATH=/usr/bin/python2 \
    "${srcdir}/${_pkgbase}-${pkgver}-cuda"

    cd "${srcdir}/build-cuda"
    make
}

package_root-py2() {
    provides=('root' 'python2-pyroot')
    conflicts=('root' 'python-pyroot')
    optdepends+=('gcc-fortran: Enable the Fortran components of ROOT')
    cd "${srcdir}/build"

    make DESTDIR="${pkgdir}" install

    # fix python env call
    sed -e 's/@python@/python2/' -i "${pkgdir}/usr/lib/root/cmdLineUtils.py"

    # try to deal with weird PyROOT, PyMVA and JupyROOT stuff
    install -d "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages"
    ln -s "/usr/lib/root/ROOT.py" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"
    ln -s "/usr/lib/root/_pythonization.py" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"
    ln -s "/usr/lib/root/cmdLineUtils.py" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"
    ln -s "/usr/lib/root/cppyy.py" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"
    ln -s "/usr/lib/root/JsMVA/" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"
    ln -s "/usr/lib/root/JupyROOT/" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"
    ln -s "/usr/lib/root/libPyROOT.so" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"
    ln -s "/usr/lib/root/libPyMVA.so" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"
    ln -s "/usr/lib/root/libJupyROOT.so" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"

    install -D "${srcdir}/rootd" \
        "${pkgdir}/etc/rc.d/rootd"
    install -D -m644 "${srcdir}/root.xml" \
        "${pkgdir}/usr/share/mime/packages/root.xml"

    install -D -m644 "${srcdir}/${_pkgbase}-${pkgver}/build/package/debian/root-system-bin.desktop.in" \
        "${pkgdir}/usr/share/applications/root-system-bin.desktop"

    # replace @prefix@ with /usr for the desktop
    sed -e 's_@prefix@_/usr_' -i "${pkgdir}/usr/share/applications/root-system-bin.desktop"

    install -D -m644 "${srcdir}/${_pkgbase}-${pkgver}/build/package/debian/root-system-bin.png" \
        "${pkgdir}/usr/share/icons/hicolor/48x48/apps/root-system-bin.png"

    # use a file that pacman can track instead of adding directly to ld.so.conf
    install -d "${pkgdir}/etc/ld.so.conf.d"
    echo '/usr/lib/root' > "${pkgdir}/etc/ld.so.conf.d/root.conf"

    rm -rf "${pkgdir}/etc/root/daemons"
}

package_root-cuda-py2() {
    pkgdesc='C++ data analysis framework and interpreter from CERN with GPU (CUDA) features enabled'
    provides=('root' 'python2-pyroot')
    conflicts=('root' 'python2-pyroot')
    depends+=('cuda')
    cd "${srcdir}/build-cuda"

    make DESTDIR="${pkgdir}" install

    # fix python env call
    sed -e 's/@python@/python2/' -i "${pkgdir}/usr/lib/root/cmdLineUtils.py"

    # try to deal with weird PyROOT, PyMVA and JupyROOT stuff
    install -d "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages"
    ln -s "/usr/lib/root/ROOT.py" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"
    ln -s "/usr/lib/root/_pythonization.py" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"
    ln -s "/usr/lib/root/cmdLineUtils.py" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"
    ln -s "/usr/lib/root/cppyy.py" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"
    ln -s "/usr/lib/root/JsMVA/" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"
    ln -s "/usr/lib/root/JupyROOT/" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"
    ln -s "/usr/lib/root/libPyROOT.so" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"
    ln -s "/usr/lib/root/libPyMVA.so" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"
    ln -s "/usr/lib/root/libJupyROOT.so" "${pkgdir}/usr/lib/python$(get_py2ver)/site-packages/"

    install -D "${srcdir}/rootd" \
        "${pkgdir}/etc/rc.d/rootd"
    install -D -m644 "${srcdir}/root.xml" \
        "${pkgdir}/usr/share/mime/packages/root.xml"

    install -D -m644 "${srcdir}/${_pkgbase}-${pkgver}-cuda/build/package/debian/root-system-bin.desktop.in" \
        "${pkgdir}/usr/share/applications/root-system-bin.desktop"

    # replace @prefix@ with /usr for the desktop
    sed -e 's_@prefix@_/usr_' -i "${pkgdir}/usr/share/applications/root-system-bin.desktop"

    install -D -m644 "${srcdir}/${_pkgbase}-${pkgver}-cuda/build/package/debian/root-system-bin.png" \
        "${pkgdir}/usr/share/icons/hicolor/48x48/apps/root-system-bin.png"

    # use a file that pacman can track instead of adding directly to ld.so.conf
    install -d "${pkgdir}/etc/ld.so.conf.d"
    echo '/usr/lib/root' > "${pkgdir}/etc/ld.so.conf.d/root.conf"

    rm -rf "${pkgdir}/etc/root/daemons"
}