blob: c09aff70f1b8e7cb1810745540789217d09007d3 [file] [log] [blame]
From c0c07af5f1a35db1feefbfaa5d66b8210a9abd3b Mon Sep 17 00:00:00 2001
From: Gavin Smith <gavinsmith0123@gmail.com>
Date: Sun, 19 Dec 2021 11:17:10 +0000
Subject: [PATCH 1/1] Attempt to make texi2any relocatable
* tp/texi2any.pl: Reinstate code removed on 2018-08-15, which
attempted to find associated files relative to the installed location
of texi2any. Also find loadable XS modules.
Report from Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com>
who was using Eli Zaretskii's ezwinports build of Texinfo.
---
ChangeLog | 11 +++++++++++
tp/texi2any.pl | 13 ++++++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index fa7cc7a42a..bfec6f5cfa 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -77,8 +77,19 @@ BEGIN
Texinfo::ModulePath::init(undef, undef, 'updirs' => 1);
} else {
# Look for modules in their installed locations.
-
my $lib_dir = File::Spec->catdir($datadir, $package);
+
+ # try to make package relocatable, will only work if
+ # standard relative paths are used
+ if (! -f File::Spec->catfile($lib_dir, 'Texinfo', 'Parser.pm')
+ and -f File::Spec->catfile($command_directory, $updir, 'share',
+ $package, 'Texinfo', 'Parser.pm')) {
+ $lib_dir = File::Spec->catdir($command_directory, $updir,
+ 'share', $package);
+ $packagedir = File::Spec->catdir($command_directory, $updir,
+ 'lib', $package);
+ }
+
unshift @INC, $lib_dir;
require Texinfo::ModulePath;
--
2.36.1.255.ge46751e96f-goog