Name: tinycdb Summary: Utility and library for manipulating constant databases Version: 0.78 Release: 1 Group: System Environment/Libraries License: Public Domain URL: http://www.corpit.ru/mjt/tinycdb.html Source0: http://www.corpit.ru/mjt/%{name}/%{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root %define _libdir64 %{_prefix}/lib64 %description tinycdb is a small, fast and reliable utility and subroutine library for creating and reading constant databases. The database structure is tuned for fast reading. This package contains tinycdb utility and shared library. %package devel Summary: Development files for %{name} Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description devel tinycdb is a small, fast and reliable utility set and subroutine library for creating and reading constant databases. This package contains tinycdb development library and header file for developing applications that use %{name}. %prep %setup -q mkdir ../32bit mv * ../32bit mv ../32bit . mkdir 64bit cp -r 32bit/* 64bit/ %build cd 64bit # first build the 64-bit version export OBJECT_MODE=64 export CC="xlc -q64" make %{?_smp_mflags} staticlib CreateExportList -X64 %{name}.exp libcdb.a ${CC} -qmkshrobj libcdb.a -o libcdb.so.1 -bE:%{name}.exp rm -f %{name}.exp cd ../32bit # now build the 32-bit version export OBJECT_MODE=32 export CC="xlc" make %{?_smp_mflags} staticlib CreateExportList -X32 %{name}.exp libcdb.a ${CC} -qmkshrobj libcdb.a -o libcdb.so.1 -bE:%{name}.exp rm -f %{name}.exp %install [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} cd 32bit make install prefix=${RPM_BUILD_ROOT}%{_prefix} cd .. # create RTL-style shared libraries mkdir -p ${RPM_BUILD_ROOT}%{_libdir} cp 32bit/libcdb.so.1 ${RPM_BUILD_ROOT}%{_libdir}/ chmod 0755 ${RPM_BUILD_ROOT}%{_libdir}/ mkdir -p ${RPM_BUILD_ROOT}%{_libdir64} cp 64bit/libcdb.so.1 ${RPM_BUILD_ROOT}%{_libdir64}/ chmod 0755 ${RPM_BUILD_ROOT}%{_libdir64}/ ( cd ${RPM_BUILD_ROOT}%{_libdir} ln -s libcdb.so.1 libcdb.so cd ${RPM_BUILD_ROOT}%{_libdir64} ln -s libcdb.so.1 libcdb.so ) # crete "normal-style" AIX shared library /usr/bin/rm -f ${RPM_BUILD_ROOT}%{_libdir}/libcdb.a /usr/bin/ar -X32 -rv ${RPM_BUILD_ROOT}%{_libdir}/libcdb.a ${RPM_BUILD_ROOT}%{_libdir}/libcdb.so.1 /usr/bin/ar -X64 -q ${RPM_BUILD_ROOT}%{_libdir}/libcdb.a ${RPM_BUILD_ROOT}%{_libdir64}/libcdb.so.1 # create the pkgconfig files mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/pkgconfig mkdir -p ${RPM_BUILD_ROOT}%{_libdir64}/pkgconfig cat 32bit/debian/libcdb.pc | sed 's|/usr|/opt/freeware|g' > \ ${RPM_BUILD_ROOT}%{_libdir}/pkgconfig/libcdb.pc cat 32bit/debian/libcdb.pc | sed 's|/usr|/opt/freeware|g' | sed 's|/lib|/lib64|g' | > \ ${RPM_BUILD_ROOT}%{_libdir64}/pkgconfig/libcdb.pc # now rebuild the binary program with the shared library cd 32bit export OBJECT_MODE=32 ${CC} ${CFLAGS} -o ${RPM_BUILD_ROOT}%{_bindir}/cdb cdb.c -L${RPM_BUILD_ROOT}%{_libdir} ${LDFLAGS} -lcdb cd ../64bit export OBJECT_MODE=64 ${CC} ${CFLAGS} -o ${RPM_BUILD_ROOT}%{_bindir}/cdb_64 cdb.c -L${RPM_BUILD_ROOT}%{_libdir} ${LDFLAGS} -lcdb ( cd ${RPM_BUILD_ROOT} for dir in bin include lib lib64 do mkdir -p usr/${dir} cd usr/${dir} ln -sf ../..%{_prefix}/${dir}/* . cd - done ) %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system,-) %doc 32bit/NEWS 32bit/ChangeLog %{_bindir}/cdb* %{_libdir}/*.a %{_libdir}/*.so* %{_libdir64}/*.so* %{_mandir}/man1/* %{_mandir}/man5/* /usr/bin/cdb* /usr/lib/*.a /usr/lib/*.so* /usr/lib64/*.so* %files devel %defattr(-,root,sytem,-) %{_includedir}/* %{_libdir}/pkgconfig/*.pc %{_libdir64}/pkgconfig/*.pc %{_mandir}/man3/* /usr/include/* %changelog * Tue Jun 12 2012 Michael Perzl - 0.78-1 - updated to version 0.78 * Mon Nov 29 2010 Michael Perzl - 0.77-1 - first version for AIX V5.1 and higher