public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gnulib: allow control over srcdir
@ 2021-06-08 22:06 Mike Frysinger
  2021-06-09 14:47 ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2021-06-08 22:06 UTC (permalink / raw)
  To: gdb-patches

The current setting assumes that gnulib is only used by dirs
immediately under the source root.  Trying to build it two or
more levels deep fails.  Add a variable so users can control.
---
 gnulib/Makefile.gnulib.inc.in | 6 +++++-
 sim/common/Make-common.in     | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gnulib/Makefile.gnulib.inc.in b/gnulib/Makefile.gnulib.inc.in
index 822f892a189a..fc3d63c39f18 100644
--- a/gnulib/Makefile.gnulib.inc.in
+++ b/gnulib/Makefile.gnulib.inc.in
@@ -36,9 +36,13 @@ ifndef GNULIB_BUILDDIR
 $(error missing GNULIB_BUILDDIR)
 endif
 
+ifndef GNULIB_SRCDIR
+GNULIB_SRCDIR = $(srcdir)/../gnulib
+endif
+
 LIBGNU = $(GNULIB_BUILDDIR)/import/libgnu.a
 LIBGNU_EXTRA_LIBS = @FREXPL_LIBM@ @FREXP_LIBM@ @INET_NTOP_LIB@ \
                     @LIBTHREAD@ @LIB_GETLOGIN@ @LIB_GETRANDOM@ \
                     @LIB_HARD_LOCALE@ @LIB_MBRTOWC@ \
                     @LIB_SETLOCALE_NULL@ @LIBINTL@ @LIB_SELECT@ @LIBSOCKET@
-INCGNU = -I$(srcdir)/../gnulib/import -I$(GNULIB_BUILDDIR)/import
+INCGNU = -I$(GNULIB_SRCDIR)/import -I$(GNULIB_BUILDDIR)/import
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 4b2587985379..3ea840d935e0 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -41,6 +41,7 @@ srcroot = $(srcdir)/../..
 srcsim = $(srcdir)/..
 
 # Helper code from gnulib.
+GNULIB_SRCDIR = $(srcroot)/gnulib
 GNULIB_BUILDDIR = ../../gnulib
 include $(GNULIB_BUILDDIR)/Makefile.gnulib.inc
 
-- 
2.31.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnulib: allow control over srcdir
  2021-06-08 22:06 [PATCH] gnulib: allow control over srcdir Mike Frysinger
@ 2021-06-09 14:47 ` Tom Tromey
  2021-06-09 16:58   ` Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2021-06-09 14:47 UTC (permalink / raw)
  To: Mike Frysinger via Gdb-patches

>>>>> "Mike" == Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> writes:

Mike> The current setting assumes that gnulib is only used by dirs
Mike> immediately under the source root.  Trying to build it two or
Mike> more levels deep fails.  Add a variable so users can control.

This is ok.

This file isn't actually used any more by gdb.

Tom

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnulib: allow control over srcdir
  2021-06-09 14:47 ` Tom Tromey
@ 2021-06-09 16:58   ` Mike Frysinger
  2021-06-10 18:15     ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2021-06-09 16:58 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Mike Frysinger via Gdb-patches

On 09 Jun 2021 08:47, Tom Tromey wrote:
> >>>>> "Mike" == Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Mike> The current setting assumes that gnulib is only used by dirs
> Mike> immediately under the source root.  Trying to build it two or
> Mike> more levels deep fails.  Add a variable so users can control.
> 
> This is ok.

i noticed an issue.  upstream gnulib already uses GNULIB_SRCDIR in its bootstrap
so people can export it in their env to point to the upstream gnulib git tree.
if that's exported, then building gdb fails :/.

since we can't assume GNU make, i was going to rename it to GNULIB_LOCAL_SRCDIR
unless someone wants to bikeshed a diff name.

> This file isn't actually used any more by gdb.

seems to be ?  gdb/Makefile.in & gdbserver/Makefile.in have:

