2
0

bootstrap.sh 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345
  1. #!/bin/bash
  2. ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
  3. ##### Author: Travis Cross <tc@traviscross.com>
  4. mod_dir="../src/mod"
  5. conf_dir="../conf"
  6. lang_dir="../conf/vanilla/lang"
  7. fs_description="FreeSWITCH is a scalable open source cross-platform telephony platform designed to route and interconnect popular communication protocols using audio, video, text or any other form of media."
  8. mod_build_depends="." mod_depends="." mod_recommends="." mod_suggests="."
  9. supported_debian_distros="squeeze wheezy jessie sid"
  10. supported_ubuntu_distros="trusty utopic"
  11. supported_distros="$supported_debian_distros $supported_ubuntu_distros"
  12. avoid_mods=(
  13. applications/mod_limit
  14. applications/mod_mongo
  15. applications/mod_mp4
  16. applications/mod_osp
  17. applications/mod_rad_auth
  18. applications/mod_skel
  19. applications/mod_cluechoo
  20. asr_tts/mod_cepstral
  21. codecs/mod_com_g729
  22. codecs/mod_ilbc
  23. codecs/mod_sangoma_codec
  24. codecs/mod_siren
  25. codecs/mod_skel_codec
  26. endpoints/mod_gsmopen
  27. endpoints/mod_h323
  28. endpoints/mod_khomp
  29. endpoints/mod_opal
  30. endpoints/mod_reference
  31. endpoints/mod_unicall
  32. languages/mod_managed
  33. sdk/autotools
  34. xml_int/mod_xml_ldap
  35. xml_int/mod_xml_radius
  36. )
  37. avoid_mods_sid=(
  38. directories/mod_ldap
  39. formats/mod_shout
  40. languages/mod_java
  41. )
  42. avoid_mods_jessie=(
  43. directories/mod_ldap
  44. languages/mod_java
  45. formats/mod_shout
  46. )
  47. avoid_mods_wheezy=(
  48. event_handlers/mod_amqp
  49. languages/mod_java
  50. )
  51. avoid_mods_squeeze=(
  52. event_handlers/mod_amqp
  53. formats/mod_vlc
  54. languages/mod_managed
  55. )
  56. avoid_mods_trusty=(
  57. )
  58. avoid_mods_utopic=(
  59. directories/mod_ldap
  60. )
  61. manual_pkgs=(
  62. freeswitch-all
  63. freeswitch
  64. libfreeswitch1
  65. freeswitch-meta-bare
  66. freeswitch-meta-default
  67. freeswitch-meta-vanilla
  68. freeswitch-meta-sorbet
  69. freeswitch-meta-all
  70. freeswitch-meta-codecs
  71. freeswitch-meta-conf
  72. freeswitch-meta-lang
  73. freeswitch-meta-mod-say
  74. freeswitch-all-dbg
  75. freeswitch-dbg
  76. libfreeswitch1-dbg
  77. libfreeswitch-dev
  78. freeswitch-doc
  79. freeswitch-init
  80. freeswitch-sysvinit
  81. freeswitch-systemd
  82. freeswitch-lang
  83. freeswitch-timezones
  84. )
  85. err () {
  86. echo "$0 error: $1" >&2
  87. exit 1
  88. }
  89. xread () {
  90. local xIFS="$IFS"
  91. IFS=''
  92. read $@
  93. local ret=$?
  94. IFS="$xIFS"
  95. return $ret
  96. }
  97. intersperse () {
  98. local sep="$1"
  99. awk "
  100. BEGIN {
  101. first=1;
  102. sep=\"${sep}\";
  103. }"'
  104. /.*/ {
  105. if (first == 0) {
  106. printf "%s%s", sep, $0;
  107. } else {
  108. printf "%s", $0;
  109. }
  110. first=0;
  111. }
  112. END { printf "\n"; }'
  113. }
  114. postfix () {
  115. local px="$1"
  116. awk "
  117. BEGIN { px=\"${px}\"; }"'
  118. /.*/ { printf "%s%s\n", $0, px; }'
  119. }
  120. avoid_mod_filter () {
  121. local x="avoid_mods_$codename[@]"
  122. local -a mods=("${avoid_mods[@]}" "${!x}")
  123. for x in "${mods[@]}"; do
  124. if [ "$1" = "$x" ]; then
  125. [ "$2" = "show" ] && echo "excluding module $x" >&2
  126. return 1
  127. fi
  128. done
  129. return 0
  130. }
  131. modconf_filter () {
  132. while xread l; do
  133. if [ "$1" = "$l" ]; then
  134. [ "$2" = "show" ] && echo "including module $l" >&2
  135. return 0
  136. fi
  137. done < modules.conf
  138. return 1
  139. }
  140. mod_filter () {
  141. if test -f modules.conf; then
  142. modconf_filter $@
  143. else
  144. avoid_mod_filter $@
  145. fi
  146. }
  147. mod_filter_show () {
  148. mod_filter "$1" show
  149. }
  150. map_fs_modules () {
  151. local filterfn="$1" percatfns="$2" permodfns="$3"
  152. for x in $mod_dir/*; do
  153. test -d $x || continue
  154. test ! ${x##*/} = legacy || continue
  155. category=${x##*/} category_path=$x
  156. for f in $percatfns; do $f; done
  157. for y in $x/*; do
  158. module_name=${y##*/} module_path=$y
  159. module=$category/$module_name
  160. if $filterfn $category/$module; then
  161. [ -f ${y}/module ] && . ${y}/module
  162. for f in $permodfns; do $f; done
  163. fi
  164. unset module_name module_path module
  165. done
  166. unset category category_path
  167. done
  168. }
  169. map_modules () {
  170. local filterfn="$1" percatfns="$2" permodfns="$3"
  171. for x in $parse_dir/*; do
  172. test -d $x || continue
  173. category=${x##*/} category_path=$x
  174. for f in $percatfns; do $f; done
  175. for y in $x/*; do
  176. test -f $y || continue
  177. module=${y##*/} module_path=$y
  178. $filterfn $category/$module || continue
  179. module="" category="" module_name=""
  180. section="" description="" long_description=""
  181. build_depends="" depends="" recommends="" suggests=""
  182. distro_conflicts=""
  183. distro_vars=""
  184. for x in $supported_distros; do
  185. distro_vars="$distro_vars build_depends_$x"
  186. eval build_depends_$x=""
  187. done
  188. . $y
  189. [ -n "$description" ] || description="$module_name"
  190. [ -n "$long_description" ] || description="Adds ${module_name}."
  191. for f in $permodfns; do $f; done
  192. unset \
  193. module module_name module_path \
  194. section description long_description \
  195. build_depends depends recommends suggests \
  196. distro_conflicts $distro_vars
  197. done
  198. unset category category_path
  199. done
  200. }
  201. map_confs () {
  202. local fs="$1"
  203. for x in $conf_dir/*; do
  204. test ! -d $x && continue
  205. conf=${x##*/} conf_dir=$x
  206. for f in $fs; do $f; done
  207. unset conf conf_dir
  208. done
  209. }
  210. map_langs () {
  211. local fs="$1"
  212. for x in $lang_dir/*; do
  213. test ! -d $x && continue
  214. lang=${x##*/} lang_dir=$x
  215. for f in $fs; do $f; done
  216. unset lang lang_dir
  217. done
  218. }
  219. map_pkgs () {
  220. local fsx="$1"
  221. for x in "${manual_pkgs[@]}"; do
  222. $fsx $x
  223. done
  224. map_pkgs_confs () { $fsx "freeswitch-conf-${conf//_/-}"; }
  225. map_confs map_pkgs_confs
  226. map_pkgs_langs () { $fsx "freeswitch-lang-${lang//_/-}"; }
  227. map_langs map_pkgs_langs
  228. map_pkgs_mods () {
  229. $fsx "freeswitch-${module//_/-}"
  230. $fsx "freeswitch-${module//_/-}-dbg"; }
  231. map_modules map_pkgs_mods
  232. }
  233. list_pkgs () {
  234. list_pkgs_thunk () { printf '%s\n' "$1"; }
  235. map_pkgs list_pkgs_thunk
  236. }
  237. list_freeswitch_all_pkgs () {
  238. list_pkgs \
  239. | grep -v '^freeswitch-all$' \
  240. | grep -v -- '-dbg$'
  241. }
  242. list_freeswitch_all_provides () {
  243. list_freeswitch_all_pkgs \
  244. | intersperse ',\n '
  245. }
  246. list_freeswitch_all_replaces () {
  247. list_freeswitch_all_pkgs \
  248. | postfix ' (<= ${binary:Version})' \
  249. | intersperse ',\n '
  250. }
  251. list_freeswitch_all_dbg_pkgs () {
  252. list_pkgs \
  253. | grep -v '^freeswitch-all-dbg$' \
  254. | grep -- '-dbg$'
  255. }
  256. list_freeswitch_all_dbg_provides () {
  257. list_freeswitch_all_dbg_pkgs \
  258. | intersperse ',\n '
  259. }
  260. list_freeswitch_all_dbg_replaces () {
  261. list_freeswitch_all_dbg_pkgs \
  262. | postfix ' (<= ${binary:Version})' \
  263. | intersperse ',\n '
  264. }
  265. print_source_control () {
  266. local libtool_dep="libtool, libtool-bin"
  267. case "$codename" in
  268. squeeze|wheezy|trusty) libtool_dep="libtool" ;;
  269. esac
  270. cat <<EOF
  271. Source: freeswitch
  272. Section: comm
  273. Priority: optional
  274. Maintainer: Travis Cross <tc@traviscross.com>
  275. Build-Depends:
  276. # for debian
  277. debhelper (>= 8.0.0),
  278. # bootstrapping
  279. automake (>= 1.9), autoconf, ${libtool_dep},
  280. # core build
  281. dpkg-dev (>= 1.15.8.12), gcc (>= 4:4.4.5), g++ (>= 4:4.4.5),
  282. libc6-dev (>= 2.11.3), make (>= 3.81),
  283. libpcre3-dev,
  284. libedit-dev (>= 2.11),
  285. libsqlite3-dev,
  286. wget, pkg-config,
  287. # core codecs
  288. libogg-dev, libspeex-dev, libspeexdsp-dev,
  289. # configure options
  290. libssl-dev, unixodbc-dev, libpq-dev,
  291. libncurses5-dev, libjpeg62-turbo-dev | libjpeg62-dev | libjpeg8-dev,
  292. python-dev, erlang-dev,
  293. # documentation
  294. doxygen,
  295. # for APR (not essential for build)
  296. uuid-dev, libexpat1-dev, libgdbm-dev, libdb-dev,
  297. # used by many modules
  298. libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl-dev,
  299. bison, zlib1g-dev,
  300. # module build-depends
  301. $(debian_wrap "${mod_build_depends}")
  302. Standards-Version: 3.9.3
  303. Homepage: https://freeswitch.org/
  304. Vcs-Git: https://freeswitch.org/stash/scm/fs/freeswitch.git
  305. Vcs-Browser: https://freeswitch.org/stash/projects/FS/repos/freeswitch/browse
  306. EOF
  307. }
  308. print_core_control () {
  309. cat <<EOF
  310. Package: freeswitch-all
  311. Architecture: any
  312. Provides: $(list_freeswitch_all_provides)
  313. Replaces: $(list_freeswitch_all_replaces)
  314. Conflicts: $(list_freeswitch_all_replaces)
  315. Depends: \${shlibs:Depends}, \${perl:Depends}, \${misc:Depends},
  316. freeswitch-music-default (>= 1.0.8),
  317. freeswitch-sounds-en-us-callie (>= 1.0.25) | freeswitch-sounds,
  318. $(debian_wrap "${mod_depends}")
  319. Recommends:
  320. $(debian_wrap "${mod_recommends}")
  321. Suggests: freeswitch-all-dbg,
  322. $(debian_wrap "${mod_suggests}")
  323. Description: Cross-Platform Scalable Multi-Protocol Soft Switch
  324. $(debian_wrap "${fs_description}")
  325. .
  326. This package contains FreeSWITCH and all modules and extras.
  327. Package: freeswitch
  328. Architecture: any
  329. Depends: \${shlibs:Depends}, \${perl:Depends}, \${misc:Depends},
  330. libfreeswitch1 (= \${binary:Version})
  331. Recommends:
  332. Suggests: freeswitch-dbg
  333. Description: Cross-Platform Scalable Multi-Protocol Soft Switch
  334. $(debian_wrap "${fs_description}")
  335. .
  336. This package contains the FreeSWITCH core.
  337. Package: libfreeswitch1
  338. Architecture: any
  339. Depends: \${shlibs:Depends}, \${misc:Depends}
  340. Recommends:
  341. Suggests: libfreeswitch1-dbg
  342. Description: Cross-Platform Scalable Multi-Protocol Soft Switch
  343. $(debian_wrap "${fs_description}")
  344. .
  345. This package contains the FreeSWITCH core library.
  346. Package: freeswitch-meta-bare
  347. Architecture: any
  348. Depends: \${misc:Depends}, freeswitch (= \${binary:Version})
  349. Recommends:
  350. freeswitch-doc (= \${binary:Version}),
  351. freeswitch-mod-commands (= \${binary:Version}),
  352. freeswitch-init (= \${binary:Version}),
  353. freeswitch-lang (= \${binary:Version}),
  354. freeswitch-timezones (= \${binary:Version}),
  355. freeswitch-music,
  356. freeswitch-sounds
  357. Suggests:
  358. Description: Cross-Platform Scalable Multi-Protocol Soft Switch
  359. $(debian_wrap "${fs_description}")
  360. .
  361. This is a metapackage which depends on the packages needed for a very
  362. bare FreeSWITCH install.
  363. Package: freeswitch-meta-default
  364. Architecture: any
  365. Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
  366. freeswitch-mod-commands (= \${binary:Version}),
  367. freeswitch-mod-conference (= \${binary:Version}),
  368. freeswitch-mod-db (= \${binary:Version}),
  369. freeswitch-mod-dptools (= \${binary:Version}),
  370. freeswitch-mod-fifo (= \${binary:Version}),
  371. freeswitch-mod-hash (= \${binary:Version}),
  372. freeswitch-mod-spandsp (= \${binary:Version}),
  373. freeswitch-mod-voicemail (= \${binary:Version}),
  374. freeswitch-mod-dialplan-xml (= \${binary:Version}),
  375. freeswitch-mod-loopback (= \${binary:Version}),
  376. freeswitch-mod-sofia (= \${binary:Version}),
  377. freeswitch-mod-local-stream (= \${binary:Version}),
  378. freeswitch-mod-native-file (= \${binary:Version}),
  379. freeswitch-mod-sndfile (= \${binary:Version}),
  380. freeswitch-mod-tone-stream (= \${binary:Version}),
  381. freeswitch-mod-lua (= \${binary:Version}),
  382. freeswitch-mod-console (= \${binary:Version}),
  383. freeswitch-mod-say-en (= \${binary:Version})
  384. Recommends:
  385. freeswitch-init (= \${binary:Version}),
  386. freeswitch-lang (= \${binary:Version}),
  387. freeswitch-timezones (= \${binary:Version}),
  388. freeswitch-meta-codecs (= \${binary:Version}),
  389. freeswitch-music,
  390. freeswitch-sounds
  391. Suggests:
  392. freeswitch-mod-cidlookup (= \${binary:Version}),
  393. freeswitch-mod-curl (= \${binary:Version}),
  394. freeswitch-mod-directory (= \${binary:Version}),
  395. freeswitch-mod-enum (= \${binary:Version}),
  396. freeswitch-mod-spy (= \${binary:Version}),
  397. freeswitch-mod-valet-parking (= \${binary:Version})
  398. Description: Cross-Platform Scalable Multi-Protocol Soft Switch
  399. $(debian_wrap "${fs_description}")
  400. .
  401. This is a metapackage which depends on the packages needed for a
  402. reasonably basic FreeSWITCH install.
  403. Package: freeswitch-meta-vanilla
  404. Architecture: any
  405. Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
  406. freeswitch-mod-console (= \${binary:Version}),
  407. freeswitch-mod-logfile (= \${binary:Version}),
  408. freeswitch-mod-enum (= \${binary:Version}),
  409. freeswitch-mod-cdr-csv (= \${binary:Version}),
  410. freeswitch-mod-event-socket (= \${binary:Version}),
  411. freeswitch-mod-sofia (= \${binary:Version}),
  412. freeswitch-mod-loopback (= \${binary:Version}),
  413. freeswitch-mod-commands (= \${binary:Version}),
  414. freeswitch-mod-conference (= \${binary:Version}),
  415. freeswitch-mod-db (= \${binary:Version}),
  416. freeswitch-mod-dptools (= \${binary:Version}),
  417. freeswitch-mod-expr (= \${binary:Version}),
  418. freeswitch-mod-fifo (= \${binary:Version}),
  419. freeswitch-mod-hash (= \${binary:Version}),
  420. freeswitch-mod-voicemail (= \${binary:Version}),
  421. freeswitch-mod-esf (= \${binary:Version}),
  422. freeswitch-mod-fsv (= \${binary:Version}),
  423. freeswitch-mod-valet-parking (= \${binary:Version}),
  424. freeswitch-mod-httapi (= \${binary:Version}),
  425. freeswitch-mod-dialplan-xml (= \${binary:Version}),
  426. freeswitch-mod-dialplan-asterisk (= \${binary:Version}),
  427. freeswitch-mod-spandsp (= \${binary:Version}),
  428. freeswitch-mod-g723-1 (= \${binary:Version}),
  429. freeswitch-mod-g729 (= \${binary:Version}),
  430. freeswitch-mod-amr (= \${binary:Version}),
  431. freeswitch-mod-h26x (= \${binary:Version}),
  432. freeswitch-mod-sndfile (= \${binary:Version}),
  433. freeswitch-mod-native-file (= \${binary:Version}),
  434. freeswitch-mod-local-stream (= \${binary:Version}),
  435. freeswitch-mod-tone-stream (= \${binary:Version}),
  436. freeswitch-mod-lua (= \${binary:Version}),
  437. freeswitch-mod-say-en (= \${binary:Version}),
  438. Recommends:
  439. freeswitch-init (= \${binary:Version}),
  440. freeswitch-lang (= \${binary:Version}),
  441. freeswitch-timezones (= \${binary:Version}),
  442. freeswitch-music,
  443. freeswitch-sounds,
  444. freeswitch-conf-vanilla (= \${binary:Version}),
  445. Description: Cross-Platform Scalable Multi-Protocol Soft Switch
  446. $(debian_wrap "${fs_description}")
  447. .
  448. This is a metapackage which depends on the packages needed for
  449. running the FreeSWITCH vanilla example configuration.
  450. Package: freeswitch-meta-sorbet
  451. Architecture: any
  452. Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
  453. Recommends:
  454. freeswitch-init (= \${binary:Version}),
  455. freeswitch-lang (= \${binary:Version}),
  456. freeswitch-timezones (= \${binary:Version}),
  457. freeswitch-meta-codecs (= \${binary:Version}),
  458. freeswitch-music,
  459. freeswitch-sounds,
  460. freeswitch-mod-abstraction (= \${binary:Version}),
  461. freeswitch-mod-avmd (= \${binary:Version}),
  462. freeswitch-mod-blacklist (= \${binary:Version}),
  463. freeswitch-mod-callcenter (= \${binary:Version}),
  464. freeswitch-mod-cidlookup (= \${binary:Version}),
  465. freeswitch-mod-commands (= \${binary:Version}),
  466. freeswitch-mod-conference (= \${binary:Version}),
  467. freeswitch-mod-curl (= \${binary:Version}),
  468. freeswitch-mod-db (= \${binary:Version}),
  469. freeswitch-mod-directory (= \${binary:Version}),
  470. freeswitch-mod-distributor (= \${binary:Version}),
  471. freeswitch-mod-dptools (= \${binary:Version}),
  472. freeswitch-mod-easyroute (= \${binary:Version}),
  473. freeswitch-mod-enum (= \${binary:Version}),
  474. freeswitch-mod-esf (= \${binary:Version}),
  475. freeswitch-mod-esl (= \${binary:Version}),
  476. freeswitch-mod-expr (= \${binary:Version}),
  477. freeswitch-mod-fifo (= \${binary:Version}),
  478. freeswitch-mod-fsk (= \${binary:Version}),
  479. freeswitch-mod-fsv (= \${binary:Version}),
  480. freeswitch-mod-hash (= \${binary:Version}),
  481. freeswitch-mod-httapi (= \${binary:Version}),
  482. freeswitch-mod-http-cache (= \${binary:Version}),
  483. freeswitch-mod-lcr (= \${binary:Version}),
  484. freeswitch-mod-nibblebill (= \${binary:Version}),
  485. freeswitch-mod-oreka (= \${binary:Version}),
  486. freeswitch-mod-random (= \${binary:Version}),
  487. freeswitch-mod-redis (= \${binary:Version}),
  488. freeswitch-mod-rss (= \${binary:Version}),
  489. freeswitch-mod-sms (= \${binary:Version}),
  490. freeswitch-mod-snapshot (= \${binary:Version}),
  491. freeswitch-mod-snom (= \${binary:Version}),
  492. freeswitch-mod-sonar (= \${binary:Version}),
  493. freeswitch-mod-soundtouch (= \${binary:Version}),
  494. freeswitch-mod-spandsp (= \${binary:Version}),
  495. freeswitch-mod-spy (= \${binary:Version}),
  496. freeswitch-mod-stress (= \${binary:Version}),
  497. freeswitch-mod-valet-parking (= \${binary:Version}),
  498. freeswitch-mod-vmd (= \${binary:Version}),
  499. freeswitch-mod-voicemail (= \${binary:Version}),
  500. freeswitch-mod-voicemail-ivr (= \${binary:Version}),
  501. freeswitch-mod-flite (= \${binary:Version}),
  502. freeswitch-mod-pocketsphinx (= \${binary:Version}),
  503. freeswitch-mod-tts-commandline (= \${binary:Version}),
  504. freeswitch-mod-dialplan-xml (= \${binary:Version}),
  505. freeswitch-mod-html5 (= \${binary:Version}),
  506. freeswitch-mod-loopback (= \${binary:Version}),
  507. freeswitch-mod-rtmp (= \${binary:Version}),
  508. freeswitch-mod-skinny (= \${binary:Version}),
  509. freeswitch-mod-sofia (= \${binary:Version}),
  510. freeswitch-mod-cdr-csv (= \${binary:Version}),
  511. freeswitch-mod-cdr-sqlite (= \${binary:Version}),
  512. freeswitch-mod-event-socket (= \${binary:Version}),
  513. freeswitch-mod-json-cdr (= \${binary:Version}),
  514. freeswitch-mod-local-stream (= \${binary:Version}),
  515. freeswitch-mod-native-file (= \${binary:Version}),
  516. freeswitch-mod-shell-stream (= \${binary:Version}),
  517. freeswitch-mod-sndfile (= \${binary:Version}),
  518. freeswitch-mod-tone-stream (= \${binary:Version}),
  519. freeswitch-mod-lua (= \${binary:Version}),
  520. freeswitch-mod-console (= \${binary:Version}),
  521. freeswitch-mod-logfile (= \${binary:Version}),
  522. freeswitch-mod-syslog (= \${binary:Version}),
  523. freeswitch-mod-say-en (= \${binary:Version}),
  524. freeswitch-mod-posix-timer (= \${binary:Version}),
  525. freeswitch-mod-timerfd (= \${binary:Version}),
  526. freeswitch-mod-xml-cdr (= \${binary:Version}),
  527. freeswitch-mod-xml-curl (= \${binary:Version}),
  528. Description: Cross-Platform Scalable Multi-Protocol Soft Switch
  529. $(debian_wrap "${fs_description}")
  530. .
  531. This is a metapackage which recommends most packaged FreeSWITCH
  532. modules except a few which aren't recommended.
  533. Package: freeswitch-meta-all
  534. Architecture: any
  535. Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
  536. Recommends:
  537. freeswitch-init (= \${binary:Version}),
  538. freeswitch-lang (= \${binary:Version}),
  539. freeswitch-timezones (= \${binary:Version}),
  540. freeswitch-meta-codecs (= \${binary:Version}),
  541. freeswitch-meta-conf (= \${binary:Version}),
  542. freeswitch-meta-lang (= \${binary:Version}),
  543. freeswitch-meta-mod-say (= \${binary:Version}),
  544. freeswitch-music,
  545. freeswitch-sounds,
  546. freeswitch-mod-abstraction (= \${binary:Version}),
  547. freeswitch-mod-avmd (= \${binary:Version}),
  548. freeswitch-mod-blacklist (= \${binary:Version}),
  549. freeswitch-mod-callcenter (= \${binary:Version}),
  550. freeswitch-mod-cidlookup (= \${binary:Version}),
  551. freeswitch-mod-commands (= \${binary:Version}),
  552. freeswitch-mod-conference (= \${binary:Version}),
  553. freeswitch-mod-curl (= \${binary:Version}),
  554. freeswitch-mod-db (= \${binary:Version}),
  555. freeswitch-mod-directory (= \${binary:Version}),
  556. freeswitch-mod-distributor (= \${binary:Version}),
  557. freeswitch-mod-dptools (= \${binary:Version}),
  558. freeswitch-mod-easyroute (= \${binary:Version}),
  559. freeswitch-mod-enum (= \${binary:Version}),
  560. freeswitch-mod-esf (= \${binary:Version}),
  561. freeswitch-mod-esl (= \${binary:Version}),
  562. freeswitch-mod-expr (= \${binary:Version}),
  563. freeswitch-mod-fifo (= \${binary:Version}),
  564. freeswitch-mod-fsk (= \${binary:Version}),
  565. freeswitch-mod-fsv (= \${binary:Version}),
  566. freeswitch-mod-hash (= \${binary:Version}),
  567. freeswitch-mod-httapi (= \${binary:Version}),
  568. freeswitch-mod-http-cache (= \${binary:Version}),
  569. freeswitch-mod-ladspa (= \${binary:Version}),
  570. freeswitch-mod-lcr (= \${binary:Version}),
  571. freeswitch-mod-memcache (= \${binary:Version}),
  572. freeswitch-mod-nibblebill (= \${binary:Version}),
  573. freeswitch-mod-oreka (= \${binary:Version}),
  574. freeswitch-mod-random (= \${binary:Version}),
  575. freeswitch-mod-redis (= \${binary:Version}),
  576. freeswitch-mod-rss (= \${binary:Version}),
  577. freeswitch-mod-sms (= \${binary:Version}),
  578. freeswitch-mod-snapshot (= \${binary:Version}),
  579. freeswitch-mod-snipe-hunt (= \${binary:Version}),
  580. freeswitch-mod-snom (= \${binary:Version}),
  581. freeswitch-mod-sonar (= \${binary:Version}),
  582. freeswitch-mod-soundtouch (= \${binary:Version}),
  583. freeswitch-mod-spandsp (= \${binary:Version}),
  584. freeswitch-mod-spy (= \${binary:Version}),
  585. freeswitch-mod-stress (= \${binary:Version}),
  586. freeswitch-mod-translate (= \${binary:Version}),
  587. freeswitch-mod-valet-parking (= \${binary:Version}),
  588. freeswitch-mod-vmd (= \${binary:Version}),
  589. freeswitch-mod-voicemail (= \${binary:Version}),
  590. freeswitch-mod-voicemail-ivr (= \${binary:Version}),
  591. freeswitch-mod-flite (= \${binary:Version}),
  592. freeswitch-mod-pocketsphinx (= \${binary:Version}),
  593. freeswitch-mod-tts-commandline (= \${binary:Version}),
  594. freeswitch-mod-unimrcp (= \${binary:Version}),
  595. freeswitch-mod-dialplan-asterisk (= \${binary:Version}),
  596. freeswitch-mod-dialplan-directory (= \${binary:Version}),
  597. freeswitch-mod-dialplan-xml (= \${binary:Version}),
  598. freeswitch-mod-ldap (= \${binary:Version}),
  599. freeswitch-mod-alsa (= \${binary:Version}),
  600. freeswitch-mod-dingaling (= \${binary:Version}),
  601. freeswitch-mod-html5 (= \${binary:Version}),
  602. freeswitch-mod-loopback (= \${binary:Version}),
  603. freeswitch-mod-portaudio (= \${binary:Version}),
  604. freeswitch-mod-rtmp (= \${binary:Version}),
  605. freeswitch-mod-skinny (= \${binary:Version}),
  606. freeswitch-mod-skypopen (= \${binary:Version}),
  607. freeswitch-mod-sofia (= \${binary:Version}),
  608. freeswitch-mod-cdr-csv (= \${binary:Version}),
  609. freeswitch-mod-cdr-mongodb (= \${binary:Version}),
  610. freeswitch-mod-cdr-pg-csv (= \${binary:Version}),
  611. freeswitch-mod-cdr-sqlite (= \${binary:Version}),
  612. freeswitch-mod-erlang-event (= \${binary:Version}),
  613. freeswitch-mod-event-multicast (= \${binary:Version}),
  614. freeswitch-mod-event-socket (= \${binary:Version}),
  615. freeswitch-mod-event-test (= \${binary:Version}),
  616. freeswitch-mod-event-zmq (= \${binary:Version}),
  617. freeswitch-mod-json-cdr (= \${binary:Version}),
  618. freeswitch-mod-radius-cdr (= \${binary:Version}),
  619. freeswitch-mod-snmp (= \${binary:Version}),
  620. freeswitch-mod-local-stream (= \${binary:Version}),
  621. freeswitch-mod-native-file (= \${binary:Version}),
  622. freeswitch-mod-portaudio-stream (= \${binary:Version}),
  623. freeswitch-mod-shell-stream (= \${binary:Version}),
  624. freeswitch-mod-sndfile (= \${binary:Version}),
  625. freeswitch-mod-tone-stream (= \${binary:Version}),
  626. freeswitch-mod-java (= \${binary:Version}),
  627. freeswitch-mod-lua (= \${binary:Version}),
  628. freeswitch-mod-perl (= \${binary:Version}),
  629. freeswitch-mod-python (= \${binary:Version}),
  630. freeswitch-mod-yaml (= \${binary:Version}),
  631. freeswitch-mod-console (= \${binary:Version}),
  632. freeswitch-mod-logfile (= \${binary:Version}),
  633. freeswitch-mod-syslog (= \${binary:Version}),
  634. freeswitch-mod-posix-timer (= \${binary:Version}),
  635. freeswitch-mod-timerfd (= \${binary:Version}),
  636. freeswitch-mod-xml-cdr (= \${binary:Version}),
  637. freeswitch-mod-xml-curl (= \${binary:Version}),
  638. freeswitch-mod-xml-rpc (= \${binary:Version}),
  639. freeswitch-mod-xml-scgi (= \${binary:Version}),
  640. Suggests:
  641. freeswitch-mod-vlc (= \${binary:Version}),
  642. Description: Cross-Platform Scalable Multi-Protocol Soft Switch
  643. $(debian_wrap "${fs_description}")
  644. .
  645. This is a metapackage which recommends or suggests all packaged
  646. FreeSWITCH modules.
  647. Package: freeswitch-meta-codecs
  648. Architecture: any
  649. Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
  650. freeswitch-mod-amr (= \${binary:Version}),
  651. freeswitch-mod-amrwb (= \${binary:Version}),
  652. freeswitch-mod-b64 (= \${binary:Version}),
  653. freeswitch-mod-bv (= \${binary:Version}),
  654. freeswitch-mod-celt (= \${binary:Version}),
  655. freeswitch-mod-codec2 (= \${binary:Version}),
  656. freeswitch-mod-dahdi-codec (= \${binary:Version}),
  657. freeswitch-mod-g723-1 (= \${binary:Version}),
  658. freeswitch-mod-g729 (= \${binary:Version}),
  659. freeswitch-mod-h26x (= \${binary:Version}),
  660. freeswitch-mod-isac (= \${binary:Version}),
  661. freeswitch-mod-mp4v (= \${binary:Version}),
  662. freeswitch-mod-opus (= \${binary:Version}),
  663. freeswitch-mod-silk (= \${binary:Version}),
  664. freeswitch-mod-spandsp (= \${binary:Version}),
  665. freeswitch-mod-theora (= \${binary:Version}),
  666. freeswitch-mod-vp8 (= \${binary:Version})
  667. Suggests:
  668. freeswitch-mod-ilbc (= \${binary:Version}),
  669. freeswitch-mod-siren (= \${binary:Version})
  670. Description: Cross-Platform Scalable Multi-Protocol Soft Switch
  671. $(debian_wrap "${fs_description}")
  672. .
  673. This is a metapackage which depends on the packages needed to install
  674. most FreeSWITCH codecs.
  675. Package: freeswitch-meta-conf
  676. Architecture: all
  677. Depends: \${misc:Depends},
  678. freeswitch-conf-curl (= \${binary:Version}),
  679. freeswitch-conf-insideout (= \${binary:Version}),
  680. freeswitch-conf-sbc (= \${binary:Version}),
  681. freeswitch-conf-softphone (= \${binary:Version}),
  682. freeswitch-conf-vanilla (= \${binary:Version}),
  683. Description: Cross-Platform Scalable Multi-Protocol Soft Switch
  684. $(debian_wrap "${fs_description}")
  685. .
  686. This is a metapackage which depends on the available configuration
  687. examples for FreeSWITCH.
  688. Package: freeswitch-meta-lang
  689. Architecture: all
  690. Depends: \${misc:Depends},
  691. freeswitch-lang-de (= \${binary:Version}),
  692. freeswitch-lang-en (= \${binary:Version}),
  693. freeswitch-lang-es (= \${binary:Version}),
  694. freeswitch-lang-fr (= \${binary:Version}),
  695. freeswitch-lang-he (= \${binary:Version}),
  696. freeswitch-lang-pt (= \${binary:Version}),
  697. freeswitch-lang-ru (= \${binary:Version}),
  698. Description: Cross-Platform Scalable Multi-Protocol Soft Switch
  699. $(debian_wrap "${fs_description}")
  700. .
  701. This is a metapackage which depends on all language files for
  702. FreeSWITCH.
  703. Package: freeswitch-meta-mod-say
  704. Architecture: any
  705. Depends: \${misc:Depends},
  706. freeswitch-mod-say-de (= \${binary:Version}),
  707. freeswitch-mod-say-en (= \${binary:Version}),
  708. freeswitch-mod-say-es (= \${binary:Version}),
  709. freeswitch-mod-say-fa (= \${binary:Version}),
  710. freeswitch-mod-say-fr (= \${binary:Version}),
  711. freeswitch-mod-say-he (= \${binary:Version}),
  712. freeswitch-mod-say-hr (= \${binary:Version}),
  713. freeswitch-mod-say-hu (= \${binary:Version}),
  714. freeswitch-mod-say-it (= \${binary:Version}),
  715. freeswitch-mod-say-ja (= \${binary:Version}),
  716. freeswitch-mod-say-nl (= \${binary:Version}),
  717. freeswitch-mod-say-pl (= \${binary:Version}),
  718. freeswitch-mod-say-pt (= \${binary:Version}),
  719. freeswitch-mod-say-ru (= \${binary:Version}),
  720. freeswitch-mod-say-th (= \${binary:Version}),
  721. freeswitch-mod-say-zh (= \${binary:Version}),
  722. Description: Cross-Platform Scalable Multi-Protocol Soft Switch
  723. $(debian_wrap "${fs_description}")
  724. .
  725. This is a metapackage which depends on all mod_say languages for
  726. FreeSWITCH.
  727. Package: freeswitch-all-dbg
  728. Section: debug
  729. Priority: extra
  730. Architecture: any
  731. Provides: $(list_freeswitch_all_dbg_provides)
  732. Replaces: $(list_freeswitch_all_dbg_replaces)
  733. Breaks: $(list_freeswitch_all_dbg_replaces)
  734. Depends: \${misc:Depends}, freeswitch-all (= \${binary:Version})
  735. Description: debugging symbols for FreeSWITCH
  736. $(debian_wrap "${fs_description}")
  737. .
  738. This package contains debugging symbols for FreeSWITCH.
  739. Package: freeswitch-dbg
  740. Section: debug
  741. Priority: extra
  742. Architecture: any
  743. Depends: \${misc:Depends}, freeswitch (= \${binary:Version})
  744. Description: debugging symbols for FreeSWITCH
  745. $(debian_wrap "${fs_description}")
  746. .
  747. This package contains debugging symbols for FreeSWITCH.
  748. Package: libfreeswitch1-dbg
  749. Section: debug
  750. Priority: extra
  751. Architecture: any
  752. Depends: \${misc:Depends}, libfreeswitch1 (= \${binary:Version})
  753. Description: debugging symbols for FreeSWITCH
  754. $(debian_wrap "${fs_description}")
  755. .
  756. This package contains debugging symbols for libfreeswitch1.
  757. Package: libfreeswitch-dev
  758. Section: libdevel
  759. Architecture: any
  760. Depends: \${misc:Depends}, freeswitch
  761. Description: development libraries and header files for FreeSWITCH
  762. $(debian_wrap "${fs_description}")
  763. .
  764. This package contains include files for FreeSWITCH.
  765. Package: freeswitch-doc
  766. Section: doc
  767. Architecture: all
  768. Depends: \${misc:Depends}
  769. Description: documentation for FreeSWITCH
  770. $(debian_wrap "${fs_description}")
  771. .
  772. This package contains Doxygen-produce documentation for FreeSWITCH.
  773. It may be an empty package at the moment.
  774. Package: freeswitch-init
  775. Architecture: all
  776. Depends: \${misc:Depends},
  777. freeswitch-sysvinit (= \${binary:Version}),
  778. freeswitch-systemd (= \${binary:Version})
  779. Description: FreeSWITCH startup configuration
  780. $(debian_wrap "${fs_description}")
  781. .
  782. This is a metapackage which depends on the default system startup
  783. packages for FreeSWITCH.
  784. Package: freeswitch-sysvinit
  785. Architecture: all
  786. Depends: \${misc:Depends}, lsb-base (>= 3.0-6)
  787. Description: FreeSWITCH SysV init script
  788. $(debian_wrap "${fs_description}")
  789. .
  790. This package contains the SysV init script for FreeSWITCH.
  791. Package: freeswitch-systemd
  792. Architecture: all
  793. Depends: \${misc:Depends}
  794. Description: FreeSWITCH systemd configuration
  795. $(debian_wrap "${fs_description}")
  796. .
  797. This package contains the systemd configuration for FreeSWITCH.
  798. ## misc
  799. ## languages
  800. Package: freeswitch-lang
  801. Architecture: all
  802. Depends: \${misc:Depends},
  803. freeswitch-lang-en (= \${binary:Version})
  804. Description: Language files for FreeSWITCH
  805. $(debian_wrap "${fs_description}")
  806. .
  807. This is a metapackage which depends on the default language packages
  808. for FreeSWITCH.
  809. ## timezones
  810. Package: freeswitch-timezones
  811. Architecture: all
  812. Depends: \${misc:Depends}
  813. Description: Timezone files for FreeSWITCH
  814. $(debian_wrap "${fs_description}")
  815. .
  816. $(debian_wrap "This package includes the timezone files for FreeSWITCH.")
  817. EOF
  818. }
  819. print_mod_control () {
  820. local m_section="${section:-comm}"
  821. cat <<EOF
  822. Package: freeswitch-${module_name//_/-}
  823. Section: ${m_section}
  824. Architecture: any
  825. $(debian_wrap "Depends: \${shlibs:Depends}, \${misc:Depends}, libfreeswitch1 (= \${binary:Version}), ${depends}")
  826. $(debian_wrap "Recommends: ${recommends}")
  827. $(debian_wrap "Suggests: freeswitch-${module_name//_/-}-dbg, ${suggests}")
  828. Description: ${description} for FreeSWITCH
  829. $(debian_wrap "${fs_description}")
  830. .
  831. $(debian_wrap "This package contains ${module_name} for FreeSWITCH.")
  832. .
  833. $(debian_wrap "${long_description}")
  834. Package: freeswitch-${module_name//_/-}-dbg
  835. Section: debug
  836. Priority: extra
  837. Architecture: any
  838. Depends: \${misc:Depends},
  839. freeswitch-${module_name//_/-} (= \${binary:Version})
  840. Description: ${description} for FreeSWITCH (debug)
  841. $(debian_wrap "${fs_description}")
  842. .
  843. $(debian_wrap "This package contains debugging symbols for ${module_name} for FreeSWITCH.")
  844. .
  845. $(debian_wrap "${long_description}")
  846. EOF
  847. }
  848. print_mod_install () {
  849. cat <<EOF
  850. /usr/lib/freeswitch/mod/${1}.so
  851. EOF
  852. }
  853. print_long_filename_override () {
  854. local p="$1"
  855. cat <<EOF
  856. # The long file names are caused by appending the nightly information.
  857. # Since one of these packages will never end up on a Debian CD, the
  858. # related problems with long file names will never come up here.
  859. ${p}: package-has-long-file-name *
  860. EOF
  861. }
  862. print_gpl_openssl_override () {
  863. local p="$1"
  864. cat <<EOF
  865. # We're definitely not doing this. Nothing in FreeSWITCH has a more
  866. # restrictive license than LGPL or MPL.
  867. ${p}: possible-gpl-code-linked-with-openssl
  868. EOF
  869. }
  870. print_itp_override () {
  871. local p="$1"
  872. cat <<EOF
  873. # We're not in Debian (yet) so we don't have an ITP bug to close.
  874. ${p}: new-package-should-close-itp-bug
  875. EOF
  876. }
  877. print_common_overrides () {
  878. print_long_filename_override "$1"
  879. }
  880. print_mod_overrides () {
  881. print_common_overrides "$1"
  882. print_gpl_openssl_override "$1"
  883. }
  884. print_conf_overrides () {
  885. print_common_overrides "$1"
  886. }
  887. print_conf_control () {
  888. cat <<EOF
  889. Package: freeswitch-conf-${conf//_/-}
  890. Architecture: all
  891. Depends: \${misc:Depends}
  892. Description: FreeSWITCH ${conf} configuration
  893. $(debian_wrap "${fs_description}")
  894. .
  895. $(debian_wrap "This package contains the ${conf} configuration for FreeSWITCH.")
  896. EOF
  897. }
  898. print_conf_install () {
  899. cat <<EOF
  900. conf/${conf} /usr/share/freeswitch/conf
  901. EOF
  902. }
  903. print_lang_overrides () {
  904. print_common_overrides "$1"
  905. }
  906. print_lang_control () {
  907. local lang_name="$(echo ${lang} | tr '[:lower:]' '[:upper:]')"
  908. case "${lang}" in
  909. de) lang_name="German" ;;
  910. en) lang_name="English" ;;
  911. es) lang_name="Spanish" ;;
  912. fr) lang_name="French" ;;
  913. he) lang_name="Hebrew" ;;
  914. pt) lang_name="Portuguese" ;;
  915. ru) lang_name="Russian" ;;
  916. esac
  917. cat <<EOF
  918. Package: freeswitch-lang-${lang//_/-}
  919. Architecture: all
  920. Depends: \${misc:Depends}
  921. Recommends: freeswitch-sounds-${lang}
  922. Description: ${lang_name} language files for FreeSWITCH
  923. $(debian_wrap "${fs_description}")
  924. .
  925. $(debian_wrap "This package includes the ${lang_name} language files for FreeSWITCH.")
  926. EOF
  927. }
  928. print_lang_install () {
  929. cat <<EOF
  930. conf/vanilla/lang/${lang} /usr/share/freeswitch/lang
  931. EOF
  932. }
  933. print_edit_warning () {
  934. echo "#### Do not edit! This file is auto-generated from debian/bootstrap.sh."; echo
  935. }
  936. gencontrol_per_mod () {
  937. print_mod_control "$module_name" "$description" "$long_description" >> control
  938. }
  939. gencontrol_per_cat () {
  940. (echo "## mod/$category"; echo) >> control
  941. }
  942. geninstall_per_mod () {
  943. local f=freeswitch-${module_name//_/-}.install
  944. (print_edit_warning; print_mod_install "$module_name") > $f
  945. print_mod_install "$module_name" >> freeswitch-all.install
  946. test -f $f.tmpl && cat $f.tmpl >> $f
  947. }
  948. genoverrides_per_mod () {
  949. local f=freeswitch-${module_name//_/-}.lintian-overrides
  950. (print_edit_warning; print_mod_overrides freeswitch-${module_name//_/-}) > $f
  951. test -f $f.tmpl && cat $f.tmpl >> $f
  952. }
  953. genmodulesconf () {
  954. genmodules_per_cat () { echo "## $category"; }
  955. genmodules_per_mod () { echo "$module"; }
  956. print_edit_warning
  957. map_modules 'mod_filter' 'genmodules_per_cat' 'genmodules_per_mod'
  958. }
  959. genconf () {
  960. print_conf_control >> control
  961. local p=freeswitch-conf-${conf//_/-}
  962. local f=$p.install
  963. (print_edit_warning; print_conf_install) > $f
  964. print_conf_install >> freeswitch-all.install
  965. test -f $f.tmpl && cat $f.tmpl >> $f
  966. local f=$p.lintian-overrides
  967. (print_edit_warning; print_conf_overrides "$p") > $f
  968. test -f $f.tmpl && cat $f.tmpl >> $f
  969. }
  970. genlang () {
  971. print_lang_control >> control
  972. local p=freeswitch-lang-${lang//_/-}
  973. local f=$p.install
  974. (print_edit_warning; print_lang_install) > $f
  975. print_lang_install >> freeswitch-all.install
  976. test -f $f.tmpl && cat $f.tmpl >> $f
  977. local f=$p.lintian-overrides
  978. (print_edit_warning; print_lang_overrides "$p") > $f
  979. test -f $f.tmpl && cat $f.tmpl >> $f
  980. }
  981. accumulate_mod_deps () {
  982. local x=""
  983. # build-depends
  984. if [ -n "$(eval echo \$build_depends_$codename)" ]; then
  985. x="$(eval echo \$build_depends_$codename)"
  986. else x="${build_depends}"; fi
  987. if [ -n "$x" ]; then
  988. if [ ! "$mod_build_depends" = "." ]; then
  989. mod_build_depends="${mod_build_depends}, ${x}"
  990. else mod_build_depends="${x}"; fi; fi
  991. # depends
  992. if [ -n "$(eval echo \$depends_$codename)" ]; then
  993. x="$(eval echo \$depends_$codename)"
  994. else x="${depends}"; fi
  995. x="$(echo "$x" | sed 's/, \?/\n/g' | grep -v '^freeswitch' | tr '\n' ',' | sed -e 's/,$//' -e 's/,/, /g')"
  996. if [ -n "$x" ]; then
  997. if [ ! "$mod_depends" = "." ]; then
  998. mod_depends="${mod_depends}, ${x}"
  999. else mod_depends="${x}"; fi; fi
  1000. # recommends
  1001. if [ -n "$(eval echo \$recommends_$codename)" ]; then
  1002. x="$(eval echo \$recommends_$codename)"
  1003. else x="${recommends}"; fi
  1004. x="$(echo "$x" | sed 's/, \?/\n/g' | grep -v '^freeswitch' | tr '\n' ',' | sed -e 's/,$//' -e 's/,/, /g')"
  1005. if [ -n "$x" ]; then
  1006. if [ ! "$mod_recommends" = "." ]; then
  1007. mod_recommends="${mod_recommends}, ${x}"
  1008. else mod_recommends="${x}"; fi; fi
  1009. # suggests
  1010. if [ -n "$(eval echo \$suggests_$codename)" ]; then
  1011. x="$(eval echo \$suggests_$codename)"
  1012. else x="${suggests}"; fi
  1013. x="$(echo "$x" | sed 's/, \?/\n/g' | grep -v '^freeswitch' | tr '\n' ',' | sed -e 's/,$//' -e 's/,/, /g')"
  1014. if [ -n "$x" ]; then
  1015. if [ ! "$mod_suggests" = "." ]; then
  1016. mod_suggests="${mod_suggests}, ${x}"
  1017. else mod_suggests="${x}"; fi; fi
  1018. }
  1019. genmodctl_new_mod () {
  1020. grep -e "^Module: ${module}$" control-modules >/dev/null && return 0
  1021. cat <<EOF
  1022. Module: $module
  1023. Description: $description
  1024. $long_description
  1025. EOF
  1026. echo
  1027. }
  1028. genmodctl_new_cat () {
  1029. grep -e "^## mod/${category}$" control-modules >/dev/null && return 0
  1030. cat <<EOF
  1031. ## mod/$category
  1032. EOF
  1033. }
  1034. pre_parse_mod_control () {
  1035. local fl=true ll_nl=false ll_descr=false
  1036. while xread l; do
  1037. if [ -z "$l" ]; then
  1038. # is newline
  1039. if ! $ll_nl && ! $fl; then
  1040. echo
  1041. fi
  1042. ll_nl=true
  1043. continue
  1044. elif [ -z "${l##\#*}" ]; then
  1045. # is comment
  1046. continue
  1047. elif [ -z "${l## *}" ]; then
  1048. # is continuation line
  1049. if ! $ll_descr; then
  1050. echo -n "$l"
  1051. else
  1052. echo -n "Long-Description: $(echo "$l" | sed -e 's/^ *//')"
  1053. fi
  1054. else
  1055. # is header line
  1056. $fl || echo
  1057. if [ "${l%%:*}" = "Description" ]; then
  1058. ll_descr=true
  1059. echo "Description: ${l#*: }"
  1060. continue
  1061. else
  1062. echo -n "$l"
  1063. fi
  1064. fi
  1065. fl=false ll_nl=false ll_descr=false
  1066. done < control-modules
  1067. }
  1068. var_escape () {
  1069. (echo -n \'; echo -n "$1" | sed -e "s/'/'\\\\''/g"; echo -n \')
  1070. }
  1071. parse_mod_control () {
  1072. pre_parse_mod_control > control-modules.preparse
  1073. local category=""
  1074. local module_name=""
  1075. rm -rf $parse_dir
  1076. while xread l; do
  1077. if [ -z "$l" ]; then
  1078. # is newline
  1079. continue
  1080. fi
  1081. local header="${l%%:*}"
  1082. local value="${l#*: }"
  1083. if [ "$header" = "Module" ]; then
  1084. category="${value%%/*}"
  1085. module_name="${value#*/}"
  1086. mkdir -p $parse_dir/$category
  1087. (echo "module=$(var_escape "$value")"; \
  1088. echo "category=$(var_escape "$category")"; \
  1089. echo "module_name=$(var_escape "$module_name")"; \
  1090. ) >> $parse_dir/$category/$module_name
  1091. else
  1092. ([ -n "$category" ] && [ -n "$module_name" ]) \
  1093. || err "unexpected header $header"
  1094. local var_name="$(echo "$header" | sed -e 's/-/_/g' | tr '[A-Z]' '[a-z]')"
  1095. echo "${var_name}=$(var_escape "$value")" >> $parse_dir/$category/$module_name
  1096. fi
  1097. done < control-modules.preparse
  1098. }
  1099. debian_wrap () {
  1100. local fl=true
  1101. echo "$1" | fold -s -w 69 | while xread l; do
  1102. local v="$(echo "$l" | sed -e 's/ *$//g')"
  1103. if $fl; then
  1104. fl=false
  1105. echo "$v"
  1106. else
  1107. echo " $v"
  1108. fi
  1109. done
  1110. }
  1111. genmodctl_cat () {
  1112. (echo "## mod/$category"; echo)
  1113. }
  1114. genmodctl_mod () {
  1115. echo "Module: $module"
  1116. [ -n "$section" ] && echo "Section: $section"
  1117. echo "Description: $description"
  1118. echo "$long_description" | fold -s -w 69 | while xread l; do
  1119. local v="$(echo "$l" | sed -e 's/ *$//g')"
  1120. echo " $v"
  1121. done
  1122. [ -n "$build_depends" ] && debian_wrap "Build-Depends: $build_depends"
  1123. for x in $supported_distros; do
  1124. [ -n "$(eval echo \$build_depends_$x)" ] \
  1125. && debian_wrap "Build-Depends-$x: $(eval echo \$build_depends_$x)"
  1126. done
  1127. [ -n "$depends" ] && debian_wrap "Depends: $depends"
  1128. [ -n "$reccomends" ] && debian_wrap "Recommends: $recommends"
  1129. [ -n "$suggests" ] && debian_wrap "Suggests: $suggests"
  1130. [ -n "$distro_conflicts" ] && debian_wrap "Distro-Conflicts: $distro_conflicts"
  1131. echo
  1132. }
  1133. set_modules_non_dfsg () {
  1134. local len=${#avoid_mods}
  1135. for ((i=0; i<len; i++)); do
  1136. case "${avoid_mods[$i]}" in
  1137. codecs/mod_siren|codecs/mod_ilbc)
  1138. unset avoid_mods[$i]
  1139. ;;
  1140. esac
  1141. done
  1142. }
  1143. unavoid_modules () {
  1144. local len=${#avoid_mods}
  1145. for ((i=0; i<len; i++)); do
  1146. for x in $1; do
  1147. if test "${avoid_mods[$i]}" = "$x"; then
  1148. unset avoid_mods[$i]
  1149. fi
  1150. done
  1151. done
  1152. }
  1153. conf_merge () {
  1154. local of="$1" if="$2"
  1155. if [ -s $if ]; then
  1156. grep -v '^##\|^$' $if | while xread x; do
  1157. touch $of
  1158. if ! grep -e "$x" $of >/dev/null; then
  1159. printf '%s\n' "$x" >> $of
  1160. fi
  1161. done
  1162. fi
  1163. }
  1164. codename="sid"
  1165. modulelist_opt=""
  1166. modules_add=""
  1167. while getopts "c:m:p:" o; do
  1168. case "$o" in
  1169. c) codename="$OPTARG" ;;
  1170. m) modulelist_opt="$OPTARG" ;;
  1171. p) modules_add="$modules_add $OPTARG";;
  1172. esac
  1173. done
  1174. shift $(($OPTIND-1))
  1175. echo "Bootstrapping debian/ for ${codename}" >&2
  1176. echo >&2
  1177. echo "Please wait, this takes a few seconds..." >&2
  1178. test -z "$modulelist_opt" || set_modules_${modulelist_opt/-/_}
  1179. test -z "$modules_add" || unavoid_modules "$modules_add"
  1180. echo "Adding any new modules to control-modules..." >&2
  1181. parse_dir=control-modules.parse
  1182. map_fs_modules ':' 'genmodctl_new_cat' 'genmodctl_new_mod' >> control-modules
  1183. echo "Parsing control-modules..." >&2
  1184. parse_mod_control
  1185. echo "Displaying includes/excludes..." >&2
  1186. map_modules 'mod_filter_show' '' ''
  1187. echo "Generating modules_.conf..." >&2
  1188. genmodulesconf > modules_.conf
  1189. echo "Generating control-modules.gen as sanity check..." >&2
  1190. (echo "# -*- mode:debian-control -*-"; \
  1191. echo "##### Author: Travis Cross <tc@traviscross.com>"; echo; \
  1192. map_modules ':' 'genmodctl_cat' 'genmodctl_mod' \
  1193. ) > control-modules.gen
  1194. echo "Accumulating dependencies from modules..." >&2
  1195. map_modules 'mod_filter' '' 'accumulate_mod_deps'
  1196. echo "Generating debian/..." >&2
  1197. > control
  1198. > freeswitch-all.install
  1199. (print_edit_warning; print_mod_overrides "freeswitch-all") \
  1200. > freeswitch-all.lintian-overrides
  1201. (print_edit_warning; print_source_control; print_core_control) >> control
  1202. echo "Generating debian/ (conf)..." >&2
  1203. (echo "### conf"; echo) >> control
  1204. map_confs 'genconf'
  1205. echo "Generating debian/ (lang)..." >&2
  1206. (echo "### lang"; echo) >> control
  1207. map_langs 'genlang'
  1208. echo "Generating debian/ (modules)..." >&2
  1209. (echo "### modules"; echo) >> control
  1210. map_modules "mod_filter" \
  1211. "gencontrol_per_cat" \
  1212. "gencontrol_per_mod geninstall_per_mod genoverrides_per_mod"
  1213. echo "Generating debian/ (-all package)..." >&2
  1214. grep -e '^Package:' control | grep -v '^freeswitch-all$' | while xread l; do
  1215. m="${l#*: }"
  1216. conf_merge freeswitch-all.install $m.install
  1217. done
  1218. for x in postinst postrm preinst prerm; do
  1219. cp -a freeswitch.$x freeswitch-all.$x
  1220. done
  1221. cp -a freeswitch-doc.docs freeswitch-all.docs
  1222. #cp -a freeswitch-systemd.freeswitch.service freeswitch-all.freeswitch.service
  1223. cp -a freeswitch-sysvinit.freeswitch.default freeswitch-all.freeswitch.default
  1224. cp -a freeswitch-sysvinit.freeswitch.init freeswitch-all.freeswitch.init
  1225. echo "Generating additional lintian overrides..." >&2
  1226. grep -e '^Package:' control | while xread l; do
  1227. m="${l#*: }"
  1228. f=$m.lintian-overrides
  1229. [ -s $f ] || print_edit_warning >> $f
  1230. if ! grep -e 'package-has-long-file-name' $f >/dev/null; then
  1231. print_long_filename_override "$m" >> $f
  1232. fi
  1233. if ! grep -e 'new-package-should-close-itp-bug' $f >/dev/null; then
  1234. print_itp_override "$m" >> $f
  1235. fi
  1236. done
  1237. for p in freeswitch libfreeswitch1; do
  1238. f=$p.lintian-overrides
  1239. [ -s $f ] || print_edit_warning >> $f
  1240. print_gpl_openssl_override "$p" >> $f
  1241. done
  1242. echo "Cleaning up..." >&2
  1243. rm -f control-modules.preparse
  1244. rm -rf control-modules.parse
  1245. diff control-modules control-modules.gen >/dev/null && rm -f control-modules.gen
  1246. echo "Done bootstrapping debian/" >&2
  1247. touch .stamp-bootstrap