file.spec 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. ##
  2. ## file.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package version
  24. %define V_api_c 5.03
  25. %define V_api_pl 0.96
  26. # package information
  27. Name: file
  28. Summary: Automatic File Content Type Recognition Tool
  29. URL: http://www.darwinsys.com/file/
  30. Vendor: Christos Zoulas
  31. Packager: OpenPKG Foundation e.V.
  32. Distribution: OpenPKG Community
  33. Class: BASE
  34. Group: Filesystem
  35. License: BSD
  36. Version: %{V_api_c}
  37. Release: 20090524
  38. # package options
  39. %option with_perl no
  40. # list of sources
  41. Source0: ftp://ftp.astron.com/pub/file/file-%{V_api_c}.tar.gz
  42. Source1: http://www.cpan.org/modules/by-module/File/File-LibMagic-%{V_api_pl}.tgz
  43. Patch0: file.patch
  44. # build information
  45. Prefix: %{l_prefix}
  46. BuildRoot: %{l_buildroot}
  47. BuildPreReq: OpenPKG, openpkg >= 20040130, gcc, make
  48. PreReq: OpenPKG, openpkg >= 20040130
  49. BuildPreReq: zlib
  50. PreReq: zlib
  51. %if "%{with_perl}" == "yes"
  52. BuildPreReq: perl, perl-openpkg
  53. PreReq: perl
  54. %endif
  55. AutoReq: no
  56. AutoReqProv: no
  57. %description
  58. The popular file(1) command which determines the type of a file by
  59. peeking at magic bytes of its content.
  60. %track
  61. prog file = {
  62. version = %{V_api_c}
  63. url = ftp://ftp.astron.com/pub/file/
  64. regex = file-(__VER__)\.tar\.gz
  65. }
  66. prog file:File-LibMagic = {
  67. version = %{V_api_pl}
  68. url = http://www.cpan.org/modules/by-module/File/
  69. regex = File-LibMagic-(__VER__)\.tgz
  70. }
  71. %prep
  72. %setup -q
  73. %setup -q -D -T -a 1
  74. %patch -p0
  75. %build
  76. ACLOCAL=true \
  77. AUTOCONF=true \
  78. AUTOMAKE=true \
  79. AUTOHEADER=true \
  80. CC="%{l_cc}" \
  81. CFLAGS="%{l_cflags -O} %{l_cppflags}" \
  82. CPPFLAGS="%{l_cppflags}" \
  83. LDFLAGS="%{l_ldflags}" \
  84. GREP="grep" \
  85. ./configure \
  86. --prefix=%{l_prefix} \
  87. --mandir=%{l_prefix}/man \
  88. --disable-shared \
  89. --disable-nls
  90. %{l_make} %{l_mflags}
  91. %if "%{with_perl}" == "yes"
  92. %{l_shtool} subst \
  93. -e 's;-I\.;-I. -I../src;g' \
  94. -e 's;-lmagic;-L../src/.libs -lmagic %{l_ldflags} -lz;' \
  95. File-LibMagic-%{V_api_pl}/Makefile.PL
  96. %{l_prefix}/bin/perl-openpkg prepare
  97. %{l_prefix}/bin/perl-openpkg -d File-LibMagic-%{V_api_pl} configure build
  98. %endif
  99. %install
  100. rm -rf $RPM_BUILD_ROOT
  101. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  102. %if "%{with_perl}" == "yes"
  103. %{l_prefix}/bin/perl-openpkg -d File-LibMagic-%{V_api_pl} install
  104. %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
  105. %else
  106. >perl-openpkg-files
  107. %endif
  108. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2>/dev/null || true
  109. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} `cat perl-openpkg-files`
  110. %files -f files
  111. %clean
  112. rm -rf $RPM_BUILD_ROOT