gdb/Makefile.in:GNULIB_BUILDDIR = ../gnulib
gdb/Makefile.in:include $(GNULIB_BUILDDIR)/Makefile.gnulib.inc
gdb/Makefile.in:	$(INTL_CFLAGS) $(INCGNU) $(INCSUPPORT) $(ENABLE_CFLAGS) \
gdb/Makefile.in:	$(WIN32LIBS) $(LIBGNU) $(LIBGNU_EXTRA_LIBS) $(LIBICONV) \
gdb/Makefile.in:	$(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) \
gdbserver/Makefile.in:GNULIB_BUILDDIR = ../gnulib
gdbserver/Makefile.in:include $(GNULIB_BUILDDIR)/Makefile.gnulib.inc
gdbserver/Makefile.in:	-I$(srcdir)/../gdb $(INCGNU) $(INCSUPPORT) \
gdbserver/Makefile.in:gdbserver$(EXEEXT): $(sort $(OBS)) ${CDEPS} $(LIBGNU) $(LIBIBERTY) \
gdbserver/Makefile.in:		-o gdbserver$(EXEEXT) $(OBS) $(GDBSUPPORT) $(LIBGNU) \
gdbserver/Makefile.in:		$(LIBGNU_EXTRA_LIBS) $(LIBIBERTY) $(INTL) \
gdbserver/Makefile.in:gdbreplay$(EXEEXT): $(sort $(GDBREPLAY_OBS)) $(LIBGNU) $(LIBIBERTY) \
gdbserver/Makefile.in:		$(GDBSUPPORT) $(LIBGNU) $(LIBGNU_EXTRA_LIBS) \
-mike

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnulib: allow control over srcdir
  2021-06-09 16:58   ` Mike Frysinger
@ 2021-06-10 18:15     ` Tom Tromey
  2021-06-13  5:23       ` [PATCH] gnulib: define the path to gnulib's parent dir Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2021-06-10 18:15 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Mike Frysinger via Gdb-patches

Mike> since we can't assume GNU make, i was going to rename it to GNULIB_LOCAL_SRCDIR
Mike> unless someone wants to bikeshed a diff name.

I think it's fine to assume GNU make, Makefile.gnulib.inc already seems
to with its use of $(error)


Anyway, one idea is to replace GNULIB_BUILDDIR with a variable that just
indicates how to reach top-of-entire-tree from the Makefile in question,
like:

# gdb or whatever sets:
top_of_tree = ../..

# gnulib does:
GNULIB_BUILDDIR = $(top_of_tree)/gnulib
INCGNU = -I$(srcdir)/$(top_of_tree)/gnulib/import


>> This file isn't actually used any more by gdb.

Mike> seems to be ?  gdb/Makefile.in & gdbserver/Makefile.in have:

Ugh, sorry.  grep fail by me.

Tom

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] gnulib: define the path to gnulib's parent dir
  2021-06-10 18:15     ` Tom Tromey
