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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
#!/bin/bash
# Slackware build script for HHVM
# Copyright 2015-2022 Eugene Wissner, Dachau, Germany
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=hhvm
VERSION=${VERSION:-4.153.1}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
OPAM_STAMP="12fbd9f"
CARGO_BUILD="2"
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
echo "$ARCH is not supported."
exit 1
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar Jxvf $CWD/$PRGNAM-$VERSION.tar.xz
cd $PRGNAM-$VERSION
mkdir -p hphp/hack/facebook hphp/hack/_build/opam
tar Jxvf $CWD/hack-switch-$OPAM_STAMP.tar.xz -C hphp/hack/_build/opam
tar Jxvf $CWD/cargo-home-$CARGO_BUILD.tar.xz -C hphp/hack/_build
install -m 0755 -D $CWD/opam-2.1.0-x86_64-linux \
third-party/opam/opamDownload-prefix/src/opam-2.1.0-x86_64-linux
install -m 0644 -D $CWD/fmt-6.1.2.zip third-party/fmt/bundled_fmt-prefix/src/fmt-6.1.2.zip
unzip $CWD/fmt-6.1.2.zip -d third-party/fmt/bundled_fmt-prefix/src
mv third-party/fmt/bundled_fmt-prefix/src/fmt-6.1.2 third-party/fmt/bundled_fmt-prefix/src/bundled_fmt
mkdir -p third-party/re2/bundled_re2-prefix/src/bundled_re2
install -m 0644 -D $CWD/re2-2021-11-01.tar.gz third-party/re2/bundled_re2-prefix/src/re2-2021-11-01.tar.gz
tar zxvf $CWD/re2-2021-11-01.tar.gz \
-C third-party/re2/bundled_re2-prefix/src/bundled_re2 \
--strip-components=1
mkdir -p third-party/brotli/bundled_brotli-prefix/src/bundled_brotli
install -m 0644 -D $CWD/brotli-v1.0.9.tar.gz third-party/brotli/bundled_brotli-prefix/src/brotli-v1.0.9.tar.gz
tar zxvf $CWD/brotli-v1.0.9.tar.gz \
-C third-party/brotli/bundled_brotli-prefix/src/bundled_brotli \
--strip-components=1
mkdir -p third-party/rustc/bundled_rust-prefix/src/bundled_rust
install -m 0644 -D $CWD/rustc-2021-11-29-rust-nightly-x86_64-unknown-linux-gnu.tar.gz \
third-party/rustc/bundled_rust-prefix/src/rustc-2021-11-29-rust-nightly-x86_64-unknown-linux-gnu.tar.gz
tar zxvf $CWD/rustc-2021-11-29-rust-nightly-x86_64-unknown-linux-gnu.tar.gz \
-C third-party/rustc/bundled_rust-prefix/src/bundled_rust \
--strip-components=1
mkdir -p third-party/proxygen/bundled_proxygen-prefix/src/bundled_proxygen
install -m 0644 -D $CWD/proxygen-v2022.01.31.00.tar.gz \
third-party/proxygen/bundled_proxygen-prefix/src/proxygen-v2022.01.31.00.tar.gz
tar zxvf $CWD/proxygen-v2022.01.31.00.tar.gz \
-C third-party/proxygen/bundled_proxygen-prefix/src/bundled_proxygen
mkdir -p third-party/folly/bundled_folly-prefix/src/bundled_folly
install -m 0644 -D $CWD/folly-v2022.03.14.00.tar.gz \
third-party/folly/bundled_folly-prefix/src/folly-v2022.03.14.00.tar.gz
tar zxvf $CWD/folly-v2022.03.14.00.tar.gz \
-C third-party/folly/bundled_folly-prefix/src/bundled_folly
mkdir -p third-party/fb-mysql/bundled_fbmysqlclient-prefix/src/bundled_fbmysqlclient
install -m 0644 -D $CWD/fb-prod8-202101.tar.gz \
third-party/fb-mysql/bundled_fbmysqlclient-prefix/src/fb-prod8-202101.tar.gz
tar -zxvf $CWD/fb-prod8-202101.tar.gz \
-C third-party/fb-mysql/bundled_fbmysqlclient-prefix/src/bundled_fbmysqlclient
mkdir -p third-party/wangle/bundled_wangle-prefix/src/bundled_wangle
install -m 0644 -D $CWD/wangle-v2022.01.31.00.tar.gz \
third-party/wangle/bundled_wangle-prefix/src/wangle-v2022.01.31.00.tar.gz
tar -zxvf $CWD/wangle-v2022.01.31.00.tar.gz \
-C third-party/wangle/bundled_wangle-prefix/src/bundled_wangle
mkdir -p third-party/squangle/bundled_squangle-prefix/src/bundled_squangle
install -m 0644 -D $CWD/squangle-v2022.01.31.00.tar.gz \
third-party/squangle/bundled_squangle-prefix/src/squangle-2022.01.31.00.tar.gz
tar -zxvf $CWD/squangle-v2022.01.31.00.tar.gz \
-C third-party/squangle/bundled_squangle-prefix/src/bundled_squangle \
--strip-components=1
mkdir -p third-party/watchman/bundled_watchman-prefix/src/bundled_watchman
install -m 0644 -D $CWD/watchman-v2022.01.31.00.tar.gz \
third-party/watchman/bundled_watchman-prefix/src/watchman-v2022.01.31.00.tar.gz
tar -zxvf $CWD/watchman-v2022.01.31.00.tar.gz \
-C third-party/watchman/bundled_watchman-prefix/src/bundled_watchman \
--strip-components=1
mkdir -p third-party/thrift/bundled_thrift-prefix/src/bundled_thrift
install -m 0644 -D $CWD/fbthrift-v2022.01.31.00.tar.gz \
third-party/thrift/bundled_thrift-prefix/src/fbthrift-v2022.01.31.00.tar.gz
tar -zxvf $CWD/fbthrift-v2022.01.31.00.tar.gz \
-C third-party/thrift/bundled_thrift-prefix/src/bundled_thrift \
--strip-components=1
mkdir -p third-party/mcrouter/bundled_mcrouter-prefix/src/bundled_mcrouter
install -m 0644 -D $CWD/mcrouter-v2022.01.31.00.tar.gz \
third-party/mcrouter/bundled_mcrouter-prefix/src/mcrouter-v2022.01.31.00.tar.gz
tar -zxvf $CWD/mcrouter-v2022.01.31.00.tar.gz \
-C third-party/mcrouter/bundled_mcrouter-prefix/src/bundled_mcrouter \
--strip-components=1
mkdir -p third-party/timelib/bundled_timelib-prefix/src/bundled_timelib
install -m 0644 -D $CWD/timelib-2021.07.tar.gz third-party/timelib/bundled_timelib-prefix/src/timelib-2021.07.tar.gz
tar -zxvf $CWD/timelib-2021.07.tar.gz \
-C third-party/timelib/bundled_timelib-prefix/src/bundled_timelib \
--strip-components=1
mkdir -p third-party/fizz/bundled_fizz-prefix/src/bundled_fizz
install -m 0644 -D $CWD/fizz-v2022.01.31.00.tar.gz \
third-party/fizz/bundled_fizz-prefix/src/fizz-v2022.01.31.00.tar.gz
tar -zxvf $CWD/fizz-v2022.01.31.00.tar.gz \
-C third-party/fizz/bundled_fizz-prefix/src/bundled_fizz
# The working directory is hphp/hack.
cat << EOF > hphp/hack/facebook/fetch_opam2_repo_hack.sh
#!/bin/sh
cp $CWD/index-$OPAM_STAMP.tar.gz facebook/
echo facebook/index-$OPAM_STAMP
EOF
chmod 0755 hphp/hack/facebook/fetch_opam2_repo_hack.sh
patch -p1 --verbose -i $CWD/patches/0001-liburing.patch
patch -p1 --verbose -i $CWD/patches/0002-download.patch
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
export CMAKE_PREFIX_PATH=`pwd`
cmake \
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib${LIBDIRSUFFIX} \
-DENABLE_MCROUTER=true \
-DENABLE_EXTENSION_IMAGICK=false \
-DNON_DISTRIBUTABLE_BUILD=true \
-DENABLE_LD_GOLD=true \
-DUSE_JEMALLOC=true \
-DUSE_BUNDLED_TZDATA=OFF \
-DFORCE_BUNDLED_LZ4=OFF \
-DMYSQL_UNIX_SOCK_ADDR=/var/run/mysqld/mysqld.sock \
-DCMAKE_BUILD_TYPE=Release .
make || make -j1
make install DESTDIR=$PKG
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
mkdir -p $PKG/usr/man
mv hphp/doc/man $PKG/usr/man/man1
find $PKG/usr/man -type f -exec gzip -9 {} \;
install -m 644 -D $CWD/etc/rc.hhvm $PKG/etc/rc.d/rc.hhvm.new
install -m 644 -D $CWD/etc/server.ini $PKG/etc/hhvm/server.ini.new
install -m 644 -D $CWD/etc/php.ini $PKG/etc/hhvm/php.ini.new
mkdir -p $PKG/var/log/hhvm $PKG/usr/lib64/hhvm/extensions
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a *.md LICENSE* hphp/doc/* $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|