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.
michael@52 | 1 | ## |
michael@52 | 2 | ## stun.spec -- OpenPKG RPM Package Specification |
michael@52 | 3 | ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/> |
michael@52 | 4 | ## |
michael@52 | 5 | ## Permission to use, copy, modify, and distribute this software for |
michael@52 | 6 | ## any purpose with or without fee is hereby granted, provided that |
michael@52 | 7 | ## the above copyright notice and this permission notice appear in all |
michael@52 | 8 | ## copies. |
michael@52 | 9 | ## |
michael@52 | 10 | ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@52 | 11 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@52 | 12 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@52 | 13 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@52 | 14 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@52 | 15 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@52 | 16 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@52 | 17 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@52 | 18 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@52 | 19 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@52 | 20 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@52 | 21 | ## SUCH DAMAGE. |
michael@52 | 22 | ## |
michael@52 | 23 | |
michael@52 | 24 | # package version |
michael@52 | 25 | %define V_dist 0.96_Aug13 |
michael@52 | 26 | %define V_opkg 0.96 |
michael@52 | 27 | |
michael@52 | 28 | # package information |
michael@52 | 29 | Name: stun |
michael@52 | 30 | Summary: STUN Client & Server |
michael@52 | 31 | URL: http://www.vovida.org/applications/downloads/stun/ |
michael@52 | 32 | Vendor: Vovida |
michael@52 | 33 | Packager: OpenPKG Foundation e.V. |
michael@52 | 34 | Distribution: OpenPKG Community |
michael@52 | 35 | Class: EVAL |
michael@52 | 36 | Group: VoIP |
michael@52 | 37 | License: Open Source |
michael@52 | 38 | Version: %{V_opkg} |
michael@53 | 39 | Release: 20090106 |
michael@52 | 40 | |
michael@52 | 41 | # list of sources |
michael@52 | 42 | Source0: http://switch.dl.sourceforge.net/stun/stund_%{V_dist}.tgz |
michael@52 | 43 | Source1: rc.stun |
michael@52 | 44 | Patch0: stun.patch |
michael@52 | 45 | |
michael@52 | 46 | # build information |
michael@52 | 47 | Prefix: %{l_prefix} |
michael@52 | 48 | BuildRoot: %{l_buildroot} |
michael@85 | 49 | BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc, gcc::with_cxx = yes |
michael@52 | 50 | PreReq: OpenPKG, openpkg >= 20060823 |
michael@52 | 51 | AutoReq: no |
michael@52 | 52 | AutoReqProv: no |
michael@52 | 53 | |
michael@52 | 54 | %description |
michael@52 | 55 | The STUN (Simple Traversal of UDP through NATs (Network Address |
michael@52 | 56 | Translation)) server is an implementation of the STUN protocol that |
michael@52 | 57 | enables STUN functionality in SIP-based systems. The STUN server |
michael@52 | 58 | tar ball also include a client API to enable STUN functionality in |
michael@52 | 59 | SIP endpoints. In addition there is a command line UNIX client and |
michael@52 | 60 | a graphical windows client that check what type of NAT the user is |
michael@52 | 61 | using. STUN is an application-layer protocol that can determine the |
michael@52 | 62 | public IP and nature of a NAT device that sits between the STUN |
michael@52 | 63 | client and STUN server. The current version of the code supports |
michael@52 | 64 | most of RFC 3489 except the ability to get OTPs from the server. |
michael@52 | 65 | |
michael@52 | 66 | %track |
michael@52 | 67 | prog stun = { |
michael@52 | 68 | version = %{V_dist} |
michael@52 | 69 | url = http://prdownloads.sourceforge.net/stun/ |
michael@52 | 70 | regex = stund_(.+?)\.tgz |
michael@52 | 71 | } |
michael@52 | 72 | |
michael@52 | 73 | %prep |
michael@52 | 74 | %setup -q -n stund |
michael@52 | 75 | %patch -p0 |
michael@53 | 76 | case "%{l_platform -t}" in |
michael@53 | 77 | *-sunos* ) |
michael@53 | 78 | %{l_shtool} subst \ |
michael@53 | 79 | -e 's;^\(LDFLAGS\)+=.*;\1=;' \ |
michael@53 | 80 | -e 's;^#\(LDFLAGS+=\) -lnsl -lsocket;\1-lsocket -lnsl;' \ |
michael@53 | 81 | Makefile |
michael@53 | 82 | ;; |
michael@53 | 83 | * ) |
michael@53 | 84 | %{l_shtool} subst \ |
michael@53 | 85 | -e 's;^\(LDFLAGS\)+=.*;\1=;' \ |
michael@53 | 86 | Makefile |
michael@53 | 87 | ;; |
michael@53 | 88 | esac |
michael@52 | 89 | |
michael@52 | 90 | %build |
michael@52 | 91 | %{l_make} %{l_mflags} \ |
michael@52 | 92 | CXX="%{l_cxx}" \ |
michael@53 | 93 | CXXFLAGS="%{l_cxxflags -O}" |
michael@52 | 94 | |
michael@52 | 95 | %install |
michael@52 | 96 | rm -rf $RPM_BUILD_ROOT |
michael@52 | 97 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@52 | 98 | $RPM_BUILD_ROOT%{l_prefix}/bin \ |
michael@52 | 99 | $RPM_BUILD_ROOT%{l_prefix}/sbin \ |
michael@52 | 100 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ |
michael@52 | 101 | $RPM_BUILD_ROOT%{l_prefix}/var/stun |
michael@52 | 102 | %{l_shtool} install -c -s -m 755 \ |
michael@52 | 103 | client $RPM_BUILD_ROOT%{l_prefix}/bin/stun |
michael@52 | 104 | %{l_shtool} install -c -s -m 755 \ |
michael@52 | 105 | server $RPM_BUILD_ROOT%{l_prefix}/sbin/stund |
michael@52 | 106 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@52 | 107 | %{SOURCE rc.stun} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
michael@52 | 108 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} |
michael@52 | 109 | |
michael@52 | 110 | %files -f files |
michael@52 | 111 | |
michael@52 | 112 | %clean |
michael@52 | 113 | rm -rf $RPM_BUILD_ROOT |
michael@52 | 114 | |
michael@52 | 115 | %post |
michael@52 | 116 | if [ $1 -eq 1 ]; then |
michael@52 | 117 | # display final hints on initial installation |
michael@52 | 118 | ( echo "Before starting the STUN daemon, please set the configuration" |
michael@52 | 119 | echo "variables \"stun_bind_addr{1,2}\" in $RPM_INSTALL_PREFIX/etc/rc.conf" |
michael@52 | 120 | echo "to two *different* IP addresses bound to your host. STUN requires this." |
michael@52 | 121 | ) | %{l_rpmtool} msg -b -t notice |
michael@52 | 122 | fi |
michael@52 | 123 | |
michael@52 | 124 | # after upgrade, restart service |
michael@52 | 125 | [ $1 -eq 2 ] || exit 0 |
michael@52 | 126 | eval `%{l_rc} stun status 2>/dev/null` |
michael@52 | 127 | [ ".$stun_active" = .yes ] && %{l_rc} stun restart |
michael@52 | 128 | exit 0 |
michael@52 | 129 | |
michael@52 | 130 | %preun |
michael@52 | 131 | # before erase, stop service and remove log files |
michael@52 | 132 | [ $1 -eq 0 ] || exit 0 |
michael@52 | 133 | %{l_rc} stun stop 2>/dev/null |
michael@52 | 134 | rm -f $RPM_INSTALL_PREFIX/var/stun/stun.pid >/dev/null 2>&1 || true |
michael@52 | 135 | exit 0 |
michael@52 | 136 |