Skip to content

Commit

Permalink
install: Readd ALSA detection if needed.
Browse files Browse the repository at this point in the history
Asterisk 21 removed chan_alsa, and with it
detection of the ALSA library. Other out-of-tree
modules (not in this repo) may still depend on
ALSA, so this allows the build system changes
to be reversed if needed so these modules can
still be built without modification.

This option does NOT patch chan_alsa back in.
  • Loading branch information
InterLinked1 committed Jan 17, 2024
1 parent e6d79eb commit 9d7ad7d
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 1 deletion.
44 changes: 44 additions & 0 deletions patches/alsa.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in
index 6594a922eb..21a8a2ac49 100644
--- a/build_tools/menuselect-deps.in
+++ b/build_tools/menuselect-deps.in
@@ -1,3 +1,4 @@
+ALSA=@PBX_ALSA@
BLUETOOTH=@PBX_BLUETOOTH@
BEANSTALK=@PBX_BEANSTALK@
COROSYNC=@PBX_COROSYNC@
diff --git a/configure.ac b/configure.ac
index a3563e97a9..1d6a6143af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -530,6 +530,7 @@ THIRD_PARTY_CONFIGURE()
# by the --with option name (the third field),
# to make things easier for the users.

+AST_EXT_LIB_SETUP([ALSA], [Advanced Linux Sound Architecture], [asound])
AST_EXT_LIB_SETUP([BFD], [Debug symbol decoding], [bfd])

# BKTR is used for backtrace support on platforms that do not
@@ -1633,6 +1634,8 @@ fi

# do the package library checks now

+AST_EXT_LIB_CHECK([ALSA], [asound], [snd_pcm_open], [alsa/asoundlib.h])
+
AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_openr], [bfd.h])
# Fedora/RedHat/CentOS require extra libraries
AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_openr], [bfd.h], [-ldl -liberty])
diff --git a/makeopts.in b/makeopts.in
index f7824f3476..bddf77ac1a 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -130,6 +130,9 @@ C_COMPILER_FAMILY=@AST_C_COMPILER_FAMILY@
AST_RPATH=@AST_RPATH@
AST_FORTIFY_SOURCE=@AST_FORTIFY_SOURCE@

+ALSA_INCLUDE=@ALSA_INCLUDE@
+ALSA_LIB=@ALSA_LIB@
+
BFD_INCLUDE=@BFD_INCLUDE@
BFD_LIB=@BFD_LIB@

4 changes: 4 additions & 0 deletions phreaknet.1
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ Install chan_sip instead of or in addition to chan_pjsip.
By default, chan_sip is not compiled or loaded since it is deprecated
and will be removed in Asterisk 21.
.TP
\f[B]--alsa\f[R]
Ensure ALSA library detection exists in the build system. This does
NOT readd the deprecated/removed chan_alsa module.
.TP
\f[B]--cisco\f[R]
Add full support for Cisco Call Manager phones using the usecallmanager
patches (chan_sip only)
Expand Down
3 changes: 3 additions & 0 deletions phreaknet.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ directories if necessary.
**-s**, **--sip**
: Install chan_sip instead of or in addition to chan_pjsip. By default, chan_sip is not compiled or loaded since it is deprecated and will be removed in Asterisk 21.

**--alsa**
: Ensure ALSA library detection exists in the build system. This does NOT readd the deprecated/removed chan_alsa module.

**--cisco**
: Add full support for Cisco Call Manager phones using the usecallmanager patches (chan_sip only)

Expand Down
20 changes: 19 additions & 1 deletion phreaknet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ PATH="/sbin:$PATH" # in case su used without path
AST_CC=1 # Country Code (default: 1 - NANPA)
AST_USER=""
EXTRA_FEATURES=1
ALSA=0
WEAK_TLS=0
CHAN_SIP=0
ENHANCED_CHAN_SIP=0
Expand Down Expand Up @@ -440,6 +441,7 @@ Options:
--experimental install: Install experimental features that may not be production ready
--fast install: Compile as fast as possible
--lightweight install: Only install basic, required modules for basic Asterisk functionality
--alsa install: Ensure ALSA library detection exists in the build system. This does NOT readd the deprecated/removed chan_alsa module.
--cisco install: Add full support for Cisco Call Manager phones (chan_sip only)
--sccp install: Install chan_sccp channel driver (Cisco Skinny)
--drivers install: Also install DAHDI drivers removed in 2018
Expand Down Expand Up @@ -2183,7 +2185,7 @@ else
fi

