flex.spec 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. ##
  2. ## flex.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2003 Cable & Wireless <http://www.cw.com/>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package versions
  26. %define V_release 2.5.4a
  27. %define V_release_maj 2.5.4
  28. %define V_beta 2.5.31
  29. # package information
  30. Name: flex
  31. Summary: Fast Lexical Analyzer Generator
  32. URL: http://www.gnu.org/software/flex/
  33. Vendor: Free Software Foundation
  34. Packager: The OpenPKG Project
  35. Distribution: OpenPKG [CORE]
  36. Group: Language
  37. License: BSD
  38. Version: %{V_release}
  39. Release: 20030730
  40. # package options
  41. %option with_beta no
  42. # list of sources
  43. Source0: ftp://ftp.gnu.org/non-gnu/flex/flex-%{V_release}.tar.gz
  44. Source1: http://osdn.dl.sourceforge.net/sourceforge/lex/flex-%{V_beta}.tar.gz
  45. Patch0: flex.patch
  46. # build information
  47. Prefix: %{l_prefix}
  48. BuildRoot: %{l_buildroot}
  49. BuildPreReq: OpenPKG, openpkg >= 20030103, bison, make
  50. PreReq: OpenPKG, openpkg >= 20030103
  51. AutoReq: no
  52. AutoReqProv: no
  53. %description
  54. Flex is a tool for generating scanners: programs which recognized lexical
  55. patterns in text. flex reads the given input files for a description of a
  56. scanner to generate. The description is in the form of pairs of regular
  57. expressions and C code, called rules. flex generates as output a C source
  58. file, lex.yy.c, which defines a routine yylex(). This file is compiled and
  59. linked with the -lfl library to produce an executable. When the executable
  60. is run, it analyzes its input for occurrences of the regular expressions.
  61. Whenever it finds one, it executes the corresponding C code.
  62. %prep
  63. %setup0 -q -c -n flex-%{version}
  64. %if "%{with_beta}" == "yes"
  65. %setup1 -q -T -D -a 1
  66. ( cd flex-%{V_beta}
  67. %patch0 -p0
  68. ) || exit $?
  69. %endif
  70. %build
  71. # configure and build Flex (stable version)
  72. ( cd flex-%{V_release_maj}
  73. CC="%{l_cc}" \
  74. CFLAGS="%{l_cflags -O}" \
  75. ./configure \
  76. --prefix=$RPM_BUILD_ROOT%{l_prefix}
  77. %{l_make} %{l_mflags}
  78. ) || exit $?
  79. # configure and build Flex (beta version)
  80. %if "%{with_beta}" == "yes"
  81. ( cd flex-%{V_beta}
  82. CC="%{l_cc}" \
  83. CFLAGS="%{l_cflags -O}" \
  84. HELP2MAN=`type -P true` \
  85. ./configure \
  86. --prefix=%{l_prefix} \
  87. --disable-nls
  88. %{l_make} %{l_mflags}
  89. ) || exit $?
  90. %endif
  91. %install
  92. rm -rf $RPM_BUILD_ROOT
  93. # install Flex (beta version)
  94. %if "%{with_beta}" == "yes"
  95. ( cd flex-%{V_beta}
  96. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  97. mv $RPM_BUILD_ROOT%{l_prefix}/bin/flex \
  98. $RPM_BUILD_ROOT%{l_prefix}/bin/flex-beta
  99. mv $RPM_BUILD_ROOT%{l_prefix}/include/FlexLexer.h \
  100. $RPM_BUILD_ROOT%{l_prefix}/include/FlexLexer-beta.h
  101. mv $RPM_BUILD_ROOT%{l_prefix}/lib/libfl.a \
  102. $RPM_BUILD_ROOT%{l_prefix}/lib/libfl-beta.a
  103. mv $RPM_BUILD_ROOT%{l_prefix}/man/man1/flex.1 \
  104. $RPM_BUILD_ROOT%{l_prefix}/man/man1/flex-beta.1
  105. ) || exit $?
  106. %endif
  107. # install Flex (stable version)
  108. ( cd flex-%{V_release_maj}
  109. %{l_make} %{l_mflags} install
  110. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/flex++
  111. ) || exit $?
  112. # strip down installation
  113. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  114. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  115. # determine installation files
  116. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  117. %files -f files
  118. %clean
  119. rm -rf $RPM_BUILD_ROOT