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: 6%{?dist}
|
---|
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 |
|
---|
14 | Patch0: file-os2.diff
|
---|
15 |
|
---|
16 | Requires: file-libs = %{version}-%{release}
|
---|
17 | Requires: mmap >= 20110103
|
---|
18 |
|
---|
19 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
---|
20 | BuildRequires: zlib-devel
|
---|
21 |
|
---|
22 | %description
|
---|
23 | The file command is used to identify a particular file according to the
|
---|
24 | type of data contained by the file. File can identify many different
|
---|
25 | file types, including ELF binaries, system libraries, RPM packages, and
|
---|
26 | different graphics formats.
|
---|
27 |
|
---|
28 | %package libs
|
---|
29 | Summary: Libraries for applications using libmagic
|
---|
30 | Group: Applications/File
|
---|
31 |
|
---|
32 | %description libs
|
---|
33 |
|
---|
34 | Libraries for applications using libmagic.
|
---|
35 |
|
---|
36 | %package devel
|
---|
37 | Summary: Libraries and header files for file development
|
---|
38 | Group: Applications/File
|
---|
39 | Requires: %{name} = %{version}-%{release}
|
---|
40 |
|
---|
41 | %description devel
|
---|
42 | The file-devel package contains the header files and libmagic library
|
---|
43 | necessary for developing programs using libmagic.
|
---|
44 |
|
---|
45 | %package static
|
---|
46 | Summary: Static library for file development
|
---|
47 | Group: Applications/File
|
---|
48 | Requires: %{name} = %{version}-%{release}
|
---|
49 |
|
---|
50 | %description static
|
---|
51 | The file-static package contains the static version of
|
---|
52 | the libmagic library.
|
---|
53 |
|
---|
54 | %package -n python-magic
|
---|
55 | Summary: Python bindings for the libmagic API
|
---|
56 | Group: Development/Libraries
|
---|
57 | BuildRequires: python-devel
|
---|
58 | Requires: %{name} = %{version}-%{release}
|
---|
59 |
|
---|
60 | %description -n python-magic
|
---|
61 | This package contains the Python bindings to allow access to the
|
---|
62 | libmagic API. The libmagic library is also used by the familiar
|
---|
63 | file(1) command.
|
---|
64 |
|
---|
65 | %prep
|
---|
66 |
|
---|
67 | # Don't use -b -- it will lead to poblems when compiling magic file
|
---|
68 | %setup -q
|
---|
69 | %patch0 -p1
|
---|
70 |
|
---|
71 | #iconv -f iso-8859-1 -t utf-8 < doc/libmagic.man > doc/libmagic.man_
|
---|
72 | touch -r doc/libmagic.man doc/libmagic.man_
|
---|
73 | mv doc/libmagic.man_ doc/libmagic.man
|
---|
74 |
|
---|
75 | %build
|
---|
76 | export CONFIG_SHELL="/bin/sh"
|
---|
77 | export LDFLAGS="-Zbin-files -Zhigh-mem -Zomf -Zargs-wild -Zargs-resp"
|
---|
78 | export LIBS="-lurpo -lmmap"
|
---|
79 | export CFLAGS="%{optflags} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
|
---|
80 | %configure \
|
---|
81 | --enable-fsect-man5 --disable-rpath \
|
---|
82 | --disable-shared --disable-static \
|
---|
83 | "--cache-file=%{_topdir}/cache/%{name}-%{_target_cpu}.cache"
|
---|
84 |
|
---|
85 | # remove hardcoded library paths from local libtool
|
---|
86 | #sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
|
---|
87 | #sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
|
---|
88 | #export LD_LIBRARY_PATH=%{_builddir}/%{name}-%{version}/src/.libs
|
---|
89 | make %{?_smp_mflags}
|
---|
90 |
|
---|
91 | cd python
|
---|
92 | CFLAGS="%{optflags}" %{__python} setup.py build
|
---|
93 |
|
---|
94 | %install
|
---|
95 | rm -rf $RPM_BUILD_ROOT
|
---|
96 | mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
|
---|
97 | mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man1
|
---|
98 | mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man5
|
---|
99 | mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/misc
|
---|
100 | mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/file
|
---|
101 |
|
---|
102 | make DESTDIR=${RPM_BUILD_ROOT} install
|
---|
103 | rm -f ${RPM_BUILD_ROOT}%{_libdir}/*.la
|
---|
104 |
|
---|
105 | cat magic/Magdir/* > ${RPM_BUILD_ROOT}%{_datadir}/misc/magic
|
---|
106 | ln -s misc/magic ${RPM_BUILD_ROOT}%{_datadir}/magic
|
---|
107 | #ln -s file/magic.mime ${RPM_BUILD_ROOT}%{_datadir}/magic.mime
|
---|
108 | ln -s ../magic ${RPM_BUILD_ROOT}%{_datadir}/file/magic
|
---|
109 |
|
---|
110 | cp src/magic.dll ${RPM_BUILD_ROOT}%{_libdir}
|
---|
111 | cp src/.libs/magic_s.a ${RPM_BUILD_ROOT}%{_libdir}
|
---|
112 |
|
---|
113 | cd python
|
---|
114 | %{__python} setup.py install -O1 --skip-build --root ${RPM_BUILD_ROOT}
|
---|
115 | %{__install} -d ${RPM_BUILD_ROOT}%{_datadir}/%{name}
|
---|
116 |
|
---|
117 | %clean
|
---|
118 | rm -rf $RPM_BUILD_ROOT
|
---|
119 |
|
---|
120 | #%post libs -p /sbin/ldconfig
|
---|
121 |
|
---|
122 | #%postun libs -p /sbin/ldconfig
|
---|
123 |
|
---|
124 | %files
|
---|
125 | %defattr(-,root,root,-)
|
---|
126 | %doc COPYING ChangeLog README
|
---|
127 | %{_bindir}/*
|
---|
128 | %{_mandir}/man1/*
|
---|
129 |
|
---|
130 | %files libs
|
---|
131 | %defattr(-,root,root,-)
|
---|
132 | %{_libdir}/*.dll
|
---|
133 | %{_datadir}/magic*
|
---|
134 | %{_mandir}/man5/*
|
---|
135 | %{_datadir}/file
|
---|
136 | %{_datadir}/misc/*
|
---|
137 |
|
---|
138 | %files devel
|
---|
139 | %defattr(-,root,root,-)
|
---|
140 | %{_libdir}/*.dll
|
---|
141 | %{_libdir}/magic.a
|
---|
142 | %{_includedir}/magic.h
|
---|
143 | %{_mandir}/man3/*
|
---|
144 |
|
---|
145 | %files static
|
---|
146 | %defattr(-,root,root,-)
|
---|
147 | %{_libdir}/*_s.a
|
---|
148 |
|
---|
149 | %files -n python-magic
|
---|
150 | %defattr(-, root, root, -)
|
---|
151 | %doc python/README COPYING python/example.py
|
---|
152 | %{_libdir}/python*/*
|
---|
153 |
|
---|
154 | %changelog
|
---|