summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cd9a648e8e46c52cd6fb2b84ae25e0a6ada559a9 (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
# Maintainer: Yen Chi Hsuan <yan12125 at gmail dot com>
# Contributor: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
# Contributor: James Miller <james@pocketrent.com>

_pkgname=hhvm
_github_addr=facebook/hhvm
pkgname=${_pkgname}-git
pkgver=20150820
pkgrel=1
pkgdesc="Virtual Machine, Runtime, and JIT for PHP"
arch=('x86_64')
url="http://hhvm.com"
license=('PHP')
depends=('boost-libs'
         'fribidi'
         'google-glog'
         'imagemagick'
         'intel-tbb'
         'jemalloc'
         'libdwarf'
         'libedit'
         'libmcrypt'
         'libmemcached'
         'libvpx'
         'libxslt'
         'libyaml'
         'mysql'
         'oniguruma'
         'php'
         'sqlite'
         'unixodbc')
# curl included in php
# gd is bundled in hphp/runtime/ext/gd/libgd
# libxml2 included in libxslt
# pcre included in lots of packages
makedepends=('git' 'cmake' 'clang' 'boost' 'python2' 'pfff' 'ocaml-findlib' 'gperf')
source=("git+https://github.com/$_github_addr" #1
        "git+https://github.com/hhvm/hhvm-third-party"
        "git+https://github.com/facebook/folly"
        "git+https://github.com/facebook/fbthrift"
        "git+https://github.com/facebook/squangle"
        "git+https://github.com/facebook/proxygen" #6
        "git+https://github.com/facebook/mcrouter"
        "git+https://github.com/google/re2"
        "git+https://github.com/webscalesql/webscalesql-5.6"
        "git+https://github.com/facebook/wangle" #10
        'hhvm.tmpfile'
        'hhvm@.service'
        'server.ini'
        'systemd-server.conf'
        'php_ini.patch')
backup=('etc/hhvm/server.ini' 'etc/hhvm/systemd-server.conf')
sha256sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP'
            'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP'
            'c049b53f5ca7f8384d3b0a9d257018770b3a171f3b7ae8865cbb2c402a26b5e9'
            'dddf4325926a41b3f1b5a41a1a42364ee463ab627f9d9b05ccf7c4660af3a51c'
            'bca85e0445f3e26df65876c52e507aec8146cd31cce12c82846b55705529caed'
            '66ae41fb6ef07dd02a9c959ab6b6e07bcb1d17b0c164a091fc5ecd9dc7967cd0'
            'f878bca477ce33d43a0a110a961b1b9aa600cf7000df756d1fe25f8dcde87da8')

install=hhvm.install

_EXTRA_COMPONENTS=('hackificator' 'remove_soft_types')

pkgver() {
    cd "${srcdir}/${_pkgname}"
    git log -1 --format='%cd' --date=short | tr -d -- '-'
}

prepare() {
    cd "${srcdir}/${_pkgname}"

    git submodule init
    git config submodule.third-party.url "${srcdir}/hhvm-third-party"
    git submodule update

    cd third-party
    git submodule init
    git config submodule.folly.url "${srcdir}/folly"
    git config submodule.mcrouter/src.url "${srcdir}/mcrouter"
    git config submodule.proxygen/src.url "${srcdir}/proxygen"
    git config submodule.re2/src.url "${srcdir}/re2"
    git config submodule.squangle/squangle.url "${srcdir}/squangle"
    git config submodule.thrift/src.url "${srcdir}/fbthrift"
    git config submodule.webscalesqlclient/webscalesql-5.6.url "${srcdir}/webscalesql-5.6"
    git config submodule.wangle/src.url "${srcdir}/wangle"
    git submodule update
}

build() {
    cd "${srcdir}/${_pkgname}"
    msg2 "Building hhvm"

    # Force hardcoded MySQL unix domain socket path here
    # becuase the server may not be running when building
    # The path listed here is copied from PKGBUILD of extra/mariadb
    # If you use a custom path setting in my.cnf, please change it

    CC=clang CXX=clang++ \
    cmake \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_INSTALL_LIBDIR=lib \
        -DCMAKE_PREFIX_PATH="$srcdir" \
        -DMYSQL_UNIX_SOCK_ADDR=/run/mysqld/mysqld.sock \
        -DCLANG_FORCE_LIBSTDCXX=ON \
        .

    make

    cd "${srcdir}/${_pkgname}/hphp/hack/tools"
    msg2 "Building extra components"

    msg2 "hardening-wrapper leads to build failures. See FS#42748"

    for tool in "${_EXTRA_COMPONENTS[@]}"
    do
        pushd "$tool"
        make clean
        make depend
        make
        popd
    done

    pushd augmented_types
    make clean
    make
    popd
}

check() {
    cd "${srcdir}"
    cp /etc/php/php.ini php_patched.ini
    patch -p1 -i php_ini.patch

    cd "${srcdir}/${_pkgname}/hphp/test"
    php -c "${srcdir}/php_patched.ini" ./run --threads 2 quick
    # ./run --threads 2 all
}

package() {
    cd "${srcdir}/${_pkgname}"
    make DESTDIR="$pkgdir/" install

    msg2 "Install extra components"
    cd "${srcdir}/${_pkgname}/hphp/hack/bin/tools"
    for tool in *
    do
        install -Dm755 "${tool}" "${pkgdir}/usr/bin/${tool}"
    done

    cd "${srcdir}/${_pkgname}/hphp/hack/tools/augmented_types/_build"
    install -Dm755 augmented_types.native "${pkgdir}/usr/bin/augmented_types"

    cd "${srcdir}"
    install -Dm644 hhvm.tmpfile "${pkgdir}/usr/lib/tmpfiles.d/hhvm.conf"
    install -Dm644 hhvm@.service "${pkgdir}/usr/lib/systemd/system/hhvm@.service"
    install -Dm644 server.ini "${pkgdir}/etc/hhvm/server.ini"
    install -Dm644 systemd-server.conf "${pkgdir}/etc/hhvm/systemd-server.conf"

    install -Ddm755 -o http "${pkgdir}/var/log/hhvm"
    install -Ddm755 -o http "${pkgdir}/var/lib/hhvm"
}