Guest User

Untitled

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