Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag

COMPONENT_TARGETS  = $(HARDWARE_INTEL_PC32)
COMPONENT_TARGETS += $(HARDWARE_INTEL_PC64)
COMPONENT_TARGETS += $(HARDWARE_EBOX_3350DX2)
COMPONENT_TARGETS += $(HARDWARE_CB1X)
COMPONENT_TARGETS += $(HARDWARE_CB2X)
COMPONENT_TARGETS += $(HARDWARE_CB3X)
COMPONENT_TARGETS += $(HARDWARE_ORANGE_PP2E)
COMPONENT_TARGETS += $(HARDWARE_NANOPI_NEO)
COMPONENT_TARGETS += $(HARDWARE_ORANGE_PP)
COMPONENT_TARGETS += $(HARDWARE_ORANGE_PL2)
COMPONENT_TARGETS += $(HARDWARE_ORANGE_PI5)
COMPONENT_TARGETS += $(HARDWARE_ORANGE_PI5B)
COMPONENT_TARGETS += $(HARDWARE_ORANGE_PI5P)
COMPONENT_TARGETS += $(HARDWARE_ROCK_5B)
COMPONENT_TARGETS += $(HARDWARE_WECHIP_TX6)
COMPONENT_TARGETS += $(HARDWARE_REPKA_PI3)
COMPONENT_TARGETS += $(HARDWARE_FFRK3288)
COMPONENT_TARGETS += $(HARDWARE_POIN2)
COMPONENT_TARGETS += $(HARDWARE_RK3328_CC)
COMPONENT_TARGETS += $(HARDWARE_KHADAS_EDGE)
COMPONENT_TARGETS += $(HARDWARE_LEEZ_P710)
COMPONENT_TARGETS += $(HARDWARE_M201)
COMPONENT_TARGETS += $(HARDWARE_MXV)
COMPONENT_TARGETS += $(HARDWARE_P201)
COMPONENT_TARGETS += $(HARDWARE_NEXBOX_A95X)
COMPONENT_TARGETS += $(HARDWARE_ODROID_C2)
COMPONENT_TARGETS += $(HARDWARE_P212)
COMPONENT_TARGETS += $(HARDWARE_KHADAS_VIM)
COMPONENT_TARGETS += $(HARDWARE_Q201)
COMPONENT_TARGETS += $(HARDWARE_ENYBOX_X2)
COMPONENT_TARGETS += $(HARDWARE_KHADAS_VIM2)
COMPONENT_TARGETS += $(HARDWARE_NIT6Q)
COMPONENT_TARGETS += $(HARDWARE_OKMX6DL_C)
COMPONENT_TARGETS += $(HARDWARE_OKMX6Q_C)
COMPONENT_TARGETS += $(HARDWARE_BONE_BLACK)
COMPONENT_TARGETS += $(HARDWARE_OMAP5UEVM)
COMPONENT_TARGETS += $(HARDWARE_DRA7XXEVM)
COMPONENT_TARGETS += $(HARDWARE_CI20)
COMPONENT_TARGETS += $(HARDWARE_BAIKAL_T1)
COMPONENT_TARGETS += $(HARDWARE_BAIKAL_M1)
COMPONENT_TARGETS += $(HARDWARE_S824L)
COMPONENT_TARGETS += $(HARDWARE_VESNIN)
COMPONENT_TARGETS += $(HARDWARE_S824L_LSB)
COMPONENT_TARGETS += $(HARDWARE_VESNIN_LSB)
COMPONENT_TARGETS += $(HARDWARE_TL2WK2)
COMPONENT_TARGETS += $(HARDWARE_TL2SV2)
COMPONENT_TARGETS += $(HARDWARE_TL2WK2_LSB)
COMPONENT_TARGETS += $(HARDWARE_TL2SV2_LSB)
COMPONENT_TARGETS += $(HARDWARE_VISIONFIVE2)
COMPONENT_TARGETS += $(HARDWARE_SIFIVE_U740)


NEED_ABS_PATH      = true
COMPONENT_IS_3PP   = true


include ../../../build-system/constants.mk


