-
Notifications
You must be signed in to change notification settings - Fork 2
/
php-8.1.yaml
390 lines (371 loc) · 11.2 KB
/
php-8.1.yaml
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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
package:
name: php-8.1
version: 8.1.31
epoch: 0
description: "the PHP programming language"
copyright:
- license: PHP-3.01
dependencies:
provides:
- php=${{package.full-version}}
runtime:
- ${{package.name}}-config
- libxml2
environment:
contents:
packages:
- aom-dev
- autoconf
- bison
- build-base
- busybox
- bzip2-dev
- ca-certificates-bundle
- curl-dev
- dav1d-dev
- file
- freetds
- freetds-dev
- freetype-dev
- gmp-dev
- icu-dev
- libavif-dev
- libffi-dev
- libjpeg-turbo-dev
- libpng-dev
- libsodium-dev
- libtool
- libwebp-dev
- libx11-dev
- libxml2-dev
- libxpm-dev
- libxslt-dev
- libzip
- oniguruma-dev
- openldap-dev
- openssf-compiler-options
- openssl-dev
- patch
- postgresql-dev
- re2c
- readline-dev
- sqlite-dev
- unixodbc-dev
- wget
environment:
CFLAGS: -Wno-incompatible-pointer-types
pipeline:
- uses: git-checkout
with:
repository: https://github.com/php/php-src
tag: php-${{package.version}}
expected-commit: 38123aca18c3c1bd1f109ec77af2f175d7afcf35
- name: Patch to use C++17 (default)
runs: |
# patching PHP_CXX_COMPILE_STDCXX to 17
sed -i 's|PHP_CXX_COMPILE_STDCXX(11|PHP_CXX_COMPILE_STDCXX(17|' ext/intl/config.m4
- name: Configure
runs: |
./buildconf --force
EXTENSION_DIR=/usr/lib/php/modules ./configure \
--prefix=/usr \
--libdir=/usr/lib/php \
--datadir=/usr/share/php \
--sysconfdir=/etc/php \
--localstatedir=/var \
--with-layout=GNU \
--with-pic \
--with-config-file-path=/etc/php \
--with-config-file-scan-dir=/etc/php/conf.d \
--enable-cli \
--enable-ctype=shared \
--enable-bcmath=shared \
--with-curl=shared \
--enable-dom=shared \
--enable-fileinfo=shared \
--with-iconv=shared \
--with-openssl=shared \
--with-readline \
--enable-ftp=shared \
--with-sodium=shared \
--enable-fpm \
--with-pear \
--enable-gd=shared \
--with-avif \
--with-freetype \
--with-jpeg \
--with-webp \
--with-xpm \
--disable-gd-jis-conv \
--with-libxml \
--enable-phar=shared \
--enable-mbstring=shared \
--with-mysqli=shared \
--with-mysql-sock=/run/mysqld/mysqld.sock \
--enable-mysqlnd=shared \
--enable-pdo=shared \
--with-pdo-mysql=shared,mysqlnd \
--with-pdo-sqlite=shared \
--with-pdo-dblib=shared \
--with-pdo-pgsql=shared \
--with-pdo-odbc=shared,unixODBC,/usr \
--with-unixODBC=shared,/usr \
--enable-pcntl=shared \
--enable-sockets=shared \
--with-bz2=shared \
--enable-calendar=shared \
--enable-exif=shared \
--with-gettext=shared \
--with-gmp=shared \
--enable-intl=shared \
--with-ldap=shared \
--enable-opcache=shared \
--enable-soap=shared \
--with-xsl=shared \
--with-zlib \
--enable-xml=shared \
--enable-simplexml=shared \
--enable-xml=shared \
--enable-xmlreader=shared \
--enable-xmlwriter=shared \
--enable-posix=shared \
--with-pgsql=shared \
--with-zip=shared \
--enable-shmop=shared \
--enable-sysvsem=shared \
--enable-sysvshm=shared \
--enable-sysvmsg=shared \
--with-ffi=shared
- uses: autoconf/make
- name: Make Install
runs: |
INSTALL_ROOT=${{targets.destdir}} DESTDIR=${{targets.destdir}} make install
mkdir -p "${{targets.destdir}}/bin" && ln -s /usr/bin/php "${{targets.destdir}}/bin/php"
- uses: strip
data:
- name: extensions
items:
bz2: Bzip2
curl: cURL
gd: GD imaging
gmp: GNU GMP support
ldap: LDAP
mysqlnd: MySQLnd
openssl: OpenSSL
pdo_mysql: MySQL driver for PDO
pdo_sqlite: SQLite 3.x driver for PDO
pdo_dblib: PDO driver for Sybase / MS SQL databases
pdo_pgsql: PDO driver for pgsql
pdo_odbc: PDO driver for ODBC
soap: SOAP
sodium: Sodium
calendar: Calendar
exif: EXIF
gettext: GetText
intl: Internationalization
mbstring: Multibyte String Functions
opcache: Opcache
pcntl: pcntl
pdo: PHP Data Objects
phar: PHP Archive
sockets: Sockets
xsl: XSL
bcmath: BC Math
ctype: ctype
iconv: Iconv
dom: DOM
pgsql: PostgreSQL
posix: Posix
shmop: shmop
sysvmsg: sysvmsg
sysvsem: sysvsem
sysvshm: sysvshm
simplexml: SimpleXML
mysqli: MySQLi
xml: XML
xmlreader: XMLReader
xmlwriter: XMLWriter
fileinfo: fileinfo
zip: Zip
odbc: UnixODBC
ftp: FTP
ffi: FFI
subpackages:
- name: ${{package.name}}-config
dependencies:
provides:
- php-config=${{package.full-version}}
pipeline:
- runs: |
mkdir -p "${{targets.subpkgdir}}/etc/php/conf.d"
mv $HOME/php.ini-production ${{targets.subpkgdir}}/etc/php/php.ini
- range: extensions
name: "${{package.name}}-${{range.key}}"
description: "The ${{range.value}} extension"
dependencies:
runtime:
- "${{package.name}}-${{range.key}}-config"
provides:
- php-${{range.key}}=${{package.full-version}}
pipeline:
- runs: |
export EXTENSIONS_DIR=usr/lib/php/modules
mkdir -p "${{targets.subpkgdir}}"/$EXTENSIONS_DIR
mv "${{targets.destdir}}/$EXTENSIONS_DIR/${{range.key}}.so" \
"${{targets.subpkgdir}}/$EXTENSIONS_DIR/${{range.key}}.so"
- range: extensions
name: "${{package.name}}-${{range.key}}-config"
description: "The ${{range.value}} extension configuration"
dependencies:
provides:
- php-${{range.key}}-config=${{package.full-version}}
pipeline:
- runs: |
export CONF_DIR="${{targets.subpkgdir}}/etc/php/conf.d"
mkdir -p $CONF_DIR
order=10
prefix=
[ "${{range.key}}" != "opcache" ] || prefix="zend_"
# Determine load order based on number of dependencies found in config.w32
[ -f "ext/${{range.key}}/config.w32" ] && \
deps=`sed -En "s/.*ADD_EXTENSION_DEP\('${{range.key}}', ([^)]+)\).*/\1/p" "ext/${{range.key}}/config.w32" \
| tr -d "'," | tr ' ' '\n' \
| sort -u \
| while read -r dep; do
[ "$dep" = "true" ] || echo $dep
done | wc -w`
echo "${prefix}extension=${{range.key}}.so" > $CONF_DIR/"$((order+order*deps))-${{range.key}}.ini"
- name: ${{package.name}}-dev
description: PHP 8.1 development headers
dependencies:
provides:
- php-dev=${{package.full-version}}
pipeline:
- uses: split/dev
- runs: |
mkdir -p ${{targets.subpkgdir}}/usr/bin
mv ${{targets.destdir}}/usr/bin/phpize ${{targets.subpkgdir}}/usr/bin/
mv ${{targets.destdir}}/usr/lib ${{targets.subpkgdir}}/usr
- name: ${{package.name}}-doc
description: PHP 8.1 documentation
dependencies:
provides:
- php-doc=${{package.full-version}}
pipeline:
- uses: split/manpages
- name: "${{package.name}}-cgi"
description: PHP 8.1 CGI
dependencies:
provides:
- php-cgi=${{package.full-version}}
pipeline:
- runs: |
mkdir -p ${{targets.subpkgdir}}/usr/bin
mv ${{targets.destdir}}/usr/bin/php-cgi ${{targets.subpkgdir}}/usr/bin/
- name: "${{package.name}}-dbg"
description: Interactive PHP Debugger
dependencies:
provides:
- php-dbg=${{package.full-version}}
pipeline:
- runs: |
mkdir -p ${{targets.subpkgdir}}/usr/bin
mv ${{targets.destdir}}/usr/bin/phpdbg ${{targets.subpkgdir}}/usr/bin/
- name: "${{package.name}}-fpm"
description: PHP 8.1 FastCGI Process Manager (FPM)
dependencies:
runtime:
- "${{package.name}}-fpm-config"
provides:
- php-fpm=${{package.full-version}}
pipeline:
- runs: |
mkdir -p ${{targets.subpkgdir}}/usr/sbin
mv ${{targets.destdir}}/usr/sbin/php-fpm ${{targets.subpkgdir}}/usr/sbin/
- name: ${{package.name}}-fpm-config
description: PHP 8.1 FastCGI Process Manager (FPM) configuration
dependencies:
provides:
- php-fpm-config=${{package.full-version}}
pipeline:
- runs: |
mkdir -p ${{targets.subpkgdir}}/etc/php/php-fpm.d
mv ${{targets.destdir}}/etc/php/php-fpm.conf.default ${{targets.subpkgdir}}/etc/php/php-fpm.conf
mv ${{targets.destdir}}/etc/php/php-fpm.d/www.conf.default ${{targets.subpkgdir}}/etc/php/php-fpm.d/www.conf \
&& { \
echo '[global]'; \
echo 'error_log = /proc/self/fd/2'; \
echo 'daemonize = no'; \
echo; \
echo '[www]'; \
echo 'listen = [::]:9000'; \
echo 'access.log = /proc/self/fd/2'; \
echo; \
echo 'clear_env = no'; \
echo; \
echo 'catch_workers_output = yes'; \
echo; \
echo 'decorate_workers_output = no'; \
} | tee ${{targets.subpkgdir}}/etc/php/php-fpm.d/zz-apko.conf
update:
enabled: true
github:
identifier: php/php-src
strip-prefix: php-
tag-filter: php-8.1
use-tag: true
test:
environment:
contents:
packages:
- postgresql
- postgresql-client
- wolfi-base
- shadow
- sudo-rs
- glibc-locales
- php-8.1-pgsql
environment:
PGDATA: /tmp/test_db
PGUSER: wolfi
pipeline:
- name: "Test database creation"
runs: |
useradd $PGUSER
sudo -u $PGUSER initdb -D /tmp/test_db
sudo -u $PGUSER pg_ctl -D /tmp/test_db -l /tmp/logfile start
sudo -u $PGUSER createdb testdb
psql -lqt | cut -d \| -f 1 | grep -qw testdb
php --help
- name: "Test basic read/write operations"
runs: |
sudo -u $PGUSER psql -d testdb -c "CREATE TABLE test_table (id SERIAL PRIMARY KEY, test_value VARCHAR(50));"
sudo -u $PGUSER psql -d testdb -c "INSERT INTO test_table (test_value) VALUES ('Hello, Wolfi!');"
sudo -u $PGUSER psql -d testdb -t -A -c "SELECT test_value FROM test_table WHERE id=1;"
- name: "Test php"
- runs: |
php --version
php -m
- runs: |
cat <<'EOF' >> /tmp/read_db.php
<?php
$conn = pg_connect("host=localhost dbname=testdb user=wolfi");
if (!$conn) {
echo "Connection error.\n";
exit;
}
$result = pg_query($conn, "SELECT test_value FROM test_table WHERE id=1");
if (!$result) {
echo "Error in the query.\n";
exit;
}
$row = pg_fetch_row($result);
if (!$row) {
echo "Empty.\n";
exit;
}
echo "Value from test_table: $row[0]\n";
pg_close($conn);
?>
EOF
php /tmp/read_db.php