[86394] users/ryandesign/ports/lang/php54/Portfile

ryandesign at macports.org ryandesign at macports.org
Mon Oct 24 23:54:07 PDT 2011


Revision: 86394
          http://trac.macports.org/changeset/86394
Author:   ryandesign at macports.org
Date:     2011-10-24 23:54:07 -0700 (Mon, 24 Oct 2011)
Log Message:
-----------
php54: subports for SAPIs; remove apache (1) support; remove ipc, pear and no_web variants; use notes instead of ui_msgs

Modified Paths:
--------------
    users/ryandesign/ports/lang/php54/Portfile

Modified: users/ryandesign/ports/lang/php54/Portfile
===================================================================
--- users/ryandesign/ports/lang/php54/Portfile	2011-10-25 06:38:08 UTC (rev 86393)
+++ users/ryandesign/ports/lang/php54/Portfile	2011-10-25 06:54:07 UTC (rev 86394)
@@ -5,7 +5,7 @@
 
 name                    php54
 set php                 ${name}
-# Increment revision of php54-eaccelerator when updating version of php54.
+# Increment revision of ${php}-eaccelerator when updating version of ${php}.
 version                 5.4.0beta1
 set major               [lindex [split ${version} .] 0]
 categories              lang php www
@@ -34,9 +34,14 @@
                         rmd160  358ae467f1a64e704adbe614acce1a846631d0ed \
                         sha256  f288855f07d37e84e3e51a8fd9617556155e69fcaf0a84633360ada718226b15
 
