flex.spec 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. ##
  2. ## flex.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 versions
  24. %define V_new 2.5.35
  25. %define V_old 2.5.4a
  26. %define V_old_maj 2.5.4
  27. %define V_reflex 20090902
  28. # package information
  29. Name: flex
  30. Summary: Fast Lexical Analyzer Generator
  31. URL: http://www.gnu.org/software/flex/
  32. Vendor: Free Software Foundation
  33. Packager: OpenPKG Foundation e.V.
  34. Distribution: OpenPKG Community
  35. Class: CORE
  36. Group: CompilerCompiler
  37. License: BSD
  38. Version: %{V_new}
  39. Release: 20090903
  40. # package options
  41. %option with_old no
  42. # list of sources
  43. Source0: http://switch.dl.sourceforge.net/sourceforge/flex/flex-%{V_new}.tar.gz
  44. Source1: http://switch.dl.sourceforge.net/sourceforge/flex/flex-%{V_old}.tar.gz
  45. Source2: ftp://invisible-island.net/reflex/reflex-%{V_reflex}.tgz
  46. Patch0: flex.patch
  47. # build information
  48. Prefix: %{l_prefix}
  49. BuildRoot: %{l_buildroot}
  50. BuildPreReq: OpenPKG, openpkg >= 20040212, bison, make
  51. PreReq: OpenPKG, openpkg >= 20040212, m4
  52. AutoReq: no
  53. AutoReqProv: no
  54. %description
  55. Flex is a tool for generating scanners: programs which recognize
  56. lexical patterns in text. Flex reads the given input files for a
  57. description of a scanner to generate. The description is in the
  58. form of pairs of regular expressions and C code, called rules.
  59. Flex generates as output a C source file, lex.yy.c, which defines
  60. a C function yylex(). This file is compiled and linked with the
  61. -lfl library to produce an executable. When the executable is run,
  62. it analyzes its input for occurrences of the regular expressions.
  63. Whenever it finds one, it executes the corresponding C code.
  64. %track
  65. prog flex:new = {
  66. version = %{V_new}
  67. url = http://sourceforge.net/projects/flex/files/
  68. regex = flex-(__VER__)\.tar\.gz
  69. }
  70. prog flex:old = {
  71. disabled
  72. comment = "cs: 'old' actually refers to the completely discontinued version of flex"
  73. version = %{V_old}
  74. url = http://flex.sourceforge.net/
  75. regex = flex-(__VER__)\.tar\.gz
  76. }
  77. prog flex:reflex = {
  78. version = %{V_reflex}
  79. url = ftp://invisible-island.net/reflex/
  80. regex = reflex-(__VER__)\.tgz
  81. }
  82. %prep
  83. %setup -q -c
  84. %setup -q -T -D -a 1
  85. %setup -q -T -D -a 2
  86. %patch -p0 -d flex-%{V_new}
  87. sleep 1; touch flex-%{V_new}/scan.c
  88. %{l_shtool} subst \
  89. -e '1,/^@copying/!{ /^@end copying/,/^@copying/!H }' \
  90. -e '/^@insertcopying/g' \
  91. -e '/^@copying/,/^@end copying/d' \
  92. flex-%{V_new}/doc/flex.texi
  93. %build
  94. # configure and build Flex (new version)
  95. ( cd flex-%{V_new}
  96. CC="%{l_cc}" \
  97. CFLAGS="%{l_cflags -O}" \
  98. HELP2MAN=`type -P true` \
  99. ./configure \
  100. --prefix=%{l_prefix} \
  101. --disable-nls
  102. cp -p doc/flex.1 doc/flex.1.saved
  103. %{l_shtool} subst \
  104. -e 's;"m4";"%{l_prefix}/bin/m4";' \
  105. main.c
  106. %{l_make} %{l_mflags}
  107. ) || exit $?
  108. %if "%{with_old}" == "yes"
  109. # configure and build Flex (old version)
  110. ( cd flex-%{V_old_maj}
  111. CC="%{l_cc}" \
  112. CFLAGS="%{l_cflags -O}" \
  113. ./configure \
  114. --prefix=$RPM_BUILD_ROOT%{l_prefix}
  115. %{l_make} %{l_mflags}
  116. ) || exit $?
  117. # configure and build Reflex (alternative old version)
  118. ( cd reflex-%{V_reflex}
  119. CC="%{l_cc}" \
  120. CFLAGS="%{l_cflags -O}" \
  121. ./configure \
  122. --prefix=%{l_prefix}
  123. %{l_make} %{l_mflags}
  124. ) || exit $?
  125. %endif
  126. %install
  127. rm -rf $RPM_BUILD_ROOT
  128. %if "%{with_old}" == "yes"
  129. # install Flex (old version)
  130. ( cd flex-%{V_old_maj}
  131. %{l_make} %{l_mflags} install
  132. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/flex++
  133. mv $RPM_BUILD_ROOT%{l_prefix}/bin/flex \
  134. $RPM_BUILD_ROOT%{l_prefix}/bin/flex-old
  135. mv $RPM_BUILD_ROOT%{l_prefix}/include/FlexLexer.h \
  136. $RPM_BUILD_ROOT%{l_prefix}/include/FlexLexer-old.h
  137. mv $RPM_BUILD_ROOT%{l_prefix}/lib/libfl.a \
  138. $RPM_BUILD_ROOT%{l_prefix}/lib/libfl-old.a
  139. mv $RPM_BUILD_ROOT%{l_prefix}/man/man1/flex.1 \
  140. $RPM_BUILD_ROOT%{l_prefix}/man/man1/flex-old.1
  141. ) || exit $?
  142. # install Reflex (alternative old version)
  143. ( cd reflex-%{V_reflex}
  144. %{l_make} %{l_mflags} install \
  145. prefix=$RPM_BUILD_ROOT%{l_prefix} \
  146. exec_prefix=$RPM_BUILD_ROOT%{l_prefix}
  147. ) || exit $?
  148. %endif
  149. # install Flex (new version)
  150. ( cd flex-%{V_new}
  151. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  152. %{l_shtool} install -c -m 644 \
  153. doc/flex.1.saved \
  154. $RPM_BUILD_ROOT%{l_prefix}/man/man1/flex.1
  155. ) || exit $?
  156. # strip down installation
  157. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  158. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  159. # determine installation files
  160. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  161. %files -f files
  162. %clean
  163. rm -rf $RPM_BUILD_ROOT