summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 140843cf0369150e2c953833618bffc68923ce08 (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
# Maintainer: Michele Mocciola <mickele>

pkgname=salome-kernel
pkgver=7.8.0
pkgrel=2
pkgdesc="Generic platform for Pre and Post-Processing for numerical simulation - KERNEL Module"
url="http://www.salome-platform.org"
depends=('python2' 'python2-numpy' 'boost-libs' 'omniorb416' 'omniorbpy36' 'hdf5-salome' 'graphviz' 'libxml2' 'cppunit' 'lapack' 'net-tools' 'openmpi' 'libbatch')
makedepends=('doxygen' 'python2-sphinx' 'swig2' 'boost')
arch=('i686' 'x86_64')
license=('LGPL')
source=("${pkgname}.sh" "http://files.salome-platform.org/Salome/Salome${pkgver}/src${pkgver}.tar.gz")
options=(!makeflags)
# options=(debug !strip)

_source=KERNEL_SRC
# _source=kernel
_basedir=/opt/salome
_installdir=${_basedir}
_profiledir=${_basedir}/env.d

prepare() {
#  msg "Connecting to git server..."
#  if [[ -d ${_source} ]] ; then
#     rm -rf ${_source}
#  fi
#  git clone git://git.salome-platform.org/modules/${_source}.git
#  cd ${_source}
#  git checkout V${pkgver:0:1}_${pkgver:2:1}_${pkgver:4:1}
#  msg "GIT checkout done or server timeout"

  cd ${_source}

  sed -e 's|INSTALL(CODE "FILE(TIMESTAMP \\"\${CMAKE_INSTALL_PREFIX}/\${path}/\${file_name}\\"            py_time)")|INSTALL(CODE "IF(EXISTS \\"\${CMAKE_INSTALL_PREFIX}/\${path}/\${file_we}.py\\") \\n  FILE(TIMESTAMP \\"\${CMAKE_INSTALL_PREFIX}/\${path}/\${file_we}.py\\" py_time) \\n ELSE()\\n  SET(py_time 0) \\n ENDIF() ")|' -i salome_adm/cmake_files/SalomeMacros.cmake

  # DESTDIR
  sed -e 's|\\"\${CMAKE_INSTALL_PREFIX}/\\\${INSTALL_PYIDL_DIR}\\"|\\"\\\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\\\${INSTALL_PYIDL_DIR}\\"|' -i salome_adm/cmake_files/UseOmniORB.cmake
  for _FILE in {"salome_adm/cmake_files/SalomeMacros.cmake","salome_adm/cmake_files/deprecated/install_and_compile_python_file.cmake"}
  do
    sed -e "s|'\${CMAKE_INSTALL_PREFIX}|'\\\\\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}|" -i ${_FILE}
  done

  # python -> python2
  for _FILE in `grep -Rl "/usr/bin/env python" * `
  do
	sed -e "s|/usr/bin/env python|/usr/bin/env python2|" -i ${_FILE}
  done
  for _FILE in `grep -Rl "'python'" * `
  do
    sed -e "s|'python'|'python2'|" -i ${_FILE}
  done
  for _FILE in `grep -Rl '"python"' * `
  do
    sed -e 's|"python"|"python2"|' -i ${_FILE}
  done
  for _FILE in `grep -Rl '"python ' * `
  do
    sed -e 's|"python |"python2 |' -i ${_FILE}
  done
  sed -e "s|python|python2|" -i bin/runSalome
  for _FILE in {"bin/appliskel/runSession","bin/appliskel/runAppli","bin/appliskel/runConsole","bin/appliskel/runRemote.sh"}
  do
    sed -e "s|python |python2 |" -i ${_FILE}
  done
}

build() {
  rm -rf "$srcdir/$_source/build"
  mkdir -p "$srcdir/$_source/build"
  cd "$srcdir/$_source/build"

  local cmake_options=""

  # generic options
  cmake_options+=" -DCMAKE_BUILD_TYPE=Release"
  cmake_options+=" -DCMAKE_INSTALL_PREFIX=${_installdir}"

  # debug options
  cmake_options+=" -DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF"
  cmake_options+=" -DSALOME_CMAKE_DEBUG:BOOL=OFF"

  # libbatch
  cmake_options+=" -DSALOME_USE_LIBBATCH:BOOL=ON"

  # mpi
  cmake_options+=" -DSALOME_USE_MPI:BOOL=ON"

  # python2
  cmake_options+=" -DPYTHON_EXECUTABLE=/usr/bin/python2"

  # sphinx-2
  cmake_options+=" -DSPHINX_EXECUTABLE=/usr/bin/sphinx-build2"
  cmake_options+=" -DSPHINX_APIDOC_EXECUTABLE=/usr/bin/sphinx-apidoc2"

  # omniorb
  cmake_options+=" -DOMNIORB_ROOT_DIR=/usr"
  cmake_options+=" -DOMNIORBPY_ROOT_DIR=/usr"

  # swig2
  cmake_options+=" -DSWIG_EXECUTABLE=/usr/bin/swig-2"

  # libxml2
  cmake_options+=" -DLIBXML2_ROOT_DIR=/usr"
  cmake_options+=" -DLibXml2_DIR=/usr/lib/cmake/libxml2"
  cmake_options+=" -DLIBXML2_INCLUDE_DIR=/usr/include/libxml2"

  # hdf5-1.8
  cmake_options+=" -DHDF5_INCLUDE_DIRS:PATH=/usr/include/hdf5_18/"
  cmake_options+=" -DHDF5_INCLUDE_DIR:PATH=/usr/include/hdf5_18/"
  cmake_options+=" -DHDF5_C_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5cc_18"
  cmake_options+=" -DHDF5_C_LIBRARY_hdf5:FILEPATH=/usr/lib/hdf5_18/libhdf5.so"
  cmake_options+=" -DHDF5_DIFF_EXECUTABLE:FILEPATH=/usr/bin/h5diff_18"

  # options for other system libraries
  cmake_options+=" -DPTHREAD_ROOT_DIR=/usr"
  cmake_options+=" -DBOOST_ROOT_DIR=/usr"
  cmake_options+=" -DCPPUNIT_ROOT_DIR=/usr"
  cmake_options+=" -DDOXYGEN_ROOT_DIR=/usr"
  cmake_options+=" -DGRAPHVIZ_ROOT_DIR=/usr"

  cmake ${cmake_options} ..


  make
}

package() {
  cd "${srcdir}/${_source}/build"

  make DESTDIR="${pkgdir}" install

  for _FILE in `find -L ${pkgdir}${_installdir} -iname *.py`
  do
    sed -i -e "s|${srcdir}||" ${_FILE}
    sed -i -e "s|${pkgdir}||" ${_FILE}
  done
  for _FILE in `find -L ${pkgdir}${_installdir}/bin/salome/test/ -iname "*.cmake"`
  do
    sed -i -e "s| python | python2 |" ${_FILE}
  done

  rm -f "${pkgdir}${_installdir}/bin/salome/VERSION"

  for _FILE in {"salome","envd","runConsole","runRemote.sh","runSalomeScript","runSession"}
  do
    ln -s "${_installdir}/bin/salome/appliskel/${_FILE}" "${pkgdir}${_installdir}"
  done

  for _FILE in {"getApplyPath","update_catalogs","kill_remote_containers"}
  do
    ln -s ${_installdir}/bin/salome/appliskel/${_FILE}.py "${pkgdir}${_installdir}"
    ln -s ${_installdir}/bin/salome/appliskel/${_FILE}.pyc "${pkgdir}${_installdir}"
    ln -s ${_installdir}/bin/salome/appliskel/${_FILE}.pyo "${pkgdir}${_installdir}"
  done

  ln -s /tmp "${pkgdir}${_installdir}/USERS"

  # install profile
  install -D -m755 "${srcdir}/${pkgname}.sh" \
                   "${pkgdir}${_profiledir}/${pkgname}.sh"

  # install link to launcher in /usr/bin
  install -d -m755 "${pkgdir}/usr/bin"
  ln -s "${_installdir}/salome" "${pkgdir}/usr/bin/salome"
}
md5sums=('6cc4e82fde36b648a47a11d320033129'
         '0f6de10ad9d9c646fce3ca21a7dab46a')