]> git.pld-linux.org Git - packages/file.git/blobdiff - file.spec
make libseccomp dependency conditional
[packages/file.git] / file.spec
index 868b65abf08f7bfcfc0674ba6032fb2c78f5db1f..1edd4e71d205fb67b84e784f5f6bf951ae113972 100644 (file)
--- a/file.spec
+++ b/file.spec
@@ -1,8 +1,14 @@
 #
 # Conditional build:
-%bcond_without python          # don't build python-magic module
-%bcond_without static_libs     # don't build static libraries
-%bcond_without tests           # don't perform "make check"
+%bcond_without python2         # CPython 2.x python-magic module
+%bcond_without python3         # CPython 3.x python-magic module
+%bcond_without static_libs     # static library
+%bcond_without tests           # unit tests
+%bcond_without seccomp         # SECCOMP support
+
+%ifnarch %{x8664} aarch64
+%undefine      with_seccomp
+%endif
 
 Summary:       A utility for determining file types
 Summary(cs.UTF-8):     Program pro zjišťování typu souborů
@@ -28,35 +34,46 @@ Summary(uk.UTF-8):  Утиліта для визначення типів фай
 Summary(zh_CN.UTF-8):  判定文件类型的工具。
 Summary(zh_TW.UTF-8):  用於決定檔案類型的一個工具程式。
 Name:          file
-Version:       5.13
+Version:       5.44
 Release:       2
 License:       distributable
 Group:         Applications/File
 Source0:       ftp://ftp.astron.com/pub/file/%{name}-%{version}.tar.gz
-# Source0-md5: d60c1364ba956eff7d21f8250808fc6d
+# Source0-md5: a60d586d49d015d842b9294864a89c7a
 Source1:       http://ftp1.pld-linux.org/people/glen/%{name}-non-english-man-pages.tar.bz2
 # Source1-md5: 6a45bcaefd19b94db36a1b2b7c5b806b
 Source2:       %{name}-zisofs.magic
 Source3:       %{name}-mscompress.magic
 Source4:       %{name}-magic.mime-gen.awk
-Patch0:                %{name}-sparc.patch
-Patch1:                %{name}-selinux.patch
-Patch2:                searchpath.patch
-Patch3:                automake.patch
-Patch4:                sticky-bit.patch
-Patch5:                cdf-pread.patch
-Patch6:                macho-crash.patch
+Patch0:                searchpath.patch
+Patch1:                automake.patch
+Patch2:                %{name}-gettext-no-random-translations.patch
+Patch3:                name-use-count.patch
 URL:           http://www.darwinsys.com/file/
 BuildRequires: autoconf >= 2.50
 BuildRequires: automake
+BuildRequires: bzip2-devel
+%{?with_seccomp:BuildRequires: libseccomp-devel}
 BuildRequires: libtool >= 2:2.0
-BuildRequires: rpmbuild(macros) >= 1.453
-%if %{with python}
+BuildRequires: lzlib-devel
+BuildRequires: rpm-build >= 4.6
+BuildRequires: rpmbuild(macros) >= 1.751
+%if %{with python2}
 BuildRequires: python-devel
 BuildRequires: python-modules
+BuildRequires: python-setuptools
+BuildRequires: rpm-pythonprov
+%endif
+%if %{with python3}
+BuildRequires: python3-devel
+BuildRequires: python3-modules
+BuildRequires: python3-setuptools
 BuildRequires: rpm-pythonprov
 %endif
+BuildRequires: xz-devel
 BuildRequires: zlib-devel
+BuildRequires: zstd-devel
+Requires(pretrans):    coreutils
 Requires:      libmagic = %{version}-%{release}
 Conflicts:     rpm-build < 4.4.1-9
 Conflicts:     xdelta < 1.0.0
@@ -203,8 +220,13 @@ Biblioteka funkcji operujących na pliku bazy danych magic.
 Summary:       Header files for libmagic library
 Summary(pl.UTF-8):     Pliki nagłówkowe biblioteki libmagic
 Group:         Development/Libraries
+Requires:      bzip2-devel
 Requires:      libmagic = %{version}-%{release}
+%{?with_seccomp:Requires:      libseccomp-devel}
+Requires:      lzlib-devel
+Requires:      lzma-devel
 Requires:      zlib-devel
+Requires:      zstd-devel
 
 %description -n libmagic-devel
 Library of functions which operate on magic database file.
@@ -235,17 +257,32 @@ Biblioteka funkcji operujących na pliku bazy danych magic.
 Ten pakiet zawiera statyczną wersję biblioteki.
 
 %package -n python-magic
-Summary:       Python bindings for libmagic
-Summary(pl.UTF-8):     Wiązania Pythona dla libmagic
+Summary:       Python bindings for libmagic
+Summary(pl.UTF-8):     Wiązania Pythona 2 do biblioteki libmagic
 Group:         Libraries/Python
 Requires:      libmagic = %{version}-%{release}
