diff options
author | Reuben Thomas <rrt@sc3d.org> | 2014-01-09 22:31:42 +0000 |
---|---|---|
committer | Ben Pfaff <blp@cs.stanford.edu> | 2014-01-09 21:13:40 -0800 |
commit | b532ce5d26245bf99bdd5cfb8530e29b808b80bd (patch) | |
tree | 5e145c2a01487f4b646118a51b06140932b28f21 /doc | |
parent | e446f257e29da65d94ec2d944e08a62b5690d99b (diff) | |
download | gnulib-b532ce5d26245bf99bdd5cfb8530e29b808b80bd.tar.gz |
relocatable-perl: like relocatable-script, but for Perl scripts
* build-aux/relocatable.pl.in: Add.
* doc/relocatable-maint.texi: Add documentation.
* modules/relocatable-perl: Add.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/relocatable-maint.texi | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/doc/relocatable-maint.texi b/doc/relocatable-maint.texi index f972b2fb48..23b5048741 100644 --- a/doc/relocatable-maint.texi +++ b/doc/relocatable-maint.texi @@ -144,6 +144,37 @@ where the script gets installed. Also, at the end, instead of that you need. @item +If your package installs Perl scripts, also import the +@code{relocatable-perl} module. Then, near the beginning of each +Perl script that your package installs, add the following: + +@example +@@relocatable_pl@@ +if ("@@RELOCATABLE@@" eq "yes") { + my $exec_prefix = "@@exec_prefix@@"; + my $orig_installdir = "@@bindir@@"; # see Makefile.am's *_SCRIPTS variables + my ($orig_installprefix, $curr_installprefix) = find_prefixes($orig_installdir, find_curr_installdir()); + sub relocate { # the subroutine is defined whether or not the enclosing block is executed + my ($dir) = @@_; + if ("@@RELOCATABLE@@" eq "yes") { + $dir =~ s%^$orig_installprefix/%$curr_installprefix/%; + $dir =~ s,/$,,; + } + return $dir; + } +} + +# Get some relocated directory names. +$sysconfdir = relocate("@@sysconfdir@@"); +$some_datadir = relocate(@@datadir@@/something"); +@end example + +You must adapt the definition of @code{$orig_installdir}, depending on +where the script gets installed. Also, at the end, instead of +@code{sysconfdir} and @code{some_datadir}, transform those variables +that you need. + +@item In your @file{Makefile.am}, for every program @command{foo} that gets installed in, say, @file{$(bindir)}, you add: |