Guest User

Untitled

a guest
Mar 4th, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.31 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. WWWDIR?= www
  40. WEBPATH?= ${PREFIX}/${WWWDIR}/data/FreePBX
  41. TARGET?= ${WEBPATH}
  42. WWWCGI?= ${PREFIX}/${WWWDIR}/cgi-bin
  43. PANEL?= ${TARGET}/panel
  44. BASE_FREEPBX?= www
  45. PLIST_SUB= BASE_FREEPBX=${BASE_FREEPBX}
  46.  
  47. WWWOWN?= www
  48. WWWGRP?= www
  49. DBUSER?= asteriskuser
  50. DBUSERPASS?= amp109
  51. DBHOST?= localhost
  52. ASTMGRUSER?= AsteriskUser
  53. ASTMGRPASS?= AsteriskPass
  54. HOSTNAME?= localhost
  55. #Until amportal looks more descent, prepare the files here
  56. EXEC_FILES= ${PREFIX}/bin/retrieve_conf \
  57. ${PREFIX}/bin/ampbackup.pl \
  58. ${PREFIX}/bin/fax-process.pl \
  59. ${PREFIX}/bin/retrieve_queues_conf_from_mysql.pl \
  60. ${PREFIX}/bin/retrieve_zap_conf_from_mysql.pl \
  61. ${PREFIX}/bin/retrieve_sip_conf_from_mysql.pl \
  62. ${PREFIX}/bin/retrieve_backup_cron_from_mysql.pl \
  63. ${PREFIX}/bin/retrieve_op_conf_from_mysql.pl \
  64. ${PREFIX}/bin/retrieve_iax_conf_from_mysql.pl \
  65. ${PREFIX}/bin/retrieve_parse_amportal_conf.pl \
  66. ${PREFIX}/share/asterisk/agi-bin/dialparties.agi \
  67. ${PREFIX}/share/asterisk/agi-bin/fixlocalprefix \
  68. ${PREFIX}/share/asterisk/agi-bin/phpagi.php \
  69. ${PREFIX}/share/asterisk/agi-bin/dialparties.agi.pl \
  70. ${PREFIX}/share/asterisk/agi-bin/list-item-remove.php \
  71. ${PREFIX}/share/asterisk/agi-bin/recordingcheck \
  72. ${PREFIX}/share/asterisk/agi-bin/directory \
  73. ${PREFIX}/share/asterisk/agi-bin/phpagi-asmanager.php \
  74. ${TARGET}/admin/bounce_op.sh \
  75. ${WWWCGI}/vmail.cgi
  76.  
  77. NO_BUILD= yes
  78. PKGMESSAGE= ${WRKDIR}/pkg-message
  79. SUB_FILES= pkg-message
  80. SUB_LIST+= TARGET=${TARGET} DOCS=${DOCSDIR}
  81. PLIST_SUB+= WWWDIR=${PREFIX}/WWW
  82.  
  83. DOCS= SQL/cdr_mysql_table.sql SQL/newinstall.sql docs/README.directory amportal-db-functions.sh amportal-db-remove.sh amportal-db-install.sh
  84.  
  85. .include <bsd.port.pre.mk>
  86.  
  87. .if defined(WITH_APACHE13) && defined(WITH_APACHE2)
  88. IGNORE= does not support both Apache13 and Apache2 - disable one of them
  89. APACHEDIR= www
  90. LIB_DEPENDS+= apache:${PORTSDIR}/www/apache13
  91. PLIST_SUB+= apache=""
  92. WANT_PHP_MOD= yes
  93. .else
  94. PLIST_SUB+= apache13="@comment "
  95. .endif
  96.  
  97. .if defined(WITH_APACHE2) && defined(WITH_APACHE13)
  98. IGNORE= does not support both c-ares and IPv6 - disable one of them
  99. APACHEDIR= www
  100. LIB_DEPENDS+= apache2:${PORTSDIR}/www/apache2
  101. PLIST_SUB+= apache2=""
  102. WANT_PHP_MOD= yes
  103. .else
  104. PLIST_SUB+= apache2="@comment "
  105. .endif
  106.  
  107. .if defined(WITH_APACHE22) && defined(WITH_APACHE2)
  108. IGNORE= does not support both - disable one of them
  109. APACHEDIR= www/apache22
  110. LIB_DEPENDS+= apache22:${PORTSDIR}/www/apache22
  111. PLIST_SUB+= apache22=""
  112. WANT_PHP_MOD= yes
  113. .else
  114. PLIST_SUB+= apache22="@comment "
  115. .endif
  116.  
  117. .if defined(WITH_LIGHTTPD)
  118. LIB_DEPENDS+= lighttpd:${PORTSDIR}/www/lighttpd
  119. PLIST_SUB+= LIGHTTPD=""
  120. .else
  121. PLIST_SUB+= LIGHTTPD="@comment "
  122. .endif
  123.  
  124. .if defined(WITH_MYSQL4) && defined(WITH_MYSQL5)
  125. IGNORE= does not support both MySQL4 and Mysql5 - disable one of them
  126. LIB_DEPENDS+= mysql:${PORTSDIR}/databases/mysql-server
  127. PLIST_SUB+= MYSQL=""
  128. .else
  129. PLIST_SUB+= MYSQL="@comment "
  130. .endif
  131.  
  132. .if defined(WITH_MYSQL5) && defined
  133. IGNORE= does not support both MySQL4 and MySQL5- disable one of them
  134. LIB_DEPENDS+= mysql5:${PORTSDIR}/databases/mysql50-server
  135. PLIST_SUB+= MYSQL5=""
  136. .else
  137. PLIST_SUB+= MYSQL5="@comment "
  138. .endif
  139.  
  140. .if defined(WITH_SQLITE3)
  141. LIB_DEPENDS+= sqlite3:${PORTSDIR}/databases/sqlite3
  142. PLIST_SUB+= SQLITE3=""
  143. .else
  144. PLIST_SUB+= SQLITE3="@comment "
  145. .endif
  146.  
  147. .if defined(WITH_PHP4) && defined(WITH_PHP5)
  148. IGNORE= does not support both PHP4 and PHP5 - disable one of them
  149. LIB_DEPENDS+= php:${PORTSDIR}/lang/php
  150. PLIST_SUB+= PHP="gd gettext mysql session openssl posix"
  151. .else
  152. PLIST_SUB+= PHP="@comment "
  153. .endif
  154.  
  155. .if defined(WITH_PHP5) && defined(WITH_PHP4)
  156. IGNORE= does not support both PHP4 and PHP5 - disable one of them
  157. LIB_DEPENDS+= php5:${PORTSDIR}/lang/php5
  158. PLIST_SUB+= PHP5="gd gettext mysql session openssl posix"
  159. .else
  160. PLIST_SUB+= PHP5="@comment "
  161. .endif
  162.  
  163.  
  164. post-patch:
  165. @${ECHO}
  166. @${ECHO} " NOTE: Apache22 user should define /apache22..."
  167. @${ECHO}
  168.  
  169. .if exists(/tmp/mysql.sock)
  170. @(cd ${PATCHDIR} && ${PERL} install.pl --check-mysql)
  171. .else
  172. @(cd ${PATCHDIR} && ${PERL} install.pl --check-mysql)
  173. @(${RM} -rf ${WRKDIR})
  174. exit 1
  175. .endif
  176.  
  177. .if !exists(${LOCALBASE}/etc/php.ini)
  178. @${ECHO}
  179. @${ECHO} Making a default php.ini...
  180. @${CP} ${PATCHDIR}/php${PHP_VER}.ini ${LOCALBASE}/etc/php.ini
  181. @${REINPLACE_CMD} -e 's|%%TARGET%%|${TARGET}|g' ${LOCALBASE}/etc/php.ini
  182. .endif
  183.  
  184. do-install:
  185. @${ECHO} Backing up your asterisk configuration...
  186. @(cd ${PREFIX}/etc && ${CP} -ripf asterisk asterisk.orig)
  187. @(${CP} ${PATCHDIR}/amportal*.sh ${WRKSRC})
  188. @(cd ${WRKSRC}/amp_conf && ${CHMOD} -R +x bin sbin agi-bin cgi-bin)
  189. @(${FIND} ${WRKSRC}/amp_conf -type f | ${XARGS} ${REINPLACE_CMD} -e 's|/usr/bin/php|${LOCALBASE}/bin/php|g')
  190. @(${FIND} ${WRKSRC} -type f | ${XARGS} ${REINPLACE_CMD} -e 's|/var/lib/asterisk|${LOCALBASE}/share/asterisk|g')
  191. @(${FIND} ${WRKSRC} -type f -name "*.bak" | ${XARGS} rm)
  192. @(${FIND} ${WRKSRC} -type f -name "*.orig" | ${XARGS} rm)
  193. @(cd ${PATCHDIR} && ${PERL} install.pl --create-base)
  194. @(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)
  195. @(${FIND} ${TARGET} -type d | ${XARGS} ${CHMOD} 755)
  196. @(${FIND} ${TARGET} -type f | ${XARGS} ${CHMOD} 644)
  197. @(${MKDIR} ${PREFIX}/share/asterisk/sounds/custom)
  198. @for WRITABLE in ${PREFIX}/etc/asterisk ${TARGET}/admin/modules ${PREFIX}/share/asterisk/sounds/custom /var/spool/asterisk; do\
  199. ${CHMOD} -R 755 $$WRITABLE; \
  200. ${CHOWN} -R ${WWWOWN}:${WWWGRP} $$WRITABLE; \
  201. done;
  202.  
  203. .if !defined(NOPORTDOCS)
  204. @${MKDIR} ${DOCSDIR}
  205. @for doc in ${DOCS}; do \
  206. ${CP} ${WRKSRC}/$$doc ${DOCSDIR};\
  207. done;
  208. .endif
  209.  
  210. @for EXECUTABLE in ${EXEC_FILES}; do\
  211. ${CHMOD} +x $$EXECUTABLE; \
  212. done;
  213.  
  214. post-install:
  215. @(cd ${PATCHDIR} && ${PERL} install.pl --install-base)
  216. @${CAT} ${PKGMESSAGE}
  217.  
  218. .include <bsd.port.post.mk>
Add Comment
Please, Sign In to add comment