-%pyrequires_eq python-libs
+Requires:      python-libs
+BuildArch:     noarch
 
 %description -n python-magic
-Python bindings for libmagic.
+Python bindings for libmagic.
 
 %description -n python-magic -l pl.UTF-8
-Wiązania Pythona dla libmagic.
+Wiązania Pythona 2 do biblioteki libmagic.
+
+%package -n python3-magic
+Summary:       Python 3 bindings for libmagic
+Summary(pl.UTF-8):     Wiązania Pythona 3 do biblioteki libmagic
+Group:         Libraries/Python
+Requires:      libmagic = %{version}-%{release}
+Requires:      python-libs
+BuildArch:     noarch
+
+%description -n python3-magic
+Python 3 bindings for libmagic.
+
+%description -n python3-magic -l pl.UTF-8
+Wiązania Pythona 3 do biblioteki libmagic.
 
 %prep
 %setup -q
@@ -253,11 +290,8 @@ Wiązania Pythona dla libmagic.
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
-%patch4 -p1
-%patch5 -p1
-%patch6 -p1
 
-%if "%{cc_version}" < "3.4"
+%if "%{_ver_lt '%{cc_version}' '3.4'}" == "1"
 %{__sed} -i -e 's,-Wextra,,' configure.ac
 %endif
 
@@ -266,22 +300,32 @@ cp -p %{SOURCE2} magic/Magdir/zisofs
 
 rm -f magic/Magdir/{*.orig,*~}
 
+%if %{with python3}
+cp -a python py3
+%endif
+
 %build
 %{__libtoolize}
-%{__aclocal}
-%{__autoheader}
+%{__aclocal} -I m4
 %{__autoconf}
+%{__autoheader}
 %{__automake}
 %configure \
+       %{!?with_seccomp:--disable-libseccomp} \
        --disable-silent-rules \
        --enable-fsect-man5 \
        %{?with_static_libs:--enable-static}
 
 %{__make}
 
-%if %{with python}
+%if %{with python2}
 cd python
-%{__python} setup.py build
+%py_build
+cd ..
+%endif
+%if %{with python3}
+cd py3
+%py3_build
 cd ..
 %endif
 
@@ -296,19 +340,23 @@ install -d $RPM_BUILD_ROOT/%{_lib}
 %{__make} install \
        DESTDIR=$RPM_BUILD_ROOT
 
-mv $RPM_BUILD_ROOT%{_libdir}/libmagic.so.* $RPM_BUILD_ROOT/%{_lib}
+%{__mv} $RPM_BUILD_ROOT%{_libdir}/libmagic.so.* $RPM_BUILD_ROOT/%{_lib}
 ln -sf /%{_lib}/$(basename $RPM_BUILD_ROOT/%{_lib}/libmagic.so.*.*.*) \
         $RPM_BUILD_ROOT%{_libdir}/libmagic.so
 
-%if %{with python}
+%if %{with python2}
 cd python
-%{__python} setup.py install \
-       --root=$RPM_BUILD_ROOT \
-       --optimize=2
+%py_install
 cd ..
 %py_postclean
 %endif
 
+%if %{with python3}
+cd py3
+%py3_install
+cd ..
+%endif
+
 awk -f %{SOURCE4} < $RPM_BUILD_ROOT%{_datadir}/misc/magic > $RPM_BUILD_ROOT%{_datadir}/misc/magic.mime
 ln -s misc $RPM_BUILD_ROOT%{_datadir}/file
 
@@ -334,7 +382,7 @@ fi
 
 %files
 %defattr(644,root,root,755)
-%doc ChangeLog COPYING README
+%doc ChangeLog COPYING
 %attr(755,root,root) %{_bindir}/file
 %{_datadir}/file
 %{_datadir}/misc/magic
@@ -363,6 +411,7 @@ fi
 %attr(755,root,root) %{_libdir}/libmagic.so
 %{_libdir}/libmagic.la
 %{_includedir}/magic.h
+%{_pkgconfigdir}/libmagic.pc
 %{_mandir}/man3/libmagic.3*
 
 %if %{with static_libs}
@@ -371,12 +420,19 @@ fi
 %{_libdir}/libmagic.a
 %endif
 
-%if %{with python}
+%if %{with python2}
 %files -n python-magic
 %defattr(644,root,root,755)
-%doc python/README python/example.py
-%if "%{py_ver}" > "2.4"
-%{py_sitescriptdir}/Magic_file_extensions-*.egg-info
-%endif
+%doc python/README.md python/example.py
 %{py_sitescriptdir}/magic.py[co]
+%{py_sitescriptdir}/file_magic-*-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-magic
+%defattr(644,root,root,755)
+%doc python/README.md python/example.py
+%{py3_sitescriptdir}/magic.py
+%{py3_sitescriptdir}/__pycache__/magic.*.py[co]
+%{py3_sitescriptdir}/file_magic-*-py*.egg-info
 %endif
This page took 0.089721 seconds and 4 git commands to generate.