Skip to content

Commit e837397

Browse files
committed
refactor: use ac_cv_func var instead of patching config.m4 for OMP
Match the imagick pattern: pass ac_cv_func_omp_pause_resource_all=no to configure instead of patching config.m4. This is simpler and consistent with how the project handles the same issue in imagick.
1 parent cd9f898 commit e837397

1 file changed

Lines changed: 2 additions & 15 deletions

File tree

src/SPC/builder/extension/gmagick.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,14 @@
55
namespace SPC\builder\extension;
66

77
use SPC\builder\Extension;
8-
use SPC\store\FileSystem;
98
use SPC\util\CustomExt;
109

1110
#[CustomExt('gmagick')]
1211
class gmagick extends Extension
1312
{
1413
public function getUnixConfigureArg(bool $shared = false): string
1514
{
16-
return '--with-gmagick=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH;
17-
}
18-
19-
public function patchBeforeBuildconf(): bool
20-
{
21-
// Remove the OpenMP check from config.m4 to avoid linking against libgomp
22-
// in static builds. The gmagick source code already has a fallback path
23-
// (usleep loop) when HAVE_OMP_PAUSE_RESOURCE_ALL is not defined.
24-
FileSystem::replaceFileRegex(
25-
SOURCE_PATH . '/php-src/ext/gmagick/config.m4',
26-
'/AC_MSG_CHECKING\(omp_pause_resource_all usability\).*?AC_MSG_RESULT\(no\)\n\t\t\]\)/s',
27-
'dnl OMP check removed for static build'
28-
);
29-
return true;
15+
$disable_omp = ' ac_cv_func_omp_pause_resource_all=no';
16+
return '--with-gmagick=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . $disable_omp;
3017
}
3118
}

0 commit comments

Comments
 (0)