SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "php56"

# SliTaz package receipt.

PACKAGE="php56"
VERSION="5.6.40"
CATEGORY="development"
SHORT_DESC="PHP web programming language."
MAINTAINER="shann@slitaz.org"
LICENSE="BSD"
WEB_SITE="https://www.php.net/"

TARBALL="$PACKAGE-$VERSION.tar.xz"
WGET_URL="https://packages.sury.org/php/pool/main/p/php5.6/php5.6_5.6.40.orig.tar.xz"

DEPENDS="libssl libzip libxml2 lighttpd php-common sqlite"
BUILD_DEPENDS="apache apache-dev apr-dev apr-util-dev c-client 
    coreutils-conditions curl-dev cyrus-sasl-dev gettext 
    jpeg-dev libldap libmcrypt-dev libmysqlclient libpng-dev 
    libtool libunixODBC libvpx-dev libxml2-dev libzip-dev 
    mhash-dev mysql-dev net-snmp-dev openldap-dev openssl-dev 
    perl pkg-config postgresql-dev re2c sed sqlite-dev 
    unixODBC-dev pcre-dev"

HOST_ARCH="i486 arm x86_64"

current_version()
{
    wget -O - $WEB_SITE 2>/dev/null | \
    sed '/Released/!d;s|.*PHP ||;s| Rel.*||' | sort -Vr | sed q
}

# Special thanks to Ondřej Surý and Freexian for support php 5.6 branch

case "$ARCH" in
    i?86|x86_64)
        # Add --with-pic, seem issue on x86, no really know
        # see https://forum.tinycorelinux.net/index.php/topic,22397.0.html
        # seem also slackware 15.0 use this flag for php 7.4.x

        ARCH_ARGS="                        \
            --prefix=/usr                    \
            --program-suffix=56                \
            --sysconfdir=/etc/php56                \
            --datadir=/usr/share/php56            \
            --infodir=/usr/share/info            \
            --mandir=/usr/share/man                \
            --localstatedir=/var                \
            --config-cache                    \
            --enable-calendar                \
            --enable-dba=shared                \
            --enable-exif                    \
            --enable-fpm                    \
            --enable-ftp                    \
            --enable-zip                    \
            --enable-opcache                \
            --enable-maintainer-zts                \
            --disable-mbregex                \
            --enable-mbstring                \
            --enable-soap=shared,/usr            \
            --enable-sockets                \
            --with-config-file-path=/etc/php56        \
            --with-curl=shared                \
            --with-gettext                    \
            --with-gd=shared                \
            --with-imap=shared                \
            --with-imap-ssl                    \
            --with-ldap=shared                \
            --with-mcrypt=shared                \
            --with-mhash                    \
            --with-mysql-sock=/var/run/mysqld/mysql.sock    \
            --with-mysql=shared                \
            --with-mysqli=shared                \
            --with-openssl=shared                \
            --with-jpeg-dir=/usr                \
            --with-pcre-dir=/usr                \
            --with-pcre-regex=/usr                \
            --with-png-dir=/usr                \
            --with-pdo-mysql=shared                \
            --with-pdo-pgsql=shared                \
            --with-pdo-sqlite=shared,/usr            \
            --with-pear=/usr/share/php56            \
            --with-pgsql=shared,/usr            \
            --with-snmp=shared,/usr                \
            --with-sqlite3=shared,/usr            \
            --with-unixODBC=shared,/usr            \
            --with-pic                    \
            --with-zlib" ;;
    arm*)
        BUILD_DEPENDS="sqlite-dev libxml2-dev zlib-dev curl-dev"
        ARCH_ARGS="\
            --prefix=/usr \
            --sysconfdir=/etc \
            --infodir=/usr/share/info \
            --mandir=/usr/share/man \
            --config-cache \
            --enable-mbstring \
            --enable-sockets \
            --enable-ftp \
            --enable-zip \
            --enable-calendar \
            --enable-exif \
            --enable-dba=shared \
            --enable-sqlite-utf8 \
            --with-mhash \
            --with-sqlite=shared \
            --with-config-file-path=/etc \
            --with-zlib \
            --with-gettext \
            --with-curl=shared \
            --with-openssl=shared \
            --with-jpeg-dir=/usr \
            --with-png-dir=/usr \
            --with-apxs2=/usr/bin/apxs" ;;
