summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ffc6d3f9117c375a167c70ee42e0f52ce65532c9 (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
# Maintainer: Mirko Scholz

pkgname=cctbx-bin
pkgver=1902
pkgrel=1
pkgdesc="The Computational Crystallography Toolbox (cctbx)"
arch=('x86_64')
url="https://cci.lbl.gov/cctbx_docs/index.html"
license=('BSD')
depends=(python2 libpng15)
makedepends=(fakechroot)
_installer="cctbx-installer-dev-$pkgver-intel-linux-2.6-x86_64-centos6"
source=("http://cci.lbl.gov/cctbx_build/dev-${pkgver}/${_installer}.tar.gz")
noextract=("${source[@]##*/}")
sha1sums=('8046536794285436a088f410a2bbe5931123ba99')
options=(!strip)

#
# this makes CCTBX available on Arch Linux
#
# I am not using any graphical facilities, only cctbx python modules
#
# The following tests succeed mostly
#
# cctbx.python /opt/cctbx-*/modules/cctbx_project/cctbx/run_tests.py
# cctbx.python /opt/cctbx-*/modules/cctbx_project/libtbx/run_tests.py
# cctbx.python /opt/cctbx-*/modules/cctbx_project/iotbx/run_tests.py
#
# The following tests fail 
#
# cctbx.python /opt/cctbx-*/modules/cctbx_project/scitbx/run_tests.py

package() {
  # follows https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=microchip-mplabx-bin
  mkdir -p "$pkgdir"/{etc,tmp,opt}
  ln -s /usr/bin "$pkgdir"
  echo "root:x:0:0:root:/root:/bin/bash" > "${pkgdir}/etc/passwd"
  echo "root:x:0:root" > "${pkgdir}/etc/group"
  # cp -r --reflink=auto --no-dereference --preserve=links "$srcdir/$_installer" "$pkgdir/tmp"
  (cd "$pkgdir/tmp"; tar xf "$srcdir/${_installer}.tar.gz")
  cat <<EOF > "$pkgdir/tmp/install.sh"
#!/bin/sh
PATH=/bin
echo Running CCTBX installer...
cd "/tmp/$_installer"
./install --verbose --prefix /opt
EOF
  chmod 0755 "$pkgdir/tmp/install.sh"

  # the installer uses the system's python (although it ships with its own version)
  env FAKECHROOT_EXCLUDE_PATH=/dev:/proc:/sys:/usr \
  fakechroot chroot "$pkgdir" /tmp/install.sh

  (cd "${pkgdir}/tmp/${_installer}"; install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE")

  rm -rf "$pkgdir"/{etc,tmp,bin}

  # don't know why it isn't set executable, tests work better that way
  find "$pkgdir/opt" -name libtbx.python -exec chmod a+x '{}' ';'

  mkdir -p "$pkgdir/usr/bin"
  cat <<EOF > "$pkgdir/usr/bin/cctbx.python"
#!/bin/sh
. /opt/cctbx-dev-${pkgver}/cctbx_env.sh
exec cctbx.python "\$@"
EOF
  chmod a+x "$pkgdir/usr/bin/cctbx.python"

}