| 151 | # Build the FPM binary. Keep the options here in sync with those in the |
| 152 | # relevant part of the post-destroot phase. |
| 153 | variant fpm conflicts no_web description {Add FPM (Fast Process Management) web server binary} { |
| 154 | depends_lib-append port:libevent |
| 155 | |
| 156 | set fpm_pidfile ${prefix}/var/run/php-fpm.pid |
| 157 | |
| 158 | patchfiles-append patch-fpm-conf.diff |
| 159 | |
| 160 | startupitem.create yes |
| 161 | startupitem.name php-fpm |
| 162 | startupitem.executable ${prefix}/sbin/php-fpm --fpm-config ${phpinidir}/php-fpm.conf |
| 163 | startupitem.pidfile auto ${fpm_pidfile} |
| 164 | |
| 165 | if { ![variant_isset apache] && ![variant_isset apache2] } { |
| 166 | configure.args-delete \ |
| 167 | --disable-fpm |
| 168 | configure.args-append \ |
| 169 | --enable-fpm |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | |
| 291 | |
| 292 | if { [variant_isset fpm] } { |
| 293 | # If we've built an Apache module (any version) then the FPM binary |
| 294 | # will not have been built, so we need to run through the whole process |
| 295 | # again and build just the FPM binary. Keep the options here in sync |
| 296 | # with the options specified in the apache and apache2 variants. |
| 297 | # This shouldn't be necessary, but is done for http://bugs.php.net/bug.php?id=52419 |
| 298 | if { [variant_isset apache] } { |
| 299 | if { ![variant_isset macosx] && (![info exists os.subplatform] || ${os.subplatform} != "macosx") } { |
| 300 | configure.args-delete \ |
| 301 | --with-apxs=${prefix}/sbin/apxs |
| 302 | } else { |
| 303 | configure.args-delete \ |
| 304 | --with-apxs=/usr/sbin/apxs |
| 305 | } |
| 306 | } |
| 307 | if { [variant_isset apache2] } { |
| 308 | configure.args-delete \ |
| 309 | --with-apxs2=${prefix}/apache2/bin/apxs |
| 310 | } |
| 311 | |
| 312 | # Run the build again to get the FPM binary. Keep the options here |
| 313 | # in sync with those in the fpm variant. |
| 314 | if { [variant_isset apache] || [variant_isset apache2] } { |
| 315 | configure.args-delete \ |
| 316 | --disable-fpm |
| 317 | configure.args-append \ |
| 318 | --enable-fpm |
| 319 | ui_msg "$UI_PREFIX Configuring ${name} again for FPM" |
| 320 | command_exec configure |
| 321 | ui_msg "$UI_PREFIX Building ${name} again for FPM" |
| 322 | command_exec build |
| 323 | ui_msg "$UI_PREFIX Staging ${name} FPM into destroot" |
| 324 | } |
| 325 | |
| 326 | # Copy the FPM binary to the sbin dir. |
| 327 | xinstall -m 755 ${worksrcpath}/sapi/fpm/php-fpm ${destroot}${prefix}/sbin |
| 328 | } |
| 373 | |
| 374 | if {[variant_isset fpm]} { |
| 375 | ui_msg "" |
| 376 | if {![file exists ${phpinidir}/php-fpm.conf]} { |
| 377 | ui_msg "To set up PHP FPM, copy" |
| 378 | ui_msg "${phpinidir}/php-fpm.conf.default to" |
| 379 | ui_msg "${phpinidir}/php-fpm.conf and then make changes." |
| 380 | } else { |
| 381 | ui_msg "You may need to update your php-fpm.conf for any changes that have been made" |
| 382 | ui_msg "in this version of php. Compare ${phpinidir}/php-fpm.conf.default with" |
| 383 | ui_msg "${phpinidir}/php-fpm.conf." |
| 384 | } |
| 385 | } |