summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 92b850ce6ea0b947d7586c1cf6a6d2a65f57fd4c (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
# Maintainer: Jiachen YANG <farseerfc@gmail.com>
# Contributor: Sven-Hendrik Haase <sh@lutzhaase.com>

#_hgrev=63547

pkgname=pypy-stm-hg
#pkgver=2.5.1
#_pkgver=2.5.1
#[[ -n $_hgrev ]] && pkgver=2.0beta2.$_hgrev
pkgrel=3
pkgver=r77701.905ab5c077a5
pkgdesc="A Python implementation written in Python, STM branch, hg version"
url="http://pypy.org/tmdonate2.html"
arch=('i686' 'x86_64')
depends=('libffi')
provides=('pypy-stm')
conflicts=('pypy-stm')
options=(!buildflags)
makedepends=('python' 'mercurial' 'pypy' 'tk' 'clang-pypy-stm' 'llvm-pypy-stm')
optdepends=('openssl: openssl module'
            'expat: pyexpat module'
            'ncurses: ncurses module'
            'zlib: zlib module'
            'bzip2: bz2 module'
            'tk: tk module')
license=('custom:MIT')
source=("hg+https://foss.heptapod.net/pypy/pypy#branch=stmgc-c7")
md5sums=('SKIP')

pkgver() {
  #set -xv
  cd "$srcdir/pypy"
  printf "r%s.%s" "$(hg identify -n)" "$(hg identify -i)"
}

prepare() {
  cd "${srcdir}"/pypy
  # Hacky fix to allow the curses module to build on x86_64; otherwise we get:
  #   cffi.ffiplatform.VerificationError: anonymous MEVENT: wrong total size
  #                                       (we have 24, but C compiler says 20)
  if [[ $CARCH == x86_64 ]]; then
    _type=unsigned
  else
    _type=uint32_t
  fi
  sed -i -e "s/typedef unsigned long mmask_t/typedef $_type mmask_t/" \
           -e "s/typedef unsigned long chtype/typedef $_type chtype/" \
        lib_pypy/_curses.py
}

build() {
  cd "${srcdir}"/pypy/pypy/goal

  pypy ../../rpython/bin/rpython -Ojit --stm targetpypystandalone
}

package() {
  cd "${srcdir}"/pypy/pypy/tool/release

  LD_LIBRARY_PATH=../../goal/ python2 package.py ../../../ pypy-stm pypy-c "${srcdir}"/${pkgname}.tar.bz2

  mkdir -p "${pkgdir}"/opt
  tar x -C "${pkgdir}"/opt -f "${srcdir}"/${pkgname}.tar.bz2

  #mkdir -p "${pkgdir}"/opt/pypy-stm/lib
  #cp ../../goal/libpypy-c.so "${pkgdir}"/opt/pypy-stm/lib/

  mkdir -p "${pkgdir}"/usr/bin
  ln -s /opt/pypy-stm/bin/pypy-c "${pkgdir}"/usr/bin/pypy-stm

  install -Dm644 "${pkgdir}"/opt/pypy-stm/LICENSE "${pkgdir}"/usr/share/licenses/pypy-stm/LICENSE
}