SOURCE_REQUIRES    = sources/packages/n/php

REQUIRES           = net/httpd/2.4.51
REQUIRES          += net/alpine/2.25
REQUIRES          += net/curl/7.75.0
REQUIRES          += net/net-snmp/5.9
REQUIRES          += net/openssl/1.1.1r
REQUIRES          += net/krb5/1.19.1
REQUIRES          += net/libnsl/1.3.0

REQUIRES          += libs/gmp/6.2.1
REQUIRES          += libs/libffi/3.4.4
REQUIRES          += libs/aspell/0.60.8
REQUIRES          += libs/ncurses/6.3
REQUIRES          += libs/argon2/20190702
REQUIRES          += libs/oniguruma/6.9.7.1
REQUIRES          += libs/pcre2/10.36
REQUIRES          += libs/libgd/2.3.3

REQUIRES          += libs/enchant/2.3.2
REQUIRES          += libs/expat/2.5.0
REQUIRES          += libs/libxml2/2.11.4
REQUIRES          += libs/libxslt/1.1.34
REQUIRES          += libs/libedit/20191231-3.1
REQUIRES          += libs/icu4c/73.1
REQUIRES          += libs/libzip/1.9.2
REQUIRES          += libs/libsodium/1.0.18
REQUIRES          += libs/serf/1.3.9
REQUIRES          += libs/tidy-html5/5.8.0

REQUIRES          += libs/gdbm/1.23
REQUIRES          += app/db/18.1.40
REQUIRES          += app/mariadb/10.6.5
REQUIRES          += app/postgresql/14.1
REQUIRES          += app/sqlite/3.39.4.0
REQUIRES          += libs/libiodbc/3.52.14

# ======= __END_OF_REQUIRES__ =======


version            = 8.1.2
tar_xz_archive     = $(SRC_PACKAGE_PATH)/packages/n/php/php-$(version).tar.xz
SRC_ARCHIVE        = $(tar_xz_archive)
SRC_DIR            = $(TARGET_BUILD_DIR)/php-$(version)
src_dir_name       = php-$(version)
src_done           = $(TARGET_BUILD_DIR)/.source_done

cacert_archive     = $(SRC_PACKAGE_PATH)/packages/n/php/cacert.pem.xz

PATCHES = PATCHES

build_dir          = $(TARGET_BUILD_DIR)/build
build_target       = $(TARGET_BUILD_DIR)/.build_done
install_target     = $(TARGET_BUILD_DIR)/.install_done


####### Targets

PKG_GROUP = net

#
# *PKG_NAME & *PKG_VERSION shouldn't be a reference to value.
#
PHP_PKG_NAME                = php
PHP_PKG_VERSION             = 8.1.2
PHP_PKG_ARCH                = $(PKGARCH)
PHP_PKG_DISTRO_NAME         = $(DISTRO_NAME)
PHP_PKG_DISTRO_VERSION      = $(DISTRO_VERSION)
PHP_PKG_GROUP               = $(PKG_GROUP)
###                          |---handy-ruler-------------------------------|
PHP_PKG_SHORT_DESCRIPTION   = HTML-embedded scripting language
PHP_PKG_URL                 = $(BUG_URL)
PHP_PKG_LICENSE             = PHP
PHP_PKG_DESCRIPTION_FILE    = $(TARGET_BUILD_DIR)/$(PHP_PKG_NAME)-pkg-description
PHP_PKG_DESCRIPTION_FILE_IN = $(PHP_PKG_NAME)-pkg-description.in
PHP_PKG_INSTALL_SCRIPT      = $(PHP_PKG_NAME)-pkg-install.sh

PHP_PKG          = $(CURDIR)/$(TARGET_BUILD_DIR)/$(PHP_PKG_NAME)-package

pkg_basename     = $(PHP_PKG_NAME)-$(PHP_PKG_VERSION)-$(PHP_PKG_ARCH)-$(PHP_PKG_DISTRO_NAME)-$(PHP_PKG_DISTRO_VERSION)

