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@121 | 1 | ## |
michael@121 | 2 | ## db.spec -- OpenPKG RPM Package Specification |
michael@121 | 3 | ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/> |
michael@121 | 4 | ## |
michael@121 | 5 | ## Permission to use, copy, modify, and distribute this software for |
michael@121 | 6 | ## any purpose with or without fee is hereby granted, provided that |
michael@121 | 7 | ## the above copyright notice and this permission notice appear in all |
michael@121 | 8 | ## copies. |
michael@121 | 9 | ## |
michael@121 | 10 | ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@121 | 11 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@121 | 12 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@121 | 13 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@121 | 14 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@121 | 15 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@121 | 16 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@121 | 17 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@121 | 18 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@121 | 19 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@121 | 20 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@121 | 21 | ## SUCH DAMAGE. |
michael@121 | 22 | ## |
michael@121 | 23 | |
michael@121 | 24 | # package version |
michael@121 | 25 | %define V_version 4.7.25 |
michael@121 | 26 | %define V_revision 3 |
michael@121 | 27 | |
michael@121 | 28 | # package information |
michael@121 | 29 | Name: db |
michael@121 | 30 | Summary: Berkeley-DB Library |
michael@121 | 31 | URL: http://www.oracle.com/database/berkeley-db.html |
michael@121 | 32 | Vendor: Keith Bostic |
michael@121 | 33 | Packager: OpenPKG Foundation e.V. |
michael@121 | 34 | Distribution: OpenPKG Community |
michael@121 | 35 | Class: BASE |
michael@121 | 36 | Group: Database |
michael@121 | 37 | License: BSD |
michael@121 | 38 | Version: %{V_version}.%{V_revision} |
michael@122 | 39 | Release: 20090401 |
michael@121 | 40 | |
michael@121 | 41 | # package options |
michael@121 | 42 | %option with_pthreads no |
michael@121 | 43 | %option with_compat no |
michael@121 | 44 | %option with_cxx no |
michael@121 | 45 | |
michael@121 | 46 | # package options sanity check |
michael@121 | 47 | %if "%{with_pthreads}" == "yes" |
michael@121 | 48 | %{warn: WARNING: enabling Pthreads will potentially let other packages fail to build! } |
michael@121 | 49 | %endif |
michael@121 | 50 | |
michael@121 | 51 | # list of sources |
michael@121 | 52 | Source0: http://download-uk.oracle.com/berkeley-db/db-%{V_version}.tar.gz |
michael@121 | 53 | Source1: db.pc |
michael@121 | 54 | Patch0: db.patch |
michael@121 | 55 | Patch1: http://www.oracle.com/technology/products/berkeley-db/db/update/%{V_version}/patch.%{V_version}.1 |
michael@121 | 56 | Patch2: http://www.oracle.com/technology/products/berkeley-db/db/update/%{V_version}/patch.%{V_version}.2 |
michael@121 | 57 | Patch3: http://www.oracle.com/technology/products/berkeley-db/db/update/%{V_version}/patch.%{V_version}.3 |
michael@121 | 58 | |
michael@121 | 59 | # build information |
michael@121 | 60 | Prefix: %{l_prefix} |
michael@121 | 61 | BuildRoot: %{l_buildroot} |
michael@121 | 62 | BuildPreReq: OpenPKG, openpkg >= 20040130, gcc |
michael@121 | 63 | PreReq: OpenPKG, openpkg >= 20040130 |
michael@121 | 64 | %if "%{with_cxx}" == "yes" |
michael@121 | 65 | BuildPreReq: gcc::with_cxx = yes |
michael@121 | 66 | %endif |
michael@121 | 67 | AutoReq: no |
michael@121 | 68 | AutoReqProv: no |
michael@121 | 69 | |
michael@121 | 70 | %description |
michael@121 | 71 | Berkeley DB is a programmatic toolkit that provides high-performance |
michael@121 | 72 | built-in database support for desktop and server applications and |
michael@121 | 73 | for information appliances. The Berkeley DB access methods include |
michael@121 | 74 | B+tree, Extended Linear Hashing, Fixed and Variable-length records, |
michael@121 | 75 | and Queues. Berkeley DB provides full transactional support, |
michael@121 | 76 | database recovery, online backups, and separate access to locking, |
michael@121 | 77 | logging and shared memory caching subsystems. |
michael@121 | 78 | |
michael@121 | 79 | %track |
michael@121 | 80 | prog db = { |
michael@121 | 81 | version = %{V_version} |
michael@121 | 82 | url = http://www.oracle.com/technology/software/products/berkeley-db/index.html |
michael@121 | 83 | regex = Berkeley\s+DB\s+(__VER__)\s+\.tar\.gz |
michael@121 | 84 | } |
michael@121 | 85 | |
michael@121 | 86 | %prep |
michael@121 | 87 | %setup -q -n db-%{V_version} |
michael@121 | 88 | %patch -p0 -P 0 |
michael@121 | 89 | %patch -p0 -P 1 |
michael@121 | 90 | %patch -p0 -P 2 |
michael@121 | 91 | %patch -p0 -P 3 |
michael@121 | 92 | |
michael@121 | 93 | %{l_shtool} subst \ |
michael@121 | 94 | -e 's;\($(ar) cr .*\);\1 _udivdi3.o _muldi3.o _clz.o;' \ |
michael@121 | 95 | -e 's;install_utilities install_docs;install_utilities;' \ |
michael@121 | 96 | dist/Makefile.in |
michael@122 | 97 | %{l_shtool} subst \ |
michael@122 | 98 | -e 's;u_int\([0-9][0-9]*_t\);uint\1;g' \ |
michael@122 | 99 | build_brew/db_int.h dist/aclocal/types.m4 \ |
michael@122 | 100 | dist/configure dbinc_auto/* dbinc/* \ |
michael@122 | 101 | btree/* common/* crypto/* db_archive/* db_checkpoint/* \ |
michael@122 | 102 | db_codegen/* db_deadlock/* db_dump/* db_hotbackup/* \ |
michael@122 | 103 | db_load/* db_printlog/* db_recover/* db_stat/* \ |
michael@122 | 104 | db_upgrade/* db_verify/* db/* db185/* dbreg/* env/* \ |
michael@122 | 105 | fileops/* hash/* hmac/* hsearch/* lock/* log/* \ |
michael@122 | 106 | crypto/mersenne/* mp/* mutex/* os/* qam/* rep/* \ |
michael@122 | 107 | repmgr/* crypto/rijndael/* sequence/* txn/* xa/* |
michael@121 | 108 | |
michael@121 | 109 | %build |
michael@121 | 110 | # configure library |
michael@121 | 111 | %if "%{with_pthreads}" == "yes" |
michael@121 | 112 | mutex="POSIX/pthreads" |
michael@121 | 113 | %else |
michael@121 | 114 | mutex="no" |
michael@121 | 115 | case "%{l_platform -p}" in |
michael@121 | 116 | amd64-* ) mutex="x86_64/gcc-assembly";; |
michael@121 | 117 | ix86-* ) mutex="x86/gcc-assembly" ;; |
michael@121 | 118 | ia64-* ) mutex="ia64/gcc-assembly" ;; |
michael@121 | 119 | sparc*-* ) mutex="Sparc/gcc-assembly" ;; |
michael@121 | 120 | ppc*-* ) mutex="PPC/gcc-assembly" ;; |
michael@121 | 121 | alpha*-* ) mutex="ALPHA/gcc-assembly" ;; |
michael@121 | 122 | * ) mutex="UNIX/fcntl" ;; |
michael@121 | 123 | esac |
michael@121 | 124 | %endif |
michael@121 | 125 | cd build_unix |
michael@121 | 126 | CC="%{l_cc}" \ |
michael@121 | 127 | CFLAGS="%{l_cflags -O}" \ |
michael@121 | 128 | %if "%{with_cxx}" == "yes" |
michael@121 | 129 | CXX="%{l_cxx}" \ |
michael@121 | 130 | CXXFLAGS="%{l_cxxflags -O}" \ |
michael@121 | 131 | %endif |
michael@121 | 132 | GREP="grep" \ |
michael@121 | 133 | ../dist/configure \ |
michael@121 | 134 | --prefix=%{l_prefix} \ |
michael@121 | 135 | %if "%{with_compat}" == "yes" |
michael@121 | 136 | --enable-compat185 \ |
michael@121 | 137 | %else |
michael@121 | 138 | --disable-compat185 \ |
michael@121 | 139 | %endif |
michael@121 | 140 | %if "%{with_cxx}" == "yes" |
michael@121 | 141 | --enable-cxx \ |
michael@121 | 142 | %else |
michael@121 | 143 | --disable-cxx \ |
michael@121 | 144 | %endif |
michael@121 | 145 | --disable-java \ |
michael@121 | 146 | --with-mutex="$mutex" \ |
michael@121 | 147 | %if "%{with_pthreads}" == "yes" |
michael@121 | 148 | --enable-pthread_api \ |
michael@121 | 149 | %endif |
michael@121 | 150 | --disable-shared |
michael@121 | 151 | |
michael@121 | 152 | # build library |
michael@121 | 153 | ar -vx `%{l_cc} -print-libgcc-file-name` _udivdi3.o _muldi3.o _clz.o |
michael@121 | 154 | %{l_make} %{l_mflags -O} |
michael@121 | 155 | |
michael@121 | 156 | %install |
michael@121 | 157 | # install library |
michael@121 | 158 | rm -rf $RPM_BUILD_ROOT |
michael@121 | 159 | ( cd build_unix |
michael@121 | 160 | %{l_make} %{l_mflags} install \ |
michael@121 | 161 | prefix=$RPM_BUILD_ROOT%{l_prefix} |
michael@121 | 162 | ) || exit $? |
michael@121 | 163 | |
michael@121 | 164 | # strip down installation |
michael@121 | 165 | rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libdb-[0-9]*.a |
michael@121 | 166 | strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true |
michael@121 | 167 | %if "%{with_compat}" == "no" |
michael@121 | 168 | rm -f $RPM_BUILD_ROOT%{l_prefix}/include/db_185.h |
michael@121 | 169 | %endif |
michael@121 | 170 | %if "%{with_cxx}" == "no" |
michael@121 | 171 | rm -f $RPM_BUILD_ROOT%{l_prefix}/include/db_cxx.h |
michael@121 | 172 | rm -f $RPM_BUILD_ROOT%{l_prefix}/include/cxx_*.h |
michael@121 | 173 | %endif |
michael@121 | 174 | |
michael@121 | 175 | # install pkg-config configuration |
michael@121 | 176 | libs="-ldb" |
michael@121 | 177 | case "%{l_platform -t}" in |
michael@121 | 178 | *-sunos* ) libs="$libs -lrt -lsocket -lnsl" ;; |
michael@121 | 179 | esac |
michael@121 | 180 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@121 | 181 | $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig |
michael@121 | 182 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@121 | 183 | -e "s;@version@;%{version};" \ |
michael@121 | 184 | -e "s;@libs@;$libs;" \ |
michael@121 | 185 | %{SOURCE db.pc} \ |
michael@121 | 186 | $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/ |
michael@121 | 187 | |
michael@121 | 188 | # determine installation files |
michael@121 | 189 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} |
michael@121 | 190 | |
michael@121 | 191 | %files -f files |
michael@121 | 192 | |
michael@121 | 193 | %clean |
michael@121 | 194 | rm -rf $RPM_BUILD_ROOT |
michael@121 | 195 |