*more* relocatable perl

Gianni Ceccarelli via perl5-porters <[email protected]> Thu, 16 Jul 2026 13:08:12 +0100
Newsgroups gmane.comp.lang.perl.perl5.porters
Message-ID <20260716130812.1bb571ed@exelion>
Hello!

For $work, I need to build a `perl` that can be copied in different
locations, and should work fine from any of them.

Of course I started with `-Duserelocatableinc`, which takes care of
`@INC` and a few `%Config` entries (prefixexp archlibexp privlibexp
sitearchexp sitebinexp sitelibexp sitescriptexp siteprefixexp
sitelib_stem installarchlib installprefixexp installprivlib
installsitearch installsitebin installsitelib installsitescript)

But it does not take care of installbin installprefix
installscript perlpath scriptdir scriptdirexp startperl

startperl and perlpath are used by CPAN modules
(e.g. `ExtUtils::Helpers::make_executable`,
`ExtUtils::MM_Unix::fixin`) to (re)write the shebang line of programs,
and a few other libraries use those in their tests.  Therefore, moving
a "relocatable INC" perl to a different directory and trying to
install some modules, often fails.

I have worked around the issue in my builds, by patching `Config.pm`
to apply a simplified version of `relocate_inc` to those other
settings, and I think it's good enough _for me_.

But=E2=80=A6

Would it be sensible to have a `-Duserelocatablebin` that has the same
effect as `userelocatableinc`, but for the other settings?

So for example you'd get, in `Config.pm`:

    scriptdir =3D> '.../',
   =20
instead of

    scriptdir =3D> '/home/dakkar/perl5/perlbrew/perls/perl-5.44.0/bin',
   =20
`bin` and `binexp` are already set to `.../` when `userelocatableinc`
is set (although, weirdly, they don't get filtered through
`relocate_inc()`=E2=80=A6 bug?)

--=20
	Dakkar - <Mobilis in mobile>
	GPG public key fingerprint =3D A071 E618 DD2C 5901 9574
	                             6FE2 40EA 9883 7519 3F88
	                    key id =3D 0x75193F88