Makefile.inc 13 KB

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