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 ## libupnp.spec -- OpenPKG RPM Specification
3 ## Copyright (c) 2009 Michael Schloh von Bennewitz <michael@schloh.com>
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 ##
25 # package information
26 Name: libupnp
27 Summary: Universal Plug and Play (UPnP) SDK
28 URL: http://pupnp.sourceforge.net/
29 Vendor: Michel Pfeiffer
30 Packager: Michael Schloh von Bennewitz
31 Distribution: Michael Schloh von Bennewitz
32 Class: EVAL
33 Group: Network
34 License: BSD
35 Version: 1.6.6
36 Release: 20090106
38 # list of sources
39 Source0: http://switch.dl.sourceforge.net/pupnp/libupnp-%{version}.tar.bz2
40 Patch0: libupnp.patch
42 # build information
43 Prefix: %{l_prefix}
44 BuildRoot: %{l_buildroot}
45 BuildPreReq: OpenPKG, openpkg >= 20040130, make
46 PreReq: OpenPKG, openpkg >= 20040130
47 AutoReq: no
48 AutoReqProv: no
50 %description
51 The portable Universal Plug and Play (UPnP) SDK provides support
52 for building UPnP compliant control points, devices, and bridges
53 that are compliant with version 1.0 of the Universal Plug and
54 Play device architecture specification.
56 %track
57 prog libupnp = {
58 version = %{version}
59 url = http://prdownloads.sourceforge.net/upnp/
60 regex = libupnp-(__VER__)\.tar\.bz2
61 }
63 %prep
64 # unpack sources
65 %setup -q
66 %patch -p0
68 # apply coorections
69 %{l_shtool} subst \
70 -e 's;#if defined(_sun);#if (defined(sun) \&\& defined(__svr4__));' \
71 upnp/src/api/upnpapi.c
72 %{l_shtool} subst \
73 -e 's;defined(SPARC_SOLARIS);(defined(sun) \&\& defined(__svr4__));' \
74 upnp/src/genlib/net/uri/uri.c
75 %{l_shtool} subst \
76 -e 's;\(uuid_create_from_name\);\1_upnp;g' \
77 -e 's;\(uuid_compare\);\1_upnp;g' \
78 -e 's;\(uuid_create\);\1_upnp;g' \
79 -e 's;\(uuid_unpack\);\1_upnp;g' \
80 upnp/src/gena/gena_device.c \
81 upnp/src/gena/gena_ctrlpt.c \
82 upnp/src/uuid/uuid.c \
83 upnp/src/inc/uuid.h
85 %build
86 # query for platform specific libraries
87 loclibs=""
88 case "%{l_platform -t}" in
89 *-sunos* ) loclibs="-lsocket -lnsl -lrt" ;;
90 esac
92 # prepare build configuration
93 CC="%{l_cc}" \
94 CFLAGS="%{l_cflags -O}" \
95 CPPFLAGS="%{l_cppflags}" \
96 LDFLAGS="%{l_ldflags}" \
97 LIBS="$loclibs" \
98 GREP=grep \
99 ./configure \
100 --prefix=%{l_prefix} \
101 --disable-shared
103 # build using parallel make
104 %{l_make} %{l_mflags -O}
106 %install
107 # remove previously existing installations
108 rm -rf $RPM_BUILD_ROOT
110 # run the native installation logic
111 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
113 # install docs
114 %{l_shtool} mkdir -f -p -m 755 \
115 $RPM_BUILD_ROOT%{l_prefix}/share/libupnp/doc/pdf \
116 $RPM_BUILD_ROOT%{l_prefix}/share/libupnp/doc/html/ixml \
117 $RPM_BUILD_ROOT%{l_prefix}/share/libupnp/doc/html/upnp
118 %{l_shtool} install -c -m 644 \
119 docs/dist/html/ixml/* \
120 $RPM_BUILD_ROOT%{l_prefix}/share/libupnp/doc/html/ixml/
121 %{l_shtool} install -c -m 644 \
122 docs/dist/html/upnp/* \
123 $RPM_BUILD_ROOT%{l_prefix}/share/libupnp/doc/html/upnp/
124 %{l_shtool} install -c -m 644 \
125 docs/dist/*.pdf \
126 $RPM_BUILD_ROOT%{l_prefix}/share/libupnp/doc/pdf/
128 # install examples
129 %{l_shtool} mkdir -f -p -m 755 \
130 $RPM_BUILD_ROOT%{l_prefix}/share/libupnp/examples
131 %{l_shtool} install -c -m 755 \
132 upnp/sample/upnp_tv_combo \
133 upnp/sample/upnp_tv_ctrlpt \
134 upnp/sample/upnp_tv_device \
135 $RPM_BUILD_ROOT%{l_prefix}/share/libupnp/examples/
137 # determine installation files
138 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
139 %{l_files_std} \
140 '%doc %{l_prefix}/share/libupnp/doc/html/*/*' \
141 '%doc %{l_prefix}/share/libupnp/doc/pdf/*' \
142 '%not %dir %{l_prefix}/lib/pkgconfig'
144 %files -f files
146 %clean
147 rm -rf $RPM_BUILD_ROOT
149 %post
150 # after installing or upgrading package networking reminder
151 ( echo "Before using UPnP, the network must be able to multicast route."
152 echo "The following command may add a static multicast route:"
153 echo " # route add -net 239.0.0.0 netmask 255.0.0.0 dev eth0"
154 ) | %{l_rpmtool} msg -b -t notice
155 exit 0