Bump to file 5.32
[platform/upstream/file.git] / packaging / file.spec
1 %global         _miscdir    %{_datadir}/misc
2
3 Name:           file
4 BuildRequires:  findutils
5 BuildRequires:  libtool
6 BuildRequires:  zlib-devel
7 Url:            http://www.darwinsys.com/file/
8 Version:        5.32
9 Release:        0
10 Summary:        A Tool to Determine File Types
11 License:        BSD-2.0
12 Group:          System/Utilities
13
14 ### SOURCES BEGIN ###
15 Source2:        baselibs.conf
16 Source1001:     file.manifest
17 ### SOURCES END ###
18 Source:         ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
19
20 %description
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.
25
26 %package -n libmagic-data
27 Summary:        The magic files for libmagic to use
28 Group:          System/Libraries
29
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.
33
34 %package -n libmagic
35 Summary:        Library with file's functionality
36 Group:          System/Libraries
37 Requires:       libmagic-data = %{version}
38 Provides:       libfile
39 Obsoletes:      libfile =< 5.04
40
41 %description -n libmagic
42 This library reads magic files and detects file types. Used by file command
43
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
48 Requires:       glibc-devel
49 Requires:       libmagic = %{version}
50
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.
54
55 %prep
56 %setup -q -n file-%{version}
57 ### PREP BEGIN ###
58 cp %{SOURCE1001} .
59 ### PREP END ###
60
61 %build
62 ### BUILD BEGIN ###
63 export LANG=POSIX
64 export LC_ALL=POSIX
65 rm -f Magdir/*,v Magdir/*~
66 rm -f ltcf-c.sh ltconfig ltmain.sh
67 autoreconf -fiv
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
72
73 %{__make} %{?_smp_mflags} pkgdatadir='$(datadir)'
74 %if 0%{?build_python_bindings:1}
75 pushd python
76 python setup.py build
77 popd
78 %endif
79 ### BUILD END ###
80
81 %install
82 export LANG=POSIX
83 export LC_ALL=POSIX
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
96 unset LD_LIBRARY_PATH
97 %{__rm} -f %{buildroot}%{_libdir}/*.la
98
99 %post -n libmagic -p /sbin/ldconfig
100
101 %postun -n libmagic -p /sbin/ldconfig
102
103 %files -n libmagic
104 %manifest %{name}.manifest
105 %defattr (644,root,root,755)
106 %license COPYING
107 %{_libdir}/lib*.so.*
108
109 %files -n libmagic-data
110 %manifest %{name}.manifest
111 %defattr (644,root,root,755)
112 %license COPYING
113 %config(noreplace) %{_sysconfdir}/magic
114 #%%{_miscdir}/magic
115 %{_miscdir}/magic.mgc
116 %doc %{_mandir}/man5/magic.5.gz
117
118 %files
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
124 %license COPYING
125
126 %files -n file-devel
127 %manifest %{name}.manifest
128 %defattr (644,root,root,755)
129 %{_libdir}/lib*.so
130 %{_includedir}/magic.h
131 %doc %{_mandir}/man3/libmagic.3.gz
132 %license COPYING