| 1 | #define svn_url     F:/rd/ports/file/trunk | 
|---|
| 2 | %define svn_url     http://svn.netlabs.org/repos/ports/file/trunk | 
|---|
| 3 | %define svn_rev     266 | 
|---|
| 4 |  | 
|---|
| 5 | %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} | 
|---|
| 6 | %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} | 
|---|
| 7 | %define __libtoolize : | 
|---|
| 8 |  | 
|---|
| 9 | Summary: A utility for determining file types | 
|---|
| 10 | Name: file | 
|---|
| 11 | Version: 5.04 | 
|---|
| 12 | Release: 7%{?dist} | 
|---|
| 13 | License: BSD | 
|---|
| 14 | Group: Applications/File | 
|---|
| 15 | URL: http://www.darwinsys.com/file/ | 
|---|
| 16 |  | 
|---|
| 17 | Source: %{name}-%{version}%{?svn_rev:-r%{svn_rev}}.zip | 
|---|
| 18 |  | 
|---|
| 19 | Requires: file-libs = %{version}-%{release} | 
|---|
| 20 | Requires: mmap >= 20110103 | 
|---|
| 21 |  | 
|---|
| 22 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) | 
|---|
| 23 | BuildRequires: zlib-devel | 
|---|
| 24 |  | 
|---|
| 25 | %description | 
|---|
| 26 | The file command is used to identify a particular file according to the | 
|---|
| 27 | type of data contained by the file.  File can identify many different | 
|---|
| 28 | file types, including ELF binaries, system libraries, RPM packages, and | 
|---|
| 29 | different graphics formats. | 
|---|
| 30 |  | 
|---|
| 31 | %package libs | 
|---|
| 32 | Summary: Libraries for applications using libmagic | 
|---|
| 33 | Group:   Applications/File | 
|---|
| 34 |  | 
|---|
| 35 | %description libs | 
|---|
| 36 |  | 
|---|
| 37 | Libraries for applications using libmagic. | 
|---|
| 38 |  | 
|---|
| 39 | %package devel | 
|---|
| 40 | Summary:  Libraries and header files for file development | 
|---|
| 41 | Group:    Applications/File | 
|---|
| 42 | Requires: %{name} = %{version}-%{release} | 
|---|
| 43 |  | 
|---|
| 44 | %description devel | 
|---|
| 45 | The file-devel package contains the header files and libmagic library | 
|---|
| 46 | necessary for developing programs using libmagic. | 
|---|
| 47 |  | 
|---|
| 48 | %package static | 
|---|
| 49 | Summary: Static library for file development | 
|---|
| 50 | Group:    Applications/File | 
|---|
| 51 | Requires: %{name} = %{version}-%{release} | 
|---|
| 52 |  | 
|---|
| 53 | %description static | 
|---|
| 54 | The file-static package contains the static version of | 
|---|
| 55 | the libmagic library. | 
|---|
| 56 |  | 
|---|
| 57 | %package -n python-magic | 
|---|
| 58 | Summary: Python bindings for the libmagic API | 
|---|
| 59 | Group:   Development/Libraries | 
|---|
| 60 | BuildRequires: python-devel | 
|---|
| 61 | Requires: %{name} = %{version}-%{release} | 
|---|
| 62 |  | 
|---|
| 63 | %description -n python-magic | 
|---|
| 64 | This package contains the Python bindings to allow access to the | 
|---|
| 65 | libmagic API. The libmagic library is also used by the familiar | 
|---|
| 66 | file(1) command. | 
|---|
| 67 |  | 
|---|
| 68 | %package debug | 
|---|
| 69 | Summary: HLL debug data for exception handling support. | 
|---|
| 70 |  | 
|---|
| 71 | %description debug | 
|---|
| 72 | HLL debug data for exception handling support. | 
|---|
| 73 |  | 
|---|
| 74 | %prep | 
|---|
| 75 | %if %{?svn_rev:%(sh -c 'if test -f "%{_sourcedir}/%{name}-%{version}-r%{svn_rev}.zip" ; then echo 1 ; else echo 0 ; fi')}%{!?svn_rev):0} | 
|---|
| 76 | %setup -q | 
|---|
| 77 | %else | 
|---|
| 78 | %setup -n "%{name}-%{version}" -Tc | 
|---|
| 79 | svn export %{?svn_rev:-r %{svn_rev}} %{svn_url} . --force | 
|---|
| 80 | rm -f "%{_sourcedir}/%{name}-%{version}%{?svn_rev:-r%{svn_rev}}.zip" | 
|---|
| 81 | (cd .. && zip -SrX9 "%{_sourcedir}/%{name}-%{version}%{?svn_rev:-r%{svn_rev}}.zip" "%{name}-%{version}") | 
|---|
| 82 | %endif | 
|---|
| 83 |  | 
|---|
| 84 | #iconv -f iso-8859-1 -t utf-8 < doc/libmagic.man > doc/libmagic.man_ | 
|---|
| 85 | touch -r doc/libmagic.man doc/libmagic.man_ | 
|---|
| 86 | mv doc/libmagic.man_ doc/libmagic.man | 
|---|
| 87 |  | 
|---|
| 88 | %build | 
|---|
| 89 | export CONFIG_SITE="/@unixroot/usr/share/config.legacy" | 
|---|
| 90 | export LDFLAGS="-Zbin-files -Zhigh-mem -Zomf -Zargs-wild -Zargs-resp" | 
|---|
| 91 | export LIBS="-lurpo -lmmap" | 
|---|
| 92 | export CFLAGS="%{optflags} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" | 
|---|
| 93 | %configure \ | 
|---|
| 94 | --enable-fsect-man5 --disable-rpath \ | 
|---|
| 95 | --disable-shared --disable-static | 
|---|
| 96 |  | 
|---|
| 97 | make %{?_smp_mflags} | 
|---|
| 98 |  | 
|---|
| 99 | cd python | 
|---|
| 100 | CFLAGS="%{optflags}" %{__python} setup.py build | 
|---|
| 101 |  | 
|---|
| 102 | %install | 
|---|
| 103 | rm -rf $RPM_BUILD_ROOT | 
|---|
| 104 | mkdir -p ${RPM_BUILD_ROOT}%{_bindir} | 
|---|
| 105 | mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man1 | 
|---|
| 106 | mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man5 | 
|---|
| 107 | mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/misc | 
|---|
| 108 | mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/file | 
|---|
| 109 |  | 
|---|
| 110 | make DESTDIR=${RPM_BUILD_ROOT} install | 
|---|
| 111 | rm -f ${RPM_BUILD_ROOT}%{_libdir}/*.la | 
|---|
| 112 |  | 
|---|
| 113 | cat magic/Magdir/* > ${RPM_BUILD_ROOT}%{_datadir}/misc/magic | 
|---|
| 114 | ln -s misc/magic ${RPM_BUILD_ROOT}%{_datadir}/magic | 
|---|
| 115 | #ln -s file/magic.mime ${RPM_BUILD_ROOT}%{_datadir}/magic.mime | 
|---|
| 116 | ln -s ../magic ${RPM_BUILD_ROOT}%{_datadir}/file/magic | 
|---|
| 117 |  | 
|---|
| 118 | cp src/magic.dll ${RPM_BUILD_ROOT}%{_libdir} | 
|---|
| 119 | cp src/.libs/magic_s.a ${RPM_BUILD_ROOT}%{_libdir} | 
|---|
| 120 |  | 
|---|
| 121 | cd python | 
|---|
| 122 | %{__python} setup.py install -O1 --skip-build --root ${RPM_BUILD_ROOT} | 
|---|
| 123 | %{__install} -d ${RPM_BUILD_ROOT}%{_datadir}/%{name} | 
|---|
| 124 |  | 
|---|
| 125 | %clean | 
|---|
| 126 | rm -rf $RPM_BUILD_ROOT | 
|---|
| 127 |  | 
|---|
| 128 | %files | 
|---|
| 129 | %defattr(-,root,root,-) | 
|---|
| 130 | %doc COPYING ChangeLog README | 
|---|
| 131 | %{_bindir}/* | 
|---|
| 132 | %{_mandir}/man1/* | 
|---|
| 133 |  | 
|---|
| 134 | %files libs | 
|---|
| 135 | %defattr(-,root,root,-) | 
|---|
| 136 | %{_libdir}/*.dll | 
|---|
| 137 | %{_datadir}/magic* | 
|---|
| 138 | %{_mandir}/man5/* | 
|---|
| 139 | %{_datadir}/file | 
|---|
| 140 | %{_datadir}/misc/* | 
|---|
| 141 |  | 
|---|
| 142 | %files devel | 
|---|
| 143 | %defattr(-,root,root,-) | 
|---|
| 144 | %{_libdir}/*.dll | 
|---|
| 145 | %{_libdir}/magic.a | 
|---|
| 146 | %{_includedir}/magic.h | 
|---|
| 147 | %{_mandir}/man3/* | 
|---|
| 148 |  | 
|---|
| 149 | %files static | 
|---|
| 150 | %defattr(-,root,root,-) | 
|---|
| 151 | %{_libdir}/*_s.a | 
|---|
| 152 |  | 
|---|
| 153 | %files -n python-magic | 
|---|
| 154 | %defattr(-, root, root, -) | 
|---|
| 155 | %doc python/README COPYING python/example.py | 
|---|
| 156 | %{_libdir}/python*/* | 
|---|
| 157 |  | 
|---|
| 158 | %files debug | 
|---|
| 159 | %defattr(-,root,root) | 
|---|
| 160 | %{_libdir}/*.dbg | 
|---|
| 161 |  | 
|---|
| 162 | %changelog | 
|---|
| 163 | * Mon Feb 02 2015 yd <yd@os2power.com> 5.04-7 | 
|---|
| 164 | - r266, rebuilt with gcc 4.9.2 and python 2.7. | 
|---|