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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
|
#!/bin/bash
#
# Maintainer: Deposite Pirate <ofni.sknuplatem@etaripd>
source /usr/src/ports/Build/build.sh
NAME=php
VERSION=5.4.15
BUILD=1
DEPENDS=('libxml >= 2.9.0-1')
OPTDEPENDS=('curl >= 7.29.0-1' 'gnutls >= 3.1.10-1' 'openssl >= 1.0.1e-1' 'gdbm >= 1.10-1' 'enchant >= 1.6.0-1' 'libxslt >= 1.1.28-1')
# Description
cat > ${PKG}/install/slack-desc <<EOF
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
$(padd)|-----handy-ruler------------------------------------------------------|
${NAME}: php (HTML-embedded scripting language)
${NAME}:
${NAME}: PHP is an HTML-embedded scripting language. It shares syntax
${NAME}: characteristics with C, Java, and Perl. The primary objective behind
${NAME}: this language is to make a fast and easy-to-use scripting language
${NAME}: for dynamic web sites.
${NAME}:
${NAME}: More information can be found online at http://www.php.net
${NAME}:
${NAME}:
${NAME}:
EOF
cat >> ${PKG}/install/doinst.sh <<EOF
#!/bin/sh
config() {
NEW="\$1"
OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r \$OLD ]; then
mv \$NEW \$OLD
elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then
# toss the redundant copy
rm \$NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
# Create php-fpm's run directory if it isn't there
if [ -d run/php-fpm ]; then
install -m 0755 -d run/php-fpm
fi
# Keep same perms on rc.php-fpm.new
if [ -e etc/rc.d/rc.php-fpm ]; then
cp -a etc/rc.d/rc.php-fpm etc/rc.d/rc.php-fpm.new.incoming
cat etc/rc.d/rc.php-fpm.new > etc/rc.d/rc.php-fpm.new.incoming
mv etc/rc.d/rc.php-fpm.new.incoming etc/rc.d/rc.php-fpm.new
fi
config etc/php-fpm.conf.new
config etc/php.d/php.ini.new
config etc/apache/extra/httpd-mod_php.conf.new
config etc/conf.d/php.conf.new
config etc/rc.d/rc.php-fpm.new
EOF
# Sources
SRCNAME[0]=${NAME}
SRCVERS[0]=${VERSION}
SRCPACK[0]=ftp://fr2.php.net/mirrors/www.php.net/distributions/${SRCNAME[0]}-${SRCVERS[0]}.tar.bz2
SRCCOPY[0]="PHP"
configure()
{
extensions="--enable-bcmath=shared \
--enable-calendar=shared \
--enable-ctype=shared \
--enable-dba=shared \
--enable-exif=shared \
--enable-fpm \
--enable-ftp=shared \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--enable-hash \
--enable-json=shared \
--enable-mbregex=shared \
--enable-mbstring=shared \
--enable-mod_charset \
--enable-pdo=shared \
--enable-dom=shared \
--enable-phar \
--enable-posix=shared \
--enable-session \
--enable-shmop=shared \
--enable-simplexml \
--enable-soap=shared \
--enable-sockets=shared \
--enable-sqlite-utf8 \
--enable-sysvmsg=shared \
--enable-sysvsem=shared \
--enable-sysvshm=shared \
--enable-tokenizer=shared \
--enable-wddx=shared \
--enable-xml=shared \
--enable-xmlreader=shared \
--enable-zip=shared \
--with-fpm-user=apache \
--with-fpm-group=apache \
--with-bz2=shared,${SYS_DIR[usr]} \
--with-curl=shared,${SYS_DIR[usr]} \
--with-curlwrappers \
--with-db4=${SYS_DIR[usr]} \
--with-enchant=shared,${SYS_DIR[usr]} \
--with-freetype-dir=${SYS_DIR[usr]} \
--with-gd=shared \
--with-gdbm=shared,${SYS_DIR[usr]} \
--with-gettext=shared,${SYS_DIR[usr]} \
--with-gmp=shared,${SYS_DIR[usr]} \
--with-iconv=shared \
--with-jpeg-dir=shared,${SYS_DIR[usr]} \
--with-libxml-dir=${SYS_DIR[usr]} \
--with-mhash=shared,${SYS_DIR[usr]} \
--with-mysql=shared,mysqlnd \
--with-mysql-sock=${SYS_DIR[run]}/mariadb/mariadb.sock \
--with-mysqli=shared,mysqlnd \
--with-openssl=shared \
--with-pcre-dir=${SYS_DIR[usr]} \
--with-pcre-regex=${SYS_DIR[usr]} \
--with-pdo-mysql=shared,mysqlnd \
--with-pdo-sqlite=shared,${SYS_DIR[usr]} \
--with-png-dir=shared,${SYS_DIR[usr]} \
--with-readline=shared,${SYS_DIR[usr]} \
--with-regex=php \
--with-snmp=shared,${SYS_DIR[usr]} \
--with-sqlite3=shared,${SYS_DIR[usr]} \
--with-t1lib=${SYS_DIR[usr]} \
--with-vpx-dir=${SYS_DIR[usr]} \
--with-xpm-dir=${SYS_DIR[usr]} \
--with-xsl=shared,${SYS_DIR[usr]} \
--with-zlib=shared,${SYS_DIR[usr]} \
"
#FIXME: some PHP extensions are missing
# --with-mm=${SYS_DIR[usr]} \
# --with-ldap=shared \
# --with-imap-ssl=${SYS_DIR[usr]} \ # Requires Alpine's c-client.a
# --with-imap=${SYS_DIR[usr]} \
# --enable-simplexml=shared \ # Cannot build SPL as a module
# --enable-intl=shared \ # Requires ICU which is a fat dependency we don't want
# --with-mcrypt=${SYS_DIR[usr]} \ # Requires mcrypt.h
# --with-pspell=shared,${SYS_DIR[usr]} \ # Requires pspell
#FIXME: SQLite3 won't compile and break the build with -ffast-math
export O_FLAGS="${FLAGS//-ffast-math}"
export EXTENSION_DIR="${SYS_DIR[lib]}/plugins/php"
#export PEAR_INSTALLDIR="${SYS_DIR[share]}/pear"
CPPFLAGS="-I${SYS_DIR[include]}/apr-1 -I${SYS_DIR[include]}/sqlite-3" \
CFLAGS="${O_FLAGS}" CXXFLAGS="${O_FLAGS}" \
./configure \
${*} \
--build="${ARCH}-slackware-linux" \
--prefix="${SYS_DIR[usr]}" \
--sysconfdir="${SYS_DIR[etc]}" \
--libdir="${SYS_DIR[share]}/php" \
--mandir="${SYS_DIR[man]}" \
--localstatedir="${SYS_DIR[var]}" \
--datarootdir="${SYS_DIR[share]}" \
--datadir="${SYS_DIR[share]}" \
--with-config-file-scan-dir="${SYS_DIR[etc]}/php.d" \
--with-config-file-path="${SYS_DIR[etc]}/php.d" \
--without-pear \
--disable-rpath \
--disable-debug \
--disable-magic-quotes \
--disable-safe-mode \
--disable-sigchild \
--enable-maintainer-zts \
--enable-inline-optimization \
--enable-static=no \
--enable-shared=yes \
--enable-filter \
--enable-zend-multibyte \
--with-pic \
--with-gnu-ld \
--with-tsrm-pthreads \
${extensions}
# --with-pear=/usr/share/pear
# Old stuff
# --with-shared-layout=PHP
# --enable-discard-path
# --enable-force-cgi-redirect
}
build0()
{
#FIXME: Apache config file hack
(
install.dir ${PKG}${SYS_DIR[etc]}/apache
install.dat apache.hack ${PKG}${SYS_DIR[etc]}/apache/httpd.conf
)
# apache2 + cli build
configure \
--with-apxs2="${SYS_DIR[bin]}/apxs" \
--enable-pcntl
make ${JOBS} install INSTALL_ROOT="${PKG}"
make install-cli INSTALL_ROOT="${PKG}"
#make install-pear INSTALL_ROOT="${PKG}"
changelog NEWS
install.dir ${PKG}${SYS_DIR[etc]}/{php,tmpfiles,conf,rc}.d
install.cfg php.ini-* ${PKG}${SYS_DIR[etc]}/php.d
install.cfg php.ini-development ${PKG}${SYS_DIR[etc]}/php.d/php.ini.new
install.dir ${PKG}${SYS_DIR[etc]}/apache/extra
install.cfg mod_php.conf.example \
${PKG}${SYS_DIR[etc]}/apache/extra/httpd-mod_php.conf.new
mv \
${PKG}${SYS_DIR[etc]}/php-fpm.conf.default \
${PKG}${SYS_DIR[etc]}/php-fpm.conf.new
install.cfg sapi/fpm/init.d.php-fpm ${PKG}${SYS_DIR[etc]}/rc.d/rc.php-fpm.new
install.cfg php-fpm.conf.tmpfiles ${PKG}${SYS_DIR[etc]}/tmpfiles.d/php-fpm.conf
install.dir ${PKG}${SYS_DIR[var]}/lib/php
chgrp apache ${PKG}${SYS_DIR[var]}/lib/php
chmod 0770 ${PKG}${SYS_DIR[var]}/lib/php
install.cfg php.conf.d ${PKG}${SYS_DIR[etc]}/conf.d/php.conf.new
install.dir ${PKG}${SYS_DIR[systemdsystemscriptdir]}
install.bin cleanphpsession ${PKG}${SYS_DIR[systemdsystemscriptdir]}
install.dir ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.cfg sapi/fpm/php-fpm.service ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.dir ${PKG}${SYS_DIR[etc]}/cron.daily
(
cd ${PKG}${SYS_DIR[etc]}/cron.daily
ln -sf ${SYS_DIR[share]}/systemd/script/cleanphpsession php
)
config ${PKG}${SYS_DIR[etc]}/php-fpm.conf
chmod 0755 \
${PKG}${SYS_DIR[bin]}/php \
${PKG}${SYS_DIR[lib]}/plugins/php/*
rm -f \
${PKG}${SYS_DIR[var]}/run \
${PKG}${SYS_DIR[etc]}/php.d/*~ \
${PKG}${SYS_DIR[etc]}/apache/httpd*
}
|