michael@52: ## michael@52: ## stun.spec -- OpenPKG RPM Package Specification michael@52: ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. michael@52: ## michael@52: ## Permission to use, copy, modify, and distribute this software for michael@52: ## any purpose with or without fee is hereby granted, provided that michael@52: ## the above copyright notice and this permission notice appear in all michael@52: ## copies. michael@52: ## michael@52: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@52: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@52: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@52: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@52: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@52: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@52: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@52: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@52: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@52: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@52: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@52: ## SUCH DAMAGE. michael@52: ## michael@52: michael@52: # package version michael@52: %define V_dist 0.96_Aug13 michael@52: %define V_opkg 0.96 michael@52: michael@52: # package information michael@52: Name: stun michael@52: Summary: STUN Client & Server michael@52: URL: http://www.vovida.org/applications/downloads/stun/ michael@52: Vendor: Vovida michael@52: Packager: OpenPKG Foundation e.V. michael@52: Distribution: OpenPKG Community michael@52: Class: EVAL michael@52: Group: VoIP michael@52: License: Open Source michael@52: Version: %{V_opkg} michael@53: Release: 20090106 michael@52: michael@52: # list of sources michael@52: Source0: http://switch.dl.sourceforge.net/stun/stund_%{V_dist}.tgz michael@52: Source1: rc.stun michael@52: Patch0: stun.patch michael@52: michael@52: # build information michael@52: Prefix: %{l_prefix} michael@52: BuildRoot: %{l_buildroot} michael@85: BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc, gcc::with_cxx = yes michael@52: PreReq: OpenPKG, openpkg >= 20060823 michael@52: AutoReq: no michael@52: AutoReqProv: no michael@52: michael@52: %description michael@52: The STUN (Simple Traversal of UDP through NATs (Network Address michael@52: Translation)) server is an implementation of the STUN protocol that michael@52: enables STUN functionality in SIP-based systems. The STUN server michael@52: tar ball also include a client API to enable STUN functionality in michael@52: SIP endpoints. In addition there is a command line UNIX client and michael@52: a graphical windows client that check what type of NAT the user is michael@52: using. STUN is an application-layer protocol that can determine the michael@52: public IP and nature of a NAT device that sits between the STUN michael@52: client and STUN server. The current version of the code supports michael@52: most of RFC 3489 except the ability to get OTPs from the server. michael@52: michael@52: %track michael@52: prog stun = { michael@52: version = %{V_dist} michael@52: url = http://prdownloads.sourceforge.net/stun/ michael@52: regex = stund_(.+?)\.tgz michael@52: } michael@52: michael@52: %prep michael@52: %setup -q -n stund michael@52: %patch -p0 michael@53: case "%{l_platform -t}" in michael@53: *-sunos* ) michael@53: %{l_shtool} subst \ michael@53: -e 's;^\(LDFLAGS\)+=.*;\1=;' \ michael@53: -e 's;^#\(LDFLAGS+=\) -lnsl -lsocket;\1-lsocket -lnsl;' \ michael@53: Makefile michael@53: ;; michael@53: * ) michael@53: %{l_shtool} subst \ michael@53: -e 's;^\(LDFLAGS\)+=.*;\1=;' \ michael@53: Makefile michael@53: ;; michael@53: esac michael@52: michael@52: %build michael@52: %{l_make} %{l_mflags} \ michael@52: CXX="%{l_cxx}" \ michael@53: CXXFLAGS="%{l_cxxflags -O}" michael@52: michael@52: %install michael@52: rm -rf $RPM_BUILD_ROOT michael@52: %{l_shtool} mkdir -f -p -m 755 \ michael@52: $RPM_BUILD_ROOT%{l_prefix}/bin \ michael@52: $RPM_BUILD_ROOT%{l_prefix}/sbin \ michael@52: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ michael@52: $RPM_BUILD_ROOT%{l_prefix}/var/stun michael@52: %{l_shtool} install -c -s -m 755 \ michael@52: client $RPM_BUILD_ROOT%{l_prefix}/bin/stun michael@52: %{l_shtool} install -c -s -m 755 \ michael@52: server $RPM_BUILD_ROOT%{l_prefix}/sbin/stund michael@52: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@52: %{SOURCE rc.stun} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@52: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} michael@52: michael@52: %files -f files michael@52: michael@52: %clean michael@52: rm -rf $RPM_BUILD_ROOT michael@52: michael@52: %post michael@52: if [ $1 -eq 1 ]; then michael@52: # display final hints on initial installation michael@52: ( echo "Before starting the STUN daemon, please set the configuration" michael@52: echo "variables \"stun_bind_addr{1,2}\" in $RPM_INSTALL_PREFIX/etc/rc.conf" michael@52: echo "to two *different* IP addresses bound to your host. STUN requires this." michael@52: ) | %{l_rpmtool} msg -b -t notice michael@52: fi michael@52: michael@52: # after upgrade, restart service michael@52: [ $1 -eq 2 ] || exit 0 michael@52: eval `%{l_rc} stun status 2>/dev/null` michael@52: [ ".$stun_active" = .yes ] && %{l_rc} stun restart michael@52: exit 0 michael@52: michael@52: %preun michael@52: # before erase, stop service and remove log files michael@52: [ $1 -eq 0 ] || exit 0 michael@52: %{l_rc} stun stop 2>/dev/null michael@52: rm -f $RPM_INSTALL_PREFIX/var/stun/stun.pid >/dev/null 2>&1 || true michael@52: exit 0 michael@52: