%define libdir64 %{_prefix}/lib64 %define python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)") %define python64_sitearch %(python_64 -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)") Summary: A utility for determining file types Name: file Version: 5.03 Release: 1 License: BSD Group: Applications/File Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz URL: http://www.darwinsys.com/file/ Patch0: file-4.21-pybuild.patch Patch1: file-5.00-devdrv.patch Patch2: file-5.00-mdmp.patch Patch3: file-5.03-fonts-postscript.patch Patch4: file-5.03-xfsdump.patch Patch5: file-5.03-ifany.patch Patch6: file-5.03-multilib.patch Patch7: file-5.03-ppcswap.patch Patch8: file-5.03-add-python-3.patch Patch9: file-5.03-djvu.patch Patch10: file-5.03-delta.patch Requires: %{name}-libs = %{version}-%{release} BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: zlib-devel, patch, python-devel >= 2.6.2 BuildRequires: gcc >= 4.2.3 Requires: libgcc >= 4.2.3, zlib %description The file command is used to identify a particular file according to the type of data contained by the file. File can identify many different file types, including ELF binaries, system libraries, RPM packages, and different graphics formats. %package libs Summary: Libraries for applications using libmagic Group: Applications/File %description libs Libraries for applications using libmagic. %package devel Summary: Libraries and header files for file development Group: Applications/File Requires: %{name} = %{version}-%{release} %description devel The file-devel package contains the header files and libmagic library necessary for developing programs using libmagic. %package -n python-magic Summary: Python bindings for the libmagic API Group: Development/Libraries BuildRequires: python-devel >= 2.6.2 Requires: %{name} = %{version}-%{release} %description -n python-magic This package contains the Python bindings to allow access to the libmagic API. The libmagic library is also used by the familiar file(1) command. %prep export PATH=/opt/freeware/bin:$PATH # Don't use -b -- it will lead to poblems when compiling magic file %setup -q %patch0 -p1 #fixes #463809 %patch1 -p1 #fixes #485835 %patch2 -p1 #fixes #505758, #505759, #505762, #505765 %patch3 -p1 #fixes #513079 %patch4 -p1 #fixes #510429 %patch5 -p1 #fixes #515767 %patch6 -p1 #fixes #530083 %patch7 -p1 #fixes #531082 %patch8 -p1 #fixes #531127 %patch9 -p1 #fixes #533151 %patch10 -p1 mkdir ../32bit mv * ../32bit mv ../32bit . mkdir 64bit cp -r 32bit/* 64bit/ %build export CFLAGS="-DSYSV -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX51 -D_ALL_SOURCE -DFUNCPROTO=15 -O -I/opt/freeware/include -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" cd 64bit # first build the 64-bit version export OBJECT_MODE=64 export CC="gcc -maix64" ./configure \ --prefix=%{_prefix} \ --mandir=%{_mandir} \ --enable-fsect-man5 gmake cd python python_64 setup.py build cd ../../32bit # now build the 32-bit version export OBJECT_MODE=32 export CC="gcc" ./configure \ --prefix=%{_prefix} \ --mandir=%{_mandir} \ --enable-fsect-man5 gmake cd python python setup.py build %install [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} cd 64bit gmake DESTDIR=${RPM_BUILD_ROOT} install cd ../32bit gmake DESTDIR=${RPM_BUILD_ROOT} install /usr/bin/strip -X32_64 ${RPM_BUILD_ROOT}%{_bindir}/* || : # add the 64-bit shared objects to the shared library containing already the # 32-bit shared objects /usr/bin/ar -X64 -q ${RPM_BUILD_ROOT}%{_libdir}/libmagic.a ../64bit/src/.libs/libmagic.so.1 cat magic/Magdir/* > ${RPM_BUILD_ROOT}%{_datadir}/misc/magic ln -s misc/magic ${RPM_BUILD_ROOT}%{_datadir}/magic mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name} ln -s ../magic ${RPM_BUILD_ROOT}%{_datadir}/%{name}/magic cd ../64bit/python python_64 setup.py install -O1 --skip-build --root ${RPM_BUILD_ROOT} cd ../../32bit/python python setup.py install -O1 --skip-build --root ${RPM_BUILD_ROOT} mkdir -p ${RPM_BUILD_ROOT}/%{_docdir}/python-magic-%{version} cp example.py ${RPM_BUILD_ROOT}/%{_docdir}/python-magic-%{version} chmod 0644 ${RPM_BUILD_ROOT}/%{_docdir}/python-magic-%{version}/example.py ( cd ${RPM_BUILD_ROOT} for dir in include lib do mkdir -p usr/${dir} cd usr/${dir} ln -sf ../..%{_prefix}/${dir}/* . cd - done mkdir -p usr/linux/bin cd usr/linux/bin ln -sf ../../..%{_bindir}/* . ) %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system,-) %doc 32bit/COPYING 32bit/ChangeLog 32bit/README %{_bindir}/* %{_mandir}/man1/* /usr/linux/bin/* %files libs %defattr(-,root,system,-) %{_libdir}/*.a %{_datadir}/magic* %{_mandir}/man5/* %{_datadir}/%{name} %{_datadir}/misc/* /usr/lib/*.a %files devel %defattr(-,root,system,-) %{_includedir}/* %{_libdir}/*.la %{_mandir}/man3/* /usr/include/* /usr/lib/*.la %files -n python-magic %defattr(-,root,system,-) %doc 32bit/python/README 32bit/COPYING 32bit/python/example.py %{python_sitearch}/magic.so %{python_sitearch}/*egg-info %{python64_sitearch}/magic.so %{python64_sitearch}/*egg-info %changelog * Fri Dec 11 2009 Michael Perzl - 5.03-1 - first version for AIX V5.1 and higher