pkg_archive      = $(TARGET_BUILD_DIR)/$(PKG_GROUP)/$(pkg_basename).$(pkg_arch_suffix)
pkg_certificate  = $(call cert-name,$(pkg_archive))
pkg_signature    = $(call sign-name,$(pkg_archive))
pkg_description  = $(call desc-name,$(pkg_archive))
products         = $(call pkg-files,$(pkg_archive))

BUILD_TARGETS    = $(build_target)
BUILD_TARGETS   += $(install_target)

PRODUCT_TARGETS  = $(products)

ROOTFS_TARGETS   = $(pkg_archive)


include ../../../build-system/core.mk


env_sysroot  = INSTALL_ROOT=$(PHP_PKG)


extra_configure_switches  = --libdir=/usr/lib$(LIBUFFIX)
extra_configure_switches += --with-libdir=lib$(LIBSUFFIX)
extra_configure_switches += --localstatedir=/var
extra_configure_switches += --sysconfdir=/etc/php
extra_configure_switches += --datarootdir=/usr/share
extra_configure_switches += --datadir=/usr/share
extra_configure_switches += --infodir=/usr/share/info
extra_configure_switches += --mandir=/usr/share/man

extra_configure_switches += --with-apxs2=$(TARGET_DEST_DIR)/usr/bin/apxs
#
# Deprecated: --with-pear:
#
#extra_configure_switches += --with-pear=/usr/lib$(LIBSUFFIX)/php

extra_configure_switches += --enable-fpm
extra_configure_switches += --with-fpm-user=nginx
extra_configure_switches += --with-fpm-group=nginx
extra_configure_switches += --enable-pcntl
extra_configure_switches += --enable-mbregex
extra_configure_switches += --enable-tokenizer=shared
extra_configure_switches += --with-config-file-scan-dir=/etc/php/php.d
extra_configure_switches += --with-config-file-path=/etc/php
extra_configure_switches += --with-layout=GNU
extra_configure_switches += --disable-sigchild
extra_configure_switches += --with-libxml
extra_configure_switches += --with-expat
extra_configure_switches += --enable-simplexml
extra_configure_switches += --enable-xmlreader=shared
extra_configure_switches += --enable-dom=shared
extra_configure_switches += --enable-filter
extra_configure_switches += --disable-debug
extra_configure_switches += --with-openssl=shared,$(TARGET_DEST_DIR)/usr
extra_configure_switches += --with-kerberos=shared,$(TARGET_DEST_DIR)/usr
#
# NOTE:
#   We use internal pcre2 library instead of --with-external-pcre
#
ifneq ($(filter $(TOOLCHAIN),$(TOOLCHAIN_RISCV64_GLIBC)),)
extra_configure_switches += --without-pcre-jit
endif
extra_configure_switches += --with-zlib=shared,$(TARGET_DEST_DIR)/usr
extra_configure_switches += --enable-bcmath=shared
extra_configure_switches += --with-bz2=shared,$(TARGET_DEST_DIR)/usr
extra_configure_switches += --enable-calendar=shared
extra_configure_switches += --enable-ctype=shared
extra_configure_switches += --with-curl=shared,$(TARGET_DEST_DIR)/usr

extra_configure_switches += --enable-dba=shared
extra_configure_switches += --with-gdbm=shared,$(TARGET_DEST_DIR)/usr
#
# NOTE:
# ----
#   If db-18.1.x is configured with --enable-compat185 then
#   PHP DBA can be linked with libdb-18.1.so using db_185.h:
#
extra_configure_switches += --with-db1=shared,$(TARGET_DEST_DIR)/usr

extra_configure_switches += --enable-exif=shared
extra_configure_switches += --enable-ftp=shared
extra_configure_switches += --enable-gd=shared,$(TARGET_DEST_DIR)/usr
extra_configure_switches += --with-external-gd
extra_configure_switches += --with-avif=no
extra_configure_switches += --with-webp
extra_configure_switches += --with-jpeg
extra_configure_switches += --with-freetype
extra_configure_switches += --with-xpm=no
extra_configure_switches += --with-gettext=shared,$(TARGET_DEST_DIR)/usr
extra_configure_switches += --with-gmp=shared,$(TARGET_DEST_DIR)/usr
extra_configure_switches += --with-ffi=shared,$(TARGET_DEST_DIR)/usr
extra_configure_switches += --with-iconv=shared