FLAG_TEST=0
PARSED_ARGUMENTS=$(getopt -n phreaknet -o bc:u:dfhostu:v:w -l backtraces,cc:,dahdi,force,flag-test,help,sip,testsuite,user:,version:,weaktls,cisco,sccp,clli:,debug:,devmode,disa:,drivers,experimental,extcodecs,fast,freepbx,lightweight,api-key:,rotate,audit,boilerplate,upstream:,manselect,minimal,vanilla -- "$@")
PARSED_ARGUMENTS=$(getopt -n phreaknet -o bc:u:dfhostu:v:w -l backtraces,cc:,dahdi,force,flag-test,help,sip,testsuite,user:,version:,weaktls,alsa,cisco,sccp,clli:,debug:,devmode,disa:,drivers,experimental,extcodecs,fast,freepbx,lightweight,api-key:,rotate,audit,boilerplate,upstream:,manselect,minimal,vanilla -- "$@")
VALID_ARGUMENTS=$?
if [ "$VALID_ARGUMENTS" != "0" ]; then
usage
Expand Down Expand Up @@ -2213,6 +2215,7 @@ while true; do
-u | --user ) AST_USER=$2; shift 2;;
-v | --version ) AST_ALT_VER=$2; shift 2;;
-w | --weaktls ) WEAK_TLS=1; shift ;;
--alsa ) ALSA=1; shift ;;
--audit ) PKG_AUDIT=1; shift ;;
--cisco ) SIP_CISCO=1; shift ;;
--sccp ) CHAN_SCCP=1; shift ;;
Expand Down Expand Up @@ -2299,6 +2302,8 @@ elif [ "$cmd" = "wizard" ]; then
dialog_result "$ans" "y" "--drivers"

# Channel Drivers
ans=$(dialog --nocancel --default-item 'n' --menu "Do you require ALSA library support?" 20 60 12 y Yes n No 2>&1 >/dev/tty)
dialog_result "$ans" "y" "--alsa"
ans=$(dialog --nocancel --default-item 'n' --menu "Do you need support for the deprecated chan_sip (SIP) module?" 20 60 12 y Yes n No 2>&1 >/dev/tty)
dialog_result "$ans" "y" "--sip"
ans=$(dialog --nocancel --default-item 'n' --menu "Do you want to install the chan_sccp (Skinny) channel driver?" 20 60 12 y Yes n No 2>&1 >/dev/tty)
Expand Down Expand Up @@ -2503,6 +2508,18 @@ elif [ "$cmd" = "install" ]; then
apt-get install -y libvpb1
fi
./contrib/scripts/install_prereq install

# Modify build system if needed
if [ "$ALSA" = "1" ]; then
# chan_alsa was removed in Asterisk 21, and with it, the support for ALSA lib detection in the build system. Add it back if needed.
lines=$(grep "HAVE_ALSA" include/asterisk/autoconfig.h | wc -l)
if [ $lines -eq 0 ]; then
printf "Patching build system to detect ALSA library\n"
git_patch "alsa.diff"
./bootstrap.sh # Regenerate configure and include/asterisk/autoconfig.h.in
fi
fi

if [ "$DEVMODE" = "1" ]; then
configure_devmode
else
Expand All @@ -2513,6 +2530,7 @@ elif [ "$cmd" = "install" ]; then
fi
cp contrib/scripts/voicemailpwcheck.py /usr/local/bin
chmod +x /usr/local/bin/voicemailpwcheck.py

# Change Compile Options: https://wiki.asterisk.org/wiki/display/AST/Using+Menuselect+to+Select+Asterisk+Options
$AST_MAKE menuselect.makeopts
menuselect/menuselect --enable format_mp3 menuselect.makeopts # add mp3 support
Expand Down

0 comments on commit 9d7ad7d

Please sign in to comment.