Forráskód Böngészése

apply patch to get Flex beta version building on Solaris and similar platforms where std{in,out} cannot be used as an lvalue

Ralf S. Engelschall 22 éve
szülő
commit
267ea93581
2 módosított fájl, 44 hozzáadás és 1 törlés
  1. 39 0
      flex/flex.patch
  2. 5 1
      flex/flex.spec

+ 39 - 0
flex/flex.patch

@@ -0,0 +1,39 @@
+It is not portable to use "std{in,out}" as "lvalues" (for instance,
+building under Sun Solaris breaks here). The portable solution is to use
+freopen(3). Unfortunately, to achieve the same effect than fdopen(3) on
+"std{in,out}", one has to use "/dev/std{in,out}" (which in turn is not
+really portable, but at least more portable than using "std{in,out}"
+as "lvalues"). The only "we know it better" alternative would be to
+just replace the code with a fflush(3) on the streams and know that the
+stream has not recognized the changed underlying filedescriptor. But
+this again is not really portable, although also working for mostly all
+Unix platforms.
+
+--- filter.c.orig	2003-03-25 17:39:08.000000000 +0100
++++ filter.c	2003-07-24 10:05:02.000000000 +0200
+@@ -158,10 +158,10 @@
+ 			int     r;
+ 
+ 			/* setup streams again */
+-			if ((stdin = fdopen (0, "r")) == NULL)
+-				flexfatal (_("fdopen(0) failed"));
+-			if ((stdout = fdopen (1, "w")) == NULL)
+-				flexfatal (_("fdopen(1) failed"));
++			if ((freopen ("/dev/stdin", "r", stdin)) == NULL)
++				flexfatal (_("freopen(stdin) failed"));
++			if ((freopen ("/dev/stdout", "w", stdout)) == NULL)
++				flexfatal (_("freopen(stdout) failed"));
+ 
+ 			if ((r = chain->filter_func (chain)) == -1)
+ 				flexfatal (_("filter_func failed"));
+@@ -181,8 +181,8 @@
+ 	if (dup2 (pipes[1], 1) == -1)
+ 		flexfatal (_("dup2(pipes[1],1)"));
+ 	close (pipes[1]);
+-	if ((stdout = fdopen (1, "w")) == NULL)
+-		flexfatal (_("fdopen(1) failed"));
++	if ((freopen ("/dev/stdout", "w", stdout)) == NULL)
++		flexfatal (_("freopen(stdout) failed"));
+ 
+ 	return true;
+ }

+ 5 - 1
flex/flex.spec

@@ -38,7 +38,7 @@ Distribution: OpenPKG [CORE]
 Group:        Language
 License:      BSD
 Version:      %{V_release}
-Release:      20030723
+Release:      20030724
 
 #   package options
 %option       with_beta  yes
@@ -46,6 +46,7 @@ Release:      20030723
 #   list of sources
 Source0:      ftp://ftp.gnu.org/non-gnu/flex/flex-%{V_release}.tar.gz
 Source1:      http://osdn.dl.sourceforge.net/sourceforge/lex/flex-%{V_beta}.tar.gz
+Patch0:       flex.patch
 
 #   build information
 Prefix:       %{l_prefix}
@@ -69,6 +70,9 @@ AutoReqProv:  no
     %setup0 -q -c -n flex-%{version}
 %if "%{with_beta}" == "yes"
     %setup1 -q -T -D -a 1
+    ( cd flex-%{V_beta}
+      %patch0 -p0
+    ) || exit $?
 %endif
 
 %build