# Maintainer: Evgeniy "arcanis" Alekseev <esalexeev@gmail.com>

pkgname=mercury-ccdc
_pkgname=mercury
pkgver=3.1.1
pkgrel=1
pkgdesc="Software for 3D structure visualization, the exploration of crystal packing and the statistical analysis of CSD search data"
arch=('i686' 'x86_64')
url="http://www.ccdc.cam.ac.uk/Solutions/CSDSystem/Pages/Mercury.aspx"
license=('custom')
depends=()
# You MUST download the package from the url and put it in the PKGBUILD folder!
source=(mercurystandalone-3.1-linux-installer.run
        csdsystempatch-5.34.2-linux-installer.run
        mercury.sh
        mercury.desktop)
md5sums=('6a3f4cd1c0745d3dfe4d1fa287f30b27'
         '7142f37fe51a5a26dd6ce963fc7d32a9'
         'd98479136f348c5502204d89944178af'
         '7aa75fdf4f1a996976285ed769299ad4')

package()
{
  chmod +x "${srcdir}/mercurystandalone-3.1-linux-installer.run"
  "${srcdir}/mercurystandalone-3.1-linux-installer.run" --prefix "${pkgdir}/opt/mercury" --mode unattended
  chmod +x "${srcdir}/csdsystempatch-5.34.2-linux-installer.run"
  "${srcdir}/csdsystempatch-5.34.2-linux-installer.run" --prefix "${pkgdir}/opt/mercury" --mode unattended
  
  install -D -m644 "${pkgdir}/opt/mercury/docs/MercuryLicence.txt" \
                   "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
  install -D -m755 "${srcdir}/mercury.sh" "${pkgdir}/etc/profile.d/mercury.sh"
  install -D -m644 "${srcdir}/mercury.desktop" "${pkgdir}/usr/share/applications/mercury.desktop"
  install -D -m644 "${pkgdir}/opt/mercury/icons/mercury_32x32.png" \
                   "${pkgdir}/usr/share/icons/hicolor/32x32/apps/mercury.png"
}
