1 %global _miscdir %{_datadir}/misc
4 BuildRequires: findutils
6 BuildRequires: zlib-devel
7 Url: http://www.darwinsys.com/file/
10 Summary: A Tool to Determine File Types
12 Group: System/Utilities
15 Source2: baselibs.conf
16 Source1001: file.manifest
18 Source: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
21 With the file command, you can obtain information on the file type of a
22 specified file. File type recognition is controlled by the file
23 /etc/magic, which contains the classification criteria. This command is
24 used by apsfilter to permit automatic printing of different file types.
26 %package -n libmagic-data
27 Summary: The magic files for libmagic to use
28 Group: System/Libraries
30 %description -n libmagic-data
31 This package contains the basic magic files that libmagic reads and uses
32 to estimate a file's type.
35 Summary: Library with file's functionality
36 Group: System/Libraries
37 Requires: libmagic-data = %{version}
39 Obsoletes: libfile =< 5.04
41 %description -n libmagic
42 This library reads magic files and detects file types. Used by file command
44 %package -n file-devel
45 Summary: Include Files and Libraries mandatory for Development
46 Group: System/Libraries
47 Provides: file:/usr/include/magic.h
49 Requires: libmagic = %{version}
51 %description -n file-devel
52 This package contains all necessary include files and libraries needed
53 to develop applications that require the magic "file" interface.
56 %setup -q -n file-%{version}
65 rm -f Magdir/*,v Magdir/*~
66 rm -f ltcf-c.sh ltconfig ltmain.sh
68 CFLAGS="$RPM_OPT_FLAGS -DHOWMANY=69632"
69 %configure --disable-silent-rules --datadir=%{_miscdir} --disable-static --with-pic --enable-fsect-man5
70 sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
71 sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
73 %{__make} %{?_smp_mflags} pkgdatadir='$(datadir)'
74 %if 0%{?build_python_bindings:1}
84 mkdir %{buildroot}%{_sysconfdir}
85 make DESTDIR=%{buildroot} install pkgdatadir='$(datadir)'
86 rm -vf %{buildroot}%{_sysconfdir}/magic
87 echo '# Localstuff: file(1) magic(5) for locally observed files' > %{buildroot}%{_sysconfdir}/magic
88 echo '# global magic file is %{_miscdir}/magic(.mgc)' >> %{buildroot}%{_sysconfdir}/magic
89 %{nil install -s dcore %{buildroot}%{_bindir}}
90 # Check out that the binary does not bail out:
91 LD_LIBRARY_PATH=%{buildroot}%{_libdir}
92 export LD_LIBRARY_PATH
93 %{buildroot}%{_bindir}/file --version
94 find %{buildroot}%{_bindir}/file %{_bindir}/ /%{_lib}/ %{_libdir}/ | \
95 xargs %{buildroot}%{_bindir}/file -m %{buildroot}%{_miscdir}/magic
97 %{__rm} -f %{buildroot}%{_libdir}/*.la
99 %post -n libmagic -p /sbin/ldconfig
101 %postun -n libmagic -p /sbin/ldconfig
104 %manifest %{name}.manifest
105 %defattr (644,root,root,755)
109 %files -n libmagic-data
110 %manifest %{name}.manifest
111 %defattr (644,root,root,755)
113 %config(noreplace) %{_sysconfdir}/magic
115 %{_miscdir}/magic.mgc
116 %doc %{_mandir}/man5/magic.5.gz
119 %manifest %{name}.manifest
120 %defattr (644,root,root,755)
121 %{nil %{_bindir}/dcore}
122 %attr(755,root,root) %{_bindir}/file
123 %doc %{_mandir}/man1/file.1.gz
127 %manifest %{name}.manifest
128 %defattr (644,root,root,755)
130 %{_includedir}/magic.h
131 %doc %{_mandir}/man3/libmagic.3.gz