Skip to content

Commit 4cc985a

Browse files
crazywhaleccDubbleClickmhpcc
authored
Fix gettext on locale bug (#634)
* Fix gettext locale sanity check failure bug * Fix phpstan * Add tests * Add additional attr build configure args * Remove windows test * Fix attr configure arg * Fix attr configure bug on gnu docker and alpine docker * Add gettext-devel for doctor * weird change for gnu docker container (#643) Co-authored-by: Marc Henderkes <[email protected]> --------- Co-authored-by: Marc <[email protected]> Co-authored-by: Marc Henderkes <[email protected]>
1 parent 39a66da commit 4cc985a

File tree

9 files changed

+20
-12
lines changed

9 files changed

+20
-12
lines changed

bin/build-static-frankenphp

+4-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ RUN sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/*.repo && \
6161
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo
6262
RUN yum clean all && \
6363
yum makecache && \
64-
yum update -y
64+
yum update -y && \
65+
localedef -c -i en_US -f UTF-8 en_US.UTF-8
6566
6667
RUN yum install -y centos-release-scl
6768
@@ -137,15 +138,15 @@ MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/source:/app/source"
137138
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/dist:/app/dist"
138139
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/downloads:/app/downloads"
139140
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/pkgroot:/app/pkgroot"
140-
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/dist:/frankenphp/dist"
141+
MOUNT_LIST="$MOUNT_LIST -v ""$(pwd)""/frankenphp-dist:/frankenphp/dist"
141142

142143
# Apply env in temp env file
143144
echo 'SPC_SKIP_DOCTOR_CHECK_ITEMS=if musl-wrapper is installed,if musl-cross-make is installed' > /tmp/spc-gnu-docker.env
144145
echo 'CC=/opt/rh/devtoolset-10/root/usr/bin/gcc' >> /tmp/spc-gnu-docker.env
145146
echo 'CXX=/opt/rh/devtoolset-10/root/usr/bin/g++' >> /tmp/spc-gnu-docker.env
146147
echo 'AR=/opt/rh/devtoolset-10/root/usr/bin/ar' >> /tmp/spc-gnu-docker.env
147148
echo 'LD=/opt/rh/devtoolset-10/root/usr/bin/ld' >> /tmp/spc-gnu-docker.env
148-
echo 'SPC_DEFAULT_C_FLAGS=-fPIE' >> /tmp/spc-gnu-docker.env
149+
echo 'SPC_DEFAULT_C_FLAGS=-fPIE -fPIC' >> /tmp/spc-gnu-docker.env
149150
echo 'SPC_NO_MUSL_PATH=yes' >> /tmp/spc-gnu-docker.env
150151
echo 'SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-Wl,-O1 -pie"' >> /tmp/spc-gnu-docker.env
151152
echo 'SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-ldl -lpthread -lm -lresolv -lutil -lrt"' >> /tmp/spc-gnu-docker.env

bin/spc-alpine-docker

+3-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ RUN apk update; \
8181
make \
8282
pkgconfig \
8383
wget \
84-
xz
84+
xz \
85+
gettext-dev \
86+
binutils-gold
8587
8688
RUN curl -#fSL https://dl.static-php.dev/static-php-cli/bulk/php-8.4.4-cli-linux-\$(uname -m).tar.gz | tar -xz -C /usr/local/bin && \
8789
chmod +x /usr/local/bin/php

bin/spc-gnu-docker

+2-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ RUN sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/*.repo && \
5757
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo
5858
RUN yum clean all && \
5959
yum makecache && \
60-
yum update -y
60+
yum update -y && \
61+
localedef -c -i en_US -f UTF-8 en_US.UTF-8
6162
6263
RUN yum install -y centos-release-scl
6364

config/ext.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
},
117117
"ffi": {
118118
"support": {
119-
"Linux": "no",
119+
"Linux": "partial",
120120
"BSD": "wip"
121121
},
122122
"notes": true,

src/SPC/builder/unix/library/attr.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ protected function build(): void
1818
'CFLAGS' => trim('-I' . BUILD_INCLUDE_PATH . ' ' . $this->getLibExtraCFlags()),
1919
'LDFLAGS' => trim('-L' . BUILD_LIB_PATH . ' ' . $this->getLibExtraLdFlags()),
2020
'LIBS' => $this->getLibExtraLibs(),
21-
])->execWithEnv('./autogen.sh')
22-
->execWithEnv('./configure --prefix= --enable-static --disable-shared --disable-nls')
21+
])
22+
->execWithEnv('libtoolize --force --copy')
23+
->execWithEnv('./autogen.sh')
24+
->execWithEnv('./configure --prefix= --enable-static --disable-shared --with-pic --disable-nls')
2325
->execWithEnv("make -j {$this->builder->concurrency}")
2426
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
2527

src/SPC/builder/unix/library/libacl.php

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ protected function build(): void
3535
'LDFLAGS' => trim('-L' . BUILD_LIB_PATH . ' ' . $this->getLibExtraLdFlags()),
3636
'LIBS' => $this->getLibExtraLibs(),
3737
])
38+
->execWithEnv('libtoolize --force --copy')
3839
->execWithEnv('./autogen.sh')
3940
->execWithEnv('./configure --prefix= --enable-static --disable-shared --disable-tests --disable-nls')
4041
->execWithEnv("make -j {$this->builder->concurrency}")

src/SPC/doctor/item/LinuxToolCheckList.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class LinuxToolCheckList
3737
'git', 'autoconf', 'automake',
3838
'tar', 'unzip', 'gzip', 'gcc',
3939
'bzip2', 'cmake', 'patch',
40-
'xz', 'libtool',
40+
'xz', 'libtool', 'gettext-devel',
4141
];
4242

4343
public const TOOLS_ARCH = [
@@ -47,6 +47,7 @@ class LinuxToolCheckList
4747
private const PROVIDED_COMMAND = [
4848
'binutils-gold' => 'ld.gold',
4949
'base-devel' => 'automake',
50+
'gettext-devel' => 'gettext',
5051
];
5152

5253
/** @noinspection PhpUnused */

src/globals/ext-tests/gettext.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
file_put_contents('locale/en_US/LC_MESSAGES/test.mo', base64_decode($mo));
1515
}
1616
putenv('LANG=en_US');
17-
setlocale(LC_ALL, 'en_US');
17+
assert(setlocale(LC_ALL, 'en_US.utf-8') === 'en_US.utf-8');
1818

1919
$domain = 'test';
2020
bindtextdomain($domain, 'locale/');

src/globals/test-extensions.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
// test os (macos-13, macos-14, ubuntu-latest, windows-latest are available)
2323
$test_os = [
24-
// 'macos-13',
24+
'macos-13',
2525
'macos-14',
2626
'ubuntu-latest',
2727
// 'windows-latest',
@@ -40,7 +40,7 @@
4040

4141
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
4242
$extensions = match (PHP_OS_FAMILY) {
43-
'Linux', 'Darwin' => 'imagick',
43+
'Linux', 'Darwin' => 'gettext',
4444
'Windows' => 'bcmath',
4545
};
4646

0 commit comments

Comments
 (0)