@ 2021-06-13  5:23       ` Mike Frysinger
  2021-06-14 15:23         ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2021-06-13  5:23 UTC (permalink / raw)
  To: gdb-patches

The current setting assumes that gnulib is only used by dirs
immediately under the source root.  Trying to build it two or
more levels deep fails.  Switch GNULIB_BUILDDIR to a relative
GNULIB_PARENT_DIR so that it can be used to construct both the
build & source paths.
---
 gdb/Makefile.in               |  4 ++--
 gdbserver/Makefile.in         |  4 ++--
 gnulib/Makefile.gnulib.inc.in | 10 ++++++----
 sim/common/Make-common.in     |  4 ++--
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index f664d964536d..b3d264f267cb 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -245,8 +245,8 @@ CODESIGN_CERT = @CODESIGN_CERT@
 GDBFLAGS =
 
 # Helper code from gnulib.
-GNULIB_BUILDDIR = ../gnulib
-include $(GNULIB_BUILDDIR)/Makefile.gnulib.inc
+GNULIB_PARENT_DIR = ..
+include $(GNULIB_PARENT_DIR)/gnulib/Makefile.gnulib.inc
 
 SUPPORT = ../gdbsupport
 LIBSUPPORT = $(SUPPORT)/libgdbsupport.a
diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
index f7ade7d61d5c..12e9b2777aef 100644
--- a/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -122,8 +122,8 @@ ustlibs = @ustlibs@
 ustinc = @ustinc@
 
 # gnulib
-GNULIB_BUILDDIR = ../gnulib
-include $(GNULIB_BUILDDIR)/Makefile.gnulib.inc
+GNULIB_PARENT_DIR = ..
+include $(GNULIB_PARENT_DIR)/gnulib/Makefile.gnulib.inc
 
 # Where is the INTL library?  Typically in ../intl.
 INTL = @LIBINTL@
diff --git a/gnulib/Makefile.gnulib.inc.in b/gnulib/Makefile.gnulib.inc.in
index 822f892a189a..cf69b835cfda 100644
--- a/gnulib/Makefile.gnulib.inc.in
+++ b/gnulib/Makefile.gnulib.inc.in
@@ -32,13 +32,15 @@
 # INCGNU: A list of -I.... include paths that should be passed to the
 #        compiler, these are where the gnulib headers can be found.
 
-ifndef GNULIB_BUILDDIR
-$(error missing GNULIB_BUILDDIR)
+# Packages must define the relative path to gnulib's parent dir.
+ifndef GNULIB_PARENT_DIR
+$(error missing GNULIB_PARENT_DIR)
 endif
 
-LIBGNU = $(GNULIB_BUILDDIR)/import/libgnu.a
+LIBGNU = $(GNULIB_PARENT_DIR)/gnulib/import/libgnu.a
 LIBGNU_EXTRA_LIBS = @FREXPL_LIBM@ @FREXP_LIBM@ @INET_NTOP_LIB@ \
                     @LIBTHREAD@ @LIB_GETLOGIN@ @LIB_GETRANDOM@ \
                     @LIB_HARD_LOCALE@ @LIB_MBRTOWC@ \
                     @LIB_SETLOCALE_NULL@ @LIBINTL@ @LIB_SELECT@ @LIBSOCKET@
-INCGNU = -I$(srcdir)/../gnulib/import -I$(GNULIB_BUILDDIR)/import
+INCGNU = -I$(srcdir)/$(GNULIB_PARENT_DIR)/gnulib/import \
+         -I$(GNULIB_PARENT_DIR)/gnulib/import
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 7a5bbc1a985c..3dab9ca1fd14 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -41,8 +41,8 @@ srcroot = $(srcdir)/../..
 srcsim = $(srcdir)/..
 
 # Helper code from gnulib.
-GNULIB_BUILDDIR = ../../gnulib
-include $(GNULIB_BUILDDIR)/Makefile.gnulib.inc
+GNULIB_PARENT_DIR = ../..
+include $(GNULIB_PARENT_DIR)/gnulib/Makefile.gnulib.inc
 
 prefix = @prefix@
 exec_prefix = @exec_prefix@
-- 
2.31.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnulib: define the path to gnulib's parent dir
  2021-06-13  5:23       ` [PATCH] gnulib: define the path to gnulib's parent dir Mike Frysinger
@ 2021-06-14 15:23         ` Tom Tromey
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2021-06-14 15:23 UTC (permalink / raw)
  To: Mike Frysinger via Gdb-patches

>>>>> "Mike" == Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> writes:

Mike> The current setting assumes that gnulib is only used by dirs
Mike> immediately under the source root.  Trying to build it two or
Mike> more levels deep fails.  Switch GNULIB_BUILDDIR to a relative
Mike> GNULIB_PARENT_DIR so that it can be used to construct both the
Mike> build & source paths.

Looks good.  Thank you.

Tom

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-06-14 15:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08 22:06 [PATCH] gnulib: allow control over srcdir Mike Frysinger
2021-06-09 14:47 ` Tom Tromey
2021-06-09 16:58   ` Mike Frysinger
2021-06-10 18:15     ` Tom Tromey
2021-06-13  5:23       ` [PATCH] gnulib: define the path to gnulib's parent dir Mike Frysinger
2021-06-14 15:23         ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).