Procházet zdrojové kódy

Fix the following two problems (as reported today this way to the Flex authors): 1. In recent Flex versions you introduced some C99 support. At least the Flex 2.5.21 release is fully broken on non-C99 platforms. For instance the shipped pre-built scan.c contains non-conditional usage of <stdint.h> and references to int32_t, etc. This immediately fails. I've worked around it by doing "flex -oscan.c scan.l" before building (where "flex" was an old 2.5.4 version). 2. Additionally at least on FreeBSD 4.x the usage of <malloc.h> gives lots of warnings: /usr/include/malloc.h:2:2: warning: #warning "this file includes <malloc.h> which is deprecated, use <stdlib.h> instead". The reason is flexdef.h, line 119. <malloc.h> is really never needed today on modern systems, so I personally never included it in any software packages of me. And my packages like GNU Pth and others were ported to really lots of platforms -- both modern and esoteric ones. So I recommend you to complete remove likes 118-120, but as a workaround for myself I used a simple "#if defined(HAVE_MALLOC_H) && !defined(__FreeBSD__)" but the complete removal is certainly better.

Ralf S. Engelschall před 23 roky
rodič
revize
e71a2c0cd9
2 změnil soubory, kde provedl 22 přidání a 8 odebrání
  1. 11 0
      flex/flex.patch
  2. 11 8
      flex/flex.spec

+ 11 - 0
flex/flex.patch

@@ -0,0 +1,11 @@
+--- flexdef.h.orig	Fri Sep 13 03:17:22 2002
++++ flexdef.h	Sun Oct  6 10:21:59 2002
+@@ -115,7 +115,7 @@
+ #ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+-#ifdef HAVE_MALLOC_H
++#if defined(HAVE_MALLOC_H) && !defined(__FreeBSD__)
+ #include <malloc.h>
+ #endif
+ #ifdef HAVE_UNISTD_H

+ 11 - 8
flex/flex.spec

@@ -43,11 +43,12 @@ Distribution: OpenPKG [CORE]
 Group:        Language
 License:      BSD
 Version:      %{V_release}
-Release:      20020918
+Release:      20021006
 
 #   list of sources
 Source0:      ftp://ftp.gnu.org/non-gnu/flex/flex-%{V_release}.tar.gz
 Source1:      ftp://ftp.uncg.edu/people/wlestes/flex-%{V_beta}.tar.gz
+Patch0:       flex.patch
 
 #   build information
 Prefix:       %{l_prefix}
@@ -74,26 +75,28 @@ AutoReqProv:  no
 %if "%{with_beta}" == "yes"
     %setup1 -q -T -D -a 1
     cd flex-%{V_beta}
+    %patch -p0
 %endif
 
 %build
-%if "%{with_beta}" == "yes"
-    ( cd flex-%{V_beta}
+    ( cd flex-%{V_release_maj}
       CC="%{l_cc}" \
       CFLAGS="%{l_cflags -O}" \
       ./configure \
-          --prefix=%{l_prefix} \
-          --disable-nls
+          --prefix=$RPM_BUILD_ROOT%{l_prefix}
       %{l_make} %{l_mflags}
     )
-%endif
-    ( cd flex-%{V_release_maj}
+%if "%{with_beta}" == "yes"
+    ( cd flex-%{V_beta}
+      ../flex-%{V_release_maj}/flex -oscan.c scan.l # WORKAROUND FOR 2.5.21 ONLY!
       CC="%{l_cc}" \
       CFLAGS="%{l_cflags -O}" \
       ./configure \
-          --prefix=$RPM_BUILD_ROOT%{l_prefix}
+          --prefix=%{l_prefix} \
+          --disable-nls
       %{l_make} %{l_mflags}
     )
+%endif
 
 %install
     rm -rf $RPM_BUILD_ROOT