%ifos aix6.1 || %ifos aix7.1 || %ifos aix7.2 %global p7build 1 %else %global p7build 0 %endif %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.29 %if %{p7build} Release: 2.p7 %else Release: 2 %endif 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 >= 1.2.3-7, python-devel >= 2.7.13-1 %if %{p7build} %else BuildRequires: gcc >= 4.5.4-1 Requires: libgcc >= 4.5.4-1, zlib >= 1.2.3-7 %endif %if %{p7build} %ifos aix6.1 Requires: AIX-rpm >= 6.1.8.0 %endif %ifos aix7.1 Requires: AIX-rpm >= 7.1.3.0 %endif %ifos aix7.2 Requires: AIX-rpm >= 7.2.0.0 %endif %endif %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 %if %{p7build} %else Requires: libgcc >= 4.5.4-1 %endif Requires: zlib >= 1.2.3-7 %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.7.13-1 BuildRequires: python-setuptools 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 %if %{p7build} %else export CFLAGS="-DSYSV -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX51 -D_ALL_SOURCE -DFUNCPROTO=15 -O3 -I/opt/freeware/include -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" %endif cd 64bit # first build the 64-bit version export OBJECT_MODE=64 %if %{p7build} %else export CC="gcc -maix64" %endif ./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 %if %{p7build} %else export CC="gcc" %endif ./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 Jan 16 2017 Michael Perzl - 5.29-2 - recompiled against latest versions * Mon Nov 21 2016 Michael Perzl - 5.29-1 - updated to version 5.29 * Wed Jun 22 2016 Michael Perzl - 5.28-1 - updated to version 5.28 * Tue May 31 2016 Michael Perzl - 5.27-1 - updated to version 5.27 * Wed Dec 23 2015 Michael Perzl - 5.25-1 - updated to version 5.25 * Wed Dec 23 2015 Michael Perzl - 5.24-1 - updated to version 5.24 * Wed Dec 23 2015 Michael Perzl - 5.23-1 - updated to version 5.23 * Wed Apr 01 2015 Michael Perzl - 5.22-1 - updated to version 5.22 * Thu Dec 11 2014 Michael Perzl - 5.21-1 - updated to version 5.21 * Mon Oct 13 2014 Michael Perzl - 5.20-1 - updated to version 5.20 * Mon Jun 23 2014 Michael Perzl - 5.19-1 - updated to version 5.19 * Thu Mar 27 2014 Michael Perzl - 5.18-1 - updated to version 5.18 * Thu Mar 27 2014 Michael Perzl - 5.17-1 - updated to version 5.17 * Thu Dec 05 2013 Michael Perzl - 5.16-1 - updated to version 5.16 * Thu Dec 05 2013 Michael Perzl - 5.15-1 - updated to version 5.15 * Mon Apr 22 2013 Michael Perzl - 5.14-2 - added missing dependency on libgcc for file-libs * Fri Mar 22 2013 Michael Perzl - 5.14-1 - updated to version 5.14 * Fri Mar 22 2013 Michael Perzl - 5.13-1 - updated to version 5.13 * Fri Mar 22 2013 Michael Perzl - 5.12-1 - updated to version 5.12 * 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