flex.spec 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. ##
  2. ## flex.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2002 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2002 Ralf S. Engelschall <rse@engelschall.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 options
  26. %ifndef with_beta
  27. %define with_beta yes
  28. %endif
  29. # package versions
  30. %define V_release 2.5.4a
  31. %define V_release_maj 2.5.4
  32. %define V_beta 2.5.21
  33. # package information
  34. Name: flex
  35. Summary: Fast Lexical Analyzer Generator
  36. URL: http://www.gnu.org/software/flex/
  37. Vendor: Free Software Foundation
  38. Packager: The OpenPKG Project
  39. Distribution: OpenPKG [CORE]
  40. Group: Language
  41. License: BSD
  42. Version: %{V_release}
  43. Release: 20021006
  44. # list of sources
  45. Source0: ftp://ftp.gnu.org/non-gnu/flex/flex-%{V_release}.tar.gz
  46. Source1: ftp://ftp.uncg.edu/people/wlestes/flex-%{V_beta}.tar.gz
  47. Patch0: flex.patch
  48. # build information
  49. Prefix: %{l_prefix}
  50. BuildRoot: %{l_buildroot}
  51. BuildPreReq: OpenPKG, openpkg >= 20020206, bison, make
  52. PreReq: OpenPKG, openpkg >= 20020206
  53. AutoReq: no
  54. AutoReqProv: no
  55. %description
  56. Flex is a tool for generating scanners: programs which recognized lexical
  57. patterns in text. flex reads the given input files for a description of a
  58. scanner to generate. The description is in the form of pairs of regular
  59. expressions and C code, called rules. flex generates as output a C source
  60. file, lex.yy.c, which defines a routine yylex(). This file is compiled and
  61. linked with the -lfl library to produce an executable. When the executable
  62. is run, it analyzes its input for occurrences of the regular expressions.
  63. Whenever it finds one, it executes the corresponding C code.
  64. Options: with_beta=%{with_beta}
  65. %prep
  66. %setup0 -q -c -n flex-%{version}
  67. %if "%{with_beta}" == "yes"
  68. %setup1 -q -T -D -a 1
  69. cd flex-%{V_beta}
  70. %patch -p0
  71. %endif
  72. %build
  73. ( cd flex-%{V_release_maj}
  74. CC="%{l_cc}" \
  75. CFLAGS="%{l_cflags -O}" \
  76. ./configure \
  77. --prefix=$RPM_BUILD_ROOT%{l_prefix}
  78. %{l_make} %{l_mflags}
  79. )
  80. %if "%{with_beta}" == "yes"
  81. ( cd flex-%{V_beta}
  82. ../flex-%{V_release_maj}/flex -oscan.c scan.l # WORKAROUND FOR 2.5.21 ONLY!
  83. CC="%{l_cc}" \
  84. CFLAGS="%{l_cflags -O}" \
  85. ./configure \
  86. --prefix=%{l_prefix} \
  87. --disable-nls
  88. %{l_make} %{l_mflags}
  89. )
  90. %endif
  91. %install
  92. rm -rf $RPM_BUILD_ROOT
  93. %if "%{with_beta}" == "yes"
  94. ( cd flex-%{V_beta}
  95. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  96. mv $RPM_BUILD_ROOT%{l_prefix}/bin/flex \
  97. $RPM_BUILD_ROOT%{l_prefix}/bin/flex-beta
  98. mv $RPM_BUILD_ROOT%{l_prefix}/include/FlexLexer.h \
  99. $RPM_BUILD_ROOT%{l_prefix}/include/FlexLexer-beta.h
  100. mv $RPM_BUILD_ROOT%{l_prefix}/lib/libfl.a \
  101. $RPM_BUILD_ROOT%{l_prefix}/lib/libfl-beta.a
  102. mv $RPM_BUILD_ROOT%{l_prefix}/man/man1/flex.1 \
  103. $RPM_BUILD_ROOT%{l_prefix}/man/man1/flex-beta.1
  104. )
  105. %endif
  106. ( cd flex-%{V_release_maj}
  107. %{l_make} %{l_mflags} install
  108. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/flex++
  109. )
  110. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  111. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  112. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  113. %files -f files
  114. %clean
  115. rm -rf $RPM_BUILD_ROOT