diff options
Diffstat (limited to 'meta/recipes-devtools/flex')
7 files changed, 216 insertions, 76 deletions
diff --git a/meta/recipes-devtools/flex/flex/0001-Emit-no-line-directives-if-gen_line_dirs-is-false.patch b/meta/recipes-devtools/flex/flex/0001-Emit-no-line-directives-if-gen_line_dirs-is-false.patch new file mode 100644 index 0000000000..c8202b6bd5 --- /dev/null +++ b/meta/recipes-devtools/flex/flex/0001-Emit-no-line-directives-if-gen_line_dirs-is-false.patch @@ -0,0 +1,32 @@ +From 440f3f55739468cd26e22f31871eca8cbbd53294 Mon Sep 17 00:00:00 2001 +From: Oleksiy Obitotskyy <oobitots@cisco.com> +Date: Wed, 6 Jan 2021 06:12:14 -0800 +Subject: [PATCH] Emit no #line directives if gen_line_dirs is false + +If we set --noline we should not print line directives. +But setting --noline means gen_line_dirs is false. + +Upstream-Status: Submitted +Signed-off-by: Oleksiy Obitotskyy <oobitots@cisco.com> +--- + src/buf.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/buf.c b/src/buf.c +index 185083c..4439e28 100644 +--- a/src/buf.c ++++ b/src/buf.c +@@ -95,8 +95,8 @@ struct Buf *buf_linedir (struct Buf *buf, const char* filename, int lineno) + const char *src; + size_t tsz; + +- if (gen_line_dirs) +- return buf; ++ if (!gen_line_dirs) ++ return buf; + + tsz = strlen("#line \"\"\n") + /* constant parts */ + 2 * strlen (filename) + /* filename with possibly all backslashes escaped */ +-- +2.26.2.Cisco + diff --git a/meta/recipes-devtools/flex/flex/0001-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch b/meta/recipes-devtools/flex/flex/0001-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch new file mode 100644 index 0000000000..60bf7ce8cf --- /dev/null +++ b/meta/recipes-devtools/flex/flex/0001-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch @@ -0,0 +1,32 @@ +From ed1f7e9de0d6a1d5a9e581e02a63593d22cf1e52 Mon Sep 17 00:00:00 2001 +From: Explorer09 <explorer09@gmail.com> +Date: Mon, 4 Sep 2017 10:47:33 +0800 +Subject: [PATCH] build: AC_USE_SYSTEM_EXTENSIONS in configure.ac. + +This would, e.g. define _GNU_SOURCE in config.h, enabling the +reallocarray() prototype in glibc 2.26+ on Linux systems with that +version of glibc. + +Fixes #241. + +Upstream-Status: Backport +Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> +--- + configure.ac | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 55e774b..c879fe1 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -25,8 +25,10 @@ + # autoconf requirements and initialization + + AC_INIT([the fast lexical analyser generator],[2.6.4],[flex-help@lists.sourceforge.net],[flex]) ++AC_PREREQ([2.60]) + AC_CONFIG_SRCDIR([src/scan.l]) + AC_CONFIG_AUX_DIR([build-aux]) ++AC_USE_SYSTEM_EXTENSIONS + LT_INIT + AM_INIT_AUTOMAKE([1.11.3 -Wno-portability foreign check-news std-options dist-lzip parallel-tests subdir-objects]) + AC_CONFIG_HEADER([src/config.h]) diff --git a/meta/recipes-devtools/flex/flex/check-funcs.patch b/meta/recipes-devtools/flex/flex/check-funcs.patch new file mode 100644 index 0000000000..762275e7f8 --- /dev/null +++ b/meta/recipes-devtools/flex/flex/check-funcs.patch @@ -0,0 +1,67 @@ +Subject: build: Move dnl comments out of AC_CHECK_FUNCS + +Due to a bug, autoheader (2.69) will treat M4 dnl comments in a quoted +argument of AC_CHECK_FUNCS as function tokens and generate a lot of +redundant and useless HAVE_* macros in config.h.in. +(Examples: HAVE_DNL, HAVE_AVAILABLE_, HAVE_BY) + +It seems to be this commit dbb4e94dc7bacbcfd4acef4f085ef752fe1aa03f of +mine that revealed this autoheader bug, and the affected config.h.in +had been shipped within flex-2.6.4 release tarball. + +I have reported the autoheader bug here: +<https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html> + +As a workaround, let's move comments out of AC_CHECK_FUNCS. + +Upstream-Status: Backport +Signed-off-by: Ross Burton <ross.burton@arm.com> + +Signed-off-by: Kang-Che Sung <explorer09@gmail.com> +Signed-off-by: Zang Ruochen <zangrc.fnst@cn.fujitsu.com> +--- + configure.ac | 28 +++++++++++++--------------- + 1 file changed, 13 insertions(+), 15 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 55e774b..5ea3a93 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -153,21 +153,19 @@ AC_FUNC_REALLOC + AS_IF([test "$cross_compiling" = yes], + AC_MSG_WARN([result $ac_cv_func_realloc_0_nonnull guessed because of cross compilation])) + +-AC_CHECK_FUNCS([dup2 dnl +-memset dnl +-regcomp dnl +-strcasecmp dnl +-strchr dnl +-strdup dnl +-strtol dnl +-], [], [AC_MSG_ERROR(required library function not found on your system)]) +- +-# Optional library functions +-AC_CHECK_FUNCS([dnl +-pow dnl Used only by "examples/manual/expr" +-setlocale dnl Needed only if NLS is enabled +-reallocarray dnl OpenBSD function. We have replacement if not available. +-]) ++dnl Autoheader (<= 2.69) bug: "dnl" comments in a quoted argument of ++dnl AC_CHECK_FUNCS will expand wierdly in config.h.in. ++dnl (https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html) ++ ++AC_CHECK_FUNCS([dup2 memset regcomp strcasecmp strchr strdup strtol], [], ++ [AC_MSG_ERROR(required library function not found on your system)]) ++ ++# Optional library functions: ++# pow - Used only by "examples/manual/expr". ++# setlocale - Needed only if NLS is enabled. ++# reallocarr - NetBSD function. Use reallocarray if not available. ++# reallocarray - OpenBSD function. We have replacement if not available. ++AC_CHECK_FUNCS([pow setlocale reallocarr reallocarray]) + + AC_CONFIG_FILES( + Makefile +-- +2.25.1 + diff --git a/meta/recipes-devtools/flex/flex/do_not_create_pdf_doc.patch b/meta/recipes-devtools/flex/flex/do_not_create_pdf_doc.patch deleted file mode 100644 index 032833ae7a..0000000000 --- a/meta/recipes-devtools/flex/flex/do_not_create_pdf_doc.patch +++ /dev/null @@ -1,17 +0,0 @@ -Upstream-Status: Inappropriate (embedded specific) - -Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> - -Index: flex-2.5.37/doc/Makefile.am -=================================================================== ---- flex-2.5.37.orig/doc/Makefile.am 2012-07-21 04:18:27.000000000 +0300 -+++ flex-2.5.37/doc/Makefile.am 2013-07-30 17:57:09.834834531 +0300 -@@ -2,7 +2,7 @@ - - info_TEXINFOS = flex.texi - dist_man_MANS = flex.1 --dist_doc_DATA= flex.pdf -+EXTRA_DIST= flex.pdf - - CLEANFILES = \ - flex.hks \ diff --git a/meta/recipes-devtools/flex/flex/run-ptest b/meta/recipes-devtools/flex/flex/run-ptest index 19db337900..037301c40f 100755 --- a/meta/recipes-devtools/flex/flex/run-ptest +++ b/meta/recipes-devtools/flex/flex/run-ptest @@ -2,4 +2,4 @@ # make would want to rebuild some files with a compiler otherwise :-/ make FLEX=/usr/bin/flex -t check-TESTS || true -make FLEX=/usr/bin/flex check-TESTS +make FLEX=/usr/bin/flex abs_builddir=./ check-TESTS diff --git a/meta/recipes-devtools/flex/flex_2.6.0.bb b/meta/recipes-devtools/flex/flex_2.6.0.bb deleted file mode 100644 index f6d136c93e..0000000000 --- a/meta/recipes-devtools/flex/flex_2.6.0.bb +++ /dev/null @@ -1,58 +0,0 @@ -SUMMARY = "Flex (The Fast Lexical Analyzer)" -DESCRIPTION = "Flex is a fast lexical analyser generator. Flex is a tool for generating programs that recognize \ -lexical patterns in text." -HOMEPAGE = "http://sourceforge.net/projects/flex/" -SECTION = "devel" -LICENSE = "BSD" - -DEPENDS = "${@bb.utils.contains('PTEST_ENABLED', '1', 'bison-native flex-native', '', d)}" -BBCLASSEXTEND = "native nativesdk" - -LIC_FILES_CHKSUM = "file://COPYING;md5=e4742cf92e89040b39486a6219b68067" - -SRC_URI = "${SOURCEFORGE_MIRROR}/flex/flex-${PV}.tar.bz2 \ - file://run-ptest \ - file://do_not_create_pdf_doc.patch \ - file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \ - ${@bb.utils.contains('PTEST_ENABLED', '1', '', 'file://disable-tests.patch', d)} \ - " - -SRC_URI[md5sum] = "266270f13c48ed043d95648075084d59" -SRC_URI[sha256sum] = "24e611ef5a4703a191012f80c1027dc9d12555183ce0ecd46f3636e587e9b8e9" - -UPSTREAM_CHECK_REGEX = "flex-(?P<pver>\d+(\.\d+)+)\.tar" - -inherit autotools gettext texinfo ptest - -M4 = "${bindir}/m4" -M4_class-native = "${STAGING_BINDIR_NATIVE}/m4" -EXTRA_OECONF += "ac_cv_path_M4=${M4}" -EXTRA_OEMAKE += "m4=${STAGING_BINDIR_NATIVE}/m4" - -EXTRA_OEMAKE += "${@bb.utils.contains('PTEST_ENABLED', '1', 'FLEX=${STAGING_BINDIR_NATIVE}/flex', '', d)}" - -do_install_append_class-native() { - create_wrapper ${D}/${bindir}/flex M4=${M4} -} - -do_install_append_class-nativesdk() { - create_wrapper ${D}/${bindir}/flex M4=${M4} -} - -RDEPENDS_${PN} += "m4" -RDEPENDS_${PN}-ptest += "bash gawk" - -do_compile_ptest() { - oe_runmake -C ${B}/tests -f ${B}/tests/Makefile top_builddir=${B} INCLUDES=-I${S}/src buildtests -} - -do_install_ptest() { - mkdir -p ${D}${PTEST_PATH}/build-aux/ - cp ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/ - cp -r ${S}/tests/* ${D}${PTEST_PATH} - cp -r ${B}/tests/* ${D}${PTEST_PATH} - sed -e 's/^Makefile:/_Makefile:/' \ - -e 's/^srcdir = \(.*\)/srcdir = ./' -e 's/^top_srcdir = \(.*\)/top_srcdir = ./' \ - -e 's/^builddir = \(.*\)/builddir = ./' -e 's/^top_builddir = \(.*\)/top_builddir = ./' \ - -i ${D}${PTEST_PATH}/Makefile -} diff --git a/meta/recipes-devtools/flex/flex_2.6.4.bb b/meta/recipes-devtools/flex/flex_2.6.4.bb new file mode 100644 index 0000000000..15cf6f5cca --- /dev/null +++ b/meta/recipes-devtools/flex/flex_2.6.4.bb @@ -0,0 +1,84 @@ +SUMMARY = "Flex (The Fast Lexical Analyzer)" +DESCRIPTION = "Flex is a fast lexical analyser generator. Flex is a tool for generating programs that recognize \ +lexical patterns in text." +HOMEPAGE = "http://sourceforge.net/projects/flex/" +SECTION = "devel" +LICENSE = "BSD-3-Clause & LGPL-2.0-or-later" +LICENSE:${PN}-libfl = "BSD-3-Clause" + +DEPENDS = "${@bb.utils.contains('PTEST_ENABLED', '1', 'bison-native flex-native', '', d)}" +BBCLASSEXTEND = "native nativesdk" + +LIC_FILES_CHKSUM = "file://COPYING;md5=e4742cf92e89040b39486a6219b68067 \ + file://src/gettext.h;beginline=1;endline=17;md5=9c05dda2f58d89b850c399cf22e1a00c" + +SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/flex-${PV}.tar.gz \ + file://run-ptest \ + file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \ + ${@bb.utils.contains('PTEST_ENABLED', '1', '', 'file://disable-tests.patch', d)} \ + file://0001-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch \ + file://check-funcs.patch \ + file://0001-Emit-no-line-directives-if-gen_line_dirs-is-false.patch \ + " + +SRC_URI[md5sum] = "2882e3179748cc9f9c23ec593d6adc8d" +SRC_URI[sha256sum] = "e87aae032bf07c26f85ac0ed3250998c37621d95f8bd748b31f15b33c45ee995" + +GITHUB_BASE_URI = "https://github.com/westes/flex/releases" + +# Disputed - yes there is stack exhaustion but no bug and it is building the +# parser, not running it, effectively similar to a compiler ICE. Upstream no plans to address +# https://github.com/westes/flex/issues/414 +CVE_CHECK_IGNORE += "CVE-2019-6293" + +inherit autotools gettext texinfo ptest github-releases + +M4 = "${bindir}/m4" +M4:class-native = "${STAGING_BINDIR_NATIVE}/m4" +EXTRA_OECONF += "ac_cv_path_M4=${M4} ac_cv_func_reallocarray=no" +EXTRA_OEMAKE += "m4=${STAGING_BINDIR_NATIVE}/m4" + +EXTRA_OEMAKE += "${@bb.utils.contains('PTEST_ENABLED', '1', 'FLEX=${STAGING_BINDIR_NATIVE}/flex', '', d)}" + +do_install:append:class-native() { + create_wrapper ${D}/${bindir}/flex M4=${M4} +} + +do_install:append:class-nativesdk() { + create_wrapper ${D}/${bindir}/flex M4=${M4} +} + +PACKAGES =+ "${PN}-libfl" + +FILES:${PN}-libfl = "${libdir}/libfl.so.* ${libdir}/libfl_pic.so.*" + +RDEPENDS:${PN} += "m4" +RDEPENDS:${PN}-ptest += "bash gawk make" + +do_compile_ptest() { + oe_runmake -C ${B}/tests -f ${B}/tests/Makefile top_builddir=${B} INCLUDES=-I${S}/src buildtests +} +PTEST_PARALLEL_MAKE = "" + +do_install_ptest() { + mkdir -p ${D}${PTEST_PATH}/build-aux/ + cp ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/ + cp -r ${S}/tests/* ${D}${PTEST_PATH} + cp -r ${B}/tests/* ${D}${PTEST_PATH} + sed -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ + -e 's|${DEBUG_PREFIX_MAP}||g' \ + -e 's:${HOSTTOOLS_DIR}/::g' \ + -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ + -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \-e 's/^Makefile:/_Makefile:/' \ + -e 's/^srcdir = \(.*\)/srcdir = ./' -e 's/^top_srcdir = \(.*\)/top_srcdir = ./' \ + -e 's/^builddir = \(.*\)/builddir = ./' -e 's/^top_builddir = \(.*\)/top_builddir = ./' \ + -e 's:${UNINATIVE_LOADER}:${base_bindir}/false:g' \ + -i ${D}${PTEST_PATH}/Makefile +} +# The uninative loader is different on i386 & x86_64 hosts. Since it is only +# being replaced with /bin/false anyway, it doesn't need to be part of the task +# hash +do_install_ptest[vardepsexclude] += "UNINATIVE_LOADER" + +# Not Apache Flex, or Adobe Flex, or IBM Flex. +CVE_PRODUCT = "flex_project:flex" |