# Custom php52 port build - libevent problem



## elpek (Jul 5, 2014)

Hello, 

What I'm trying to do is to create a custom port for PHP 5.2 with fpm support. Since this version is not in portstree anymore, custom port is the only way to go. I have a problem with libevent during configure process (rquired for php-fpm) and the error I get is:


```
Configuring libevent
chmod: /wrkdirs/usr/ports/custom/custom-php52/work/php-5.2.17/libevent/configure: No such file or directory
chmod: /wrkdirs/usr/ports/custom/custom-php52/work/php-5.2.17/libevent/depcomp: No such file or directory
chmod: /wrkdirs/usr/ports/custom/custom-php52/work/php-5.2.17/libevent/install-sh: No such file or directory
chmod: /wrkdirs/usr/ports/custom/custom-php52/work/php-5.2.17/libevent/missing: No such file or directory
eval: /wrkdirs/usr/ports/custom/custom-php52/work/php-5.2.17/libevent/configure: not found
Failed to configure libevent
```

It seems to be the result of php-fpm patch applied:


```
+test -d "$abs_builddir/libevent" || mkdir -p $abs_builddir/libevent
+
+
+chmod +x "$abs_srcdir/libevent/configure" \
+               "$abs_srcdir/libevent/depcomp" \
+               "$abs_srcdir/libevent/install-sh" \
+               "$abs_srcdir/libevent/missing"
+
+libevent_configure="cd $abs_builddir/libevent ; CFLAGS=\"$CFLAGS $GCC_CFLAGS\" $abs_srcdir/libevent/configure --disable-shared"
```

But just like in the original lang/php52 one of the configure arguments is:


```
--with-libevent=${LOCALBASE}
```

The library is already installed from devel/libevent as it is a part of LIB_DEPENDS. It looks like configure is trying to build a static library instead. Why?

Here's the Makefile so far:


```
PORTVERSION=    5.2.17
CATEGORIES=     custom
MASTER_SITES=   http://museum.php.net/php5/
DISTNAME=       php-${PORTVERSION}

MAINTAINER=     xxx@xxx
COMMENT=        custom php52

GNU_CONFIGURE=  yes

NO_STAGE=       yes

USE_APACHE_RUN= 22+
USE_GNOME=      libxml2
USE_OPENSSL=    Yes
USE_MYSQL=      yes

EXTRA_PATCHES+= ${FILESDIR}/php52-backports-security-20130717.patch:-p1
EXTRA_PATCHES+= ${FILESDIR}/php-5.2.14-fpm-0.5.14-freebsd.patch:-p1
EXTRA_PATCHES+= ${FILESDIR}/suhosin-patch-5.2.16-0.9.7.patch:-p1

CONFIGURE_ARGS+=        \
                --with-layout=GNU \
                --prefix=/usr/local/php52 \
                --with-config-file-scan-dir=${PREFIX}/etc/php52 \
                --disable-all \
                --enable-libxml \
                --with-libxml-dir=${LOCALBASE} \
                --enable-reflection \
                --enable-fastcgi \
                --enable-fpm \
                --with-fpm-conf=${PREFIX}/php-fpm.conf \
                --with-fpm-pid=/var/run/php-fpm/php-fpm.pid \
                --with-fpm-log=/var/log/php-fpm/php-fpm.log \
                --with-libevent=${LOCALBASE} \
                --with-bz2=/usr \
                --enable-ctype \
                --with-curl=${LOCALBASE} \
                --enable-dom \
                --with-pcre-regex=${LOCALBASE} \
                --enable-filter \
                --with-pcre-regex=yes \
                --with-gd \
                --with-freetype-dir=${LOCALBASE} \
                --with-jpeg-dir=${LOCALBASE} \
                --with-png-dir=${LOCALBASE} \
                --enable-hash \
                --with-iconv \
                --with-imap=${LOCALBASE} \
                --with-imap-ssl=${OPENSSLBASE}  \
                --enable-json \
                --enable-mbstring \
                --with-mcrypt=${LOCALBASE} \
                --with-mhash=${LOCALBASE} \
                --with-mysql=${LOCALBASE} \
                --with-openssl=${OPENSSLBASE} \
                --enable-pdo \
                --with-pdo-mysql=${LOCALBASE} \
                --enable-session \
                --enable-soap \
                --enable-sockets \
                --enable-tokenizer \
                --enable-xml \
                --enable-xmlreader \
                --with-xmlrpc \
                --enable-xmlwriter \
                --enable-zip \
                --with-zlib=/usr

CONFLICTS=      php53-5* php5-5*

LIB_DEPENDS+=    event-1.4:${PORTSDIR}/devel/libevent \
                libcurl.so:${PORTSDIR}/ftp/curl \
                libfreetype.so:${PORTSDIR}/print/freetype2 \
                libpng15.so:${PORTSDIR}/graphics/png \
                libjpeg.so:${PORTSDIR}/graphics/jpeg \
                c-client4.9:${PORTSDIR}/mail/cclient \
                mcrypt.8:${PORTSDIR}/security/libmcrypt \
                mhash.2:${PORTSDIR}/security/mhash


LDFLAGS+=       -L${OPENSSLLIB} -lcrypto -lssl

pre-configure:
        ${REINPLACE_CMD} -e 's|freetype/freetype.h|freetype.h|g' ${WRKSRC}/configure


.include <bsd.port.mk>
```

Any help would be appreciated.


----------



## SirDice (Jul 7, 2014)

elpek said:
			
		

> What I'm trying to do is to create a custom port for PHP 5.2 with fpm support. Since this version is not in portstree anymore, custom port is the only way to go.


There's a reason why it's not in the ports tree anymore, PHP 5.2 is end-of-life and not supported anymore. Please, for your own safety, stop using it.


----------

