SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "php"

# SliTaz package receipt.

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

TARBALL="$PACKAGE-$VERSION.tar.bz2"
WGET_URL="https://www.php.net/distributions/$TARBALL"

PROVIDE="php:lighttpd"
DEPENDS="libssl11 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 openssl11-dev 
    perl pkg-config postgresql-dev re2c sed sqlite-dev 
    unixODBC-dev"

#HOST_ARCH="i486 arm"

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

case "$ARCH" in
    i?86)
        # 7.4.4 unrecognised:
        #     --enable-zip
        #    --with-jpeg-dir=/usr
        #    --with-png-dir=/usr

        # 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

        # Adjust path for use OpenSSL 1.1
        export PHP_OPENSSL_DIR="/usr/lib/openssl-1.1"
        export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/lib/openssl-1.1/pkgconfig"

        ARCH_ARGS="                        \
            --prefix=/usr                    \
            --sysconfdir=/etc                \
            --infodir=/usr/share/info            \
            --mandir=/usr/share/man                \
            --config-cache                    \
            --enable-calendar                \
            --enable-dba=shared                \
            --enable-exif                    \
            --enable-ftp                    \
            --enable-gd=shared                \
            --enable-maintainer-zts                \
            --disable-mbregex                \
            --enable-mbstring                \
            --enable-soap=shared,/usr            \
            --enable-sockets                \
            --with-config-file-path=/etc            \
            --with-curl=shared                \
            --with-gettext                    \
            --with-imap=shared                \
            --with-imap-ssl                    \
            --with-ldap=shared                \
            --with-mhash                    \
            --with-mysql-sock=/var/run/mysqld/mysql.sock    \
            --with-mysqli=shared                \
            --with-openssl=shared                \
            --with-pdo-mysql=shared                \
            --with-pdo-pgsql=shared                \
            --with-pdo-sqlite=shared,/usr            \
            --with-pear=/usr/share/php            \
            --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()
{
    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/php.ini || exit 1
    sed -i    -e 's|extension_dir = "./"|extension_dir = "/usr/share/php/"|' \
        $DESTDIR/etc/php.ini
}

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

    cp -a $src/sapi/cgi/php-cgi    $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-cgi"|' \
            -e 's|#"socket" => "/tmp/php.socket"|"socket" => "/tmp/php.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
}
6047 packages and 209931 files in current database (Wed Jun 26 15:35:30 2024)