| 1 | %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
|---|
| 2 | %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
|---|
| 3 | %define __libtoolize :
|
|---|
| 4 |
|
|---|
| 5 | Summary: A utility for determining file types
|
|---|
| 6 | Name: file
|
|---|
| 7 | Version: 5.04
|
|---|
| 8 | Release: 1
|
|---|
| 9 | License: BSD
|
|---|
| 10 | Group: Applications/File
|
|---|
| 11 | Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
|
|---|
| 12 | URL: http://www.darwinsys.com/file/
|
|---|
| 13 | Patch0: file-5.04-base.patch
|
|---|
| 14 |
|
|---|
| 15 | Requires: file-libs = %{version}-%{release}
|
|---|
| 16 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
|---|
| 17 | BuildRequires: zlib-devel
|
|---|
| 18 |
|
|---|
| 19 | %description
|
|---|
| 20 | The file command is used to identify a particular file according to the
|
|---|
| 21 | type of data contained by the file. File can identify many different
|
|---|
| 22 | file types, including ELF binaries, system libraries, RPM packages, and
|
|---|
| 23 | different graphics formats.
|
|---|
| 24 |
|
|---|
| 25 | %package libs
|
|---|
| 26 | Summary: Libraries for applications using libmagic
|
|---|
| 27 | Group: Applications/File
|
|---|
| 28 |
|
|---|
| 29 | %description libs
|
|---|
| 30 |
|
|---|
| 31 | Libraries for applications using libmagic.
|
|---|
| 32 |
|
|---|
| 33 | %package devel
|
|---|
| 34 | Summary: Libraries and header files for file development
|
|---|
| 35 | Group: Applications/File
|
|---|
| 36 | Requires: %{name} = %{version}-%{release}
|
|---|
| 37 |
|
|---|
| 38 | %description devel
|
|---|
| 39 | The file-devel package contains the header files and libmagic library
|
|---|
| 40 | necessary for developing programs using libmagic.
|
|---|
| 41 |
|
|---|
| 42 | %package static
|
|---|
| 43 | Summary: Static library for file development
|
|---|
| 44 | Group: Applications/File
|
|---|
| 45 | Requires: %{name} = %{version}-%{release}
|
|---|
| 46 |
|
|---|
| 47 | %description static
|
|---|
| 48 | The file-static package contains the static version of
|
|---|
| 49 | the libmagic library.
|
|---|
| 50 |
|
|---|
| 51 | %package -n python-magic
|
|---|
| 52 | Summary: Python bindings for the libmagic API
|
|---|
| 53 | Group: Development/Libraries
|
|---|
| 54 | #BuildRequires: python-devel
|
|---|
| 55 | Requires: %{name} = %{version}-%{release}
|
|---|
| 56 |
|
|---|
| 57 | %description -n python-magic
|
|---|
| 58 | This package contains the Python bindings to allow access to the
|
|---|
| 59 | libmagic API. The libmagic library is also used by the familiar
|
|---|
| 60 | file(1) command.
|
|---|
| 61 |
|
|---|
| 62 | %prep
|
|---|
| 63 |
|
|---|
| 64 | # Don't use -b -- it will lead to poblems when compiling magic file
|
|---|
| 65 | %setup -q
|
|---|
| 66 | %patch0 -p1
|
|---|
| 67 |
|
|---|
| 68 | #iconv -f iso-8859-1 -t utf-8 < doc/libmagic.man > doc/libmagic.man_
|
|---|
| 69 | touch -r doc/libmagic.man doc/libmagic.man_
|
|---|
| 70 | mv doc/libmagic.man_ doc/libmagic.man
|
|---|
| 71 |
|
|---|
| 72 | %build
|
|---|
| 73 | CFLAGS="%{optflags} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" \
|
|---|
| 74 | %configure --enable-fsect-man5 --disable-rpath \
|
|---|
| 75 | "--cache-file=%{_topdir}/cache/%{name}.cache"
|
|---|
| 76 |
|
|---|
| 77 | # remove hardcoded library paths from local libtool
|
|---|
| 78 | sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
|
|---|
| 79 | sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
|
|---|
| 80 | export LD_LIBRARY_PATH=%{_builddir}/%{name}-%{version}/src/.libs
|
|---|
| 81 | make %{?_smp_mflags}
|
|---|
| 82 | #cd python
|
|---|
| 83 | #CFLAGS="%{optflags}" %{__python} setup.py build
|
|---|
| 84 |
|
|---|
| 85 | %install
|
|---|
| 86 | rm -rf $RPM_BUILD_ROOT
|
|---|
| 87 | mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
|
|---|
| 88 | mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man1
|
|---|
| 89 | mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man5
|
|---|
| 90 | mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/misc
|
|---|
| 91 | mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/file
|
|---|
| 92 |
|
|---|
| 93 | make DESTDIR=${RPM_BUILD_ROOT} install
|
|---|
| 94 | rm -f ${RPM_BUILD_ROOT}%{_libdir}/*.la
|
|---|
| 95 |
|
|---|
| 96 | cat magic/Magdir/* > ${RPM_BUILD_ROOT}%{_datadir}/misc/magic
|
|---|
| 97 | ln -s misc/magic ${RPM_BUILD_ROOT}%{_datadir}/magic
|
|---|
| 98 | #ln -s file/magic.mime ${RPM_BUILD_ROOT}%{_datadir}/magic.mime
|
|---|
| 99 | ln -s ../magic ${RPM_BUILD_ROOT}%{_datadir}/file/magic
|
|---|
| 100 |
|
|---|
| 101 | #cd python
|
|---|
| 102 | #%{__python} setup.py install -O1 --skip-build --root ${RPM_BUILD_ROOT}
|
|---|
| 103 | #%{__install} -d ${RPM_BUILD_ROOT}%{_datadir}/%{name}
|
|---|
| 104 |
|
|---|
| 105 | %clean
|
|---|
| 106 | rm -rf $RPM_BUILD_ROOT
|
|---|
| 107 |
|
|---|
| 108 | #%post libs -p /sbin/ldconfig
|
|---|
| 109 |
|
|---|
| 110 | #%postun libs -p /sbin/ldconfig
|
|---|
| 111 |
|
|---|
| 112 | %files
|
|---|
| 113 | %defattr(-,root,root,-)
|
|---|
| 114 | %doc COPYING ChangeLog README
|
|---|
| 115 | %{_bindir}/*
|
|---|
| 116 | %{_mandir}/man1/*
|
|---|
| 117 |
|
|---|
| 118 | %files libs
|
|---|
| 119 | %defattr(-,root,root,-)
|
|---|
| 120 | #%{_libdir}/*so.*
|
|---|
| 121 | %{_datadir}/magic*
|
|---|
| 122 | %{_mandir}/man5/*
|
|---|
| 123 | %{_datadir}/file
|
|---|
| 124 | %{_datadir}/misc/*
|
|---|
| 125 |
|
|---|
| 126 | %files devel
|
|---|
| 127 | %defattr(-,root,root,-)
|
|---|
| 128 | #%{_libdir}/*.so
|
|---|
| 129 | %{_includedir}/magic.h
|
|---|
| 130 | %{_mandir}/man3/*
|
|---|
| 131 |
|
|---|
| 132 | %files static
|
|---|
| 133 | %defattr(-,root,root,-)
|
|---|
| 134 | %{_libdir}/*.a
|
|---|
| 135 |
|
|---|
| 136 | #%files -n python-magic
|
|---|
| 137 | #%defattr(-, root, root, -)
|
|---|
| 138 | #%doc python/README COPYING python/example.py
|
|---|
| 139 | #%{python_sitearch}/magic.so
|
|---|
| 140 | #%if 0%{?fedora} >= 9 || 0%{?rhel} >= 6
|
|---|
| 141 | #%{python_sitearch}/*egg-info
|
|---|
| 142 | #%endif
|
|---|
| 143 |
|
|---|
| 144 | %changelog
|
|---|