File mingw64-file.spec of Package mingw64-file

#
# spec file for package mingw64-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 http://bugs.opensuse.org/
#


%define somajor 1
Name:           mingw64-file
Version:        5.18
Release:        0
Summary:        A Tool to Determine File Types
License:        BSD-2-Clause
Group:          Productivity/File utilities
Url:            http://www.darwinsys.com/file/
Source:         ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
Patch0:         file-5.17.dif
Patch1:         file-5.14-misc.dif
Patch5:         file-5.14-tex.dif
Patch7:         file-4.20-ssd.dif
Patch8:         file-4.20-xen.dif
Patch9:         file-5.18-elf.dif
Patch10:        file-5.14-printf.dif
Patch11:        file-5.12-zip.dif
Patch12:        file-5.17-option.dif
Patch13:        file-4.21-scribus.dif
Patch15:        file-4.21-xcursor.dif
Patch22:        file-4.24-cromfs.dif
Patch25:        file-5.18-javacheck.dif
Patch26:        file-4.24-solv.dif
Patch27:        file-5.12-zip2.0.dif
Patch28:        file-5.07-iso9660.dif
Patch31:        file-5.07-biorad.dif
Patch32:        file-5.07-clicfs.dif
Patch35:        file-5.12-nitpick.dif
Patch36:        file-5.15-clear-invalid.patch
Patch100:       file-5.18-fileexeext.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool
BuildRequires:  mingw64-cross-binutils
BuildRequires:  mingw64-cross-gcc
BuildRequires:  mingw64-cross-pkg-config
BuildRequires:  mingw64-filesystem
BuildRequires:  mingw64-libgnurx-devel
BuildRequires:  mingw64-zlib-devel
%_mingw64_package_header_debug
BuildArch:      noarch
#!BuildIgnore: post-build-checks

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

%package magic
Summary:        The magic files for libmagic to use
Group:          Productivity/File utilities

%description magic
This package contains the basic magic files that libmagic reads and uses
to estimate a file's type.

%package -n mingw64-libmagic%{somajor}
Summary:        Library with file's functionality
Group:          System/Libraries
Requires:       %{name}-magic = %{version}

%description -n mingw64-libmagic%{somajor}
This library reads magic files and detects file types. Used by file command

%package devel
Summary:        Include Files and Libraries mandatory for Development
Group:          Development/Libraries/C and C++

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

%_mingw64_debug_package

%prep
%setup -q -n file-%{version}
%patch -P 1   -b .misc
%patch -P 5   -b .tex
%patch -P 7   -b .ssd
%patch -P 8   -b .xen
%patch -P 9   -b .elf
%patch -P 10  -b .prtf
%patch -P 11  -b .zip
%patch -P 12  -b .opt
%patch -P 13  -b .scri
%patch -P 15  -b .xcur
%patch -P 22  -b .cromfs
%patch -P 25  -b .javacheck
%patch -P 26  -b .solv
%patch -P 27  -b .zip2.0
%patch -P 28  -b .iso9600
%patch -P 31  -b .biorad
%patch -P 32  -b .clicfs
%patch -P 35  -b .nitpick
%patch -P 36 -p1 -b .clear
%patch -P 0 -b .0

%patch -P 100 -p1 -b .fileexeext

%build
export LANG=POSIX
export LC_ALL=POSIX
rm -f Magdir/*,v Magdir/*~
rm -f ltcf-c.sh ltconfig ltmain.sh
libtoolize --force --copy --install
autoreconf -fiv
rm -rf native_build
mkdir -p native_build
pushd native_build
../configure --enable-static --disable-shared
make %{?_smp_mflags}
popd
echo "lt_cv_deplibs_check_method='pass_all'" >>%{_mingw64_cache}
export LIBS=-lgnurx
# In order to get the file we just built in the native build
export PATH="`pwd`/native_build/src:$PATH"
%{_mingw64_configure} --datadir=%{_mingw64_datadir}/misc --disable-static --enable-fsect-man5
make %{?_smp_mflags} pkgdatadir='$(datadir)'

%install
export LANG=POSIX
export LC_ALL=POSIX
mkdir  %{buildroot}/etc
make DESTDIR=%{buildroot} install pkgdatadir='$(datadir)'
mkdir -p %{buildroot}%{_mingw64_sysconfdir}
rm -vf %{buildroot}%{_mingw64_sysconfdir}/magic
echo '# Localstuff: file(1) magic(5) for locally observed files' > %{buildroot}%{_mingw64_sysconfdir}/magic
echo '#     global magic file is %{_mingw64_datadir}/misc/magic(.mgc)'	>> %{buildroot}%{_mingw64_sysconfdir}/magic
rm -f %{buildroot}%{_mingw64_libdir}/*.la

%files -n mingw64-libmagic%{somajor}
%defattr (644,root,root,755)
%{_mingw64_bindir}/lib*.dll

%files magic
%defattr (644,root,root,755)
%{_mingw64_datadir}/misc
%config(noreplace) %{_mingw64_sysconfdir}/magic
%doc %{_mingw64_mandir}/man5

%files
%defattr (644,root,root,755)
%{_mingw64_bindir}/file.exe
%doc %{_mingw64_mandir}/man1

%files devel
%defattr (644,root,root,755)
%{_mingw64_libdir}/lib*.dll.a
%{_mingw64_includedir}/magic.h
%doc %{_mingw64_mandir}/man3

%changelog
openSUSE Build Service is sponsored by