Re: [Flex-help] Some flex patch snippets for Solaris.
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Will E. <wes...@gm...> - 2016-05-20 22:12:40
|
The bootstrapping of flex was reworked after 2.6.1 was released. I -think- it's immune to the vpath build that you do. If you can verify that against the current git tree, let me know the results. Ditto the building of the man page. As for finding m4, the solution needs to be more general. While what you do works for people who want to use the stock setup on Solaris, I can easily see other situations where it doesn't do enough. I'll open an issue to describe the problem. What should happen is that configure should have an option that accepts a path to a suitable m4 binary. If that option is passed, then configure sets a variable that gets put into config.h which main.c reads. If that option is not passed, then configure should try to find a suitable m4 and set the symbol as previously. The M4 environment variable is handy for certain situations that might arise as well. Thanks for your report and interest in flex. On Friday, 20 May 2016, 8:02 am -0700, Rich Burridge <ric...@or...> wrote: > Hi, > > In trying to get flex 2.6.1 working in the build environment we > use for FOSS components in Solaris, I encountered three problems > which I was easily able to patch around. Please consider these > changes for a future version of flex. > > 1/ In flex-2.6.1/src/Makefile.am there is a rule: > > stage1scan.l: scan.l > cp $(srcdir)/scan.l $(srcdir)/stage1scan.l > > For Solaris, we don't build things directly in the original source > directories, but use a separate build directory. So we need to apply > the following patch: > > --- flex-2.6.1/src/Makefile.am.orig 2016-05-19 06:21:16.631609293 -0700 > +++ flex-2.6.1/src/Makefile.am 2016-05-19 14:19:29.394717203 -0700 > @@ -87,7 +87,7 @@ > mv skel.c.tmp $(srcdir)/skel.c > > stage1scan.l: scan.l > - cp $(srcdir)/scan.l $(srcdir)/stage1scan.l > + cp $(srcdir)/scan.l $(top_builddir)/src/stage1scan.l > > stage1scan.c: stage1scan.l stage1flex$(EXEEXT) > $(top_builddir)/src/stage1flex$(EXEEXT) -o $@ $< > > 2/ Similarly, in flex-2.6.1/doc/Makefile.am we need to run help2man on > a flex file that's been created in the build directory not the source > directory, so we need to apply this patch: > > --- flex-2.6.1/doc/Makefile.am.orig 2016-05-19 06:45:26.670565152 -0700 > +++ flex-2.6.1/doc/Makefile.am 2016-05-19 06:45:45.734263762 -0700 > @@ -26,5 +26,5 @@ > for i in $(dist_man_MANS) ; do \ > $(help2man) --name='$(PACKAGE_NAME)' \ > --section=`echo $$i | sed -e 's/.*\.\([^.]*\)$$/\1/'` \ > - $(top_srcdir)/src/flex$(EXEEXT) > $$i || rm -f $$i ; \ > + $(top_builddir)/src/flex$(EXEEXT) > $$i || rm -f $$i ; \ > done > > 3/ The third one is a Solaris specific problem. In /usr/bin, the Solaris > version > of m4 doesn't understand the -P command line option, so fails when it's > part of the chain in flex. We have the GNU m4 binary under /usr/gnu/bin. > We can't rely on the M4 environment variable always being set, or that > /usr/gnu/bin will be found in the PATH environment variable before > /usr/bin, > so the existing logic in flex-2.6.1/src/main.c to find m4 doesn't > work correctly > on Solaris. I've fixed this by using the following patch: > > --- flex-2.6.1/src/main.c.orig 2016-05-19 14:36:18.569346881 -0700 > +++ flex-2.6.1/src/main.c 2016-05-20 07:59:04.169569771 -0700 > @@ -348,6 +348,7 @@ > > /* Setup the filter chain. */ > output_chain = filter_create_int(NULL, filter_tee_header, > headerfilename); > +#ifndef __sun > if ( !(m4 = getenv("M4"))) { > char *slash; > m4 = M4; > @@ -389,6 +390,9 @@ > } > } > filter_create_ext(output_chain, m4, "-P", 0); > +#else > + filter_create_ext(output_chain, "/usr/gnu/bin/m4", "-P", 0); > +#endif > filter_create_int(output_chain, filter_fix_linedirs, NULL); > > /* For debugging, only run the requested number of filters. */ > > > > Thanks. > > > ------------------------------------------------------------------------------ > Mobile security can be enabling, not merely restricting. Employees who > bring their own devices (BYOD) to work are irked by the imposition of MDM > restrictions. Mobile Device Manager Plus allows you to control only the > apps on BYO-devices by containerizing them, leaving personal data untouched! > https://ad.doubleclick.net/ddm/clk/304595813;131938128;j > -- > Flex-help mailing list > Fle...@li... > https://lists.sourceforge.net/lists/listinfo/flex-help -- Will Estes Flex Project Maintainer wes...@gm... https://github.com/westes/flex |