# IMAP c-client from alpine-2.25:
extra_configure_switches += --with-imap-ssl=$(TARGET_DEST_DIR)/usr
extra_configure_switches += --with-imap=$(TARGET_DEST_DIR)/usr/lib$(LIBSUFFIX)/alpine-2.25/c-client

extra_configure_switches += --with-ldap=shared,$(TARGET_DEST_DIR)/usr
extra_configure_switches += --enable-mbstring=shared
extra_configure_switches += --enable-mysqlnd=shared
extra_configure_switches += --with-mysqli=shared,mysqlnd
extra_configure_switches += --with-mysql-sock=/var/run/mysql/mysql.sock
extra_configure_switches += --with-iodbc=shared,$(TARGET_DEST_DIR)/usr
extra_configure_switches += --enable-pdo=shared
extra_configure_switches += --with-pdo-mysql=shared,mysqlnd
extra_configure_switches += --with-pdo-pgsql=shared,$(TARGET_DEST_DIR)/usr/bin/$(TARGET)-pg_config
extra_configure_switches += --with-pgsql=shared,$(TARGET_DEST_DIR)/usr/bin/$(TARGET)-pg_config
extra_configure_switches += --with-pdo-sqlite=shared,$(TARGET_DEST_DIR)/usr
extra_configure_switches += --with-pdo-odbc=shared,iODBC,$(TARGET_DEST_DIR)/usr
extra_configure_switches += --with-pspell=shared,$(TARGET_DEST_DIR)/usr
extra_configure_switches += --with-enchant=shared,$(TARGET_DEST_DIR)/usr
extra_configure_switches += --enable-shmop=shared
extra_configure_switches += --with-snmp=shared,$(TARGET_DEST_DIR)/usr
extra_configure_switches += --enable-soap=shared
extra_configure_switches += --enable-sockets
extra_configure_switches += --with-sqlite3=shared
extra_configure_switches += --enable-sysvmsg
extra_configure_switches += --enable-sysvsem
extra_configure_switches += --enable-sysvshm
extra_configure_switches += --with-xsl=shared,$(TARGET_DEST_DIR)/usr
extra_configure_switches += --with-zip=shared
extra_configure_switches += --enable-intl=shared
extra_configure_switches += --enable-opcache
extra_configure_switches += --with-gnu-ld
extra_configure_switches += --with-pic
extra_configure_switches += --enable-phpdbg
extra_configure_switches += --with-sodium
extra_configure_switches += --with-password-argon2
extra_configure_switches += --without-readline
extra_configure_switches += --with-libedit
extra_configure_switches += --with-tidy=shared,$(TARGET_DEST_DIR)/usr

ifeq ($(__ENABLE_STATIC__),yes)
extra_configure_switches += --enable-static=yes
else
extra_configure_switches += --enable-static=no
endif
extra_configure_switches += --enable-shared=yes


extra_environment  = EXTENSION_DIR=/usr/lib$(LIBSUFFIX)/php/extensions

ifneq ($(filter $(TOOLCHAIN),$(TOOLCHAIN_POWER8_GLIBC) $(TOOLCHAIN_POWER9_GLIBC)),)
extra_environment += ac_cv_c_bigendian_php=yes
endif

CFLAGS += -Wno-array-bounds -Wno-maybe-uninitialized


TARGET_BIN_RPATH = /lib$(LIBSUFFIX):/usr/lib$(LIBSUFFIX)
TARGET_LIB_RPATH = /lib$(LIBSUFFIX):/usr/lib$(LIBSUFFIX):/usr/lib/../lib$(LIBSUFFIX)


####### Dependencies

$(src_done): $(SRC_ARCHIVE) $(PATCHES_DEP)
	$(UNPACK_SRC_ARCHIVE)
	$(APPLY_PATCHES)
	@touch $@

