Cygport Reference Manual

### TABLE OF CONTENTS

- php.cygclass

- PHP
- PHP_CONFIG
- PHPIZE
- PEAR
- PECL
- PHP_VERSION
- PHP_INI_DIR
- PHP_EXTENSION_DIR
- PHP_PEAR_PHP_DIR
- PHP_PEAR_METADATA_DIR
- LIBPHP
- PHP_CHANNEL
- CATEGORY (php)
- SUMMARY (php)
- HOMEPAGE (php)
- SRC_URI (php)
- php_autoreconf
- php_compile
- php_install
- php_postinst
- php_fix_shebang
- src_compile (php)
- src_install (php)

## php.cygclass

[ Top ] [ Cygclasses ] [ Cygclasses ]

SYNOPSIS

      [PHP_CHANNEL="..."]
      inherit php

DESCRIPTION

PHP is a programming language most commonly used as an HTML preprocessor for creating dynamic web pages. The interpreter comes in three forms, known as SAPIs: command-line, CGI, and Apache Web Server DSO. Extensions written in either PHP or C can be installed to provide additional functionality.

This cygclass is meant for building PHP extension packages.

EXAMPLES

A typical PEAR (pure PHP) module package looks like this:

        PHP_CHANNEL=pear
        inherit php

        NAME="php-Archive_Tar"
        VERSION=1.3.11
        RELEASE=1
        CATEGORY="PHP"
        SUMMARY="PHP class for creating and managing tarballs"
        DESCRIPTION="The Archive_Tar class helps in creating and managing GNU tar
        format files compressed by Gzip or not. The class offers basic functions
        like creating an archive, adding files in the archive, extracting files
        from the archive and listing the archive content."

        # these are loaded only conditionally
        php_Archive_Tar_REQUIRES="php-bz2 php-zlib"

PECL extensions (written in C) are similarly straightforward:

        PHP_CHANNEL=pecl
        inherit php

        NAME="php-ncurses"
        VERSION=1.0.2
        RELEASE=1
        CATEGORY="PHP"
        SUMMARY="PHP ncurses extension"
        DESCRIPTION="Terminal screen handling extension for PHP (cli-mode only)"

        CYGCONF_ARGS="--enable-ncursesw"

Third-party PEAR channels are also easily handled by setting PHP_CHANNEL:

        PHP_CHANNEL="pear.phpunit.de"
        inherit php

        NAME="php-PHPUnit"
        VERSION=3.7.21
        RELEASE=1
        CATEGORY="PHP"
        SUMMARY="PHP unit testing framework"
        DESCRIPTION="An open source framework for test-driven development with the
        PHP programming language."

REQUIRES

php, php-PEAR

## PHP

[ Top ] [ php.cygclass ] [ Definitions ]

DESCRIPTION

Absolute path to the PHP interpreter.

## PHP_CONFIG

[ Top ] [ php.cygclass ] [ Definitions ]

DESCRIPTION

Absolute path to the PHP configuration script.

## PHPIZE

[ Top ] [ php.cygclass ] [ Definitions ]

DESCRIPTION

Absolute path to the PHP extension buildsystem preparation script.

## PEAR

[ Top ] [ php.cygclass ] [ Definitions ]

DESCRIPTION

Absolute path to the PHP script extension manager.

## PECL

[ Top ] [ php.cygclass ] [ Definitions ]

DESCRIPTION

Absolute path to the PHP C extension manager.

## PHP_VERSION

[ Top ] [ php.cygclass ] [ Definitions ]

DESCRIPTION

Version of the PHP interpreter.

## PHP_INI_DIR

[ Top ] [ php.cygclass ] [ Definitions ]

DESCRIPTION

Path to the PHP configuration snippets directory.

## PHP_EXTENSION_DIR

[ Top ] [ php.cygclass ] [ Definitions ]

DESCRIPTION

Installation directory for PHP C extensions.

## PHP_PEAR_PHP_DIR

