Tue, 29 Mar 2011 20:04:34 +0200
Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.
The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.
It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.
1 ##
2 ## stun.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ##
5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all
8 ## copies.
9 ##
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 # package version
25 %define V_dist 0.96_Aug13
26 %define V_opkg 0.96
28 # package information
29 Name: stun
30 Summary: STUN Client & Server
31 URL: http://www.vovida.org/applications/downloads/stun/
32 Vendor: Vovida
33 Packager: OpenPKG Foundation e.V.
34 Distribution: OpenPKG Community
35 Class: EVAL
36 Group: VoIP
37 License: Open Source
38 Version: %{V_opkg}
39 Release: 20090106
41 # list of sources
42 Source0: http://switch.dl.sourceforge.net/stun/stund_%{V_dist}.tgz
43 Source1: rc.stun
44 Patch0: stun.patch
46 # build information
47 Prefix: %{l_prefix}
48 BuildRoot: %{l_buildroot}
49 BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc, gcc::with_cxx = yes
50 PreReq: OpenPKG, openpkg >= 20060823
51 AutoReq: no
52 AutoReqProv: no
54 %description
55 The STUN (Simple Traversal of UDP through NATs (Network Address
56 Translation)) server is an implementation of the STUN protocol that
57 enables STUN functionality in SIP-based systems. The STUN server
58 tar ball also include a client API to enable STUN functionality in
59 SIP endpoints. In addition there is a command line UNIX client and
60 a graphical windows client that check what type of NAT the user is
61 using. STUN is an application-layer protocol that can determine the
62 public IP and nature of a NAT device that sits between the STUN
63 client and STUN server. The current version of the code supports
64 most of RFC 3489 except the ability to get OTPs from the server.
66 %track
67 prog stun = {
68 version = %{V_dist}
69 url = http://prdownloads.sourceforge.net/stun/
70 regex = stund_(.+?)\.tgz
71 }
73 %prep
74 %setup -q -n stund
75 %patch -p0
76 case "%{l_platform -t}" in
77 *-sunos* )
78 %{l_shtool} subst \
79 -e 's;^\(LDFLAGS\)+=.*;\1=;' \
80 -e 's;^#\(LDFLAGS+=\) -lnsl -lsocket;\1-lsocket -lnsl;' \
81 Makefile
82 ;;
83 * )
84 %{l_shtool} subst \
85 -e 's;^\(LDFLAGS\)+=.*;\1=;' \
86 Makefile
87 ;;
88 esac
90 %build
91 %{l_make} %{l_mflags} \
92 CXX="%{l_cxx}" \
93 CXXFLAGS="%{l_cxxflags -O}"
95 %install
96 rm -rf $RPM_BUILD_ROOT
97 %{l_shtool} mkdir -f -p -m 755 \
98 $RPM_BUILD_ROOT%{l_prefix}/bin \
99 $RPM_BUILD_ROOT%{l_prefix}/sbin \
100 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
101 $RPM_BUILD_ROOT%{l_prefix}/var/stun
102 %{l_shtool} install -c -s -m 755 \
103 client $RPM_BUILD_ROOT%{l_prefix}/bin/stun
104 %{l_shtool} install -c -s -m 755 \
105 server $RPM_BUILD_ROOT%{l_prefix}/sbin/stund
106 %{l_shtool} install -c -m 755 %{l_value -s -a} \
107 %{SOURCE rc.stun} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
108 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
110 %files -f files
112 %clean
113 rm -rf $RPM_BUILD_ROOT
115 %post
116 if [ $1 -eq 1 ]; then
117 # display final hints on initial installation
118 ( echo "Before starting the STUN daemon, please set the configuration"
119 echo "variables \"stun_bind_addr{1,2}\" in $RPM_INSTALL_PREFIX/etc/rc.conf"
120 echo "to two *different* IP addresses bound to your host. STUN requires this."
121 ) | %{l_rpmtool} msg -b -t notice
122 fi
124 # after upgrade, restart service
125 [ $1 -eq 2 ] || exit 0
126 eval `%{l_rc} stun status 2>/dev/null`
127 [ ".$stun_active" = .yes ] && %{l_rc} stun restart
128 exit 0
130 %preun
131 # before erase, stop service and remove log files
132 [ $1 -eq 0 ] || exit 0
133 %{l_rc} stun stop 2>/dev/null
134 rm -f $RPM_INSTALL_PREFIX/var/stun/stun.pid >/dev/null 2>&1 || true
135 exit 0