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 ## db.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_version 4.7.25
26 %define V_revision 3
28 # package information
29 Name: db
30 Summary: Berkeley-DB Library
31 URL: http://www.oracle.com/database/berkeley-db.html
32 Vendor: Keith Bostic
33 Packager: OpenPKG Foundation e.V.
34 Distribution: OpenPKG Community
35 Class: BASE
36 Group: Database
37 License: BSD
38 Version: %{V_version}.%{V_revision}
39 Release: 20090401
41 # package options
42 %option with_pthreads no
43 %option with_compat no
44 %option with_cxx no
46 # package options sanity check
47 %if "%{with_pthreads}" == "yes"
48 %{warn: WARNING: enabling Pthreads will potentially let other packages fail to build! }
49 %endif
51 # list of sources
52 Source0: http://download-uk.oracle.com/berkeley-db/db-%{V_version}.tar.gz
53 Source1: db.pc
54 Patch0: db.patch
55 Patch1: http://www.oracle.com/technology/products/berkeley-db/db/update/%{V_version}/patch.%{V_version}.1
56 Patch2: http://www.oracle.com/technology/products/berkeley-db/db/update/%{V_version}/patch.%{V_version}.2
57 Patch3: http://www.oracle.com/technology/products/berkeley-db/db/update/%{V_version}/patch.%{V_version}.3
59 # build information
60 Prefix: %{l_prefix}
61 BuildRoot: %{l_buildroot}
62 BuildPreReq: OpenPKG, openpkg >= 20040130, gcc
63 PreReq: OpenPKG, openpkg >= 20040130
64 %if "%{with_cxx}" == "yes"
65 BuildPreReq: gcc::with_cxx = yes
66 %endif
67 AutoReq: no
68 AutoReqProv: no
70 %description
71 Berkeley DB is a programmatic toolkit that provides high-performance
72 built-in database support for desktop and server applications and
73 for information appliances. The Berkeley DB access methods include
74 B+tree, Extended Linear Hashing, Fixed and Variable-length records,
75 and Queues. Berkeley DB provides full transactional support,
76 database recovery, online backups, and separate access to locking,
77 logging and shared memory caching subsystems.
79 %track
80 prog db = {
81 version = %{V_version}
82 url = http://www.oracle.com/technology/software/products/berkeley-db/index.html
83 regex = Berkeley\s+DB\s+(__VER__)\s+\.tar\.gz
84 }
86 %prep
87 %setup -q -n db-%{V_version}
88 %patch -p0 -P 0
89 %patch -p0 -P 1
90 %patch -p0 -P 2
91 %patch -p0 -P 3
93 %{l_shtool} subst \
94 -e 's;\($(ar) cr .*\);\1 _udivdi3.o _muldi3.o _clz.o;' \
95 -e 's;install_utilities install_docs;install_utilities;' \
96 dist/Makefile.in
97 %{l_shtool} subst \
98 -e 's;u_int\([0-9][0-9]*_t\);uint\1;g' \
99 build_brew/db_int.h dist/aclocal/types.m4 \
100 dist/configure dbinc_auto/* dbinc/* \
101 btree/* common/* crypto/* db_archive/* db_checkpoint/* \
102 db_codegen/* db_deadlock/* db_dump/* db_hotbackup/* \
103 db_load/* db_printlog/* db_recover/* db_stat/* \
104 db_upgrade/* db_verify/* db/* db185/* dbreg/* env/* \
105 fileops/* hash/* hmac/* hsearch/* lock/* log/* \
106 crypto/mersenne/* mp/* mutex/* os/* qam/* rep/* \
107 repmgr/* crypto/rijndael/* sequence/* txn/* xa/*
109 %build
110 # configure library
111 %if "%{with_pthreads}" == "yes"
112 mutex="POSIX/pthreads"
113 %else
114 mutex="no"
115 case "%{l_platform -p}" in
116 amd64-* ) mutex="x86_64/gcc-assembly";;
117 ix86-* ) mutex="x86/gcc-assembly" ;;
118 ia64-* ) mutex="ia64/gcc-assembly" ;;
119 sparc*-* ) mutex="Sparc/gcc-assembly" ;;
120 ppc*-* ) mutex="PPC/gcc-assembly" ;;
121 alpha*-* ) mutex="ALPHA/gcc-assembly" ;;
122 * ) mutex="UNIX/fcntl" ;;
123 esac
124 %endif
125 cd build_unix
126 CC="%{l_cc}" \
127 CFLAGS="%{l_cflags -O}" \
128 %if "%{with_cxx}" == "yes"
129 CXX="%{l_cxx}" \
130 CXXFLAGS="%{l_cxxflags -O}" \
131 %endif
132 GREP="grep" \
133 ../dist/configure \
134 --prefix=%{l_prefix} \
135 %if "%{with_compat}" == "yes"
136 --enable-compat185 \
137 %else
138 --disable-compat185 \
139 %endif
140 %if "%{with_cxx}" == "yes"
141 --enable-cxx \
142 %else
143 --disable-cxx \
144 %endif
145 --disable-java \
146 --with-mutex="$mutex" \
147 %if "%{with_pthreads}" == "yes"
148 --enable-pthread_api \
149 %endif
150 --disable-shared
152 # build library
153 ar -vx `%{l_cc} -print-libgcc-file-name` _udivdi3.o _muldi3.o _clz.o
154 %{l_make} %{l_mflags -O}
156 %install
157 # install library
158 rm -rf $RPM_BUILD_ROOT
159 ( cd build_unix
160 %{l_make} %{l_mflags} install \
161 prefix=$RPM_BUILD_ROOT%{l_prefix}
162 ) || exit $?
164 # strip down installation
165 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libdb-[0-9]*.a
166 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
167 %if "%{with_compat}" == "no"
168 rm -f $RPM_BUILD_ROOT%{l_prefix}/include/db_185.h
169 %endif
170 %if "%{with_cxx}" == "no"
171 rm -f $RPM_BUILD_ROOT%{l_prefix}/include/db_cxx.h
172 rm -f $RPM_BUILD_ROOT%{l_prefix}/include/cxx_*.h
173 %endif
175 # install pkg-config configuration
176 libs="-ldb"
177 case "%{l_platform -t}" in
178 *-sunos* ) libs="$libs -lrt -lsocket -lnsl" ;;
179 esac
180 %{l_shtool} mkdir -f -p -m 755 \
181 $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig
182 %{l_shtool} install -c -m 644 %{l_value -s -a} \
183 -e "s;@version@;%{version};" \
184 -e "s;@libs@;$libs;" \
185 %{SOURCE db.pc} \
186 $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
188 # determine installation files
189 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
191 %files -f files
193 %clean
194 rm -rf $RPM_BUILD_ROOT