From patchwork Fri Sep 29 17:20:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 820025 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="q2j8df9z"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y3dcy2S5Qz9t3f for ; Sat, 30 Sep 2017 03:21:06 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 6CE1B89FD2; Fri, 29 Sep 2017 17:21:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VTGgceaxdpLV; Fri, 29 Sep 2017 17:20:59 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id EC24889FB7; Fri, 29 Sep 2017 17:20:58 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id A36561C0419 for ; Fri, 29 Sep 2017 17:20:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 50377308D6 for ; Fri, 29 Sep 2017 17:20:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bJQ30j+hYbzh for ; Fri, 29 Sep 2017 17:20:54 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by silver.osuosl.org (Postfix) with ESMTPS id 4303B26C70 for ; Fri, 29 Sep 2017 17:20:54 +0000 (UTC) Received: by mail-wm0-f48.google.com with SMTP id r74so752137wme.5 for ; Fri, 29 Sep 2017 10:20:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=0JvyZs9rQjTD2jQPQAlq84AJV4saWZg/0THRBRWWHus=; b=q2j8df9zGJokk7gdEcMYxxj5TczeUFqxrWRV7X3Z2SJahNpq/1pdhIPHLjqo9HTcVd iinpP5b9UeKtccPfM4DgkiMriFz+Rvj1NJio5Z/iGxoRaSAVRqsk9IfQ41g4I0eUHIVf AmPdQCxYkp4PPt0Xeet3Fq1UWMwHnoTWZiRWzJMf4tfta+e8zrWMKNwK5fN7DiajjK2X rBCecLqCP+tS0PXjGCpcAv27Ul7VlZzlnlwW0XwzvYNaqVLZwJeA/lpC6ZVqbq6q1BwA duyDNWEQ5xgA9QbaCl71vEWnjMFf1FSpJhCjClLKZrxuYOBwxmsjy7tgSRLTjyrSyLgl RUUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=0JvyZs9rQjTD2jQPQAlq84AJV4saWZg/0THRBRWWHus=; b=Ki9TCNW6KItBvnOQO59IV5IhyPWzkInWUq5rHQZcK54hgJkeYA4VjwjxrGAKqpM55K RvRCBrffmgPp6zPq/hNTe43erFlg7YeuBJcAmvIzctk+DOdJrywRRvbzdSyG4uDnG0TB rydAP6UbZs6x1sIsHbVCZ0ksDePQeOd0AioeaJiBqgV6XsdY7AtHFPHOsQCkawT97D6+ QMC7L9sffiddMsBpsC8dray4j6vyLKXrVBpkkOzHiG2VNRX77xjhEDtgaGa6NhK09/pv zEtGgjzSKrbSqyUJK1grUTBFvWYTzYiUEQNxIKVKjo1O15VMstqs9dTL9Y/I73P0WhYK M1wA== X-Gm-Message-State: AMCzsaWI3XrWEv3Ws7rDghJ9FDkbT/QrkVzWL9SERYiU4QNDvYoAccFX Wf8E/qAeGlIIwauk+mlzggvQKA== X-Google-Smtp-Source: AOwi7QB1ytPFzEeDXGp+hEglBbYkkWsLdNrivoYIj3qzHfOg9o2XKuZkn7kvfSFv38iCGawtNai1zg== X-Received: by 10.28.92.136 with SMTP id q130mr4468952wmb.35.1506705652233; Fri, 29 Sep 2017 10:20:52 -0700 (PDT) Received: from localhost.localdomain (2a01cb0886107300a556795e0851f8aa.ipv6.abo.wanadoo.fr. [2a01:cb08:8610:7300:a556:795e:851:f8aa]) by smtp.gmail.com with ESMTPSA id m19sm1727901wmd.16.2017.09.29.10.20.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Sep 2017 10:20:50 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Fri, 29 Sep 2017 19:20:41 +0200 Message-Id: <20170929172041.1530-1-yann.morin.1998@free.fr> X-Mailer: git-send-email 2.11.0 Cc: Thomas Petazzoni , Adrian Perez de Castro , "Yann E. MORIN" Subject: [Buildroot] [PATCH] flex: rework patches to avoid host/target difference X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Thomas Petazzoni 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. However, since we autoreconfigure the package, we need to touch flex.1 to avoid flex from trying to regenerate it (flex.1 has a dependency on configure.ac, so if configure.ac is newer than flex.1, it regenerates the latter). Also, since the target flex only installs a static library, we do not install the package to TARGET_DIR anymore, only the staging installation is done. Finally, building the documentation is a PITA, and it depends on configure.ac and a few other files generated during the build. Touching flex.1 does not work, because autmake will forcibly remove the files when its prerequisites are too old, but will not gemnerate it. 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/ [...] Signed-off-by: Thomas Petazzoni [yann.morin.1998@free.fr: - rebase on-top of master, - add patch to not build the documentation, because simply touching flex.1 is no longer enough. ] Signed-off-by: "Yann E. MORIN" Cc: Adrian Perez de Castro Cc: Arnout Vandecappelle --- Given how welcoming upstream was about the first patch, I haven't even considered sending the second one. Sigh... --- ...it-possible-to-disable-the-build-of-the-f.patch | 76 ++++++++++++++++++++++ package/flex/0001-flex-disable-documentation.patch | 35 ---------- ...it-possible-to-disable-the-build-of-the-d.patch | 58 +++++++++++++++++ ...AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch} | 0 package/flex/flex.mk | 26 ++++---- 5 files changed, 146 insertions(+), 49 deletions(-) create mode 100644 package/flex/0001-build-make-it-possible-to-disable-the-build-of-the-f.patch 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-d.patch rename package/flex/{0002-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch => 0003-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch} (100%) diff --git a/package/flex/0001-build-make-it-possible-to-disable-the-build-of-the-f.patch b/package/flex/0001-build-make-it-possible-to-disable-the-build-of-the-f.patch new file mode 100644 index 0000000000..19f5a772c5 --- /dev/null +++ b/package/flex/0001-build-make-it-possible-to-disable-the-build-of-the-f.patch @@ -0,0 +1,76 @@ +From da21733178b34eea303964db5a05e8a3ee4095b4 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sat, 26 Aug 2017 15:17:06 +0200 +Subject: [PATCH] build: make it possible to disable the build of the flex + program + +The flex program uses fork(), which isn't available on noMMU +systems. However, the libfl library does not use fork(), and be used +by other programs/libraries. + +Therefore, it makes sense to provide an option to disable the build of +the flex program. + +Signed-off-by: Thomas Petazzoni +Signed-off-by: "Yann E. MORIN" + +--- +Submitted-upstream: https://github.com/westes/flex/pull/256 +Refused. We'll have to adapt when they do a new release... +--- + Makefile.am | 2 ++ + configure.ac | 6 ++++++ + doc/Makefile.am | 4 ++++ + src/Makefile.am | 3 +++ + 4 files changed, 15 insertions(+) + +diff --git a/Makefile.am b/Makefile.am +index e790e9d..8b57bc9 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -62,8 +62,10 @@ ChangeLog: $(srcdir)/tools/git2cl + indent: + cd src && $(MAKE) $(AM_MAKEFLAGS) indent + ++if ENABLE_PROGRAM + install-exec-hook: + cd $(DESTDIR)$(bindir) && \ + $(LN_S) -f flex$(EXEEXT) flex++$(EXEEXT) ++endif + + .PHONY: ChangeLog indent +diff --git a/configure.ac b/configure.ac +index 8882016..f49872b 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -75,6 +75,12 @@ AC_ARG_ENABLE([libfl], + [], [enable_libfl=yes]) + AM_CONDITIONAL([ENABLE_LIBFL], [test "x$enable_libfl" = xyes]) + ++AC_ARG_ENABLE([program], ++ [AS_HELP_STRING([--disable-program], ++ [do not build the flex program, only the libfl library])], ++ [], [enable_program=yes]) ++AM_CONDITIONAL([ENABLE_PROGRAM], [test "x$enable_program" = xyes]) ++ + # --disable-bootstrap is intended only to workaround problems with bootstrap + # (e.g. when cross-compiling flex or when bootstrapping has bugs). + # Ideally we should be able to bootstrap even when cross-compiling. +diff --git a/src/Makefile.am b/src/Makefile.am +index 0d13a5a..c73bc17 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -4,7 +4,10 @@ LIBS = @LIBS@ + + m4 = @M4@ + ++if ENABLE_PROGRAM + bin_PROGRAMS = flex ++endif ++ + if ENABLE_BOOTSTRAP + noinst_PROGRAMS = stage1flex + endif +-- +2.9.4 + diff --git a/package/flex/0001-flex-disable-documentation.patch b/package/flex/0001-flex-disable-documentation.patch deleted file mode 100644 index b017b41385..0000000000 --- a/package/flex/0001-flex-disable-documentation.patch +++ /dev/null @@ -1,35 +0,0 @@ -From a98443c6a72d5821d4e0152311e5c3eb4cdff25c Mon Sep 17 00:00:00 2001 -From: Vicente Olivert Riera -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 -[Adrian: patch Makefile.am instead of Makefile.in] -Signed-off-by: Adrian Perez de Castro ---- - 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 - diff --git a/package/flex/0002-build-make-it-possible-to-disable-the-build-of-the-d.patch b/package/flex/0002-build-make-it-possible-to-disable-the-build-of-the-d.patch new file mode 100644 index 0000000000..ffe30d367f --- /dev/null +++ b/package/flex/0002-build-make-it-possible-to-disable-the-build-of-the-d.patch @@ -0,0 +1,58 @@ +From b89b8475a5b2f9444c32f7d254b35968da3c8a23 Mon Sep 17 00:00:00 2001 +From: "Yann E. MORIN" +Date: Fri, 29 Sep 2017 18:03:51 +0200 +Subject: [PATCH] build: make it possible to disable the build of the + documentation + +When targetting embedded evices, the documentation is not needed. + +Building the documentation default to whether the program is built. + +Signed-off-by: "Yann E. MORIN" +Cc: Thomas Petazzoni +--- + Makefile.am | 8 +++++++- + configure.ac | 6 ++++++ + 2 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index fce30b2..ee75b64 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -41,9 +41,15 @@ EXTRA_DIST = \ + .indent.pro \ + autogen.sh + ++MAYBE_SUBDIRS = ++ ++if ENABLE_DOC ++MAYBE_SUBDIRS += doc ++endif ++ + SUBDIRS = \ + src \ +- doc \ ++ $(MAYBE_SUBDIRS) \ + examples \ + po \ + tests \ +diff --git a/configure.ac b/configure.ac +index c54e98f..b3ae450 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -80,6 +80,12 @@ AC_ARG_ENABLE([program], + [], [enable_program=yes]) + AM_CONDITIONAL([ENABLE_PROGRAM], [test "x$enable_program" = xyes]) + ++AC_ARG_ENABLE([doc], ++ [AS_HELP_STRING([--disable-doc], ++ [do not build the documentation])], ++ [], [enable_doc=${enable_program}]) ++AM_CONDITIONAL([ENABLE_DOC], [test "x$enable_doc" = xyes -a "x$enable_program" = xyes]) ++ + # --disable-bootstrap is intended only to workaround problems with bootstrap + # (e.g. when cross-compiling flex or when bootstrapping has bugs). + # Ideally we should be able to bootstrap even when cross-compiling. +-- +2.11.0 + diff --git a/package/flex/0002-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch b/package/flex/0003-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch similarity index 100% rename from package/flex/0002-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch rename to package/flex/0003-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch diff --git a/package/flex/flex.mk b/package/flex/flex.mk index aeac4ada87..5ea28e3969 100644 --- a/package/flex/flex.mk +++ b/package/flex/flex.mk @@ -7,29 +7,27 @@ FLEX_VERSION = 2.6.4 FLEX_SITE = https://github.com/westes/flex/files/981163 FLEX_INSTALL_STAGING = YES +# flex only installs a static library +FLEX_INSTALL_TARGET = NO FLEX_LICENSE = FLEX FLEX_LICENSE_FILES = COPYING FLEX_DEPENDENCIES = $(TARGET_NLS_DEPENDENCIES) host-m4 +HOST_FLEX_DEPENDENCIES = host-m4 -# 0001-flex-disable-documentation.patch +# 0001-build-make-it-possible-to-disable-the-build-of-the-f.patch # 0002-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch FLEX_AUTORECONF = YES FLEX_GETTEXTIZE = YES -FLEX_CONF_ENV = ac_cv_path_M4=/usr/bin/m4 \ +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))