From patchwork Mon May 18 06:26:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 1292338 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49QTZM0jtNz9sTC for ; Mon, 18 May 2020 16:27:06 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 9FAA08829A; Mon, 18 May 2020 06:27:03 +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 u6SCyyOZXtMa; Mon, 18 May 2020 06:27:02 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 6729687CDA; Mon, 18 May 2020 06:27:02 +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 8137E1BF2FA for ; Mon, 18 May 2020 06:27:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 7B3D920460 for ; Mon, 18 May 2020 06:27:01 +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 OOWYmNF74Ngj for ; Mon, 18 May 2020 06:26:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by silver.osuosl.org (Postfix) with ESMTPS id 49D922043F for ; Mon, 18 May 2020 06:26:59 +0000 (UTC) X-Originating-IP: 86.210.146.109 Received: from localhost (lfbn-tou-1-915-109.w86-210.abo.wanadoo.fr [86.210.146.109]) (Authenticated sender: thomas.petazzoni@bootlin.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id D41A6240002; Mon, 18 May 2020 06:26:55 +0000 (UTC) From: Thomas Petazzoni To: buildroot@buildroot.org Date: Mon, 18 May 2020 08:26:47 +0200 Message-Id: <20200518062648.1744905-1-thomas.petazzoni@bootlin.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [Buildroot] [PATCH] package/bison: make installation relocatable X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , marcelo.jimenez@gmail.com Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Our current host-bison installation is not relocatable, so if you generate the SDK, and install it in a different location, bison will no longer work with failures such as: bison: /home/user/buildroot/output/host/share/bison/m4sugar/m4sugar.m4: cannot open: No such file or directory This particular issue is already resolved upstream by the addition of "relocatable" support, which we enable using --enable-relocatable. Once this issue is fixed, a second one pops up: the path to the m4 program itself is also hardcoded. So we add a patch to fix that as well. The patch has been submitted upstream. Fixes: https://bugs.busybox.net/show_bug.cgi?id=12656 Signed-off-by: Thomas Petazzoni --- ...0001-src-make-path-to-m4-relocatable.patch | 69 +++++++++++++++++++ package/bison/bison.mk | 1 + 2 files changed, 70 insertions(+) create mode 100644 package/bison/0001-src-make-path-to-m4-relocatable.patch diff --git a/package/bison/0001-src-make-path-to-m4-relocatable.patch b/package/bison/0001-src-make-path-to-m4-relocatable.patch new file mode 100644 index 0000000000..730fbbfe89 --- /dev/null +++ b/package/bison/0001-src-make-path-to-m4-relocatable.patch @@ -0,0 +1,69 @@ +From 50c8a3af1661c3950b9743d673fd46872860aa08 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Mon, 18 May 2020 07:53:20 +0200 +Subject: [PATCH] src: make path to m4 relocatable + +Commit a4ede8f85b0c9a254fcb01e5888cee1983095669 ("package: make bison +a relocatable package") made Bison relocatable, but in fact it still +contains one absolute reference: the M4 variable, which points to the +M4 program. Let's fix that by using relocate(). + +We don't use relocate2() to store the temporary buffer and re-use it, +because m4path() is only called once. + +Upstream: submitted to the bison-patches@gnu.org mailing list +Signed-off-by: Thomas Petazzoni +--- + src/files.c | 7 +++++++ + src/files.h | 3 +++ + src/output.c | 2 +- + 3 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/src/files.c b/src/files.c +index 71c10e34..b8b43230 100644 +--- a/src/files.c ++++ b/src/files.c +@@ -421,6 +421,13 @@ pkgdatadir (void) + } + } + ++char const * ++m4path (void) ++{ ++ char const *m4 = getenv("M4"); ++ return m4 ? m4 : relocate(M4); ++} ++ + void + output_file_names_free (void) + { +diff --git a/src/files.h b/src/files.h +index 00814ad0..64b6f8b5 100644 +--- a/src/files.h ++++ b/src/files.h +@@ -64,6 +64,9 @@ extern char *all_but_ext; + /* Where our data files are installed. */ + char const *pkgdatadir (void); + ++/* Where the m4 program is installed. */ ++char const *m4path (void); ++ + void compute_output_file_names (void); + void output_file_names_free (void); + +diff --git a/src/output.c b/src/output.c +index 1871fd75..ebe75095 100644 +--- a/src/output.c ++++ b/src/output.c +@@ -682,7 +682,7 @@ static void + output_skeleton (void) + { + /* Compute the names of the package data dir and skeleton files. */ +- char const *m4 = (m4 = getenv ("M4")) ? m4 : M4; ++ char const *m4 = m4path (); + char const *datadir = pkgdatadir (); + char *skeldir = xpath_join (datadir, "skeletons"); + char *m4sugar = xpath_join (datadir, "m4sugar/m4sugar.m4"); +-- +2.26.2 + diff --git a/package/bison/bison.mk b/package/bison/bison.mk index 2174a9061c..4cc635c445 100644 --- a/package/bison/bison.mk +++ b/package/bison/bison.mk @@ -12,5 +12,6 @@ BISON_LICENSE_FILES = COPYING # parallel build issue in examples/c/reccalc/ BISON_MAKE = $(MAKE1) HOST_BISON_DEPENDENCIES = host-m4 +HOST_BISON_CONF_OPTS = --enable-relocatable $(eval $(host-autotools-package))