Skip to contentSkip to conversation

flex: fix build for nommu systems

PATCH New Gustavo Zacarias 2 participants 3 messages Nov 28, 2012 – Nov 30, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 flex: fix build for nommu systems

The flex binary uses fork() so it breaks on !MMU builds. Since we usually don't require flex in the target and the common scenario is that we just want libfl in staging reverse the options so that BR2_PACKAGE_FLEX just builds and install libfl.a and change the LIBFL option to BR2_PACKAGE_FLEX_BINARY to install the binary in the target.

---
 package/flex/Config.in        |   10 +++++-----
 package/flex/flex.mk          |   26 +++++++++-----------------
 package/gob2/Config.in        |    1 -
 package/ipsec-tools/Config.in |    1 -
 package/libcue/Config.in      |    1 -
 package/linux-pam/Config.in   |    1 -
 package/radvd/Config.in       |    1 -
 7 files changed, 14 insertions(+), 27 deletions(-)
package/flex/Config.in +5 -5
index b10eb00..adef468 100644
@@ -6,10 +6,10 @@ config BR2_PACKAGE_FLEX
 
 	  http://www.gnu.org/software/flex/
 
-config BR2_PACKAGE_FLEX_LIBFL
-	bool "Install libfl.a under staging_dir/usr/lib"
-	default y
+config BR2_PACKAGE_FLEX_BINARY
+	bool "Install tool in the target"
+	# needs fork()
+	depends on BR2_USE_MMU
 	depends on BR2_PACKAGE_FLEX
 	help
-	  Install libfl.a under staging_dir/usr/lib for further development
-	  on a host machine.
+	  Install the flex binary tool in the target filesystem.
package/flex/flex.mk +9 -17
index 2599cdc..19b6ef2 100644
@@ -16,30 +16,22 @@ FLEX_DEPENDENCIES = \
 # we don't have a host-gettext/libintl
 HOST_FLEX_DEPENDENCIES =
 
-# lex -> flex
-define FLEX_INSTALL_LEX
-	cd $(TARGET_DIR)/usr/bin && ln -snf flex lex
+ifeq ($(BR2_PACKAGE_FLEX_BINARY),)
+define FLEX_DISABLE_PROGRAM
+	$(SED) 's/^bin_PROGRAMS.*//' $(@D)/Makefile.in
 endef
 
-define FLEX_UNINSTALL_LEX
-	-rm $(TARGET_DIR)/usr/bin/lex
-endef
+FLEX_POST_EXTRACT_HOOKS += FLEX_DISABLE_PROGRAM
 
-FLEX_POST_INSTALL_HOOKS += FLEX_INSTALL_LEX
-FLEX_POST_CLEAN_HOOKS += FLEX_UNINSTALL_LEX
+else
 
-# libfl installation
-ifeq ($(BR2_PACKAGE_FLEX_LIBFL),y)
-define FLEX_INSTALL_LIBFL
-	install -D $(FLEX_DIR)/libfl.a $(STAGING_DIR)/usr/lib/libfl.a
+# lex -> flex
+define FLEX_INSTALL_LEX
+	cd $(TARGET_DIR)/usr/bin && ln -snf flex lex
 endef
 
-define FLEX_UNINSTALL_LIBFL
-	-rm $(STAGING_DIR)/lib/libfl.a
-endef
+FLEX_POST_INSTALL_HOOKS += FLEX_INSTALL_LEX
 
-FLEX_POST_INSTALL_HOOKS += FLEX_INSTALL_LIBFL
-FLEX_POST_CLEAN_HOOKS += FLEX_UNINSTALL_LIBFL
 endif
 
 $(eval $(autotools-package))
package/gob2/Config.in +0 -1
index cbe30d6..4a09c41 100644
@@ -5,7 +5,6 @@ config BR2_PACKAGE_GOB2
 	depends on BR2_USE_MMU
 	select BR2_PACKAGE_LIBGLIB2
 	select BR2_PACKAGE_FLEX
-	select BR2_PACKAGE_FLEX_LIBFL
 	select BR2_PACKAGE_BISON
 	help
 	  GOB (GTK+ Object Builder) is a preprocessor which simplifies
package/ipsec-tools/Config.in +0 -1
index 6f6dc37..06a5a56 100644
@@ -2,7 +2,6 @@ config BR2_PACKAGE_IPSEC_TOOLS
 	bool "ipsec-tools"
 	select BR2_PACKAGE_OPENSSL
 	select BR2_PACKAGE_FLEX
-	select BR2_PACKAGE_FLEX_LIBFL
 	help
 	  This package is required to support IPSec for Linux 2.6+
 
package/libcue/Config.in +0 -1
index e5e2e16..6121746 100644
@@ -1,7 +1,6 @@
 config BR2_PACKAGE_LIBCUE
 	bool "libcue"
 	select BR2_PACKAGE_FLEX
-	select BR2_PACKAGE_FLEX_LIBFL
 	help
 	  CUE Sheet Parser Library
 
