require 'formula' class Freeswitch < Formula homepage 'http://freeswitch.org' url 'git://git.freeswitch.org/freeswitch.git', :tag => 'v1.2.0' version '1.2.0' head 'git://git.freeswitch.org/freeswitch.git' depends_on :autoconf depends_on :automake depends_on :libtool depends_on 'pkg-config' => :build depends_on 'jpeg' def install system "./bootstrap.sh -j#{ENV.make_jobs}" system "./configure", "--disable-dependency-tracking", "--enable-shared", "--enable-static", "--prefix=#{prefix}", "--exec_prefix=#{prefix}" system "make" system "make install" system "make all cd-sounds-install cd-moh-install" plist_path.write startup_plist plist_path.chmod 0644 end def startup_plist; <<-EOS.undent KeepAlive Label #{plist_name} ProgramArguments #{bin}/freeswitch -nc -nonat RunAtLoad ServiceIPC EOS end def caveats; <<-EOS.undent If this is your first install, automatically load on login with: mkdir -p ~/Library/LaunchAgents cp #{plist_path} ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} If this is an upgrade and you already have the #{plist_path.basename} loaded: launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename} cp #{plist_path} ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} Or start it manually: freeswitch -nc --nonat EOS end def test system "#{bin}/freeswitch", "-version" end end