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 ## glib2.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2010 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_glib2_major 2.25
26 %define V_glib2_minor 13
28 # package information
29 Name: glib2
30 Summary: The Gtk Utility Library
31 URL: http://www.gtk.org/
32 Vendor: The Gtk Project
33 Packager: OpenPKG Foundation e.V.
34 Distribution: OpenPKG Community
35 Class: BASE
36 Group: Algorithm
37 License: GPL
38 Version: %{V_glib2_major}.%{V_glib2_minor}
39 Release: 20101020
41 # package options
42 %option with_threads yes
44 # list of sources
45 Source0: ftp://ftp.gnome.org/pub/gnome/sources/glib/%{V_glib2_major}/glib-%{version}.tar.gz
46 Patch0: glib2.patch
48 # build information
49 Prefix: %{l_prefix}
50 BuildRoot: %{l_buildroot}
51 BuildPreReq: OpenPKG, openpkg >= 20100101, perl, make, pkgconfig
52 PreReq: OpenPKG, openpkg >= 20100101, perl
53 BuildPreReq: gettext, libiconv, pcre, pcre::with_utf8 = yes
54 PreReq: gettext, libiconv, pcre, pcre::with_utf8 = yes
56 %description
57 GLib is the low-level core library that originally was split out
58 from Gtk+. It provides data structure handling for C, portability
59 wrappers, and interfaces for such runtime functionality as an event
60 loop, threads, dynamic loading, and an object system.
62 %track
63 prog glib2 = {
64 version = %{version}
65 url = ftp://ftp.gnome.org/pub/gnome/sources/glib/%{V_glib2_major}/
66 regex = glib-(__VER__)\.tar\.(gz|bz2)
67 }
69 %prep
70 %setup -q -n glib-%{version}
71 %patch -p0
73 %build
74 # configure package
75 %{l_shtool} subst \
76 -e 's;\$export_dynamic_flag_spec;;g' \
77 -e 's;eval echo \\\\;eval echo ;' \
78 configure
79 %{l_shtool} subst \
80 -e 's;/glib-2\.0\.pc;/glib-x.x.pc;g' \
81 -e 's;/gobject-2\.0\.pc;/gobject-x.x.pc;g' \
82 -e 's;/gthread-2\.0\.pc;/gthread-x.x.pc;g' \
83 -e 's;/gmodule-2\.0\.pc;/gmodule-x.x.pc;g' \
84 -e 's;/gio-unix-2\.0\.pc;/gio-unix-x.x.pc;g' \
85 -e 's;/gio-2\.0\.pc;/gio-x.x.pc;g' \
86 -e 's;/glib-2\.0;/glib2;g' \
87 -e 's;/gobject-2\.0;/gobject2;g' \
88 -e 's;/gthread-2\.0;/gthread2;g' \
89 -e 's;/gmodule-2\.0;/gmodule2;g' \
90 -e 's;/gio-unix-2\.0;/gio-unix2;g' \
91 -e 's;/gio-2\.0;/gio2;g' \
92 -e 's;/glib-x\.x\.pc;/glib-2.0.pc;g' \
93 -e 's;/gobject-x\.x\.pc;/gobject-2.0.pc;g' \
94 -e 's;/gthread-x\.x\.pc;/gthread-2.0.pc;g' \
95 -e 's;/gmodule-x\.x\.pc;/gmodule-2.0.pc;g' \
96 -e 's;/gio-unix-x\.x\.pc;/gio-unix-2.0.pc;g' \
97 -e 's;/gio-x\.x\.pc;/gio-2.0.pc;g' \
98 -e 's;lib\(g[a-z]*\)-2\.0;lib\12;g' \
99 `find . -name Makefile.in -print` \
100 m4macros/glib-2.0.m4
101 %{l_shtool} subst \
102 -e 's;/glib-2\.0;/glib2;g' \
103 -e 's;/gobject-2\.0;/gobject2;g' \
104 -e 's;/gthread-2\.0;/gthread2;g' \
105 -e 's;/gmodule-2\.0;/gmodule2;g' \
106 -e 's;/gio-unix-2\.0;/gio-unix2;g' \
107 -e 's;/gio-2\.0;/gio2;g' \
108 -e 's;-l\(g[a-z]*\)-2\.0;-l\12;g' \
109 *-2.0.pc.in
110 libs=""
111 %if "%{with_threads}" == "yes"
112 case "%{l_platform -t}" in
113 *-netbsd* ) libs="-lpthread" ;;
114 esac
115 %endif
116 CC="%{l_cc}" \
117 CFLAGS="%{l_cflags -O}" \
118 CPPFLAGS="%{l_cppflags}" \
119 LDFLAGS="%{l_ldflags}" \
120 LIBS="$libs" \
121 PERL="%{l_prefix}/bin/perl" \
122 PERL_PATH="%{l_prefix}/bin/perl" \
123 GREP="grep" \
124 ./configure \
125 --prefix=%{l_prefix} \
126 --mandir=%{l_prefix}/man \
127 --with-libiconv=gnu \
128 --disable-debug \
129 --disable-shared \
130 --with-pcre=system \
131 %if "%{with_threads}" == "yes"
132 --enable-threads \
133 %else
134 --disable-threads \
135 %endif
136 --disable-gtk-doc \
137 --disable-dtrace
139 # build package
140 %{l_make} %{l_mflags}
142 %install
143 rm -rf $RPM_BUILD_ROOT
145 # install package
146 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
148 # strip down installation
149 rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
150 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/charset.alias
151 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/locale
152 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/glib-2.0
153 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/gtk-doc
154 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/gdb
155 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
156 rm $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
158 # determine installation files
159 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
161 %files -f files
163 %clean
164 rm -rf $RPM_BUILD_ROOT