Ticket #26039: php5-fpm-variant.diff

File php5-fpm-variant.diff, 2.9 KB (added by info@…, 14 years ago)
  • (a) Portfile vs. (b) (clipboard)

    a b  
    105105        --with-ldap=/usr
    106106}
    107107
    108 variant no_web conflicts apache apache2 fastcgi description {Don't include any web server support} {}
     108variant no_web conflicts apache apache2 fastcgi fpm  description {Don't include any web server support} {}
    109109
    110110# Build an Apache 1 module. On Mac OS X, it uses Apple's provided Apache 1 server.
    111111# On other platforms, the MacPorts apache port is used. Keep the options here
     
    152152    }
    153153}
    154154
     155# FPM options
     156variant fpm conflicts no_web description {Add FPM (Fast Process Management) web server binary} {
     157    depends_lib-append      port:libevent
     158
     159    set fpm_pidfile         ${prefix}/var/run/${my_name}-fpm.pid
     160    set fpm_conf_installed  0
     161
     162    startupitem.create      yes
     163    startupitem.executable  ${prefix}/sbin/php-fpm
     164    startupitem.pidfile     auto ${fpm_pidfile}
     165
     166    if { ![variant_isset apache] && ![variant_isset apache2] } {
     167        configure.args-delete \
     168            --disable-fpm
     169        configure.args-append \
     170            --enable-fpm
     171    }
     172}
     173
    155174foreach {old_variant new_port} {
    156175    gmp             gmp
    157176    imap            imap
     
    187206        --enable-sysvmsg
    188207}
    189208
    190 if {![variant_isset apache] && ![variant_isset apache2] && ![variant_isset fastcgi] && ![variant_isset no_web]} {
     209if {![variant_isset apache] && ![variant_isset apache2] && ![variant_isset fastcgi] && ![variant_isset fpm] && ![variant_isset no_web]} {
    191210    default_variants +apache2
    192211}
    193212
     
    290309        # conflict with the cli version.
    291310        xinstall -m 755 ${worksrcpath}/sapi/cgi/php-cgi ${destroot}${prefix}/bin
    292311    }
     312
     313    if { [variant_isset fpm] } {
     314        # Copy the FPM binary to the bin dir under a new name so it doesn't
     315        # conflict with the cli version.
     316        xinstall -m 755 ${worksrcpath}/sapi/fpm/php-fpm ${destroot}${prefix}/sbin
     317    }
    293318   
    294319    #file rename ${destroot}${prefix}/etc/pear.conf ${destroot}${prefix}/etc/pear.conf.sample
    295320   
     
    299324        php.ini-development \
    300325        php.ini-production \
    301326        ${destroot}${phpinidir}
     327
     328    if { [variant_isset fpm] } {
     329      if {![file exists ${phpinidir}/php-fpm.conf]} {
     330          # Only install php-fpm.conf if doesn't exist so we don't overwrite user's file by mistake
     331          xinstall -m 644 ${worksrcpath}/sapi/fpm/php-fpm.conf ${destroot}${phpinidir}
     332      }
     333    }
    302334   
    303335    # Copy mysqlnd headers.
    304336    xinstall -d ${destroot}${prefix}/include/php/ext/mysqlnd
     
    330362        ui_msg "${phpinidir}/php.ini-production (if this is a production server)."
    331363    }
    332364   
     365    if { [variant_isset fpm] } {
     366      ui_msg ""
     367      ui_msg "FPM configuration file installed to ${phpinidir}/php-fpm.conf."
     368    }
     369
    333370    if {![variant_isset no_web]} {
    334371        ui_msg ""
    335372        ui_msg "If this is your first install, you need to activate PHP in your web server."