esac

# Rules to configure and make the package.
compile_rules()
{
    for patch in $(cat $stuff/patches/series)
    do
        patch -p1 < $stuff/patches/$patch
    done

    # Fix credits too few args for php_print_packaging_credits
    # see https://github.com/oerdnj/deb.sury.org/issues/2138
    patch -p1 < $stuff/php56-fix-credits.patch

    export CFLAGS="$CFLAGS -Wno-error=implicit-function-declaration"

    sed -i 's/pam_start/pam_nostart/' configure

    ./configure $ARCH_ARGS $CONFIGURE_ARGS &&
    make $MAKEFLAGS &&
    make -j1 INSTALL_ROOT=$DESTDIR install &&
    ./configure $ARCH_ARGS $CONFIGURE_ARGS --with-apxs2=/usr/bin/apxs &&
    make $MAKEFLAGS &&
    {
        mkdir -p $DESTDIR/etc/apache
        cp /etc/apache/httpd.conf    $DESTDIR/etc/apache/httpd.conf
        make -j1 INSTALL_ROOT=$DESTDIR install
    }

    # Production configuration file.
    mkdir -p $DESTDIR/etc
    cp $src/php.ini-production    $DESTDIR/etc/php56/php.ini || exit 1
    sed -i -e 's|.dll|.so|g;s|extension=php_|extension=|g' $DESTDIR/etc/php56/php.ini
    sed -i    -e 's|extension_dir = "./"|extension_dir = "/usr/share/php56/"|' \
        $DESTDIR/etc/php56/php.ini
    # Don't expose php
    sed -i -e "s/expose_php = .*/expose_php = Off/g" $DESTDIR/etc/php56/php.ini
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/usr/bin
    mkdir -p $fs/usr/share/php56

    cp -a $install/usr/bin/php-cgi56    $fs/usr/bin
}

# Post and pre install commands to stop
# and restart Web server if needed.
pre_install()
{
    if [ -z "$1" -a ! -f "/var/run/lighttpd.pid" ]
      then
        /etc/init.d/lighttpd stop
    fi
}

post_install()
{
    # Enable PHP
    if [ -f "$1/etc/lighttpd/lighttpd.conf" ]
      then
        [ -f "$1/usr/lib/lighttpd/mod_fastcgi.so" ] ||
          tazpkg get-install lighttpd-modules --root="$1/"
        sed -i    -e 's|#fastcgi.server = ( ".php"|fastcgi.server = ( ".php"|' \
            -e 's|#"bin-path" => "/usr/bin/php-cgi"|"bin-path" => "/usr/bin/php-cgi56"|' \
            -e 's|#"socket" => "/tmp/php.socket"|"socket" => "/tmp/php56.socket"\n  )))|' \
            "$1/etc/lighttpd/lighttpd.conf"
          grep -q mod_fastcgi "$1/etc/lighttpd/lighttpd.conf" || 
              sed -e 's|server.modules = (|server.modules = (\n  "mod_fastcgi",|' \
                  -i "$1/etc/lighttpd/lighttpd.conf"
          grep -q php3 "$1/etc/lighttpd/lighttpd.conf" || \
              sed -e 's|for PHP.*|for PHP.\nfastcgi.map-extensions = ( ".php3" => ".php", ".php4" => ".php", ".php5" => ".php" )|' \
                  -i "$1/etc/lighttpd/lighttpd.conf"
    fi

    # Start Web server.
    if [ -z "$1" -a ! -f /var/run/lighttpd.pid -a -f /etc/init.d/lighttpd ]
      then
        /etc/init.d/lighttpd start
    fi
}
6094 packages and 521500 files in current database (Tue Jun 10 00:01:42 2025)