bfd/doc: use abs_srcdir when creating symlinks

Message ID 40a989ffc81a9b07b5dd70f00521dd2171d7a200.1737465905.git.aburgess@redhat.com
State New
Headers
Series bfd/doc: use abs_srcdir when creating symlinks |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Andrew Burgess Jan. 21, 2025, 1:25 p.m. UTC
  After commit:

  commit bd32be01c997f686ab0b53f0640eaa0aeb61fbd3
  Date:   Fri Dec 3 00:23:20 2021 -0500

      bfd: merge doc subdir up a level

And the follow-up commit:

  commit 98b1464bdf6306a8ab4614b5e9f76cdb2dd00b33
  Date:   Wed Oct 2 22:58:08 2024 +0300

      bfd: fix unnecessary bfd.info regen

There is still a problem building the bfd docs from a release tar
file.

As the release tar file contains the pre-generated .texi files we
expect the bfd/doc build stage to symlink to the pre-existing .texi
files in the source tree.

However, this is still not working as expected if $(srcdir) is
relative.  The problem is this line in REGEN_TEXI:

    test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(srcdir)/$$texi $$texi; \

This is executed from the build/bfd/ directory, so if $(srcdir) is
relative, then this will get you from the bfd/ directory in the build
tree to the corresponding bfd/ directory in the src tree.  However,
the symlink is created in the bfd/doc/ build directory.  The relative
path will then fail to take you to the bfd/ directory in the src
tree.

Fix this by using $(abs_srcdir) when creating the symlink.
---
 bfd/Makefile.in  | 2 +-
 bfd/doc/local.mk | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


base-commit: 50505c486ed266463fde4ab7c0c8d530e53065a9
  

Comments

Nick Clifton Jan. 22, 2025, 10:53 a.m. UTC | #1
Hi Andrew,

> Fix this by using $(abs_srcdir) when creating the symlink.

Approved.  Please could you apply this patch to the mainline and the 2.44 branch ?

Cheers
   Nick
  
Andrew Burgess Jan. 22, 2025, 10:59 a.m. UTC | #2
Nick Clifton <nickc@redhat.com> writes:

> Hi Andrew,
>
>> Fix this by using $(abs_srcdir) when creating the symlink.
>
> Approved.  Please could you apply this patch to the mainline and the 2.44 branch ?

Pushed to master, binutils-2_44-branch, and gdb-16-branch too!

Thanks,
Andrew
  

Patch

diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index aec3717485a..ee674a36c5b 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -1318,7 +1318,7 @@  REGEN_TEXI = \
 	$(MKDOC) -f $(srcdir)/doc/doc.str < $< > $@.tmp; \
 	texi=$@; \
 	texi=$${texi%.stamp}.texi; \
-	test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(srcdir)/$$texi $$texi; \
+	test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(abs_srcdir)/$$texi $$texi; \
 	$(SHELL) $(srcdir)/../move-if-change $@.tmp $$texi; \
 	touch $@; \
 	)
diff --git a/bfd/doc/local.mk b/bfd/doc/local.mk
index 97d658b5a48..9b75402387c 100644
--- a/bfd/doc/local.mk
+++ b/bfd/doc/local.mk
@@ -101,7 +101,7 @@  REGEN_TEXI = \
 	$(MKDOC) -f $(srcdir)/%D%/doc.str < $< > $@.tmp; \
 	texi=$@; \
 	texi=$${texi%.stamp}.texi; \
-	test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(srcdir)/$$texi $$texi; \
+	test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(abs_srcdir)/$$texi $$texi; \
 	$(SHELL) $(srcdir)/../move-if-change $@.tmp $$texi; \
 	touch $@; \
 	)