package/linux-pam/Config.in +0 -1
index 7cfd814..7a4ae94 100644
@@ -2,7 +2,6 @@ config BR2_PACKAGE_LINUX_PAM
 	bool "linux-pam"
 	select BR2_PACKAGE_GETTEXT if BR2_NEEDS_GETTEXT_IF_LOCALE
 	select BR2_PACKAGE_FLEX
-	select BR2_PACKAGE_FLEX_LIBFL
 	depends on (BR2_ENABLE_LOCALE && BR2_USE_WCHAR)
 	help
 	  A Security Framework that Provides Authentication for Applications
package/radvd/Config.in +0 -1
index d0d9d70..98dbae2 100644
@@ -3,7 +3,6 @@ config BR2_PACKAGE_RADVD
 	# libdaemon uses fork()
 	depends on BR2_USE_MMU
 	select BR2_PACKAGE_FLEX
-	select BR2_PACKAGE_FLEX_LIBFL
 	select BR2_PACKAGE_LIBDAEMON
 	depends on BR2_INET_IPV6
 	help
Signature · 1 line
1.7.8.6
#1 lore raw

PATCH 1/1 flex: fix build for nommu systems

Quoted 8 lines · Gustavo Zacarias

The flex binary uses fork() so it breaks on !MMU builds. Since we usually don't require flex in the target and the common scenario is that we just want libfl in staging reverse the options so that BR2_PACKAGE_FLEX just builds and install libfl.a and change the LIBFL option to BR2_PACKAGE_FLEX_BINARY to install the binary in the target.

(untested, visual review only)

Two small comments.

[snip]

Quoted 1 line

+ifeq ($(BR2_PACKAGE_FLEX_BINARY),)

I would prefer to compare with y and swap the two branches
(that will also make the diff much more readable...)

package/flex/flex.mk FLEX_DEPENDENCIES = \ · line 24

Quoted 8 lines
package/flex/flex.mk +3 -3
+define FLEX_DISABLE_PROGRAM
+	$(SED) 's/^bin_PROGRAMS.*//' $(@D)/Makefile.in
  endef
 
-define FLEX_UNINSTALL_LEX
-	-rm $(TARGET_DIR)/usr/bin/lex
-endef
+FLEX_POST_EXTRACT_HOOKS += FLEX_DISABLE_PROGRAM

POST_PATCH_HOOKS would be more appropriate.

Regards,
Arnout

Quoted 24 lines
package/flex/flex.mk +5 -11
-FLEX_POST_INSTALL_HOOKS += FLEX_INSTALL_LEX
-FLEX_POST_CLEAN_HOOKS += FLEX_UNINSTALL_LEX
+else
 
-# libfl installation
-ifeq ($(BR2_PACKAGE_FLEX_LIBFL),y)
-define FLEX_INSTALL_LIBFL
-	install -D $(FLEX_DIR)/libfl.a $(STAGING_DIR)/usr/lib/libfl.a
+# lex ->  flex
+define FLEX_INSTALL_LEX
+	cd $(TARGET_DIR)/usr/bin&&  ln -snf flex lex
  endef
 
-define FLEX_UNINSTALL_LIBFL
-	-rm $(STAGING_DIR)/lib/libfl.a
-endef
+FLEX_POST_INSTALL_HOOKS += FLEX_INSTALL_LEX
 
-FLEX_POST_INSTALL_HOOKS += FLEX_INSTALL_LIBFL
-FLEX_POST_CLEAN_HOOKS += FLEX_UNINSTALL_LIBFL
  endif
 
  $(eval $(autotools-package))

[snip]

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#2 lore raw

PATCH 1/1 flex: fix build for nommu systems

Quoted 7 lines · Arnout Vandecappelle

Two small comments.

[snip]

Quoted 1 line

+ifeq ($(BR2_PACKAGE_FLEX_BINARY),)

I would prefer to compare with y and swap the two branches
(that will also make the diff much more readable...)

Sure, i left it that way because i was using another aproach before this one (removing the binary option since it's pointless without a target toolchain), but changed my mind after a little chat with Thomas.

Quoted 10 lines

package/flex/flex.mk FLEX_DEPENDENCIES = \ · line 24

Quoted 8 lines
package/flex/flex.mk +3 -3
+define FLEX_DISABLE_PROGRAM
+    $(SED) 's/^bin_PROGRAMS.*//' $(@D)/Makefile.in
  endef
 
-define FLEX_UNINSTALL_LEX
-    -rm $(TARGET_DIR)/usr/bin/lex
-endef
+FLEX_POST_EXTRACT_HOOKS += FLEX_DISABLE_PROGRAM

POST_PATCH_HOOKS would be more appropriate.

Really?
It's basically another patch, i can do it before (like now) it's patched with something else or after.
If the other patches did too much damage so that the sed wouldn't work, well, it'd probably be against buildroot policy on patches :) Regards.