Magellan Linux

Contents of /trunk/extras/php/php-5.3.18-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 13928 - (show annotations) (download)
Wed Oct 31 17:52:30 2012 UTC (11 years, 7 months ago) by niro
File size: 15012 byte(s)
auto added: ver bump to 5.3.18-r1
1 # $Id$
2
3 PNAME="php"
4 PVER="5.3.18"
5 PBUILD="r1"
6
7 SPLIT_PACKAGES="php
8 php-cgi
9 php-apache
10 php-embedded
11 php-pear
12 php-bcmath
13 php-curl
14 php-dba
15 php-enchant
16 php-gd
17 php-gmp
18 php-ldap
19 php-mbstring
20 php-pdo
21 php-mysql
22 php-odbc
23 php-process
24 php-pspell
25 php-soap
26 php-sqlite
27 php-tidy
28 php-xml
29 php-xmlrpc"
30
31 # splits with more then one module:
32 # php-odbc = odbc, pdo_odbc
33 # php-mysql = mysql, mysqli, pdo_mysql
34 # php-xml = xsl, wddx, dom, xmlreader, xmlwriter
35 # php-process = sysvmsg, sysvsem, sysvshm, posix
36 # php-sqlite = sqlite, sqlite3, pdo_sqlite
37
38 PCAT="dev-lang"
39 HOMEPAGE="http://php.net/"
40
41 DEPEND_COMMON=">= sys-libs/ncurses-5.9
42 >= sys-libs/readline-6.2
43 >= sys-libs/zlib-1.2
44 >= app-arch/bzip2-1
45 >= dev-libs/openssl-1.0.1"
46 DEPEND_APACHE=">= net-www/apache-2.4"
47 DEPEND_ASPELL=">= app-text/aspell-0.60"
48 DEPEND_BDB=">= dev-db/db-5.3"
49 DEPEND_CURL=">= net-misc/curl-7.28"
50 DEPEND_ENCHANT=">= app-text/enchant-1.6"
51 DEPEND_GD=">= media-libs/libjpeg-8d
52 >= media-libs/libpng-1.5
53 >= x11-libs/libXpm-3.5
54 >= media-libs/freetype-2.4
55 >= media-libs/gd-2.0.35"
56 DEPEND_GMP=">= dev-libs/gmp-5"
57 DEPEND_IDN=">= net-dns/libidn-1.25"
58 DEPEND_LDAP=">= net-nds/openldap-2.4"
59 DEPEND_MYSQL=">= dev-db/mysql5-5.5"
60 DEPEND_ODBC=">= dev-db/unixodbc-2.3"
61 DEPEND_PCRE=">= dev-libs/libpcre-8.31"
62 DEPEMD_SASL=">= dev-libs/cyrus-sasl-2.1.23"
63 DEPEND_SQLITE=">= dev-db/sqlite-3.7"
64 DEPEND_TIDY=">= app-text/htmltidy-1.46"
65 DEPEND_XML=">= dev-libs/libxml2-2.9"
66 DEPEND_XSLT=">= dev-libs/libxslt-1.1.26"
67
68 # ToDO: mcrypt, imap, mhash, maintainer-zts, intl
69 SDEPEND="${DEPEND_COMMON}
70 ${DEPEND_APACHE}
71 ${DEPEND_ASPELL}
72 ${DEPEND_BDB}
73 ${DEPEND_CURL}
74 ${DEPEND_ENCHANT}
75 ${DEPEND_GD}
76 ${DEPEND_GMP}
77 ${DEPEND_IDN}
78 ${DEPEND_LDAP}
79 ${DEPEND_MYSQL}
80 ${DEPEND_ODBC}
81 ${DEPEND_PCRE}
82 ${DEPEND_SASL}
83 ${DEPEND_SQLITE}
84 ${DEPEND_TIDY}
85 ${DEPEND_XML}
86 ${DEPEND_XSLT}
87 >= sys-dev/m4-1.4
88 >= sys-dev/libtool-1.5
89 >= sys-dev/gettext-0.17
90 >= virtual/sed"
91
92 SRCFILE="${PNAME/5/}-${PVER}.tar.bz2"
93 SRCDIR="${BUILDDIR}/${PNAME/5/}-${PVER}"
94
95 SUHOSIN_PVER="0.9.10"
96
97 sminclude mtools php5
98
99 SRC_URI=(
100 http://de2.php.net/distributions/${SRCFILE}
101 http://us2.php.net/distributions/${SRCFILE}
102 mirror://${PNAME}/${SRCFILE}
103 mirror://${PNAME}/${PNAME}-5.2.4-multilib.patch
104 mirror://${PNAME}/${PNAME}-5.2.3-httpd-config.patch
105 mirror://${PNAME}/${PNAME}-5.2.4-build-dir.patch
106 mirror://${PNAME}/${PNAME}-5.3.9-suhosin-${SUHOSIN_PVER}.patch
107 mirror://${PNAME}/php5_module.conf
108 )
109
110 # 5.3 stable series
111 UP2TAG="5.3"
112 UP2DATE="updatecmd ${HOMEPAGE} | grep 'Current.*${UP2TAG}.*Stable' | sed 's/.*\:\ \(.*\)/\1/'"
113
114 split_info_php()
115 {
116 DESCRIPTION="PHP Hypertext Preprocessor, a scripting language especially suited for web development."
117 DEPEND="${DEPEND_COMMON}
118 ${DEPEND_XML}
119 ${DEPEND_PCRE}"
120 }
121
122 split_info_php-cgi()
123 {
124 DESCRIPTION="GI and FCGI SAPI for PHP."
125 DEPEND="== dev-lang/php-${PVER}
126 ${DEPEND_XML}
127 ${DEPEND_PCRE}"
128 }
129
130 split_info_php-apache()
131 {
132 DESCRIPTION="Apache SAPI for PHP."
133 DEPEND="== dev-lang/php-${PVER}
134 ${DEPEND_XML}
135 ${DEPEND_PCRE}
136 ${DEPEND_APACHE}"
137 }
138
139 split_info_php-embedded()
140 {
141 DESCRIPTION="PHP library for embedding in applications."
142 DEPEND="== dev-lang/php-${PVER}
143 ${DEPEND_XML}
144 ${DEPEND_PCRE}"
145 }
146
147 split_info_php-pear()
148 {
149 DESCRIPTION="PHP Extension and Application Repository."
150 DEPEND="== dev-lang/php-${PVER}"
151 }
152
153 split_info_php-bcmath()
154 {
155 DESCRIPTION="A module for PHP applications for using the bcmath library."
156 DEPEND="== dev-lang/php-${PVER}"
157 }
158
159 split_info_php-curl()
160 {
161 DESCRIPTION="A module for PHP applications that use curl."
162 DEPEND="== dev-lang/php-${PVER}
163 ${DEPEND_IDN}
164 ${DEPEND_CURL}
165 ${DEPEND_LDAP}"
166 }
167
168 split_info_php-dba()
169 {
170 DESCRIPTION="A database abstraction layer module for PHP applications."
171 DEPEND="== dev-lang/php-${PVER}"
172 }
173
174 split_info_php-enchant()
175 {
176 DESCRIPTION="Human Language and Character Encoding Support."
177 DEPEND="== dev-lang/php-${PVER}
178 ${DEPEND_ENCHANT}"
179 }
180
181 split_info_php-gd()
182 {
183 DESCRIPTION="A module for PHP applications for using the gd graphics library."
184 DEPEND="== dev-lang/php-${PVER}
185 ${DEPEND_GD}"
186 }
187
188 split_info_php-gmp()
189 {
190 DESCRIPTION="A module for PHP applications for using the gmp library."
191 DEPEND="== dev-lang/php-${PVER}
192 ${DEPEND_GMP}"
193 }
194
195 split_info_php-ldap()
196 {
197 DESCRIPTION="A module for PHP applications that use LDAP."
198 DEPEND="== dev-lang/php-${PVER}
199 ${DEPEND_SASL}
200 ${DEPEND_LDAP}"
201 }
202
203 split_info_php-mbstring()
204 {
205 DESCRIPTION="A module for PHP applications which need multi-byte string handling."
206 DEPEND="== dev-lang/php-${PVER}"
207 }
208
209 split_info_php-mysql()
210 {
211 DESCRIPTION="Modules for PHP applications that use MySQL databases."
212 DEPEND="== dev-lang/php-${PVER}
213 == dev-lang/php-pdo-${PVER}
214 ${DEPEND_MYSQL}"
215 }
216
217 split_info_php-odbc()
218 {
219 DESCRIPTION="Modules for PHP applications that use ODBC databases."
220 DEPEND="== dev-lang/php-${PVER}
221 == dev-lang/php-pdo-${PVER}
222 ${DEPEND_ODBC}"
223 }
224
225 split_info_php-pdo()
226 {
227 DESCRIPTION="A database access abstraction module for PHP applications."
228 DEPEND="== dev-lang/php-${PVER}"
229 }
230
231 split_info_php-process()
232 {
233 DESCRIPTION="Modules for PHP script using system process interfaces."
234 DEPEND="== dev-lang/php-${PVER}"
235 }
236
237 split_info_php-pspell()
238 {
239 DESCRIPTION="A module for PHP applications for using pspell interfaces."
240 DEPEND="== dev-lang/php-${PVER}
241 ${DEPEND_ASPELL}"
242 }
243
244 split_info_php-soap()
245 {
246 DESCRIPTION="A module for PHP applications that use the SOAP protocol."
247 DEPEND="== dev-lang/php-${PVER}
248 ${DEPEND_XML}"
249 }
250
251 split_info_php-sqlite()
252 {
253 DESCRIPTION="Modules for PHP applications that use SQLite databases."
254 DEPEND="== dev-lang/php-${PVER}
255 == dev-lang/php-pdo-${PVER}
256 ${DEPEND_SQLITE}"
257 }
258
259 split_info_php-tidy()
260 {
261 DESCRIPTION="Standard PHP module provides tidy library support."
262 DEPEND="== dev-lang/php-${PVER}
263 ${DEPEND_TIDY}"
264 }
265
266 split_info_php-xml()
267 {
268 DESCRIPTION="Modules for PHP applications which use XML."
269 DEPEND="== dev-lang/php-${PVER}
270 ${DEPEND_XML}
271 ${DEPEND_XSLT}"
272 }
273
274 split_info_php-xmlrpc()
275 {
276 DESCRIPTION="A module for PHP applications which use the XML-RPC protocol."
277 DEPEND="== dev-lang/php-${PVER}
278 ${DEPEND_XML}"
279 }
280
281 # install-helper function
282 install_php_extensions()
283 {
284 local extensions="$@"
285 [[ -z ${extensions} ]] && die "no extensions given"
286
287 # set default PHP5_BUILD_DIR, env can override this
288 : ${PHP5_BUILD_DIR="${BUILDDIR}/build-php"}
289
290 cd ${PHP5_BUILD_DIR}
291
292 # needed directories
293 minstalldir ${PHP5_CONFIG_SCAN_DIR} || die
294 minstalldir ${PHP5_EXTENSIONS_DIR} || die
295
296 local MCONFIG
297 local ext
298 for ext in ${extensions}
299 do
300 # install extensions and the config ini
301 minstallexec modules/${ext}.so ${PHP5_EXTENSIONS_DIR} || die "mod ${ext}"
302 MCONFIG="${PHP5_CONFIG_SCAN_DIR}/${ext}.ini"
303 mclearconfig || die "ini ${ext}"
304 maddconfig "extension=${ext}.so" || die "ini ${ext}"
305 done
306 }
307
308 src_prepare()
309 {
310 munpack ${SRCFILE} || die
311 cd ${SRCDIR}
312
313 # version branding
314 sed -i "s:^\(EXTRA_VERSION=\).*:\1-magellan-${PBUILD}:" configure.in || die
315
316 # fixes multilib search pathes
317 mpatch ${PNAME}-5.2.4-multilib.patch || die
318
319 # do not touch the system httpd.conf
320 mpatch ${PNAME}-5.2.3-httpd-config.patch || die
321
322 # fixes build dir -> /usr/lib/php5/build
323 mpatch ${PNAME}-5.2.4-build-dir.patch || die
324
325 # hardend php core patch
326 # see: http://www.hardened-php.net/suhosin/index.html
327 mpatch ${PNAME}-5.3.9-suhosin-${SUHOSIN_PVER}.patch || die
328
329 # fully regenerate aclocal too
330 if [ -f aclocal.m4 ]
331 then
332 rm aclocal.m4 || die
333 fi
334
335 # rebuild configure
336 mautoreconf || die
337
338 # force use of system libtool
339 mlibtoolize || die
340 }
341
342 src_compile()
343 {
344 local php_base_config
345 local php_extensions
346 local current_run
347
348 # --with-libdir needed, doesn't honor --libdir
349 php_base_config="--with-libdir=$(mlibdir) \
350 --with-config-file-path=${PHP5_CONFIG_DIR} \
351 --with-config-file-scan-dir=${PHP5_CONFIG_SCAN_DIR} \
352 --enable-inline-optimization \
353 --enable-discard-path \
354 --disable-debug \
355 --disable-static \
356 --enable-shared \
357 --without-pear"
358
359 php_extensions="--with-zlib \
360 --with-bz2=shared \
361 --enable-bcmath=shared \
362 --enable-calendar=shared \
363 --enable-exif=shared \
364 --enable-ftp=shared \
365 --with-gettext=shared \
366 --enable-mbstring=shared \
367 --enable-mbregex \
368 --with-ncurses=shared \
369 --with-openssl=shared \
370 --with-gd=shared,/usr \
371 --enable-gd-native-ttf \
372 --with-freetype-dir=shared,/usr \
373 --with-ttf \
374 --with-t1lib=/usr \
375 --with-pcre-regex \
376 --with-gmp=shared \
377 --with-curl=shared \
378 --with-curlwrappers \
379 --enable-dba=shared \
380 --with-db4=shared \
381 --with-mysql=shared \
382 --with-mysqli=shared \
383 --with-unixODBC=shared,/usr \
384 --with-sqlite=shared \
385 --with-sqlite3=shared \
386 --enable-pdo=shared \
387 --with-pdo-odbc=shared,unixODBC,/usr \
388 --with-pdo-mysql=shared,/usr \
389 --with-pdo-sqlite=shared,/usr \
390 --enable-dbase=shared \
391 --enable-dom=shared \
392 --with-xmlrpc=shared \
393 --enable-xmlreader=shared \
394 --enable-xmlwriter=shared \
395 --with-xsl=shared,/usr \
396 --enable-wddx=shared \
397 --enable-soap=shared \
398 --enable-json=shared \
399 --enable-zip=shared \
400 --enable-phar=shared \
401 --enable-posix=shared \
402 --enable-fileinfo=shared \
403 --enable-sockets=shared \
404 --enable-sysvsem=shared \
405 --enable-sysvshm=shared \
406 --enable-sysvmsg=shared \
407 --with-tidy=shared \
408 --with-ldap=shared \
409 --with-ldap-sasl \
410 --with-enchant=shared \
411 --with-pspell=shared"
412 # ToDo:
413 # --with-mcrypt=shared \
414 # --with-mhash=shared \
415 # --with-imap=shared \
416 # --with-imap-ssl \
417 # --enable-maintainer-zts <- threaded apache2 support
418
419
420 #
421 # build php:
422 #
423
424 # prepare build outside of the SRCDIR
425 install -d ${BUILDDIR}/build-php
426 cd ${BUILDDIR}/build-php
427 ln -snf ${SRCDIR}/configure
428
429 mconfigure \
430 --srcdir=${SRCDIR} \
431 ${php_base_config} \
432 --disable-cgi \
433 --with-readline \
434 ${php_extensions} \
435 || die
436
437 mmake || die
438
439
440 #
441 # build cgi/fastcgi
442 #
443
444 # prepare build with the previous run, to save a lot of time
445 current_run=cgi
446 cp -a ${BUILDDIR}/build-php ${BUILDDIR}/build-${current_run}
447 cd ${BUILDDIR}/build-${current_run}
448
449 mconfigure \
450 --srcdir=${SRCDIR} \
451 ${php_base_config} \
452 --enable-cgi \
453 --enable-force-cgi-redirect \
454 --enable-fastcgi \
455 --disable-cli \
456 ${php_extensions} \
457 || die
458
459 mmake || die
460
461
462 #
463 # build apache mod
464 #
465
466 # prepare build with the previous run, to save a lot of time
467 current_run=apache
468 cp -a ${BUILDDIR}/build-php ${BUILDDIR}/build-${current_run}
469 cd ${BUILDDIR}/build-${current_run}
470
471 mconfigure \
472 --srcdir=${SRCDIR} \
473 ${php_base_config} \
474 --with-apxs2 \
475 --disable-cli \
476 ${php_extensions} \
477 || die
478
479 mmake || die
480
481
482 #
483 # build embedded
484 #
485
486 # prepare build with the previous run, to save a lot of time
487 current_run=embedded
488 cp -a ${BUILDDIR}/build-php ${BUILDDIR}/build-${current_run}
489 cd ${BUILDDIR}/build-${current_run}
490
491 mconfigure \
492 --srcdir=${SRCDIR} \
493 ${php_base_config} \
494 --enable-embed=shared \
495 --disable-cli \
496 ${php_extensions} \
497 || die
498
499 mmake || die
500
501
502 #
503 # build pear
504 #
505
506 # prepare build with the previous run, to save a lot of time
507 current_run=pear
508 cp -a ${BUILDDIR}/build-php ${BUILDDIR}/build-${current_run}
509 cd ${BUILDDIR}/build-${current_run}
510
511 mconfigure \
512 --srcdir=${SRCDIR} \
513 ${php_base_config} \
514 --disable-cgi \
515 --with-readline \
516 --enable-pcntl \
517 --with-pear \
518 ${php_extensions} \
519 || die
520
521 mmake || die
522 }
523
524 src_install_php()
525 {
526 cd ${BUILDDIR}/build-php
527 mmake -j1 INSTALL_ROOT=${BINDIR} EXTENSION_DIR=${PHP5_EXTENSIONS_DIR} PEAR_INSTALLDIR=${PHP5_PEAR_DIR} install || die
528
529 # fix a broken symlink
530 mlink phar.phar /usr/bin/phar || die
531
532 local php_ini=${SRCDIR}/php.ini-production
533
534 # php config
535 minstalldir /etc/php5/conf.d || die
536 # remove windows remark
537 sed -i -e '/^; extension_dir = "ext"/d' -e '/^; On windows:$/d' ${php_ini} || die
538 # fix extensions dir location
539 sed -i "s:^; \(extension_dir =\).*:\1 ${PHP5_EXTENSIONS_DIR}:" ${php_ini} || die
540 # allow short php open-tags
541 sed -i "s:^\(short_open_tag =\).*:\1 On:" ${php_ini} || die
542 minstallfile ${php_ini} /etc/php5/php.ini || die
543
544 # fix extension_dir also in phmp-config
545 sed -i "s:^\(extension_dir=\).*:\1${PHP5_EXTENSIONS_DIR}:" ${BINDIR}/usr/bin/php-config || die
546
547 # remove all extensions provided by other split-packages
548 local ext
549 for ext in curl bcmath dba enchant gd gmp ldap mbstring mysql mysqli \
550 pdo_mysql odbc pdo_odbc pdo pspell sqlite sqlite3 pdo_sqlite \
551 soap sysvmsg sysvsem sysvshm posix tidy xsl wddx dom xmlreader \
552 xmlwriter xmlrpc
553 do
554 rm ${BINDIR}/${PHP5_EXTENSIONS_DIR}/${ext}.so || die ${ext}
555 done
556
557 # remove all static extensions too
558 rm ${BINDIR}/${PHP5_EXTENSIONS_DIR}/*.a || die
559
560 # enable all default extensions
561 local MCONFIG
562 local i
563 for i in $(ls ${BINDIR}/${PHP5_EXTENSIONS_DIR}/*.so | sort )
564 do
565 MCONFIG="/etc/php5/conf.d/$(basename ${i} .so).ini"
566 mclearconfig || die
567 maddconfig "extension=$(basename ${i})" || die
568 done
569
570 # disable config-protoct for modules conf dir
571 minstalldir /etc/env.d || die
572 MCONFIG="/etc/env.d/30php5"
573 mclearconfig || die
574 maddconfig 'CONFIG_PROTECT_MASK="/etc/php5/conf.d"' || die
575
576 minstalldocs CREDITS CODING_STANDARDS EXTENSIONS LICENSE NEWS README* TODO* || die
577 }
578
579 src_install_php-cgi()
580 {
581 cd ${BUILDDIR}/build-cgi
582 minstallexec sapi/cgi/php-cgi || die
583 }
584
585 src_install_php-apache()
586 {
587 cd ${BUILDDIR}/build-apache
588
589 # install apache sapi
590 local APACHE_MOD_DIR="$(apxs -q LIBEXECDIR)"
591 minstalldir ${APACHE_MOD_DIR} || die
592 minstallexec libs/libphp5.so ${APACHE_MOD_DIR} || die
593
594 # install apache module config
595 local APACHE_SYSCONFDIR="$(apxs -q SYSCONFDIR)"
596 minstalldir ${APACHE_SYSCONFDIR}/modules.d || die
597 minstallfile -s php5_module.conf ${APACHE_SYSCONFDIR}/modules.d/php5.conf || die
598 }
599
600 src_install_php-embedded()
601 {
602 cd ${BUILDDIR}/build-embedded
603
604 # install sapi library
605 minstalldir /usr/$(mlibdir) || die
606 minstallexec libs/libphp5.so /usr/$(mlibdir)/libphp5.so || die
607
608 # install include
609 minstalldir /usr/include/${PNAME}/sapi/embed || die
610 minstallfile ${SRCDIR}/sapi/embed/php_embed.h /usr/include/${PNAME}/sapi/embed || die
611 }
612
613 src_install_php-pear()
614 {
615 cd ${BUILDDIR}/build-pear
616 mmake INSTALL_ROOT=${BINDIR} EXTENSION_DIR=${PHP5_EXTENSIONS_DIR} PEAR_INSTALLDIR=${PHP5_PEAR_DIR} install-pear || die
617
618 local i
619 for i in $(find ${BINDIR}/ -name '.*')
620 do
621 if [[ -e ${i} ]]
622 then
623 rm -rf ${i} || die ${i}
624 fi
625 done
626 }
627
628 # being a little tricky here:
629 for subpackage in ${SPLIT_PACKAGES}
630 do
631 # exclude all other packages than php-addon-modules
632 case ${subpackage} in
633 php) continue ;;
634 php-cgi) continue ;;
635 php-apache) continue ;;
636 php-embedded) continue ;;
637 php-pear) continue ;;
638 esac
639
640 eval "src_install_${subpackage}(){ install_php_extensions ${subpackage#*-} || die; }"
641 done
642
643 # exceptions
644 src_install_php-mysql()
645 {
646 install_php_extensions mysql mysqli pdo_mysql || die
647 }
648
649 src_install_php-odbc()
650 {
651 install_php_extensions odbc pdo_odbc || die
652 }
653
654 src_install_php-process()
655 {
656 install_php_extensions sysvmsg sysvsem sysvshm posix || die
657 }
658
659 src_install_php-sqlite()
660 {
661 install_php_extensions sqlite sqlite3 pdo_sqlite || die
662 }
663
664 src_install_php-xml()
665 {
666 install_php_extensions dom wddx xmlreader xmlwriter xsl || die
667 }