Skip to contentSkip to conversation

flex: rework patches to avoid host/target difference

PATCH New Yann E. MORIN 2 participants 2 messages Oct 8, 2017 – Oct 11, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 flex: rework patches to avoid host/target difference

From: Thomas Petazzoni <[email protected]>

Currently, the target and host flex packages do not behave the same in terms of patching: the target variant has a patch hook that disables building the programs (because they are not needed, and do not build on no-MMU platforms). However, this hook is obviously not executed for host-flex, because we really want the host flex binary to be built.

In preparation for the introduction of out-of-tree package build, it is important that we don't do different things in the patch hooks for the target and host variant of a given package, because the source tree will be shared between the target and host builds.

To solve this, we introduce a --disable-program configure option, through a patch to the flex configure.ac and Makefile.am. This patch makes the current 0001-flex-disable-documentation.patch no longer needed.

Furthermore, building the documentation is a PITA: flex.1 depends on configure.ac and a few other files generated during the build. Touching flex.1 does not work, because automake will forcibly remove the files when its prerequisites are too old, so pre-requisites of flex.1 will always be more recent than flex.1. So, we add a patch that adds a --disable-doc configure option.

Fixes:

    http://autobuild.buildroot.org/results/f70/f70b39632535bb9692d0a032166b2f4104532967/
    http://autobuild.buildroot.org/results/525/52567afdfe7992b3518de0e01227ba14aa300f21/
    [...]

[yann.morin.1998 at free.fr:
- rebase on-top of master,
- add patch to not build the documentation, because simply touching flex.1 is no longer enough.
- keep install in target/, for shared builds
]

Cc Thomas Petazzoni <[email protected]>
Cc Adrian Perez de Castro <[email protected]>
Cc Arnout Vandecappelle <[email protected]>

---
Changes v2 -> v3:
- keep install in target/, for shared builds

Changes v1 -> v2:
- fix commit log (Thomas)
- drop spurious indentation cleanup (Thomas)
- properly reorder patches (backport first) (Thomas)
- fix typoes (Thomas)

---
Given how welcoming upstream was about the patch adding --disable-program, I haven't even considered sending the one about --disable-doc. Sigh...

---
 ...AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch} |  0
 package/flex/0001-flex-disable-documentation.patch | 35 ----------
 ...it-possible-to-disable-the-build-of-the-f.patch | 76 ++++++++++++++++++++++
 ...it-possible-to-disable-the-build-of-the-d.patch | 58 +++++++++++++++++
 package/flex/Config.in                             |  2 +
 package/flex/flex.mk                               | 24 +++----
 6 files changed, 146 insertions(+), 49 deletions(-)
 rename package/flex/{0002-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch => 0001-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch} (100%)
 delete mode 100644 package/flex/0001-flex-disable-documentation.patch
 create mode 100644 package/flex/0002-build-make-it-possible-to-disable-the-build-of-the-f.patch
 create mode 100644 package/flex/0003-build-make-it-possible-to-disable-the-build-of-the-d.patch
package/flex/0001-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch renamed from package/flex/0002-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch +0 -0
similarity index 100%
rename from package/flex/0002-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch
rename to package/flex/0001-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch
package/flex/0001-flex-disable-documentation.patch deleted +0 -35
deleted file mode 100644
index b017b41385..0000000000
@@ -1,35 +0,0 @@
-From a98443c6a72d5821d4e0152311e5c3eb4cdff25c Mon Sep 17 00:00:00 2001
-From: Vicente Olivert Riera <[email protected]>
-Date: Wed, 13 Sep 2017 17:26:48 +0300
-Subject: [PATCH] flex: disable documentation
-
-Since we prevent the flex binary to be built, we also need to prevent
-the documentation to be built, otherwise it will fail like this:
-
-Making all in doc
-make[2]: Entering directory '/br/output/build/flex-2.6.4/doc'
-make[2]: *** No rule to make target '../src/flex', needed by 'flex.1'.
-Stop.
-
-Signed-off-by: Vicente Olivert Riera <[email protected]>
-[Adrian: patch Makefile.am instead of Makefile.in]
-Signed-off-by: Adrian Perez de Castro <[email protected]>
----
- Makefile.am | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/Makefile.am b/Makefile.am
-index 638c549..9db3420 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -43,7 +43,6 @@ EXTRA_DIST = \
- 
- SUBDIRS = \
- 	src \
--	doc \
- 	examples \
- 	po \
- 	tests \
--- 
-2.14.1
-
package/flex/0002-build-make-it-possible-to-disable-the-build-of-the-f.patch new file +76 -0

