flex.spec 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. ##
  2. ## flex.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2004 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
  36. Class: CORE
  37. Group: Language
  38. License: BSD
  39. Version: %{V_release}
  40. Release: 20040205
  41. # package options
  42. %option with_beta no
  43. # list of sources
  44. Source0: ftp://ftp.gnu.org/non-gnu/flex/flex-%{V_release}.tar.gz
  45. Source1: http://osdn.dl.sourceforge.net/sourceforge/lex/flex-%{V_beta}.tar.gz
  46. Patch0: flex.patch
  47. # build information
  48. Prefix: %{l_prefix}
  49. BuildRoot: %{l_buildroot}
  50. BuildPreReq: OpenPKG, openpkg >= 20040130, bison, make
  51. PreReq: OpenPKG, openpkg >= 20040130
  52. AutoReq: no
  53. AutoReqProv: no
  54. %description
  55. Flex is a tool for generating scanners: programs which recognized lexical
  56. patterns in text. flex reads the given input files for a description of a
  57. scanner to generate. The description is in the form of pairs of regular
  58. expressions and C code, called rules. flex generates as output a C source
  59. file, lex.yy.c, which defines a routine yylex(). This file is compiled and
  60. linked with the -lfl library to produce an executable. When the executable
  61. is run, it analyzes its input for occurrences of the regular expressions.
  62. Whenever it finds one, it executes the corresponding C code.
  63. %track
  64. prog flex:release = {
  65. version = 2.5.4a
  66. url = ftp://ftp.gnu.org/non-gnu/flex/
  67. regex = flex-(__VER__)\.tar\.gz
  68. }
  69. prog flex:beta = {
  70. comment = "see also http://astro.temple.edu/~john43/flex/"
  71. version = 2.5.31
  72. url = http://prdownloads.sourceforge.net/lex/
  73. regex = flex-(__VER__)\.tar\.gz
  74. }
  75. %prep
  76. %setup -q -c -n flex-%{version}
  77. %if "%{with_beta}" == "yes"
  78. %setup -q -T -D -a 1
  79. ( cd flex-%{V_beta}
  80. %patch -p0
  81. ) || exit $?
  82. %endif
  83. %build
  84. # configure and build Flex (stable version)
  85. ( cd flex-%{V_release_maj}
  86. CC="%{l_cc}" \
  87. CFLAGS="%{l_cflags -O}" \
  88. ./configure \
  89. --prefix=$RPM_BUILD_ROOT%{l_prefix}
  90. %{l_make} %{l_mflags}
  91. ) || exit $?
  92. # configure and build Flex (beta version)
  93. %if "%{with_beta}" == "yes"
  94. ( cd flex-%{V_beta}
  95. CC="%{l_cc}" \
  96. CFLAGS="%{l_cflags -O}" \
  97. HELP2MAN=`type -P true` \
  98. ./configure \
  99. --prefix=%{l_prefix} \
  100. --disable-nls
  101. cp -rp doc/flex.1 doc/flex.1.saved
  102. %{l_make} %{l_mflags}
  103. ) || exit $?
  104. %endif
  105. %install
  106. rm -rf $RPM_BUILD_ROOT
  107. # install Flex (beta version)
  108. %if "%{with_beta}" == "yes"
  109. ( cd flex-%{V_beta}
  110. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  111. mv $RPM_BUILD_ROOT%{l_prefix}/bin/flex \
  112. $RPM_BUILD_ROOT%{l_prefix}/bin/flex-beta
  113. mv $RPM_BUILD_ROOT%{l_prefix}/include/FlexLexer.h \
  114. $RPM_BUILD_ROOT%{l_prefix}/include/FlexLexer-beta.h
  115. mv $RPM_BUILD_ROOT%{l_prefix}/lib/libfl.a \
  116. $RPM_BUILD_ROOT%{l_prefix}/lib/libfl-beta.a
  117. mv doc/flex.1.saved \
  118. $RPM_BUILD_ROOT%{l_prefix}/man/man1/flex-beta.1
  119. ) || exit $?
  120. %endif
  121. # install Flex (stable version)
  122. ( cd flex-%{V_release_maj}
  123. %{l_make} %{l_mflags} install
  124. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/flex++
  125. ) || exit $?
  126. # strip down installation
  127. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  128. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  129. # determine installation files
  130. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  131. %files -f files
  132. %clean
  133. rm -rf $RPM_BUILD_ROOT