Remove useless code from spec file.
[platform/upstream/db4.git] / packaging / db4.spec
1 %define         generic_name db
2 %define         docdir %{_defaultdocdir}/%{name}
3 %define         major 4
4 %define         minor 8
5
6 Name:           db4
7 Version:        %{major}.%{minor}.30.NC
8 Release:        0
9 Summary:        Berkeley DB Database Library Version 4.8
10 License:        BSD-3-Clause
11 Group:          System/Libraries
12 Url:            http://www.sleepycat.com
13 Source:         db-%{version}.tar.gz
14 Source1:        %{name}.changes
15 Source9:        getpatches
16 Source1001:     db4.manifest
17 BuildRequires:  autoconf
18 BuildRequires:  fdupes
19 BuildRequires:  gcc-c++
20 Provides:       db = %{version}
21
22 %description
23 The Berkeley DB Database is a programmatic toolkit that provides
24 database support for applications.
25
26 This package contains the necessary runtime libraries.
27
28 %package utils
29 Summary:        Command Line tools for Managing Berkeley DB Databases
30 Group:          Productivity/Databases/Tools
31
32 %description utils
33 The Berkeley DB Database is a programmatic toolkit that provides
34 database support for applications.
35
36 This package contains the command line tools for managing Berkeley DB
37 databases.
38
39 %package doc
40 Summary:        Documentation for Berkeley DB
41 Group:          Development/Libraries/C and C++
42 BuildArch:      noarch
43
44 %description doc
45 The Berkeley DB Database is a programmatic toolkit that provides
46 database support for applications.
47
48 This package contains the documentation.
49
50 %package        devel
51 Summary:        Development Files and Libraries for the Berkeley DB library Version 4.8
52 Group:          Development/Libraries/C and C++
53 Requires:       %{name} = %{version}
54 Requires:       glibc-devel
55
56 %description    devel
57 The Berkeley DB Database is a programmatic toolkit that provides
58 database support for applications.
59
60 This package contains the header files and libraries.
61
62 %prep
63 %setup -q -n %{generic_name}-%{version}
64 cp %{SOURCE1001} .
65
66 %build
67 cd dist
68 # dist/RELEASE codes the build date into the binary.
69 # Use last change of changes file instead
70 LAST_MOD=`stat --format="%Y" %SOURCE1`
71 DIST_DATE=`date '+%B %e, %Y' --date="@$LAST_MOD"`
72 sed -i -e "s/^DB_RELEASE_DATE=.*$/DB_RELEASE_DATE=\"$DIST_DATE\"/" RELEASE
73 ./s_config
74 CFLAGS="%{optflags} -fno-strict-aliasing"
75 CC=gcc
76 export CFLAGS CXXFLAGS CC
77 #
78 # Build now the NPTL version
79 #
80 mkdir ../build_nptl
81 cd ../build_nptl
82 ../dist/configure --prefix=%{_prefix} \
83         --libdir=%{_libdir} --enable-compat185 --disable-dump185 \
84         --enable-shared --disable-static --enable-cxx \
85         --with-mutex="POSIX/pthreads/library" \
86 %ifarch %arm
87         %{_target_cpu}-suse-linux-gnueabi
88 %else
89         %{_target_cpu}-suse-linux
90 %endif
91 # Make sure O_DIRECT is really disabled (build host could have old kernel)
92 perl -pi -e 's/#define HAVE_O_DIRECT 1/#undef HAVE_O_DIRECT/' db_config.h
93 # Remove libtool predep_objects and postdep_objects wonkiness
94 perl -pi -e 's/^predep_objects=".*$/predep_objects=""/' libtool
95 perl -pi -e 's/^postdep_objects=".*$/postdep_objects=""/' libtool
96 perl -pi -e 's/-shared -nostdlib/-shared/' libtool
97
98 make %{?_smp_mflags} LIBSO_LIBS='$(LIBS)' LIBXSO_LIBS='$(LIBS)'" -L%{_libdir} -lstdc++"
99
100 %install
101 mkdir -p %{buildroot}%{_includedir}/db4
102 CONFIG_ARGS=$(find . -name "config.log" -exec grep "\$ \.\./dist\/configure" {} \; | sed 's/.*configure\( --.*\)/\1/g')
103 if [ -z "$CONFIG_ARGS" ]
104 then
105   echo "could not find configure arguments ... exiting"
106   exit 42
107 fi
108 mkdir -p %{buildroot}%{_libdir}
109 cd build_nptl
110 make prefix=%{buildroot}%{_prefix} libdir=%{buildroot}%{_libdir} strip=true install
111 cd ..
112 # make ldd happy:
113 chmod 755 %{buildroot}%{_libdir}/libdb*.so
114 # Fix header file installation
115 mv %{buildroot}%{_includedir}/*.h %{buildroot}%{_includedir}/db4
116 echo "#include <db4/db.h>" > %{buildroot}%{_includedir}/db.h
117 echo "#include <db4/db_185.h>" > %{buildroot}%{_includedir}/db_185.h
118 echo "#include <db4/db_cxx.h>" > %{buildroot}%{_includedir}/db_cxx.h
119 # remove dangling tags symlink from examples.
120 rm -f examples_cxx/tags
121 rm -f examples_c/tags
122 # Move documentation to the right directory
123 mkdir -p %{buildroot}%{docdir}
124 mv %{buildroot}%{_prefix}/docs/* %{buildroot}/%{docdir}
125 cp -a examples_cxx examples_c %{buildroot}/%{docdir}
126 cp -a LICENSE README %{buildroot}/%{docdir}
127 #
128 # Remove api documentation for C++, Java and TCL
129 rm -rf %{buildroot}/%{docdir}/csharp
130 rm -rf %{buildroot}/%{docdir}/java
131 rm -rf %{buildroot}/%{docdir}/api_reference/CXX
132 rm -rf %{buildroot}/%{docdir}/api_reference/STL
133 rm -rf %{buildroot}/%{docdir}/api_reference/TCL
134 rm -rf %{buildroot}/%{docdir}/gsg*/CXX
135 rm -rf %{buildroot}/%{docdir}/gsg*/JAVA
136 mv %{buildroot}/%{docdir}/collections/tutorial %{buildroot}/%{docdir}/
137 # Remove crappy *.la files
138 rm -rf %{buildroot}%{_libdir}/*.la
139 rm -rf %{buildroot}%{_libdir}/tls/*.la
140 %fdupes %{buildroot}%{_libdir}
141 %fdupes %{buildroot}%{docdir}
142
143 %post -p /sbin/ldconfig
144
145 %postun -p /sbin/ldconfig
146
147 %files
148 %manifest %{name}.manifest
149 %defattr(-,root,root)
150 %{_libdir}/libdb-%{major}.%{minor}.so
151 %{_libdir}/libdb_cxx-%{major}.%{minor}.so
152
153 %files doc
154 %manifest %{name}.manifest
155 %defattr(-,root,root)
156 %dir %{docdir}
157 %doc %{docdir}/LICENSE
158 %doc %{docdir}/README
159 %doc %{docdir}/index.html
160 %doc %{docdir}/license
161 %doc %{docdir}/articles
162 %doc %{docdir}/api_reference
163 %doc %{docdir}/examples_c
164 %doc %{docdir}/examples_cxx
165 %doc %{docdir}/gsg*
166 %doc %{docdir}/porting
167 %doc %{docdir}/programmer_reference
168 %doc %{docdir}/tutorial
169
170 %files utils
171 %manifest %{name}.manifest
172 %defattr(-,root,root)
173 %{_bindir}/db_archive
174 %{_bindir}/db_checkpoint
175 %{_bindir}/db_deadlock
176 %{_bindir}/db_dump
177 %{_bindir}/db_load
178 %{_bindir}/db_printlog
179 %{_bindir}/db_recover
180 %{_bindir}/db_sql
181 %{_bindir}/db_stat
182 %{_bindir}/db_upgrade
183 %{_bindir}/db_verify
184 %{_bindir}/db_hotbackup
185
186 %files devel
187 %manifest %{name}.manifest
188 %defattr(-,root,root)
189 %dir %{_includedir}/db4
190 %{_includedir}/db.h
191 %{_includedir}/db_185.h
192 %{_includedir}/db_cxx.h
193 %{_includedir}/db4/db.h
194 %{_includedir}/db4/db_185.h
195 %{_includedir}/db4/db_cxx.h
196 %{_libdir}/libdb.so
197 %{_libdir}/libdb-%{major}.so
198 %{_libdir}/libdb_cxx.so
199 %{_libdir}/libdb_cxx-%{major}.so
200
201 %changelog