Configuring an Asterisk build from the command line: Part 2

Configuring an Asterisk build from the command line: Part 2

Last month I wrote a blog post titled “Configuring an Asterisk build from the command line”  which outlined how to use the menuselect command to automate the Asterisk build configuration process.  Since then, I’ve gotten some questions and feedback from a few folks and I’ve thought of a few more things to share.

Feedback:

  1. “You have to run make menuselect.makeopts first before trying to run menuselect.  Yep.  If you’re starting from a clean checkout or from the tarball, you have to run make menuselect.makeopts first to scan the source files and get all the dependencies and to create a skeleton menuselect.makeopts file.
  2.  “If you don’t specify a filename with menuselect, it overwrites an existing menuselect.makeopts file“.  Yeah, I forgot to mention that as well.  To be safe, you should always run menuselect with a filename like so: menuselect/menuselect <options> <filename>
  3. If you do specify a filename and it’s not menuselect.makeopts, it’s ignored“.  Bizarre but apparently true.  I have no idea why.
  4. menuselect doesn’t return an error if you try to enable or disable something that doesn’t exist!“.  Oops.  I didn’t know about that one.  It seems that if you try to enable or disable something that doesn’t exist, menuselect prints the error but still returns “0” which allows make and scripts to continue.  A fix for this is in progress.
  5. What happened to all the extended modules??”  If you run make menuselect.makeopts in a normal Asterisk branch, most extended and many deprecated modules are automatically enabled.  If you run it in a Certified Asterisk branch however, all of the extended and deprecated modules are disabled and have to be explicitly enabled.

A More Complete Example:

You probably already know this but both Switchvox and FreePBX are based on Asterisk and CentOS. ( 4 links in one sentence.  I got a lot of points for that! )  To help make the maintenance of their RPM SPEC files easier, I came up with the following snippet for them to use as a menuselect template…

make menuselect.makeopts
ENABLE_CATEGORIES="MENUSELECT_ADDONS"
for cat in $ENABLE_CATEGORIES ; do
menuselect/menuselect --enable-category $cat menuselect.makeopts
done

DISABLE_CATEGORIES="MENUSELECT_CORE_SOUNDS MENUSELECT_EXTRA_SOUNDS MENUSELECT_MOH"
for cat in $DISABLE_CATEGORIES ; do
menuselect/menuselect --disable-category $cat menuselect.makeopts
done

ENABLE_OPTIONS=""
ENABLE_OPTIONS+=" app_adsiprog app_alarmreceiver app_amd app_attended_transfer app_blind_transfer"
ENABLE_OPTIONS+=" app_chanisavail app_dictate app_externalivr app_festival app_getcpeid app_ices"
ENABLE_OPTIONS+=" app_image app_jack app_macro app_meetme app_minivm app_morsecode app_mp3"
ENABLE_OPTIONS+=" app_nbscat app_page app_sms app_test app_url app_waitforring app_waitforsilence"
ENABLE_OPTIONS+=" app_zapateller"
ENABLE_OPTIONS+=" cdr_csv cdr_radius cel_radius"
ENABLE_OPTIONS+=" chan_console chan_mgcp chan_motif chan_oss chan_phone chan_sip chan_skinny chan_unistim"
ENABLE_OPTIONS+=" codec_opus codec_silk codec_siren14 codec_siren7"
ENABLE_OPTIONS+=" format_ogg_speex format_vox"
ENABLE_OPTIONS+=" func_frame_trace func_pitchshift"
ENABLE_OPTIONS+=" pbx_ael pbx_dundi pbx_lua pbx_realtime"
ENABLE_OPTIONS+=" res_adsi res_ael_share res_calendar res_calendar_caldav res_calendar_ews"
ENABLE_OPTIONS+=" res_calendar_exchange res_calendar_icalendar res_chan_stats res_config_ldap"
ENABLE_OPTIONS+=" res_endpoint_stats res_monitor res_phoneprov res_pjsip_history"
ENABLE_OPTIONS+=" res_pjsip_phoneprov_provider res_pktcops res_smdi res_snmp res_srtp"
ENABLE_OPTIONS+=" res_timing_pthread"
ENABLE_OPTIONS+=" DONT_OPTIMIZE"
%if "%{debug_mode}" == "1"
ENABLE_OPTIONS+=" BETTER_BACKTRACES"
%endif
for option in $ENABLE_OPTIONS ; do
menuselect/menuselect --enable $option menuselect.makeopts
done

DISABLE_OPTIONS=""
DISABLE_OPTIONS+=" BUILD_NATIVE"
for option in $DISABLE_OPTIONS ; do
menuselect/menuselect --disable $option menuselect.makeopts
done

Now, if menuselect didn’t have the bug about returning “0” on non-existent options, it would have detected that I misspelled “res_pktcops” and I wouldn’t have spent an hour of my life trying to figure out why the module wasn’t getting built.  Ah well.  If you copy and pate this example, be sure to fix it. 🙂

As always, feedback welcomed!

About the Author

What can we help you find?