Makefile.inc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. # $OpenBSD: Makefile.inc,v 1.6 2017/04/10 11:46:34 sthen Exp $
  2. COMMENT-main= server-side HTML-embedded scripting language
  3. COMMENT-fastcgi= stand-alone FastCGI version of PHP
  4. PKGNAME-main?= php-${V}
  5. PKGNAME-fastcgi?= php-fastcgi-${V}
  6. DISTFILES?= php-${V}.tar.bz2
  7. DISTNAME?= php-${V}
  8. CATEGORIES= lang www
  9. MAINTAINER= Robert Nagy <robert@openbsd.org>
  10. HOMEPAGE= http://www.php.net/
  11. SUHOSIN_V= 0.9.33
  12. SUHOSIN_PHPV?= ${V}
  13. MASTER_SITES= http://se.php.net/distributions/ \
  14. http://us.php.net/distributions/ \
  15. http://no.php.net/distributions/ \
  16. http://uk.php.net/distributions/
  17. MASTER_SITES0= http://spacehopper.org/mirrors/ \
  18. http://download.suhosin.org/ \
  19. http://blade2k.humppa.hu/ \
  20. ${_MASTER_SITE_FREEBSD}
  21. # UPGRADERS: please read BOTH the PHP and Zend licenses
  22. # and make sure they are safe before an upgrade
  23. PERMIT_PACKAGE_CDROM= Yes
  24. MODPHP_CONFIG_PATH= /var/www/conf
  25. # where the main php module is stored (outside the chroot)
  26. APACHE_MODULE_SUBDIR= lib/php-${PV}
  27. APACHE_MODULE_DIR= ${LOCALBASE}/${APACHE_MODULE_SUBDIR}
  28. # where the PEAR and extension modules are (inside the chroot)
  29. CHROOT_DIR?= /var/www
  30. MODULES_SUBDIR= lib/php-${PV}/modules
  31. MODULES_DIR= ${LOCALBASE}/${MODULES_SUBDIR}
  32. FLAVORS= ap2
  33. .if ${PV} != "5.4" && ${PV} != "5.5"
  34. FLAVORS+= no_suhosin
  35. .endif
  36. FLAVOR?=
  37. USE_GROFF= Yes
  38. PATCHORIG= .orig.port
  39. CONFIGURE_STYLE= autoconf
  40. AUTOCONF_VERSION?= 2.69
  41. CONFIGURE_ENV= CFLAGS="${CFLAGS} -I${LOCALBASE}/include -pthread" \
  42. LDFLAGS="-L${LOCALBASE}/lib -pthread" \
  43. EXTENSION_DIR=${MODULES_DIR} lt_cv_path_SED=/usr/bin/sed
  44. MAKE_ENV= ${CONFIGURE_ENV}
  45. CONFIGURE_ARGS+= --enable-shared \
  46. --disable-static \
  47. --disable-rpath \
  48. --with-config-file-path=${SYSCONFDIR} \
  49. --enable-inline-optimization \
  50. --with-pic \
  51. --with-pear=${LOCALBASE}/share/php-${PV} \
  52. --with-config-file-scan-dir=${SYSCONFDIR}/php-${PV} \
  53. --with-pdo-sqlite \
  54. --enable-sqlite-utf8 \
  55. --with-sqlite3 \
  56. --program-suffix=-${PV}
  57. # readline is broken in PHP-5.3
  58. .if ${PV} != 5.3
  59. CONFIGURE_ARGS += --with-readline
  60. .endif
  61. .if ${FLAVOR:Map2}
  62. CONFIGURE_ARGS+= --with-apxs2=${LOCALBASE}/sbin/apxs2
  63. BUILD_DEPENDS= www/apache-httpd
  64. .else
  65. # doesn't use apache-module.port.mk so MODAPACHE_APXS not available
  66. CONFIGURE_ARGS+= --with-apxs=${LOCALBASE}/sbin/apxs
  67. BUILD_DEPENDS= www/apache-httpd-openbsd
  68. .endif
  69. # default included extensions
  70. CONFIGURE_ARGS+= --with-openssl \
  71. --with-zlib \
  72. --enable-xml \
  73. --enable-wddx \
  74. --enable-cli \
  75. --with-iconv=${LOCALBASE} \
  76. --with-gettext=${LOCALBASE} \
  77. --enable-bcmath \
  78. --enable-session \
  79. --enable-calendar \
  80. --enable-ctype \
  81. --enable-ftp \
  82. --with-pcre-regex \
  83. --enable-sockets \
  84. --enable-sysvmsg \
  85. --enable-sysvsem \
  86. --enable-sysvshm \
  87. --enable-mbstring \
  88. --enable-exif \
  89. --enable-zend-multibyte \
  90. --enable-fastcgi
  91. TEST_TARGET= test
  92. TEST_FLAGS= NO_INTERACTION=1
  93. MULTI_PACKAGES+= -main -fastcgi
  94. #
  95. # Loadable php extensions by name that are included in all versions
  96. #
  97. # bz2
  98. MULTI_PACKAGES+= -bz2
  99. COMMENT-bz2= bzip2 compression extensions for php5
  100. CONFIGURE_ARGS+= --with-bz2=shared,${LOCALBASE}
  101. LIB_DEPENDS-bz2= archivers/bzip2
  102. WANTLIB-bz2= bz2>=10 pthread
  103. # curl
  104. MULTI_PACKAGES+= -curl
  105. COMMENT-curl= curl URL library extensions for php5
  106. CONFIGURE_ARGS+= --with-curl=shared,${LOCALBASE}
  107. LIB_DEPENDS-curl= net/curl
  108. WANTLIB-curl= pthread crypto idn ssl z curl>=2
  109. # dba
  110. MULTI_PACKAGES+= -dba
  111. COMMENT-dba= dba GDBM access extensions for php5
  112. CONFIGURE_ARGS+= --enable-dba=shared --with-gdbm=${LOCALBASE}
  113. LIB_DEPENDS-dba= databases/gdbm
  114. WANTLIB-dba= gdbm>=2 pthread
  115. # gd
  116. MULTI_PACKAGES+= -gd
  117. COMMENT-gd= image manipulation extensions for php5
  118. LIB_DEPENDS-gd= graphics/jpeg \
  119. graphics/png \
  120. devel/t1lib
  121. WANTLIB-gd= z jpeg>=62 png>=3 t1>=5 pthread X11 Xpm freetype
  122. CONFIGURE_ARGS+= --with-gd=shared \
  123. --with-jpeg-dir=${LOCALBASE} \
  124. --with-png-dir=${LOCALBASE} \
  125. --with-zlib-dir=/usr \
  126. --with-t1lib=${LOCALBASE} \
  127. --with-freetype-dir=${X11BASE} \
  128. --with-xpm-dir=${X11BASE}
  129. # gmp
  130. MULTI_PACKAGES+= -gmp
  131. COMMENT-gmp= gmp math library support for php5
  132. CONFIGURE_ARGS+= --with-gmp=shared,${LOCALBASE}
  133. LIB_DEPENDS-gmp= devel/gmp
  134. WANTLIB-gmp= gmp>=4 pthread
  135. # intl
  136. MULTI_PACKAGES+= -intl
  137. COMMENT-intl= intl library support for php5
  138. CONFIGURE_ARGS+= --enable-intl=shared \
  139. --with-icu-dir=${LOCALBASE}
  140. LIB_DEPENDS-intl= textproc/icu4c
  141. WANTLIB-intl= icudata icui18n icuio icuuc m pthread
  142. # imap
  143. MULTI_PACKAGES+= -imap
  144. COMMENT-imap= imap, pop3 and nntp extensions for php5
  145. CONFIGURE_ARGS+= --with-imap=shared,${LOCALBASE} \
  146. --with-imap-ssl
  147. LIB_DEPENDS-imap= mail/alpine,-c-client
  148. WANTLIB-imap= pthread crypto ssl c-client>=5
  149. # ldap
  150. MULTI_PACKAGES+= -ldap
  151. COMMENT-ldap= ldap protocol extensions for php5
  152. CONFIGURE_ARGS+= --with-ldap=shared,${LOCALBASE}
  153. LIB_DEPENDS-ldap= databases/openldap
  154. WANTLIB-ldap= pthread ldap>=2 lber
  155. # mcrypt
  156. MULTI_PACKAGES+= -mcrypt
  157. COMMENT-mcrypt= mcrypt encryption/decryption extensions for php5
  158. CONFIGURE_ARGS+= --with-mcrypt=shared,${LOCALBASE}
  159. LIB_DEPENDS-mcrypt= security/libmcrypt devel/libtool,-ltdl
  160. WANTLIB-mcrypt= mcrypt ltdl>=1 pthread
  161. # mysql
  162. MULTI_PACKAGES+= -mysql
  163. COMMENT-mysql= mysql database access extensions for php5
  164. CONFIGURE_ARGS+= --with-mysql=shared,${LOCALBASE}
  165. LIB_DEPENDS-mysql= databases/mariadb
  166. WANTLIB-mysql= pthread lib/mysql/mysqlclient
  167. # mysqli
  168. MULTI_PACKAGES+= -mysqli
  169. COMMENT-mysqli= mysql database access extensions for php5
  170. CONFIGURE_ARGS+= --with-mysqli=shared,${LOCALBASE}/bin/mysql_config
  171. LIB_DEPENDS-mysqli= databases/mariadb
  172. WANTLIB-mysqli= crypto m pthread ssl z lib/mysql/mysqlclient
  173. # odbc
  174. MULTI_PACKAGES+= -odbc
  175. COMMENT-odbc= odbc database access extensions for php5
  176. CONFIGURE_ARGS+= --with-iodbc=shared,${LOCALBASE}
  177. LIB_DEPENDS-odbc= databases/iodbc
  178. WANTLIB-odbc= iodbcinst iodbc>=2 pthread
  179. # pdo-mysql
  180. MULTI_PACKAGES+= -pdo_mysql
  181. COMMENT-pdo_mysql= PDO mysql database access extensions for php5
  182. CONFIGURE_ARGS+= --with-pdo-mysql=shared,${LOCALBASE}
  183. LIB_DEPENDS-pdo_mysql= databases/mariadb
  184. WANTLIB-pdo_mysql= crypto m pthread ssl z lib/mysql/mysqlclient
  185. # pdo-pgsql
  186. MULTI_PACKAGES+= -pdo_pgsql
  187. COMMENT-pdo_pgsql= PDO database access extensions for php5
  188. CONFIGURE_ARGS+= --with-pdo-pgsql=shared,${LOCALBASE}
  189. LIB_DEPENDS-pdo_pgsql= databases/postgresql
  190. WANTLIB-pdo_pgsql= pq>=2 pthread
  191. # pgsql
  192. MULTI_PACKAGES+= -pgsql
  193. COMMENT-pgsql= pgsql database access extensions for php5
  194. CONFIGURE_ARGS+= --with-pgsql=shared,${LOCALBASE}
  195. LIB_DEPENDS-pgsql= databases/postgresql
  196. WANTLIB-pgsql= pq>=2 pthread
  197. # pspell
  198. MULTI_PACKAGES+= -pspell
  199. COMMENT-pspell= pspell library extensions for php5
  200. CONFIGURE_ARGS+= --with-pspell=shared,${LOCALBASE}
  201. LIB_DEPENDS-pspell= textproc/aspell/core
  202. WANTLIB-pspell= aspell>=16 pspell>=16 pthread
  203. # shmop
  204. MULTI_PACKAGES+= -shmop
  205. COMMENT-shmop= shared memory extensions for php5
  206. CONFIGURE_ARGS+= --enable-shmop=shared,${LOCALBASE}
  207. LIB_DEPENDS-shmop=
  208. WANTLIB-shmop= pthread
  209. # soap
  210. MULTI_PACKAGES+= -soap
  211. COMMENT-soap= SOAP functions for php5
  212. CONFIGURE_ARGS+= --enable-soap=shared,${LOCALBASE}
  213. LIB_DEPENDS-soap= textproc/libxml
  214. WANTLIB-soap= ${MODLIBICONV_WANTLIB} m pthread z xml2>=8
  215. # snmp
  216. MULTI_PACKAGES+= -snmp
  217. COMMENT-snmp= snmp protocol extensions for php5
  218. CONFIGURE_ARGS+= --with-snmp=shared,${LOCALBASE} --enable-ucd-snmp-hack
  219. LIB_DEPENDS-snmp= net/net-snmp
  220. WANTLIB-snmp= crypto m netsnmp>=6.2 pthread
  221. # pdo-dblib
  222. MULTI_PACKAGES+= -pdo_dblib
  223. COMMENT-pdo_dblib= PDO DB-LIB support for php5
  224. CONFIGURE_ARGS+= --with-pdo-dblib=shared,${LOCALBASE}
  225. LIB_DEPENDS-pdo_dblib= databases/freetds
  226. WANTLIB-pdo_dblib= sybdb>=6 pthread
  227. # mssql
  228. MULTI_PACKAGES+= -mssql
  229. COMMENT-mssql= microsoft sql access extensions for php5
  230. CONFIGURE_ARGS+= --with-mssql=shared,${LOCALBASE}
  231. LIB_DEPENDS-mssql= databases/freetds
  232. WANTLIB-mssql= sybdb>=6 pthread
  233. # tidy
  234. MULTI_PACKAGES+= -tidy
  235. COMMENT-tidy= tidy HTML cleaner bindings
  236. CONFIGURE_ARGS+= --with-tidy=shared,${LOCALBASE}
  237. LIB_DEPENDS-tidy= www/tidyp
  238. WANTLIB-tidy= tidyp pthread
  239. # xml-rpc
  240. MULTI_PACKAGES+= -xmlrpc
  241. COMMENT-xmlrpc= XML RPC functions for php5
  242. CONFIGURE_ARGS+= --with-xmlrpc=shared
  243. LIB_DEPENDS-xmlrpc= textproc/libxml
  244. WANTLIB-xmlrpc= ${MODLIBICONV_WANTLIB} m z xml2>=8 pthread
  245. # xsl
  246. MULTI_PACKAGES+= -xsl
  247. COMMENT-xsl= XSL functions for php5
  248. CONFIGURE_ARGS+= --with-xsl=shared --enable-dom
  249. LIB_DEPENDS-xsl= textproc/libxslt
  250. WANTLIB-xsl= ${MODLIBICONV_WANTLIB} m xml2 z xslt>=3 exslt pthread
  251. # zip
  252. MULTI_PACKAGES+= -zip
  253. COMMENT-zip= zip functions for php5
  254. CONFIGURE_ARGS+= --enable-zip=shared,${LOCALBASE}
  255. LIB_DEPENDS-zip=
  256. WANTLIB-zip= z pthread
  257. # some variables to substitute
  258. SUBST_VARS= MODPHP_CONFIG_PATH PV ^MODULE_NAME
  259. PHP_VERSION= ${V}
  260. .for i in TRUEPREFIX MODULES_DIR PHP_VERSION APACHE_MODULE_DIR
  261. PHPXS_SUBST+= -e 's,${i},${${i}},'
  262. .endfor
  263. MODULES= devel/gettext
  264. WANTLIB-main+= c crypto m pthread ssl xml2>=8 z ${MODGETTEXT_WANTLIB}
  265. # php 5.4/5.5 : WANTLIB-main += ${LIBCXX}
  266. WANTLIB-fastcgi= ${WANTLIB-main}
  267. LIB_DEPENDS-main= textproc/libxml
  268. RUN_DEPENDS-main= ${MODGETTEXT_RUN_DEPENDS} \
  269. mail/femail,-chroot
  270. LIB_DEPENDS-fastcgi= ${LIB_DEPENDS-main}
  271. .if ${PV} != "5.4" && ${PV} != "5.5"
  272. . if ${FLAVOR:Mno_suhosin}
  273. SUPDISTFILES= suhosin-${SUHOSIN_V}.tgz:0 \
  274. suhosin-patch-${SUHOSIN_PHPV}-${SUHOSIN_P_V}.patch.gz:0
  275. . else
  276. DISTFILES+= suhosin-${SUHOSIN_V}.tgz:0
  277. PATCHFILES= suhosin-patch-${SUHOSIN_PHPV}-${SUHOSIN_P_V}.patch.gz:0
  278. PATCH_DIST_STRIP= -p1
  279. CONFIGURE_ARGS+= --enable-suhosin
  280. pre-patch:
  281. @mv ${WRKDIR}/suhosin-${SUHOSIN_V} ${WRKSRC}/ext/suhosin
  282. . endif
  283. .endif
  284. pre-fake:
  285. ${INSTALL_DATA_DIR} ${PREFIX}/${APACHE_MODULE_SUBDIR}/modules
  286. INSTALL_TARGET= install-headers install-build install-programs
  287. DESTDIRNAME= INSTALL_ROOT
  288. pre-configure:
  289. ${SUBST_CMD} ${WRKSRC}/main/php_ini.c
  290. @perl -pi -e "s,OPENBSD_PEAR_ROOT,'${CHROOT_DIR}/pear',g;" \
  291. -e "s,OPENBSD_PREFIX,${TRUEPREFIX},;" \
  292. ${WRKSRC}/scripts/phpize.in \
  293. ${WRKSRC}/scripts/php-config.in
  294. .if ${FLAVOR:Map2}
  295. MULTI_PACKAGES := ${MULTI_PACKAGES:N-fpm:N-fastcgi}
  296. .endif
  297. .for i in ${MULTI_PACKAGES:N-main:N-fastcgi:N-fpm:N-pcntl:S/-//g}
  298. MODULE_NAME-${i}= ${i}
  299. DESCR-${i}= ${.CURDIR}/../files/DESCR-${i}
  300. MESSAGE-${i}= ${.CURDIR}/../files/MESSAGE-ext
  301. UNMESSAGE-${i}= ${.CURDIR}/../files/UNMESSAGE-ext
  302. PKGNAME-${i}= php-${i}-${V}
  303. # don't build separate plugins for -ap2
  304. FULLPKGNAME-${i}= php-${i}-${V}${FLAVOR_EXT:S/-ap2//}
  305. FULLPKGPATH-${i}= ${PKGPATH},-${i}${FLAVOR_EXT:S/-ap2//:S/-/,/g}
  306. .if ${V:M5.3*}
  307. PKGSPEC-${i}= php-${i}->=5.3,<5.4
  308. .else if ${V:M5.4*}
  309. PKGSPEC-${i}= php-${i}->=5.4,<5.5
  310. .else if ${V:M5.5*}
  311. PKGSPEC-${i}= php-${i}->=5.5,<5.6
  312. .endif
  313. RUN_DEPENDS-${i}+= php-${V}:lang/php/${PV}
  314. .endfor
  315. DESCR-main= ${.CURDIR}/../files/DESCR-main
  316. DESCR-fastcgi= ${.CURDIR}/../files/DESCR-fastcgi
  317. MESSAGE-main= ${.CURDIR}/../files/MESSAGE-main
  318. UNMESSAGE-main= ${.CURDIR}/../files/UNMESSAGE-main
  319. post-install:
  320. ${INSTALL_DATA} ${WRKBUILD}/.libs/libphp5.so \
  321. ${PREFIX}/${APACHE_MODULE_SUBDIR}/
  322. ${INSTALL_DATA_DIR} ${WRKINST}/${CHROOT_DIR}/conf/php-${PV}.sample
  323. ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/php-${PV}
  324. ${INSTALL_PROGRAM} ${WRKBUILD}/sapi/cli/php ${PREFIX}/bin/php-${PV}
  325. ${INSTALL_PROGRAM} ${WRKBUILD}/sapi/cgi/php-cgi ${PREFIX}/bin/php-fastcgi-${PV}
  326. .if ${V:M5.3*} || ${V:M5.4*} || ${V:M5.5*}
  327. ${INSTALL_PROGRAM} ${WRKBUILD}/sapi/fpm/php-fpm ${PREFIX}/sbin/php-fpm-${PV}
  328. ${INSTALL_MAN} ${WRKBUILD}/sapi/fpm/php-fpm.8 ${PREFIX}/man/man8/php-fpm-${PV}.8
  329. ${INSTALL_DATA} ${WRKBUILD}/sapi/fpm/php-fpm.conf \
  330. ${PREFIX}/share/examples/php-${PV}/php-fpm.conf
  331. .endif
  332. ${INSTALL_DATA} ${.CURDIR}/../files/php.conf \
  333. ${PREFIX}/share/examples/php-${PV}/php.conf
  334. @perl -pi -e "s,!!PREFIX!!,${TRUEPREFIX},g;s,!!PV!!,${PV},g" \
  335. ${PREFIX}/share/examples/php-${PV}/php.conf
  336. .for m in ${MULTI_PACKAGES:N-main:N-fastcgi:N-fpm:S/-//g}
  337. ${INSTALL_DATA} ${WRKBUILD}/modules/${m}.so \
  338. ${PREFIX}/${MODULES_SUBDIR}/${m}.so
  339. echo "extension=${m}.so" > \
  340. ${PREFIX}/share/examples/php-${PV}/${m}.ini
  341. .endfor
  342. ${INSTALL_DATA_DIR} ${WRKINST}/${CHROOT_DIR}/etc
  343. echo "www:*:67:67::0:0:dummy user to appease c-client:/nonexistent:/sbin/nologin" > \
  344. ${WRKINST}/${CHROOT_DIR}/etc/master.passwd.imap
  345. pwd_mkdb -d ${WRKINST}/${CHROOT_DIR}/etc master.passwd.imap
  346. .for i in ${INI_TEMPLATES}
  347. @sed -e 's,MODULES_DIR,${MODULES_DIR},' \
  348. -e 's,OPENBSD_INCLUDE_PATH,/pear/lib:${CHROOT_DIR}/pear/lib,' \
  349. <${WRKSRC}/php.ini-${i} \
  350. >${PREFIX}/share/examples/php-${PV}/php.ini-${i}
  351. .endfor
  352. ${INSTALL_MAN} ${WRKSRC}/sapi/cli/php.1 ${PREFIX}/man/man1/php-${PV}.1