Ticket #26039: fpm-ryandesign.diff

File fpm-ryandesign.diff, 5.3 KB (added by ryandesign (Ryan Carsten Schmidt), 14 years ago)

slightly revised patch

  • Portfile

     
    8787    --with-libxml-dir=${prefix} \
    8888    --with-zlib=${prefix} \
    8989    --without-pear \
    90     --disable-cgi
     90    --disable-cgi \
     91    --disable-fpm
    9192
    9293# php5-mysql +mysqlnd needs mysqlnd support compiled into php
    9394configure.env-append    PHP_MYSQLND_ENABLED=yes
     
    99100        LIBS=-lresolv
    100101}
    101102
    102 variant no_web conflicts apache apache2 fastcgi description {Don't include any web server support} {}
     103variant no_web conflicts apache apache2 fastcgi fpm description {Don't include any web server support} {}
    103104
    104105# Build an Apache 1 module. On Mac OS X, it uses Apple's provided Apache 1 server.
    105106# On other platforms, the MacPorts apache port is used. Keep the options here
     
    146147    }
    147148}
    148149
     150# Build the FPM binary. Keep the options here in sync with those in the
     151# relevant part of the post-destroot phase.
     152variant 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
    149172variant ipc description {Add semaphore, shared memory and IPC functions} {
    150173    configure.args-append \
    151174        --enable-shmop \
     
    154177        --enable-sysvmsg
    155178}
    156179
    157 if {![variant_isset apache] && ![variant_isset apache2] && ![variant_isset fastcgi] && ![variant_isset no_web]} {
     180if {![variant_isset apache] && ![variant_isset apache2] && ![variant_isset fastcgi] && ![variant_isset fpm] && ![variant_isset no_web]} {
    158181    default_variants +apache2
    159182}
    160183
     
    256279        xinstall -m 755 ${worksrcpath}/sapi/cgi/php-cgi ${destroot}${prefix}/bin
    257280    }
    258281   
     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   
    259320    #file rename ${destroot}${prefix}/etc/pear.conf ${destroot}${prefix}/etc/pear.conf.sample
    260321   
    261322    # Copy the default php.ini files.
     
    265326        php.ini-production \
    266327        ${destroot}${phpinidir}
    267328   
     329    # Copy FPM configuration file.
     330    if {[variant_isset fpm]} {
     331        xinstall -m 644 ${worksrcpath}/sapi/fpm/php-fpm.conf ${destroot}${phpinidir}/php-fpm.conf.default
     332    }
     333   
    268334    # Copy mysqlnd headers.
    269335    xinstall -d ${destroot}${prefix}/include/php/ext/mysqlnd
    270336    eval xinstall -m 644 [glob ${worksrcpath}/ext/mysqlnd/*.h] ${destroot}${prefix}/include/php/ext/mysqlnd
     
    295361        ui_msg "${phpinidir}/php.ini-production (if this is a production server)."
    296362    }
    297363   
     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   
    298377    if {![variant_isset no_web]} {
    299378        ui_msg ""
    300379        ui_msg "If this is your first install, you need to activate PHP in your web server."