$(build_target): $(src_done)
	@mkdir -p $(build_dir)
	@cd $(build_dir) && $(BUILD_ENVIRONMENT) $(extra_environment) ../$(src_dir_name)/configure \
	  --prefix=/usr               \
	  --build=$(BUILD)            \
	  --host=$(TARGET)            \
	  $(extra_configure_switches)
	# ======= Tune configure settings for target =======
	@( cd $(build_dir) ; \
	   cfgcmd="`cat Makefile | grep '^CONFIGURE_COMMAND' | \
	     sed 's,^CONFIGURE_COMMAND[ \t]*=[ \t]*\(.*$$\),\1,' | \
	     sed \"s,$(TARGET_DEST_DIR),,g\" | \
	     sed \"s,$(TARGET)-,,g\" | \
	     sed \"s, '--build=[^\']*',,g\" | \
	     sed \"s, '--host=[^\']*',,g\" | \
	     sed \"s, 'build_alias=[^\']*',,g\" | \
	     sed \"s, 'host_alias=[^\']*',,g\"`" ; \
	   cfgopt="`cat Makefile | grep '^CONFIGURE_OPTIONS' | \
	     sed 's,^CONFIGURE_OPTIONS[ \t]*=[ \t]*\(.*$$\),\1,' | \
	     sed \"s,$(TARGET_DEST_DIR),,g\" | \
	     sed \"s,$(TARGET)-,,g\" | \
	     sed \"s, '--build=[^\']*',,g\" | \
	     sed \"s, '--host=[^\']*',,g\" | \
	     sed \"s, 'build_alias=[^\']*',,g\" | \
	     sed \"s, 'host_alias=[^\']*',,g\"`" ; \
	   sed -i "s|^\(CONFIGURE_COMMAND[ \t]*=\).*$$|\1 $${cfgcmd}|" Makefile ; \
	   sed -i "s|^\(CONFIGURE_OPTIONS[ \t]*=\).*$$|\1 $${cfgopt}|" Makefile ; \
	   sed -i "s,$(TARGET_DEST_DIR),,g"     main/build-defs.h ; \
	   sed -i "s,$(TARGET)-,,g"             main/build-defs.h ; \
	   sed -i "s, '--build=[^\']*',,g"      main/build-defs.h ; \
	   sed -i "s, '--host=[^\']*',,g"       main/build-defs.h ; \
	   sed -i "s, 'build_alias=[^\']*',,g"  main/build-defs.h ; \
	   sed -i "s, 'host_alias=[^\']*',,g"   main/build-defs.h ; \
	 )
	@cd $(build_dir) && $(BUILD_ENVIRONMENT) $(MAKE) \
	                    PHP_PHARCMD_EXECUTABLE=$(shell which php)
	@touch $@

