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