Guest User

Untitled

a guest
Mar 4th, 2018
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.27 KB | None | 0 0
  1. # New ports collection makefile for: freepbx
  2. # Date created: 26 April 2007
  3. #
  4. # $FreeBSD$
  5. #
  6. # Based in primary port make of Phillip Neumann <pneumann@gmail.com>
  7. # Phillip Neumann autorized my work inside old PR.
  8.  
  9. PORTNAME= freepbx
  10. PORTVERSION= 2.3.0
  11. CATEGORIES= www net
  12. MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
  13. MASTER_SITE_SUBDIR= amportal
  14.  
  15. MAINTAINER=
  16. COMMENT= A modular web gui for Asterisk PBX
  17.  
  18. OPTIONS= APACHE "Enable Apache13 support" off\
  19. APACHE2 "Enable Apache2 support" off\
  20. APACHE22 "Enable Apache22 support" off\
  21. LIGHTTPD "Enable Lighttpd support" on\
  22. MYSQL4 "Enable MySQL4 support" off\
  23. MYSQL5 "Enable MySQL5 support" on\
  24. SQLITE3 "Enable SQLite3 support" off\
  25. PHP4 "Enable PHP4 support" off\
  26. PHP5 "Enable PHP5 support" on
  27.  
  28.  
  29. RUN_DEPENDS= asterisk:${PORTSDIR}/net/asterisk \
  30. ${LOCALBASE}/lib/asterisk/modules/format_mp3.so:${PORTSDIR}/net/asterisk-addons \
  31. ${LOCALBASE}/share/pear/DB.php:${PORTSDIR}/databases/pear-DB \
  32. ${SITE_PERL}/Asterisk.pm:${PORTSDIR}/misc/p5-Asterisk \
  33. ${SITE_PERL}/Net/Telnet.pm:${PORTSDIR}/net/p5-Net-Telnet \
  34. ${SITE_PERL}/${PERL_ARCH}/DBD/mysql.pm:${PORTSDIR}/databases/p5-DBD-mysql \
  35. ${SITE_PERL}/${PERL_ARCH}/DBI.pm:${PORTSDIR}/databases/p5-DBI \
  36. ${LOCALBASE}/share/pear/Console/Getargs.php:${PORTSDIR}/devel/pear-Console_Getargs \
  37. bash:${PORTSDIR}/shells/bash
  38.  
  39. WEBPATH?= ${PREFIX}/${WWWDIR}/data/FreePBX
  40. TARGET?= ${WEBPATH}
  41. WWWCGI?= ${PREFIX}/${WWWDIR}/cgi-bin
  42. PANEL?= ${TARGET}/panel
  43. BASE_FREEPBX?= www
  44. PLIST_SUB= BASE_FREEPBX=${BASE_FREEPBX}
  45.  
  46. DBUSER?= asteriskuser
  47. DBUSERPASS?= amp109
  48. DBHOST?= localhost
  49. ASTMGRUSER?= AsteriskUser
  50. ASTMGRPASS?= AsteriskPass
  51. HOSTNAME?= localhost
  52. #Until amportal looks more descent, prepare the files here
  53. EXEC_FILES= ${PREFIX}/bin/retrieve_conf \
  54. ${PREFIX}/bin/ampbackup.pl \
  55. ${PREFIX}/bin/fax-process.pl \
  56. ${PREFIX}/bin/retrieve_queues_conf_from_mysql.pl \
  57. ${PREFIX}/bin/retrieve_zap_conf_from_mysql.pl \
  58. ${PREFIX}/bin/retrieve_sip_conf_from_mysql.pl \
  59. ${PREFIX}/bin/retrieve_backup_cron_from_mysql.pl \
  60. ${PREFIX}/bin/retrieve_op_conf_from_mysql.pl \
  61. ${PREFIX}/bin/retrieve_iax_conf_from_mysql.pl \
  62. ${PREFIX}/bin/retrieve_parse_amportal_conf.pl \
  63. ${PREFIX}/share/asterisk/agi-bin/dialparties.agi \
  64. ${PREFIX}/share/asterisk/agi-bin/fixlocalprefix \
  65. ${PREFIX}/share/asterisk/agi-bin/phpagi.php \
  66. ${PREFIX}/share/asterisk/agi-bin/dialparties.agi.pl \
  67. ${PREFIX}/share/asterisk/agi-bin/list-item-remove.php \
  68. ${PREFIX}/share/asterisk/agi-bin/recordingcheck \
  69. ${PREFIX}/share/asterisk/agi-bin/directory \
  70. ${PREFIX}/share/asterisk/agi-bin/phpagi-asmanager.php \
  71. ${TARGET}/admin/bounce_op.sh \
  72. ${WWWCGI}/vmail.cgi
  73.  
  74. NO_BUILD= yes
  75. PKGMESSAGE= ${WRKDIR}/pkg-message
  76. SUB_FILES= pkg-message
  77. SUB_LIST+= TARGET=${TARGET} DOCS=${DOCSDIR}
  78. PLIST_SUB+= WWWDIR=${PREFIX}/WWW
  79.  
  80. DOCS= SQL/cdr_mysql_table.sql SQL/newinstall.sql docs/README.directory amportal-db-functions.sh amportal-db-remove.sh amportal-db-install.sh
  81.  
  82. .include <bsd.port.pre.mk>
  83.  
  84. .if defined(WITH_APACHE13) && defined(WITH_APACHE2)
  85. IGNORE= does not support both Apache13 and Apache2 - disable one of them
  86. APACHEDIR= www
  87. LIB_DEPENDS+= apache:${PORTSDIR}/www/apache13
  88. PLIST_SUB+= apache=""
  89. WANT_PHP_MOD= yes
  90. .else
  91. PLIST_SUB+= apache13="@comment "
  92. .endif
  93.  
  94. .if defined(WITH_APACHE2) && defined(WITH_APACHE13)
  95. IGNORE= does not support both c-ares and IPv6 - disable one of them
  96. APACHEDIR= www
  97. LIB_DEPENDS+= apache2:${PORTSDIR}/www/apache2
  98. PLIST_SUB+= apache2=""
  99. WANT_PHP_MOD= yes
  100. .else
  101. PLIST_SUB+= apache2="@comment "
  102. .endif
  103.  
  104. .if defined(WITH_APACHE22) && defined(WITH_APACHE2)
  105. IGNORE= does not support both - disable one of them
  106. APACHEDIR= www/apache22
  107. LIB_DEPENDS+= apache22:${PORTSDIR}/www/apache22
  108. PLIST_SUB+= apache22=""
  109. WANT_PHP_MOD= yes
  110. .else
  111. PLIST_SUB+= apache22="@comment "
  112. .endif
  113.  
  114. .if defined(WITH_LIGHTTPD)
  115. LIB_DEPENDS+= lighttpd:${PORTSDIR}/www/lighttpd
  116. PLIST_SUB+= LIGHTTPD=""
  117. .else
  118. PLIST_SUB+= LIGHTTPD="@comment "
  119. .endif
  120.  
  121. .if defined(WITH_MYSQL4) && defined(WITH_MYSQL5)
  122. IGNORE= does not support both MySQL4 and Mysql5 - disable one of them
  123. LIB_DEPENDS+= mysql:${PORTSDIR}/databases/mysql-server
  124. PLIST_SUB+= MYSQL=""
  125. .else
  126. PLIST_SUB+= MYSQL="@comment "
  127. .endif
  128.  
  129. .if defined(WITH_MYSQL5) && defined
  130. IGNORE= does not support both MySQL4 and MySQL5- disable one of them
  131. LIB_DEPENDS+= mysql5:${PORTSDIR}/databases/mysql50-server
  132. PLIST_SUB+= MYSQL5=""
  133. .else
  134. PLIST_SUB+= MYSQL5="@comment "
  135. .endif
  136.  
  137. .if defined(WITH_SQLITE3)
  138. LIB_DEPENDS+= sqlite3:${PORTSDIR}/databases/sqlite3
  139. PLIST_SUB+= SQLITE3=""
  140. .else
  141. PLIST_SUB+= SQLITE3="@comment "
  142. .endif
  143.  
  144. .if defined(WITH_PHP4) && defined(WITH_PHP5)
  145. IGNORE= does not support both PHP4 and PHP5 - disable one of them
  146. LIB_DEPENDS+= php:${PORTSDIR}/lang/php
  147. PLIST_SUB+= PHP="gd gettext mysql session openssl posix"
  148. .else
  149. PLIST_SUB+= PHP="@comment "
  150. .endif
  151.  
  152. .if defined(WITH_PHP5) && defined(WITH_PHP4)
  153. IGNORE= does not support both PHP4 and PHP5 - disable one of them
  154. LIB_DEPENDS+= php5:${PORTSDIR}/lang/php5
  155. PLIST_SUB+= PHP5="gd gettext mysql session openssl posix"
  156. .else
  157. PLIST_SUB+= PHP5="@comment "
  158. .endif
  159.  
  160.  
  161. post-patch:
  162. @${ECHO}
  163. @${ECHO} " NOTE: Apache22 user should define /apache22..."
  164. @${ECHO}
  165.  
  166. .if exists(/tmp/mysql.sock)
  167. @(cd ${PATCHDIR} && ${PERL} install.pl --check-mysql)
  168. .else
  169. @(cd ${PATCHDIR} && ${PERL} install.pl --check-mysql)
  170. @(${RM} -rf ${WRKDIR})
  171. exit 1
  172. .endif
  173.  
  174. .if !exists(${LOCALBASE}/etc/php.ini)
  175. @${ECHO}
  176. @${ECHO} Making a default php.ini...
  177. @${CP} ${PATCHDIR}/php${PHP_VER}.ini ${LOCALBASE}/etc/php.ini
  178. @${REINPLACE_CMD} -e 's|%%TARGET%%|${TARGET}|g' ${LOCALBASE}/etc/php.ini
  179. .endif
  180.  
  181. do-install:
  182. @${ECHO} Backing up your asterisk configuration...
  183. @(cd ${PREFIX}/etc && ${CP} -ripf asterisk asterisk.orig)
  184. @(${CP} ${PATCHDIR}/amportal*.sh ${WRKSRC})
  185. @(cd ${WRKSRC}/amp_conf && ${CHMOD} -R +x bin sbin agi-bin cgi-bin)
  186. @(${FIND} ${WRKSRC}/amp_conf -type f | ${XARGS} ${REINPLACE_CMD} -e 's|/usr/bin/php|${LOCALBASE}/bin/php|g')
  187. @(${FIND} ${WRKSRC} -type f | ${XARGS} ${REINPLACE_CMD} -e 's|/var/lib/asterisk|${LOCALBASE}/share/asterisk|g')
  188. @(${FIND} ${WRKSRC} -type f -name "*.bak" | ${XARGS} rm)
  189. @(${FIND} ${WRKSRC} -type f -name "*.orig" | ${XARGS} rm)
  190. @(cd ${PATCHDIR} && ${PERL} install.pl --create-base)
  191. @(cd ${WRKSRC} && ./install_amp --username ${DBUSER} --password ${DBUSERPASS} --dbhost ${DBHOST} --fopwebroot=${PANEL} --webroot=${TARGET} --cgibin=${WWWCGI} --bin=${PREFIX}/bin --sbin=${PREFIX}/sbin --asteriskuser=${ASTMGRUSER} --asteriskpass=${ASTMGRPASS} --systemconfig=${PREFIX}/etc)
  192. @(${FIND} ${TARGET} -type d | ${XARGS} ${CHMOD} 755)
  193. @(${FIND} ${TARGET} -type f | ${XARGS} ${CHMOD} 644)
  194. @(${MKDIR} ${PREFIX}/share/asterisk/sounds/custom)
  195. @for WRITABLE in ${PREFIX}/etc/asterisk ${TARGET}/admin/modules ${PREFIX}/share/asterisk/sounds/custom /var/spool/asterisk; do\
  196. ${CHMOD} -R 755 $$WRITABLE; \
  197. ${CHOWN} -R ${WWWOWN}:${WWWGRP} $$WRITABLE; \
  198. done;
  199.  
  200. .if !defined(NOPORTDOCS)
  201. @${MKDIR} ${DOCSDIR}
  202. @for doc in ${DOCS}; do \
  203. ${CP} ${WRKSRC}/$$doc ${DOCSDIR};\
  204. done;
  205. .endif
  206.  
  207. @for EXECUTABLE in ${EXEC_FILES}; do\
  208. ${CHMOD} +x $$EXECUTABLE; \
  209. done;
  210.  
  211. post-install:
  212. @(cd ${PATCHDIR} && ${PERL} install.pl --install-base)
  213. @${CAT} ${PKGMESSAGE}
  214.  
  215. .include <bsd.port.post.mk>
Add Comment
Please, Sign In to add comment