$(install_target): $(build_target)
	@mkdir -p $(PHP_PKG)/etc/httpd
	@cp $(TARGET_DEST_DIR)/etc/httpd/httpd.conf* $(PHP_PKG)/etc/httpd/httpd.conf
	@cd $(build_dir) && $(BUILD_ENVIRONMENT) $(MAKE) \
	                    PHP_PEARCMD_EXECUTABLE=$(shell which php) -j1 install $(env_sysroot)
	# ======= Install mod_php.conf etc. =======
	@mkdir -p $(PHP_PKG)/etc/httpd
	@rm -f $(PHP_PKG)/etc/httpd/*
	@chmod 755 $(PHP_PKG)/etc/httpd
	@cat $(CURDIR)/conf/mod_php.conf | \
	     sed 's,@LIBDIRSUFFIX@,$(LIBSUFFIX),g' > $(PHP_PKG)/etc/httpd/mod_php.conf.new
	@mkdir -p $(PHP_PKG)/etc/php/php.d
	@chmod 755 $(PHP_PKG)/etc/php/php.d $(PHP_PKG)/etc/php/php-fpm.d
	@cat $(SRC_DIR)/php.ini-production > $(PHP_PKG)/etc/php/php.ini.new
	@cp -a $(SRC_DIR)/php.ini-development $(PHP_PKG)/etc/php
	@chmod 644 $(PHP_PKG)/etc/php/php.ini.new
	@chmod 644 $(PHP_PKG)/etc/php/php.ini-development
	@mv $(PHP_PKG)/etc/php/php-fpm.conf.default $(PHP_PKG)/etc/php/php-fpm.conf.new
	@chmod 644 $(PHP_PKG)/etc/php/php-fpm.conf.new
	@mv $(PHP_PKG)/etc/php/php-fpm.d/www.conf.default $(PHP_PKG)/etc/php/php-fpm.d/www.conf.new
	@chmod 644 $(PHP_PKG)/etc/php/php-fpm.d/www.conf.new
	@mkdir $(PHP_PKG)/etc/rc.d
	@cat $(build_dir)/sapi/fpm/init.d.php-fpm > $(PHP_PKG)/etc/rc.d/rc.php-fpm.new
	@chmod 644 $(PHP_PKG)/etc/rc.d/rc.php-fpm.new
	@mkdir -p $(PHP_PKG)/var/lib/php
	@chmod 770 $(PHP_PKG)/var/lib/php
	# ======= Install Documentation =======
	@( cd $(PHP_PKG)/usr/share/man/man1 ; \
	   for file in *.1 ; do                                \
	     ln=`head -n 1 $$file` ;                           \
	     if [ "`echo $$ln | grep '^\.so '`" != "" ] ; then \
	       origin=`echo $$ln | cut -f 2 -d ' '` ;          \
	       origin=`basename $$origin` ;                    \
	       rm -f $$file ;                                  \
	       ln -sf $$origin $$file ;                        \
	     fi ;                                              \
	   done ;                                              \
	 )
	@if [ -d $(PHP_PKG)/usr/share/man ]; then \
	  ( cd $(PHP_PKG)/usr/share/man ; \
	    for manpagedir in `find . -type d -name "man*"` ; do \
	      ( cd $$manpagedir ; \
	        for eachpage in `find . -type l -maxdepth 1` ; do \
	          ln -s `readlink $$eachpage`.gz $$eachpage.gz ; \
	          rm $$eachpage ; \
	        done ; \
	        gzip -9 *.? ; \
	      ) \
	    done \
	  ) \
	 fi
	@mkdir -p $(PHP_PKG)/usr/doc/$(src_dir_name)
	@cp -a $(SRC_DIR)/LICENSE \
	       $(PHP_PKG)/usr/doc/$(src_dir_name)
	@mkdir -p $(PHP_PKG)/usr/share/doc/$(src_dir_name)
	@( cd $(SRC_DIR) ; \
	   cp -a CODING_STANDARDS* CONTRIBUTING* EXTENSIONS LICENSE NEWS README* UPGRADING* \
	       $(PHP_PKG)/usr/share/doc/$(src_dir_name) ; \
	 )
	@( cd $(SRC_DIR) ; \
	   if [ -r ChangeLog ]; then \
	     DOCSDIR=`echo $(PHP_PKG)/usr/share/doc/$(src_dir_name)` ; \
	     cat ChangeLog | head -n 1000 > $$DOCSDIR/ChangeLog ; \
	     touch -r ChangeLog $$DOCSDIR/ChangeLog ; \
	   fi \
	 )
	# ======= Tune development '/usr/bin/php-config' sctipt =======
	@( cd $(PHP_PKG)/usr/bin ; \
	   sed -i 's,^prefix="/usr,prefix="$(TARGET_DEST_DIR)/usr,' php-config ; \
	 )
	# ======= Install the same to $(TARGET_DEST_DIR) =======
	$(call install-into-devenv, $(PHP_PKG))
	# ======= Tune target '/usr/bin/php-config' sctipt =======
	@( cd $(PHP_PKG)/usr/bin ; \
	   sed -i "s,$(TARGET_DEST_DIR),,g"    php-config ; \
	   sed -i "s,$(TARGET)-,,g"            php-config ; \
	   sed -i "s, '--build=[^\']*',,g"     php-config ; \
	   sed -i "s, '--host=[^\']*',,g"      php-config ; \
	   sed -i "s, 'build_alias=[^\']*',,g" php-config ; \
	   sed -i "s, 'host_alias=[^\']*',,g"  php-config ; \
	 )
	# ======= Strip binaries =======
	@( cd $(PHP_PKG) ; \
	   find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs $(STRIP) --strip-unneeded 2> /dev/null ; \
	   find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs $(STRIP) --strip-unneeded 2> /dev/null ; \
	 )
ifeq ($(__ENABLE_STATIC__),yes)
	@( cd $(PHP_PKG) ; \
	   find . | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs $(STRIP) -g 2> /dev/null ; \
	 )
endif
ifneq ($(PATCHELF),)
	# ======= Set RPATH/RUNPATH for target binaries =======
	@( cd $(PHP_PKG)/usr ; \
	   for file in `find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs echo` ; do \
	     rpath=`$(PATCHELF) --print-rpath $$file 2> /dev/null` ; \
	     if echo "$$rpath" | grep -q "$(TARGET_DEST_DIR)" ; then \
	       $(PATCHELF) --set-rpath $(TARGET_BIN_RPATH) $$file 1> /dev/null 2> /dev/null ; \
	     fi ; \
	   done ; \
	 )
	# ======= Set RPATH/RUNPATH for target shared objects =======
	@( cd $(PHP_PKG)/usr/lib$(LIBSUFFIX) ; \
	   for file in `find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs echo` ; do \
	     rpath=`$(PATCHELF) --print-rpath $$file 2> /dev/null` ; \
	     if echo "$$rpath" | grep -q "$(TARGET_DEST_DIR)" ; then \
	       $(PATCHELF) --set-rpath $(TARGET_LIB_RPATH) $$file 1> /dev/null 2> /dev/null ; \
	     fi ; \
	   done ; \
	 )
endif
	@touch $@

$(PHP_PKG_DESCRIPTION_FILE): $(PHP_PKG_DESCRIPTION_FILE_IN)
	@cat $< | $(SED) -e "s/@VERSION@/$(version)/g" > $@

$(pkg_certificate) : $(pkg_archive) ;
$(pkg_signature)   : $(pkg_archive) ;
$(pkg_description) : $(pkg_archive) ;

$(pkg_archive): $(install_target) $(PHP_PKG_DESCRIPTION_FILE) $(PHP_PKG_INSTALL_SCRIPT)
	@cp $(PHP_PKG_DESCRIPTION_FILE) $(PHP_PKG)/.DESCRIPTION
	@cp $(PHP_PKG_INSTALL_SCRIPT) $(PHP_PKG)/.INSTALL
	@$(BUILD_PKG_REQUIRES) $(PHP_PKG)/.REQUIRES
	@echo "pkgname=$(PHP_PKG_NAME)"                            >  $(PHP_PKG)/.PKGINFO ; \
	 echo "pkgver=$(PHP_PKG_VERSION)"                          >> $(PHP_PKG)/.PKGINFO ; \
	 echo "arch=$(PHP_PKG_ARCH)"                               >> $(PHP_PKG)/.PKGINFO ; \
	 echo "distroname=$(PHP_PKG_DISTRO_NAME)"                  >> $(PHP_PKG)/.PKGINFO ; \
	 echo "distrover=$(PHP_PKG_DISTRO_VERSION)"                >> $(PHP_PKG)/.PKGINFO ; \
	 echo "group=$(PHP_PKG_GROUP)"                             >> $(PHP_PKG)/.PKGINFO ; \
	 echo "short_description=\"$(PHP_PKG_SHORT_DESCRIPTION)\"" >> $(PHP_PKG)/.PKGINFO ; \
	 echo "url=$(PHP_PKG_URL)"                                 >> $(PHP_PKG)/.PKGINFO ; \
	 echo "license=$(PHP_PKG_LICENSE)"                         >> $(PHP_PKG)/.PKGINFO
	@$(PSEUDO) sh -c "cd $(PHP_PKG) && \
	                  chown -R root:root . && \
	                  chown -R 0:80 var/lib/php && \
	                  $(MAKE_PACKAGE) -J --linkadd=yes $(GNUPG_OPTIONS) -m -d .. ."