[ Top ] [ php.cygclass ] [ Definitions ]

DESCRIPTION

Installation directory for PHP script extensions.

## PHP_PEAR_METADATA_DIR

[ Top ] [ php.cygclass ] [ Definitions ]

DESCRIPTION

Installation directory for PHP extension metadata.

## LIBPHP

[ Top ] [ php.cygclass ] [ Definitions ]

DESCRIPTION

Link library for the PHP interpreter C library.

NOTE

This link library is Cygwin specific. On ELF platforms, PHP modules are linked with undefined symbols, which are resolved at runtime by the SAPI in use. Since the PE/COFF format used on Cygwin requires that all symbols be resolved at link time, a library is used which all SAPIs and extensions link against.

## PHP_CHANNEL

[ Top ] [ php.cygclass ] [ Variables ]

DESCRIPTION

Domain name, or well-known alias, of the PEAR/PECL server on which the PHP extension is hosted. This variable must be defined before inherit()ing php.cygclass to have any effect.

A list of known channels is available at https://pear.php.net/channels/ .

## CATEGORY (php)

[ Top ] [ php.cygclass ] [ Overloads ]

DEFINITION

    CATEGORY="PHP"

NOTE

This is defined only if PN begins with "php-".

## SUMMARY (php)

[ Top ] [ php.cygclass ] [ Overloads ]

DEFINITION

    SUMMARY="PHP ${ORIG_PN} extension"

NOTE

This is defined only if PN begins with "php-".

## HOMEPAGE (php)

[ Top ] [ php.cygclass ] [ Overloads ]

DESCRIPTION

Web address for the PHP extension. This variable is defined only if PHP_CHANNEL was defined before inherit()ing php.cygclass.

## SRC_URI (php)

[ Top ] [ php.cygclass ] [ Overloads ]

DESCRIPTION

Download location for the PHP extension sources. This variable is defined only if PHP_CHANNEL was defined before inherit()ing php.cygclass.

## php_autoreconf

[ Top ] [ php.cygclass ] [ Compile Functions ]

SYNOPSIS

      lndirs
      cd $B
      php_autoreconf

DESCRIPTION

Runs PHPIZE to prepare the PHP extension build system. This function must be run from the directory containing config.m4.

## php_compile

[ Top ] [ php.cygclass ] [ Compile Functions ]

SYNOPSIS

      cd $B
      php_compile [OPTIONS]

DESCRIPTION

Configures the PHP extension with cygconf, then compiles it with cygmake. Arguments, if any, are passed as configure flags to cygconf.

## php_install

[ Top ] [ php.cygclass ] [ Install Functions ]

SYNOPSIS

      cd $B
      php_install

DESCRIPTION

Installs the PHP extension into $D.

## php_postinst

[ Top ] [ php.cygclass ] [ Install Functions ]

SYNOPSIS

      php_postinst

DESCRIPTION

Performs the following steps:

- If the package contains C extensions, creates configuration files which will cause the extensions to be loaded by PHP automatically.
- If PHP_CHANNEL is other than 'pear' or 'pecl', a postinstall script is created to register the channel with the installed PHP.
- Cleans up files which will collide with those already on the system.

## php_fix_shebang

[ Top ] [ php.cygclass ] [ Install Functions ]

SYNOPSIS

      php_fix_shebang SCRIPT [SCRIPT ...]

DESCRIPTION

Fixes the designated interpreter of SCRIPT to PHP. This would be necessary if the original uses an incorrect path (e.g. /usr/local/bin) or an incorrectly versioned binary. SCRIPT need not be prefixed by $D.

## src_compile (php)

[ Top ] [ php.cygclass ] [ Overloads ]

DESCRIPTION

Copies $S into $B with lndirs, then, if the package is a PHP C extension, calls php_autoreconf and php_compile.

## src_install (php)

[ Top ] [ php.cygclass ] [ Overloads ]

DEFINITION

    src_install() {
            cd ${B}
            php_install
            php_postinst
    }