Makefile 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. # $OpenBSD: Makefile,v 1.256 2017/05/26 15:42:45 sthen Exp $
  2. # XXX uses -fblocks on clang, or nested functions on gcc.
  3. #
  4. # on clang/ld.bfd arches, the configure test fails to link. test looks like this:
  5. #
  6. # echo 'int main(){return ^{return 42;}();}' | \
  7. # clang -o /tmp/blockstest -fblocks -x c -L/usr/local/lib -lBlocksRuntime -
  8. #
  9. # -> undefined reference to `_NSConcreteGlobalBlock'
  10. #
  11. # on clang/ld.lld arches, it builds ok but runtime fails: dlopen()ing the .so modules
  12. # at runtime fails with undefined symbols from the BlocksRuntime lib.
  13. #
  14. BROKEN-aarch64= linker problems with BlocksRuntime that only show up at runtime
  15. COMMENT-main= open source multi-protocol PBX and telephony toolkit
  16. VER= 13.15.1
  17. PORTROACH= limitw:0,odd
  18. DISTNAME= asterisk-${VER:S/beta/-beta/:S/rc/-rc/}
  19. PKGNAME-main= asterisk-${VER}
  20. CATEGORIES= telephony
  21. HOMEPAGE= http://www.asterisk.org/
  22. MAINTAINER= Stuart Henderson <sthen@openbsd.org>
  23. # Mostly GPL v2 (only). "Specific permission is also granted to link
  24. # Asterisk with OpenSSL and OpenH323 and distribute the resulting binary
  25. # files." iLBC codec has BSD-like license terms, but also see patent
  26. # notes in codecs/ilbc/LICENSE_ADDENDUM.
  27. PERMIT_PACKAGE_CDROM= patent licensing clauses
  28. PERMIT_PACKAGE_FTP= Yes
  29. WANTLIB-main += c crypto curl execinfo g7221codec gsm iconv iksemel
  30. WANTLIB-main += ilbccodec jansson lzma m nghttp2 ogg opencore-amrnb
  31. WANTLIB-main += opencore-amrwb pj pjlib-util pjmedia pjmedia-audiodev
  32. WANTLIB-main += pjmedia-codec pjmedia-videodev pjnath pjsip pjsip-simple
  33. WANTLIB-main += pjsip-ua pjsua pjsua2 portaudio pthread resample spandsp
  34. WANTLIB-main += speex speexdsp sqlite3 ssl ${LIBCXX} termcap tiff uriparser
  35. WANTLIB-main += uuid vorbis vorbisenc vorbisfile xml2 xslt z
  36. SHARED_LIBS= asteriskssl 0.0 # 1
  37. MULTI_PACKAGES= -main -calendar -http_post -ldap -odbc \
  38. -pgsql -snmp -speex -tds
  39. PSEUDO_FLAVORS= ${MULTI_PACKAGES:N-main:C/-/no_/g}
  40. LIB_DEPENDS-main= audio/gsm \
  41. audio/libogg \
  42. audio/libvorbis \
  43. audio/portaudio-svn \
  44. converters/libiconv \
  45. databases/sqlite3 \
  46. devel/libexecinfo \
  47. devel/jansson \
  48. graphics/tiff \
  49. net/curl \
  50. sysutils/e2fsprogs \
  51. telephony/pjsua,-main \
  52. telephony/spandsp \
  53. textproc/iksemel \
  54. textproc/libxml \
  55. textproc/libxslt \
  56. www/uriparser
  57. RUN_DEPENDS-main= telephony/asterisk-sounds/core-sounds/en,gsm>=1.4.25 \
  58. telephony/asterisk-sounds/moh-opsound,wav
  59. BUILD_DEPENDS= security/libsrtp>=1.4.4 # statically linked
  60. MASTER_SITES= http://downloads.asterisk.org/pub/telephony/asterisk/releases/ \
  61. http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/
  62. # if using bundled pjproject:
  63. #
  64. #CONFIGURE_ARGS+= --with-pjproject-bundled
  65. #PJ_V= 2.5.5
  66. #MASTER_SITES0= http://www.pjsip.org/release/${PJ_V}/
  67. #EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
  68. #DISTFILES= ${DISTNAME}${EXTRACT_SUFX} pjproject-${PJ_V}.tar.bz2:0
  69. #
  70. # @cd ${WRKSRC}/third-party/; \
  71. # grep 'PJPROJECT_VERSION = ${PJ_V}$$' versions.mak > /dev/null || \
  72. # (echo "PJ_V != PJPROJECT_VERSION; update in port"; \
  73. # grep 'PJPROJECT_VERSION' versions.mak; exit 1)
  74. USE_GMAKE= Yes
  75. CONFIGURE_STYLE= gnu
  76. AUTOCONF_VERSION= 2.69
  77. AUTOMAKE_VERSION= 1.15
  78. BUILD_DEPENDS+= ${MODGNU_AUTOCONF_DEPENDS} \
  79. ${MODGNU_AUTOMAKE_DEPENDS} \
  80. archivers/bzip2 \
  81. devel/libtool,-ltdl # bogus dependencies in menuselect
  82. CPPFLAGS+= -I${X11BASE}/include -I${LOCALBASE}/include
  83. LDFLAGS+= -L${X11BASE}/lib -L${LOCALBASE}/lib
  84. CONFIGURE_ENV+= CPPFLAGS="${CPPFLAGS}" \
  85. CFLAGS="${CFLAGS}" \
  86. LDFLAGS="${LDFLAGS}" \
  87. LIBS="-lpthread" \
  88. ac_cv_path_LDCONFIG=:
  89. MAKE_FLAGS+= ASTCFLAGS="${CFLAGS}" \
  90. ASTLDFLAGS="${LDFLAGS}" \
  91. ASTSSL_SO_VERSION="${LIBasteriskssl_VERSION}" \
  92. NOISY_BUILD="Yes" \
  93. OPTIMIZE=
  94. CONFIGURE_ARGS+= --localstatedir=/var \
  95. --with-externals-cache=${FULLDISTDIR}
  96. CONFIGURE_ARGS+= --with-asound=no \
  97. --with-cap=no \
  98. --with-dahdi=no \
  99. --with-gtk2=no \
  100. --with-h323=no \
  101. --with-isdnnet=no \
  102. --with-misdn=no \
  103. --with-nbs=no \
  104. --with-newt=no \
  105. --with-osptk=no \
  106. --with-oss=no \
  107. --with-portaudio=${LOCALBASE} \
  108. --with-pri=no \
  109. --with-pwlib=no \
  110. --with-SDL_image=no \
  111. --with-sdl=no \
  112. --with-sqlite=no \
  113. --with-ss7=no \
  114. --with-suppserv=no \
  115. --with-tinfo=no \
  116. --with-tonezone=no \
  117. --with-vpb=no
  118. CONFIGURE_ARGS+= --with-jack=no \
  119. --with-lua=no \
  120. --with-radius=no \
  121. --with-resample=no
  122. # Some build options (including a useful malloc debug) are available
  123. # via menuselect. They may be enabled by running 'make configure', cd
  124. # to WRKSRC, 'gmake menuselect', then 'cd -' back to the port directory
  125. # and 'make'.
  126. FLAVOR?=
  127. FLAVORS= imap
  128. ## flavours:
  129. .if ${FLAVOR:Mimap}
  130. CONFIGURE_ARGS+= --with-imap=system
  131. MAKE_FLAGS+= MENUSELECT_OPTS_app_voicemail=IMAP_STORAGE
  132. CPPFLAGS+= -I${LOCALBASE}/include/c-client
  133. LIB_DEPENDS-main+= mail/alpine,-c-client
  134. WANTLIB-main+= c-client
  135. .else
  136. CONFIGURE_ARGS+= --with-imap=no
  137. .endif
  138. ## multipackages:
  139. .include <bsd.port.arch.mk>
  140. # calendar
  141. COMMENT-calendar= calendar support for Asterisk
  142. WANTLIB-calendar= crypto expat ical iconv intl iksemel lzma
  143. WANTLIB-calendar+= m neon proxy pthread ssl xml2 z
  144. LIB_DEPENDS-calendar= devel/gettext \
  145. net/neon \
  146. textproc/libical
  147. .if !${BUILD_PACKAGES:M-calendar}
  148. CONFIGURE_ARGS+= --with-ical=no
  149. .endif
  150. # http_post
  151. COMMENT-http_post= HTTP POST support for Asterisk
  152. LIB_DEPENDS-http_post= devel/gettext mail/gmime
  153. WANTLIB-http_post= gio-2.0 glib-2.0 gmime-2.6 gobject-2.0 intl pthread
  154. .if !${BUILD_PACKAGES:M-http_post}
  155. CONFIGURE_ARGS+= --with-gmime=no
  156. .endif
  157. # ldap
  158. COMMENT-ldap= LDAP support for Asterisk
  159. LIB_DEPENDS-ldap= databases/openldap,-main
  160. WANTLIB-ldap= ldap pthread
  161. .if !${BUILD_PACKAGES:M-ldap}
  162. CONFIGURE_ARGS+= --with-ldap=no
  163. .endif
  164. # freetds
  165. COMMENT-tds= MSSQL/Sybase support for Asterisk
  166. LIB_DEPENDS-tds= databases/freetds
  167. WANTLIB-tds= pthread sybdb
  168. .if !${BUILD_PACKAGES:M-tds}
  169. CONFIGURE_ARGS+= --with-tds=no
  170. .else
  171. CONFIGURE_ARGS+= --with-tds=${LOCALBASE}
  172. .endif
  173. # odbc
  174. COMMENT-odbc= ODBC support for Asterisk
  175. LIB_DEPENDS-odbc= databases/iodbc
  176. WANTLIB-odbc= iodbc pthread
  177. .if !${BUILD_PACKAGES:M-odbc}
  178. CONFIGURE_ARGS+= --with-iodbc=no \
  179. --with-ltdl=no
  180. .endif
  181. # postgresql
  182. COMMENT-pgsql= PostgreSQL support for Asterisk
  183. WANTLIB-pgsql= pq pthread z
  184. LIB_DEPENDS-pgsql= databases/postgresql
  185. .if !${BUILD_PACKAGES:M-pgsql}
  186. CONFIGURE_ARGS+= --with-postgres=no
  187. .endif
  188. # snmp
  189. COMMENT-snmp= Net-SNMP support for Asterisk
  190. WANTLIB-snmp= crypto kvm m netsnmp netsnmpagent netsnmpmibs pthread
  191. LIB_DEPENDS-snmp= net/net-snmp
  192. .if !${BUILD_PACKAGES:M-snmp}
  193. CONFIGURE_ARGS+= --with-snmp=no
  194. .endif
  195. # speex
  196. COMMENT-speex= Speex codec for Asterisk
  197. WANTLIB-speex= m pthread speex speexdsp
  198. LIB_DEPENDS-speex= audio/speex>=1.2rc1
  199. .if !${BUILD_PACKAGES:M-speex}
  200. CONFIGURE_ARGS+= --with-speex=no
  201. .endif
  202. NO_TEST= Yes
  203. INSTALL_TARGET= install samples
  204. EXAMPLEDIR= ${PREFIX}/share/examples/asterisk
  205. EXAMPLEFILES= cdr.conf extensions.ael extensions.conf logger.conf \
  206. modules.conf musiconhold.conf sip.conf voicemail.conf
  207. .for i in ${MULTI_PACKAGES:N-main}
  208. # subpackages aren't flavoured, so overwrite the default name/path
  209. FULLPKGNAME$i ?= asterisk$i-${VER}
  210. FULLPKGPATH$i ?= ${PKGPATH},$i
  211. RUN_DEPENDS$i += asterisk-${VER}:telephony/asterisk
  212. .endfor
  213. .if ${PROPERTIES:Mclang}
  214. BUILD_DEPENDS+= devel/blocksruntime
  215. .endif
  216. post-patch:
  217. .if ${PROPERTIES:Mclang}
  218. sed -i.beforesubst -e 's, -ftrampolines,,' ${WRKSRC}/Makefile
  219. .endif
  220. cd ${WRKSRC}; \
  221. AUTOMAKE_VERSION=${AUTOMAKE_VERSION} \
  222. AUTOCONF_VERSION=${AUTOCONF_VERSION} \
  223. ./bootstrap.sh
  224. post-install:
  225. ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/asterisk
  226. ${INSTALL_DATA} ${WRKSRC}/{BUGS,CHANGES,COPYING,CREDITS} \
  227. ${WRKSRC}/{ChangeLog,LICENSE,README*,UPGRADE*.txt} \
  228. ${PREFIX}/share/doc/asterisk
  229. ${INSTALL_DATA} ${WRKSRC}/doc/*.{pdf,txt,odt} \
  230. ${PREFIX}/share/doc/asterisk
  231. ${INSTALL_DATA_DIR} ${EXAMPLEDIR}/openbsd
  232. .for i in ${EXAMPLEFILES}
  233. @${SUBST_CMD} -c -m 444 ${FILESDIR}/$i.sample \
  234. ${EXAMPLEDIR}/openbsd/$i.sample
  235. .endfor
  236. ${INSTALL_DATA} ${WRKSRC}/contrib/scripts/asterisk.ldif \
  237. ${WRKSRC}/contrib/scripts/asterisk.ldap-schema \
  238. ${PREFIX}/share/examples/asterisk/
  239. @mv ${WRKINST}/${SYSCONFDIR}/asterisk ${EXAMPLEDIR}/default
  240. @chown -R ${SHAREOWN}:${SHAREGRP} ${EXAMPLEDIR}
  241. @rm -rf ${WRKINST}/{etc,var/{log,run,spool}}/asterisk
  242. .include <bsd.port.mk>