-depends_build           port:pkgconfig
-
-depends_lib             path:bin/gsed:gsed \
+if {${subport} == "${php}" || ${subport} == "${php}-apache" || ${subport} == "${php}-fastcgi"} {
+    
+    ### SAPIs ###
+    
+    depends_build       port:pkgconfig
+    
+    depends_lib         path:bin/gsed:gsed \
+                        port:libiconv \
                         port:libtool \
                         port:libxml2 \
                         port:bzip2 \
@@ -44,19 +49,17 @@
                         port:pcre \
                         port:readline \
                         port:zlib
-
-# Use -p1 to accommodate the Suhosin patch
-patch.pre_args          -p1
-patchfiles              patch-scripts-php-config.in.diff
-
-use_autoconf            yes
-
-set phpinidir           ${prefix}/etc/${php}
-set extraphpinidir      ${prefix}/var/db/${php}
-
-destroot.keepdirs       ${destroot}${extraphpinidir}
-
-configure.args          --mandir=${prefix}/share/man \
+    
+    # Use -p1 to accommodate the Suhosin patch
+    patch.pre_args      -p1
+    patchfiles          patch-scripts-php-config.in.diff
+    
+    use_autoconf        yes
+    
+    set phpinidir       ${prefix}/etc/${php}
+    set extraphpinidir  ${prefix}/var/db/${php}
+    
+    configure.args      --mandir=${prefix}/share/man \
                         --infodir=${prefix}/share/info \
                         --with-config-file-path=${phpinidir} \
                         --with-config-file-scan-dir=${extraphpinidir} \
@@ -84,245 +87,149 @@
                         --with-libxml-dir=${prefix} \
                         --with-zlib=${prefix} \
                         --without-pear \
+                        --disable-cli \
                         --disable-cgi
-
-# php5-mysql +mysqlnd needs mysqlnd support compiled into php
-configure.env-append    PHP_MYSQLND_ENABLED=yes
-
-configure.universal_args-delete --disable-dependency-tracking
-
-variant no_web conflicts apache apache2 fastcgi description {Don't include any web server support} {}
-
-# Build an Apache 1 module. On Mac OS X, it uses Apple's provided Apache 1 server.
-# On other platforms, the MacPorts apache port is used. Keep the options here
-# in sync with those in the relevant part of the post-destroot phase.
-variant apache conflicts apache2 no_web description {Add Apache 1 web server module} {
-    if { ! [variant_isset macosx] && (![info exists os.subplatform] || ${os.subplatform} != "macosx") } {
-        depends_lib-append \
-            port:apache
-        configure.args-append \
-            --with-apxs=${prefix}/sbin/apxs
-    } else {
-        destroot.violate_mtree yes
-        configure.args-append \
-            --with-apxs=/usr/sbin/apxs
+    
+    # ${php}-mysql +mysqlnd needs mysqlnd support compiled into the SAPI
+    configure.env       PHP_MYSQLND_ENABLED=yes
+    
+    configure.universal_args-delete --disable-dependency-tracking
+    
+    test.run            yes
+    
+    destroot.args       INSTALL_ROOT=${destroot}
+    
+    variant debug description {Enable debug support (useful to analyze a PHP-related core dump)} {
+        configure.args-append   --enable-debug
     }
-}
-
-# Build an Apache 2.2 module. Keep the options here in sync with those in the
-# relevant part of the post-destroot phase.
-variant apache2 conflicts apache no_web description {Add Apache 2.2 web server module} {
-    pre-configure {
-        # Checking for mod_cgi.so is a convenient way to verify apache2 is using its
-        # +preforkmpm variant. (+eventmpm and +workermpm instead provide mod_cgid.so.)
-        if {![file exists ${prefix}/apache2/modules/mod_cgi.so]} {
-            ui_error "To use ${name} with the +apache2 variant, apache2 must be installed with the +preforkmpm variant."
-            return -code error "incompatible apache2 installation"
+    
+    variant suhosin description {Add Suhosin patch} {
+        pre-fetch {
+            if {"darwin" == ${os.platform} && ${os.major} < 9} {
+                ui_error "The suhosin variant requires Mac OS X 10.5 or greater."
+                return -code error "incompatible Mac OS X version"
+            }
+            set suhosin_available 1
+            if {!${suhosin_available}} {
+                ui_error "There is no suhosin patch for PHP ${version} yet. Please check back later."
+            }
+            if {![file exists ${extraphpinidir}/suhosin.ini]} {
+                ui_msg "You may also be interested in the suhosin extension, a related but different piece of software. See the ${php}-suhosin port."
+            }
+            if {!${suhosin_available}} {
+                return -code error "unavailable variant"
+            }
         }
+        set suhosin_patch_version   5.3.7-0.9.10
+        set suhosin_patch           suhosin-patch-${suhosin_patch_version}.patch.gz
+        patch_sites-append          http://download.suhosin.org/
+        patchfiles-append           ${suhosin_patch}
+        checksums-append            ${suhosin_patch} \
+                                    rmd160  19f789bf49a5fed2cd88b199fd8ac5d1ffa9bdc8 \
+                                    sha256  0a0dac0e4343596f2bfcef27dcf7180524b78bb1d2d2ca878370a7d0f8313d26 \
     }
-    destroot.violate_mtree yes
-    depends_lib-append \
-        port:apache2
-    configure.args-append \
-        --with-apxs2=${prefix}/apache2/bin/apxs
-}
-
-# Build a FastCGI binary. Keep the options here in sync with those in the
-# relevant part of the post-destroot phase.
-variant fastcgi conflicts no_web description {Add FastCGI web server binary} {
-    if { ![variant_isset apache] && ![variant_isset apache2] } {
-        configure.args-delete \
-            --disable-cgi
-        configure.args-append \
-            --enable-cgi
+    
+    if {${subport} != ${php}} {
+        notes-append "If this is your first install, you need to activate ${php} in your web server."
     }
 }
 
-variant ipc description {Add semaphore, shared memory and IPC functions} {
-    configure.args-append \
-        --enable-shmop \
-        --enable-sysvsem \
-        --enable-sysvshm \
-        --enable-sysvmsg
-}
-
-if {![variant_isset apache] && ![variant_isset apache2] && ![variant_isset fastcgi] && ![variant_isset no_web]} {
-    default_variants +apache2
-}
-
-variant pear description {Add PEAR} {
-    configure.args-delete \
-        --without-pear
-    configure.args-append \
-        --with-pear=${prefix}/lib/php
-    destroot.target-append \
-        install-pear
-    destroot.args-append \
-        PHP_PEAR_INSTALL_DIR=${prefix}/lib/php
+if {${subport} == ${php}} {
+    configure.args-delete   --disable-cli
+    configure.args-append   --enable-cli
+    
+    destroot.target         install-cli install-build install-headers install-programs
+    
+    destroot.keepdirs       ${destroot}${extraphpinidir}
+    
     post-destroot {
-        #nuke pear-stuff in ${destroot}
-        system -W ${destroot} "rm -rf .channels .depdb .depdblock .filemap .lock"
+        # Copy the default php.ini files.
+        xinstall -m 755 -d ${destroot}${phpinidir}
+        xinstall -m 644 -W ${worksrcpath} \
+            php.ini-development \
+            php.ini-production \
+            ${destroot}${phpinidir}
         
-        system "if \[ -f ${prefix}/lib/php/.depdblock \]; then rm -f ${destroot}${prefix}/lib/php/.depdblock; fi"
-        system "if \[ -f ${prefix}/lib/php/.depdb \]; then rm -f ${destroot}${prefix}/lib/php/.depdb; fi"
-        system "if \[ -f ${prefix}/lib/php/.filemap \]; then rm -f ${destroot}${prefix}/lib/php/.filemap; fi"
-        system "if \[ -f ${prefix}/lib/php/.lock \]; then rm -f ${destroot}${prefix}/lib/php/.lock; fi"
-        system "if \[ -d ${prefix}/lib/php/.channels \]; then rm -rf ${destroot}${prefix}/lib/php/.channels; fi"
+        # Copy mysqlnd headers.
+        xinstall -d ${destroot}${prefix}/include/php/ext/mysqlnd
+        eval xinstall -m 644 [glob ${worksrcpath}/ext/mysqlnd/*.h] ${destroot}${prefix}/include/php/ext/mysqlnd
     }
-}
-
-variant suhosin description {Add Suhosin patch} {
-    pre-fetch {
-        if {"darwin" == ${os.platform} && ${os.major} < 9} {
-            ui_error "The suhosin variant requires Mac OS X 10.5 or greater."
-            return -code error "incompatible Mac OS X version"
-        }
-        set suhosin_available 1
-        if {!${suhosin_available}} {
-            ui_error "There is no suhosin patch for PHP ${version} yet. Please check back later."
-        }
-        if {![file exists ${prefix}/var/db/php5/suhosin.ini]} {
-            ui_msg "You may also be interested in the suhosin extension, a related but different piece of software. See the php5-suhosin port."
-        }
-        if {!${suhosin_available}} {
-            return -code error "unavailable variant"
-        }
+    
+    if {![file exists ${phpinidir}/php.ini]} {
+        notes-append "
+To customize ${php}, copy\
+${phpinidir}/php.ini-development (if this is a development server) or\
+${phpinidir}/php.ini-production (if this is a production server) to\
+${phpinidir}/php.ini and then make changes.
+"
+    } else {
+        notes-append "
+You may need to update your php.ini for any changes that have been made\
+in this version of ${php}. Compare ${phpinidir}/php.ini with\
+${phpinidir}/php.ini-development (if this is a development server) or\
+${phpinidir}/php.ini-production (if this is a production server).
+"
     }
-    set suhosin_patch_version   5.3.7-0.9.10
-    set suhosin_patch           suhosin-patch-${suhosin_patch_version}.patch.gz
-    patch_sites-append          http://download.suhosin.org/
-    patchfiles-append           ${suhosin_patch}
-    checksums-append            ${suhosin_patch} \
-                                rmd160  19f789bf49a5fed2cd88b199fd8ac5d1ffa9bdc8 \
-                                sha256  0a0dac0e4343596f2bfcef27dcf7180524b78bb1d2d2ca878370a7d0f8313d26 \
+    
+    livecheck.type          regex
+    livecheck.url           ${homepage}
+    livecheck.regex         php-?(5\\.\[0-9.\]+(?:(?:alpha|beta|RC)\\d+|-latest))\\.tar
+} else {
+    depends_lib-append      port:${php}
+    
+    livecheck.type          none
 }
 
-destroot.args           INSTALL_ROOT=${destroot}
-
-destroot.target         install-cli install-build install-headers install-programs
-
-post-destroot {
-    # Copy the Apache 1 module.
-    if { [variant_isset apache] } {
-        xinstall -m 755 -d ${destroot}${prefix}/libexec/apache \
-            ${destroot}${prefix}/etc/apache/extra
-        xinstall -m 755 ${worksrcpath}/libs/libphp5.so ${destroot}${prefix}/libexec/apache/mod_${php}.so
-        xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}$prefix/etc/apache/extra/mod_${php}.conf
-    }
+subport ${php}-apache2handler {
+    description             ${php} Apache 2 Handler SAPI
     
-    # Copy the Apache 2.2 module.
-    if { [variant_isset apache2] } {
-        xinstall -m 755 -d ${destroot}${prefix}/apache2/modules \
-            ${destroot}${prefix}/apache2/conf/extra
-        xinstall -m 755 ${worksrcpath}/libs/libphp5.so ${destroot}${prefix}/apache2/modules/mod_${php}.so
-        xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}${prefix}/apache2/conf/extra/mod_${php}.conf
-    }
+    long_description        ${description}
     
-    if { [variant_isset fastcgi] } {
-        # If we've built an Apache module (any version) then the FastCGI binary
-        # will not have been built, so we need to run through the whole process
-        # again and build just the FastCGI binary. Keep the options here in sync
-        # with the options specified in the apache and apache2 variants.
-        if { [variant_isset apache] } {
-            if { ![variant_isset macosx] && (![info exists os.subplatform] || ${os.subplatform} != "macosx") } {
-                configure.args-delete \
-                    --with-apxs=${prefix}/sbin/apxs
-            } else {
-                configure.args-delete \
-                    --with-apxs=/usr/sbin/apxs
-            }
+    depends_lib-append      port:apache2
+    
+    set apxs ${prefix}/apache2/bin/apxs
+    set confdir ${prefix}/apache2/conf
+    set moduledir ${prefix}/apache2/modules
+    
+    pre-configure {
+        # Checking for mod_cgi.so is a convenient way to verify apache2 is using its
+        # +preforkmpm variant. (+eventmpm and +workermpm instead provide mod_cgid.so.)
+        if {![file exists ${moduledir}/mod_cgi.so]} {
+            ui_error "To use ${subport}, apache2 must be installed with the +preforkmpm variant."
+            return -code error "incompatible apache2 installation"
         }
-        if { [variant_isset apache2] } {
-            configure.args-delete \
-                --with-apxs2=${prefix}/apache2/bin/apxs
-        }
-        
-        # Run the build again to get the FastCGI binary. Keep the options here
-        # in sync with those in the fastcgi variant.
-        if { [variant_isset apache] || [variant_isset apache2] } {
-            configure.args-delete \
-                --disable-cgi
-            configure.args-append \
-                --enable-cgi
-            ui_msg "$UI_PREFIX Configuring ${name} again for fastcgi"
-            command_exec configure
-            ui_msg "$UI_PREFIX Building ${name} again for fastcgi"
-            command_exec build
-            ui_msg "$UI_PREFIX Staging ${name} fastcgi into destroot"
-        }
-        
-        # Copy the FastCGI binary to the bin dir under a new name so it doesn't
-        # conflict with the cli version.
-        xinstall -m 755 ${worksrcpath}/sapi/cgi/php-cgi ${destroot}${prefix}/bin
     }
     
-    #file rename ${destroot}${prefix}/etc/pear.conf ${destroot}${prefix}/etc/pear.conf.sample
+    configure.args-append   --with-apxs2=${apxs}
     
-    # Copy the default php.ini files.
-    xinstall -m 755 -d ${destroot}${phpinidir}
-    xinstall -m 644 -W ${worksrcpath} \
-        php.ini-development \
-        php.ini-production \
-        ${destroot}${phpinidir}
+    build.target            libs/libphp5.bundle
     
-    # Copy mysqlnd headers.
-    xinstall -d ${destroot}${prefix}/include/php/ext/mysqlnd
-    eval xinstall -m 644 [glob ${worksrcpath}/ext/mysqlnd/*.h] ${destroot}${prefix}/include/php/ext/mysqlnd
-}
-
-pre-activate {
-    set filepath ${extraphpinidir}/.turd_${name}
-    if {[file exists ${filepath}]} {
-        delete ${filepath}
-    }
-}
-
-post-activate {
-    if {[file exists ${prefix}/etc/php.ini] && ![file exists ${phpinidir}/php.ini]} {
-        move ${prefix}/etc/php.ini ${phpinidir}
-        ui_msg "Your ${prefix}/etc/php.ini has been moved to ${phpinidir}/php.ini"
-        ui_msg ""
-    }
-    if {![file exists ${phpinidir}/php.ini]} {
-        ui_msg "To customize php, copy"
-        ui_msg "${phpinidir}/php.ini-development (if this is a development server) or"
-        ui_msg "${phpinidir}/php.ini-production (if this is a production server) to"
-        ui_msg "${phpinidir}/php.ini and then make changes."
-    } else {
-        ui_msg "You may need to update your php.ini for any changes that have been made"
-        ui_msg "in this version of php. Compare ${phpinidir}/php.ini with"
-        ui_msg "${phpinidir}/php.ini-development (if this is a development server) or"
-        ui_msg "${phpinidir}/php.ini-production (if this is a production server)."
-    }
+    destroot.violate_mtree  yes
     
-    if {![variant_isset no_web]} {
-        ui_msg ""
-        ui_msg "If this is your first install, you need to activate PHP in your web server."
-        if {![variant_isset fastcgi]} {
-            if {[variant_isset apache]} {
-                set moduledir ${prefix}/libexec/modules
-                set apxs ${prefix}/apache/bin/apxs
-            }
-            if {[variant_isset apache2]} {
-                set moduledir ${prefix}/apache2/modules
-                set apxs ${prefix}/apache2/bin/apxs
-            }
-            ui_msg ""
-            ui_msg "To enable PHP in Apache, run"
-            ui_msg "  cd ${moduledir}"
-            ui_msg "  ${apxs} -a -e -n \"${php}\" lib${php}.so"
-        }
+    destroot {
+        xinstall -m 755 -d ${destroot}${moduledir} ${destroot}${confdir}/extra
+        xinstall -m 644 ${worksrcpath}/libs/libphp5.so ${destroot}${moduledir}/mod_${php}.so
+        xinstall -m 644 ${filespath}/mod_php.conf ${destroot}${confdir}/extra/mod_${php}.conf
     }
     
-    #ui_msg "* copy  ${prefix}/etc/pear.conf.sample to  ${prefix}/etc/pear.conf"
-}
+    notes-append "
 
-variant debug description {Enable debug support (useful to analyze a PHP-related core dump)} {
-    configure.args-append   --enable-debug
+To enable ${subport}, run:
+
+    cd ${moduledir}
+    ${apxs} -a -e -n \"${php}\" mod_${php}.so
+"
 }
 
-test.run                yes
-
-livecheck.type          regex
-livecheck.url           ${homepage}
-livecheck.regex         php-?(5\\.\[0-9.\]+(?:(?:alpha|beta|RC)\\d+|-latest))\\.tar
+subport ${php}-fastcgi {
+    description             ${php} FastCGI SAPI
+    
+    long_description        ${description}
+    
+    configure.args-delete   --disable-cgi
+    configure.args-append   --enable-cgi
+    
+    build.target            cgi
+    
+    destroot.target         install-cgi
+}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20111024/cb449185/attachment.html>


More information about the macports-changes mailing list