File file.spec of Package file.openSUSE_Evergreen_11.4

# spec file for package file
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           file
BuildRequires:  findutils
BuildRequires:  zlib-devel
# bug437293
%ifarch ppc64
Obsoletes:      file-64bit
# Set Version also in python-magic.spec
Version:        5.04
Release:        0
Summary:        A Tool to Determine File Types
License:        BSD-2-Clause
Group:          Productivity/File utilities
Source2:        baselibs.conf
Patch:          file-%{version}.dif
Patch1:         file-5.02-misc.dif
Patch3:         file-5.04-exec.dif
Patch4:         file-4.24-autoconf.dif
Patch5:         file-4.03-tex.dif
Patch7:         file-4.20-ssd.dif
Patch8:         file-4.20-xen.dif
Patch9:         file-4.24-elf.dif
Patch10:        file-4.18-printf.dif
Patch11:        file-4.24-reg_dos.dif
Patch12:        file-5.02-option.dif
Patch13:        file-4.21-scribus.dif
Patch14:        file-5.04-awk.dif
Patch15:        file-4.21-xcursor.dif
Patch16:        file-4.21-reiserfs.dif
Patch20:        file-4.24-mips.dif
Patch21:        file-4.16-python.dif
Patch22:        file-4.24-cromfs.dif
Patch24:        file-4.24-warn.dif
Patch25:        file-5.02-javacheck.dif
Patch26:        file-4.24-solv.dif
Patch27:        file-5.04-zip2.0.dif
Patch28:        file-5.03-iso9660.dif
Patch29:        file-5.04-llvm.dif
Patch30:        file-5.04-visibility.patch
Patch31:        file-5.04-biorad.dif
Patch50:        file-CVE-2012-1571.patch
# PATCH-FIX-USTREAM bnc#866750 - file: crash when parsing some PE executables
Patch99:        0001-PR-313-Aaron-Reffett-Check-properly-for-exceeding-th.patch
# PATCH-FIX-USTREAM bnc#864589 - CVE-2014-1943: file: infinite recursion
Patch100:       0001-prevent-infinite-recursion.patch
# PATCH-FIX-USTREAM last patch for bnc#866750 - CVE-2014-2270: file: crash when parsing some PE executables
Patch102:       0001-off-by-one-in-out-of-bounds-calculations-Jan-Kaluza.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%global         _sysconfdir /etc
%global         _miscdir    %{_datadir}/misc

With the file command, you can obtain information on the file type of a
specified file. File type recognition is controlled by the file
/etc/magic, which contains the classification criteria. This command is
used by apsfilter to permit automatic printing of different file types.

    Mark Moraes <>
    Christos Zoulas <>

%package     -n file-devel
Summary:        Include Files and Libraries mandatory for Development
License:        Other uncritical OpenSource License
Group:          Development/Libraries/Other
Provides:       file:/usr/include/magic.h
Requires:       file = %{version}
Requires:       glibc-devel

%description -n file-devel
This package contains all necessary include files and libraries needed
to develop applications that require the magic "file" interface.

    Mark Moraes <>
    Christos Zoulas <>

%setup -q -n file-%{version}
%patch99 -p0
%patch100 -p0
%patch102 -p0
%patch1  -p0 -b .misc
%patch3  -p0 -b .exec
%patch4  -p0 -b .conf
%patch5  -p0 -b .tex
%patch7  -p0 -b .ssd
%patch8  -p0 -b .xen
%patch9  -p0 -b .elf
%patch10 -p0 -b .prtf
%patch11 -p0 -b .reg
%patch12 -p0 -b .opt
%patch13 -p0 -b .scri
%patch14 -p0 -b .awk
%patch15 -p0 -b .xcur
%patch16 -p0 -b .reiserfs
%ifarch mips
%patch20 -p0 -b .mips
%if 0%{?build_python_bindings:1}
%patch21 -p0 -b .python
%patch22 -p0 -b .cromfs
%patch24 -p0 -b .warn
%patch25 -p0 -b .javacheck
%patch26 -p0 -b .solv
%patch27 -p0 -b .zip2.0
%patch28 -p0 -b .iso9600
%patch29 -p0 -b .llvm
%patch30 -p0 -b .vis
%patch31 -p0 -b .biorad
%patch50 -p0 -b .CVE20121571

rm -f Magdir/*,v Magdir/*~
rm -f ltconfig
autoreconf -fiv
%configure --datadir=%{_miscdir} --disable-static --with-pic --enable-fsect-man5
%{__make} %{?_smp_mflags} pkgdatadir='$(datadir)'
%if 0%{?build_python_bindings:1}
pushd python
python build

mkdir  %{buildroot}/etc
make DESTDIR=%{buildroot} install pkgdatadir='$(datadir)'
rm -vf %{buildroot}%{_sysconfdir}/magic
echo '# Localstuff: file(1) magic(5) for locally observed files' > %{buildroot}%{_sysconfdir}/magic
echo '#     global magic file is %{_miscdir}/magic(.mgc)'	>> %{buildroot}%{_sysconfdir}/magic
#install -s dcore %{buildroot}%{_bindir}
# Check out that the binary does not bail out:
find %{buildroot}%{_bindir}/file %{_bindir}/ /%{_lib}/ %{_libdir}/ | \
	xargs %{buildroot}%{_bindir}/file -m %{buildroot}%{_miscdir}/magic
%{__rm} -f %{buildroot}%{_libdir}/*.la

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%defattr (644,root,root,755)
%config(noreplace) %{_sysconfdir}/magic
%attr(755,root,root) %{_bindir}/file
%attr(644,root,root) %{_mandir}/man1/file.1.gz
%attr(644,root,root) %{_mandir}/man5/magic.5.gz

%files -n file-devel
%defattr (644,root,root,755)
%attr(644,root,root) %{_mandir}/man3/libmagic.3.gz