%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.11 Release: 2 License: BSD Group: Applications/File Source0: ftp://ftp.astron.com/pub/file/%{name}-%{version}.tar.gz URL: http://www.darwinsys.com/file/ 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 Requires: libgcc >= 4.2.3, zlib %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 %setup -q mkdir ../32bit mv * ../32bit mv ../32bit . mkdir 64bit cd 32bit && tar cf - . | (cd ../64bit ; tar xpf -) %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} # move it to the proper location mkdir -p ${RPM_BUILD_ROOT}%{_libdir64} mv ${RPM_BUILD_ROOT}%{_libdir}/python* ${RPM_BUILD_ROOT}%{_libdir64}/ 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.py %{python64_sitearch}/magic.py %{python_sitearch}/magic.pyc %{python64_sitearch}/magic.pyc %{python_sitearch}/magic.pyo %{python64_sitearch}/magic.pyo %{python_sitearch}/*egg-info %{python64_sitearch}/*egg-info %changelog * Mon Apr 22 2013 Michael Perzl - 5.11-2 - added missing dependency on libgcc for file-libs * Fri Mar 22 2013 Michael Perzl - 5.11-1 - updated to version 5.11 * Fri Mar 22 2013 Michael Perzl - 5.10-1 - updated to version 5.10 * Fri Mar 22 2013 Michael Perzl - 5.09-1 - updated to version 5.09 * Fri Mar 22 2013 Michael Perzl - 5.08-1 - updated to version 5.08 * Fri Mar 22 2013 Michael Perzl - 5.07-1 - updated to version 5.07 * Fri Mar 22 2013 Michael Perzl - 5.06-1 - updated to version 5.06 * Mon May 02 2011 Michael Perzl - 5.05-1 - updated to version 5.05 * Wed Nov 03 2010 Michael Perzl - 5.04-1 - updated to version 5.04 * Fri Dec 11 2009 Michael Perzl - 5.03-1 - first version for AIX V5.1 and higher