Skip to content

Commit 9713b76

Browse files
committed
Add patch to modify info.c for release builds to hide configure command
1 parent cbc8fee commit 9713b76

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/Package/Target/php/unix.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,25 @@ public function tryPatchMakefileUnix(): void
161161
shell()->cd(SOURCE_PATH . '/php-src')->exec('sed -i "s|//lib|/lib|g" Makefile');
162162
}
163163

164+
#[BeforeStage('php', [self::class, 'makeForUnix'], 'php')]
165+
#[PatchDescription('Patch info.c to hide configure command in release builds')]
166+
public function patchInfoCForRelease(): void
167+
{
168+
if (str_contains((string) getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS'), '-release')) {
169+
FileSystem::replaceFileLineContainsString(
170+
SOURCE_PATH . '/php-src/ext/standard/info.c',
171+
'#ifdef CONFIGURE_COMMAND',
172+
'#ifdef NO_CONFIGURE_COMMAND',
173+
);
174+
} else {
175+
FileSystem::replaceFileLineContainsString(
176+
SOURCE_PATH . '/php-src/ext/standard/info.c',
177+
'#ifdef NO_CONFIGURE_COMMAND',
178+
'#ifdef CONFIGURE_COMMAND',
179+
);
180+
}
181+
}
182+
164183
#[Stage]
165184
public function makeForUnix(TargetPackage $package, PackageInstaller $installer): void
166185
{

0 commit comments

Comments
 (0)