Fri, 17 Apr 2009 23:40:08 +0200
Update and completely overhaul packaging and build configuration.
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