Wed, 01 Apr 2009 16:24:45 +0200
Import package vendor original specs for necessary manipulations.
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: 20081221
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
98 %build
99 # configure library
100 %if "%{with_pthreads}" == "yes"
101 mutex="POSIX/pthreads"
102 %else
103 mutex="no"
104 case "%{l_platform -p}" in
105 amd64-* ) mutex="x86_64/gcc-assembly";;
106 ix86-* ) mutex="x86/gcc-assembly" ;;
107 ia64-* ) mutex="ia64/gcc-assembly" ;;
108 sparc*-* ) mutex="Sparc/gcc-assembly" ;;
109 ppc*-* ) mutex="PPC/gcc-assembly" ;;
110 alpha*-* ) mutex="ALPHA/gcc-assembly" ;;
111 * ) mutex="UNIX/fcntl" ;;
112 esac
113 %endif
114 cd build_unix
115 CC="%{l_cc}" \
116 CFLAGS="%{l_cflags -O}" \
117 %if "%{with_cxx}" == "yes"
118 CXX="%{l_cxx}" \
119 CXXFLAGS="%{l_cxxflags -O}" \
120 %endif
121 GREP="grep" \
122 ../dist/configure \
123 --prefix=%{l_prefix} \
124 %if "%{with_compat}" == "yes"
125 --enable-compat185 \
126 %else
127 --disable-compat185 \
128 %endif
129 %if "%{with_cxx}" == "yes"
130 --enable-cxx \
131 %else
132 --disable-cxx \
133 %endif
134 --disable-java \
135 --with-mutex="$mutex" \
136 %if "%{with_pthreads}" == "yes"
137 --enable-pthread_api \
138 %endif
139 --disable-shared
141 # build library
142 ar -vx `%{l_cc} -print-libgcc-file-name` _udivdi3.o _muldi3.o _clz.o
143 %{l_make} %{l_mflags -O}
145 %install
146 # install library
147 rm -rf $RPM_BUILD_ROOT
148 ( cd build_unix
149 %{l_make} %{l_mflags} install \
150 prefix=$RPM_BUILD_ROOT%{l_prefix}
151 ) || exit $?
153 # strip down installation
154 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libdb-[0-9]*.a
155 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
156 %if "%{with_compat}" == "no"
157 rm -f $RPM_BUILD_ROOT%{l_prefix}/include/db_185.h
158 %endif
159 %if "%{with_cxx}" == "no"
160 rm -f $RPM_BUILD_ROOT%{l_prefix}/include/db_cxx.h
161 rm -f $RPM_BUILD_ROOT%{l_prefix}/include/cxx_*.h
162 %endif
164 # install pkg-config configuration
165 libs="-ldb"
166 case "%{l_platform -t}" in
167 *-sunos* ) libs="$libs -lrt -lsocket -lnsl" ;;
168 esac
169 %{l_shtool} mkdir -f -p -m 755 \
170 $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig
171 %{l_shtool} install -c -m 644 %{l_value -s -a} \
172 -e "s;@version@;%{version};" \
173 -e "s;@libs@;$libs;" \
174 %{SOURCE db.pc} \
175 $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
177 # determine installation files
178 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
180 %files -f files
182 %clean
183 rm -rf $RPM_BUILD_ROOT