76 lines not on this page · raw message

package/flex/0003-build-make-it-possible-to-disable-the-build-of-the-d.patch new file +58 -0

58 lines not on this page · raw message

package/flex/Config.in +2 -0
index 33d123d732..0690777afd 100644
@@ -4,4 +4,6 @@ config BR2_PACKAGE_FLEX
 	  A fast lexical analyser generator. A tool for generating
 	  programs that perform pattern-matching on text.
 
+	  Only the library is available.
+
 	  https://github.com/westes/flex/
package/flex/flex.mk +10 -14
index aeac4ada87..6ce768c318 100644
@@ -10,26 +10,22 @@ FLEX_INSTALL_STAGING = YES
 FLEX_LICENSE = FLEX
 FLEX_LICENSE_FILES = COPYING
 FLEX_DEPENDENCIES = $(TARGET_NLS_DEPENDENCIES) host-m4
+HOST_FLEX_DEPENDENCIES = host-m4
 
-# 0001-flex-disable-documentation.patch
-# 0002-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch
+# 0001-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch
+# 0002-build-make-it-possible-to-disable-the-build-of-the-f.patch
+# 0003-build-make-it-possible-to-disable-the-build-of-the-d.patch
 FLEX_AUTORECONF = YES
 FLEX_GETTEXTIZE = YES
 FLEX_CONF_ENV = ac_cv_path_M4=/usr/bin/m4 \
 	ac_cv_func_reallocarray=no
 
-HOST_FLEX_DEPENDENCIES = host-m4
-
-define FLEX_DISABLE_PROGRAM
-	$(SED) 's/^bin_PROGRAMS.*//' $(@D)/src/Makefile.in
-endef
-FLEX_POST_PATCH_HOOKS += FLEX_DISABLE_PROGRAM
-
-# flex++ symlink is broken when flex binary is not installed
-define FLEX_REMOVE_BROKEN_SYMLINK
-	rm -f $(TARGET_DIR)/usr/bin/flex++
-endef
-FLEX_POST_INSTALL_TARGET_HOOKS += FLEX_REMOVE_BROKEN_SYMLINK
+# Don't enable programs, they are not needed on the target, and
+# require MMU support.
+# Don't enable the doc, it's not needed on the target and requires
+# special tools (help2man) to build.
+FLEX_CONF_OPTS += --disable-program --disable-doc
+HOST_FLEX_CONF_OPTS = --disable-doc
 
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
Signature · 1 line
2.11.0
#1 lore raw

PATCH v3 1/1 flex: rework patches to avoid host/target difference

Hello,

Quoted 37 lines · Yann E. MORIN

From: Thomas Petazzoni <[email protected]>

Currently, the target and host flex packages do not behave the same in terms of patching: the target variant has a patch hook that disables building the programs (because they are not needed, and do not build on no-MMU platforms). However, this hook is obviously not executed for host-flex, because we really want the host flex binary to be built.

In preparation for the introduction of out-of-tree package build, it is important that we don't do different things in the patch hooks for the target and host variant of a given package, because the source tree will be shared between the target and host builds.

To solve this, we introduce a --disable-program configure option, through a patch to the flex configure.ac and Makefile.am. This patch makes the current 0001-flex-disable-documentation.patch no longer needed.

Furthermore, building the documentation is a PITA: flex.1 depends on configure.ac and a few other files generated during the build. Touching flex.1 does not work, because automake will forcibly remove the files when its prerequisites are too old, so pre-requisites of flex.1 will always be more recent than flex.1. So, we add a patch that adds a --disable-doc configure option.

Fixes:

    http://autobuild.buildroot.org/results/f70/f70b39632535bb9692d0a032166b2f4104532967/
    http://autobuild.buildroot.org/results/525/52567afdfe7992b3518de0e01227ba14aa300f21/
    [...]

[yann.morin.1998 at free.fr:
- rebase on-top of master,
- add patch to not build the documentation, because simply touching flex.1 is no longer enough.
- keep install in target/, for shared builds
]

Quoted 8 lines
Cc Thomas Petazzoni <[email protected]>
Cc Adrian Perez de Castro <[email protected]>
Cc Arnout Vandecappelle <[email protected]>

---
Changes v2 -> v3:
- keep install in target/, for shared builds

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com