summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 917db63d07c549cf08998af465bce81e96c91d4a (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
# Contributor: acxz <akashpatel2008 at yahoo dot com>
# Maintainer: Stefan Husmann <stefan-husmann@t-online.de>

pkgname=scotch-git
pkgver=7.0.1.r733.1093134
pkgrel=1
pkgdesc="Libraries for graph, mesh and hypergraph partitioning, static mapping, and sparse matrix block ordering"
url="https://gitlab.inria.fr/scotch/scotch"
license=("custom:CeCILL-C")
depends=('zlib' 'openmpi' 'bzip2')
provides=('scotch' 'ptscotch' 'ptscotch-openmpi' 'scotch_esmumps' 'scotch_ptesmumps')
conflicts=('scotch' 'ptscotch-openmpi' 'scotch_esmumps' 'scotch_esmumps5')
arch=('i686' 'x86_64')
source=("git+$url.git")
sha256sums=('SKIP')
_pkgname=scotch

pkgver() {
  cd "$_pkgname"
  _version=$(grep SCOTCH_VERSION CMakeLists.txt |head -1|cut -d" " -f2|tr -d \))
  _release=$(grep SCOTCH_RELEASE CMakeLists.txt |head -1|cut -d" " -f2|tr -d \))
  _patchlevel=$(grep SCOTCH_PATCHLEVEL CMakeLists.txt |head -1|cut -d" " -f2|tr -d \))
  
  printf "${_version}.${_release}.${_patchlevel}.r%s.%s" \
	 "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd ${_pkgname}/src

  [ -e Makefile.inc ] && rm Makefile.inc
  cp "Make.inc/Makefile.inc.${CARCH/_/-}_pc_linux2.shlib" Makefile.inc

  # Apply patch to fix shared library ldflags
  sed -i 's/$(AR) $(ARFLAGS) $(@) $(?)/$(AR) $(ARFLAGS) $(@) $(?) $(LDFLAGS)/g' libscotch/Makefile

  # Use the CFLAGS defined /etc/makepkg.conf
  sed -i "s/-O3/${CFLAGS} -fPIC/g" Makefile.inc

  # Fix C compiler
  sed -i "s/CCD\t.*=.*gcc/CCD = mpicc/" Makefile.inc

  # Also enable bzip2 compression
  sed -i "s/-DCOMMON_FILE_COMPRESS_GZ/-DCOMMON_FILE_COMPRESS_GZ -DCOMMON_FILE_COMPRESS_BZ2/" Makefile.inc
  sed -i "s/-lz/-lz -lbz2/" Makefile.inc

  # Fix the creation of directories1
  sed -i "s/mkdir/mkdir\ -p/" Makefile.inc

  # To install headers and libs also for esmumps
  sed -i 's/scotch\*/{scotch,esmumps}\*/g' Makefile
}

build() {
  cd ${_pkgname}/src

  make scotch
  make -j1 esmumps

  # MPI implementation is not thread-safe: compile the parallel versions without SCOTCH_PTHREAD
  sed -i "s/-DSCOTCH_PTHREAD//" Makefile.inc

  make ptscotch
  make -j1 ptesmumps
}

package() {
  cd ${_pkgname}/src

  make install prefix="$pkgdir"/usr includedir="$pkgdir"/usr/include/scotch

  # To avoid conflict with extra/gpart, maybe move the package to /opt/scotch ?
  mv "$pkgdir"/usr/bin/gpart "$pkgdir"/usr/bin/gpart-scotch

  install -m 644 -D "../doc/CeCILL-C_V1-en.txt" "$pkgdir"/usr/share/licenses/${_pkgname}/LICENSE
}