Mail archive
alpine-devel

Re: [alpine-devel] [PATCH] main/php: improved APKBUILD, see changes

From: Natanael Copa <ncopa_at_alpinelinux.org>
Date: Thu, 13 Jan 2011 15:39:56 +0100

On Thu, 13 Jan 2011 04:35:08 -0600
Matt Smith <mcs_at_darkregion.net> wrote:

> php-5.3.5-r2 changelog:
> - Recreated php-cli subpackage and moved it out of the main php
> package;
> - Combined php-cli and php-pear in the build() function (one less
> `make` to perform);
> - Created php-common subpackage, currently containing php.ini;
> - Converted the main php package into a metapackage, which currently
> depends on php-common and php-cgi;
> - Updated the dev() split function to include all the build dirs we
> used, and then symlinked /usr/lib/php/build to build-cgi by default;
> - Moved the phar command to the php-phar subpackage;
>
> Let me know what you think.

perfect! Applied.

some of the code is repetitive. Could go in a function so if you in the future needs to modify the sed line then you only need to do it one place.

--- a/main/php/APKBUILD
+++ b/main/php/APKBUILD
_at_@ -86,7 +86,12 @@ prepare() {
         patch -p1 -i "${srcdir}"/suhosin-patch-${_suhosinver}.patch || return 1
 }
 
-build() {
+_do_build() {
+ local cp_from="$1"
+ local cp_to="$2"
+ shift
+ shift
+
         _phpconfig="--build=${CHOST:-i486-alpine-linux-uclibc} \
                 --prefix=/usr \
                 --sysconfdir=/etc/php \
_at_@ -167,58 +172,48 @@ build() {
                 "
 # --with-enchant=shared,/usr \
 # --with-tidy=shared \
+ cp -a "$srcdir"/$cp_from "$srcdir"/$cp_to
+ cd "$srcdir"/$cp_to
+ ./configure ${_phpconfig} \
+ "$_at_" \
+ ${_phpextensions} \
+ || return 1
+ sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile # see #183
+ make || return 1
+}
 
+build() {
         # cgi and fcgi
- cp -a "$srcdir"/$pkgname-$pkgver "$srcdir"/$pkgname-cgi
- cd "$srcdir"/$pkgname-cgi
- ./configure ${_phpconfig} \
+ _do_build $pkgname-$pkgver $pkgname-cgi \
                 --disable-cli \
                 --enable-cgi \
- ${_phpextensions}
- sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile # see #183
- make || return 1
+ || return 1
 
         # fpm
- cp -a "$srcdir"/$pkgname-cgi "$srcdir"/$pkgname-fpm
- cd "$srcdir"/$pkgname-fpm
- ./configure ${_phpconfig} \
+ _do_build $pkgname-cgi $pkgname-fpm \
                 --disable-cli \
                 --enable-fpm \
- ${_phpextensions}
- sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile # see #183
- make || return 1
+ || return 1
 
         # apache2
- cp -a "$srcdir"/$pkgname-cgi "$srcdir"/$pkgname-apache2
- cd "$srcdir"/$pkgname-apache2
- ./configure ${_phpconfig} \
+ _do_build $pkgname-cgi $pkgname-apache2 \
                 --disable-cli \
                 --with-apxs2 \
- ${_phpextensions}
- sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile # see #183
- make || return 1
+ || return 1
 
         # embed
- cp -a "$srcdir"/$pkgname-cgi "$srcdir"/$pkgname-embed
- cd "$srcdir"/$pkgname-embed
- ./configure ${_phpconfig} \
+ _do_build $pkgname-cgi $pkgname-embed \
                 --disable-cli \
                 --enable-embed=shared \
- ${_phpextensions}
- sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile # see #183
- make || return 1
+ || return 1
 
         # cli and pear
- cp -a "$srcdir"/$pkgname-cgi "$srcdir"/$pkgname-cli-pear
- cd "$srcdir"/$pkgname-cli-pear
- ./configure ${_phpconfig} \
+ _do_build $pkgname-cgi $pkgname-cli-pear \
                 --disable-cgi \
                 --with-readline \
                 --enable-pcntl \
                 --with-pear \
- ${_phpextensions}
- sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile # see #183
- make || return 1
+ || return 1
 }
 
 package() {


-nc


---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Thu Jan 13 2011 - 15:39:56 UTC