Hmm.. I'm not sure what all the fuss is about in this thread. It's a pretty simple problem, and almost all of it is handled for you by perl itself...
First you need a directory for each platform to hold its binaries. Personally, I like to hide them:
cd ~/perl
mkdir bin
mkdir .platforms
cd .platforms
mkdir SunOS5.8 Linux2.4.14
cd ..
Make as many directories as you have architechtures. I suggest using names that are a combination of uname -s and -r output, but whatever scheme you like is fine.
Make a source directory or whatever and put the perl source in it.
mkdir source
cd source
tar xzvf ~/stable.tar.gz (or wherever it is)
Now, on each platform simply compile perl as you normally would, with only one change. When asked 'Pathname where the public executables will reside?', answer:
~/perl/.platforms/SunOS5.8 (or whichever platform you're on.)
Now all the architechture dependent executables, like 'perl' will be installed in that directory. Next, just write a shell script (sh is probably most universal) that does something like this:
#!/bin/sh
system=`uname -s`
release=`uname -r`
exec $HOME/perl/.platform/$system$release/$0 "$@"
You can obviously make the wrapper much fancier if you like. When you have it how you'd like it, place it in ~/perl/bin and call it .wrapper. Then just create symbolic links for each item in .platform/SunOS5.8 or whatever that point to .wrapper. For example:
cd ~/perl/bin
ln -s .wrapper perl
Now whenever you execute ~/perl/bin/perl, it will exec the version of perl for your platform. Since the normal perl installation takes care of what to do for architechture specific library files and so on, that should be all you need to do.
When installing perl modules that are pure perl, you should really only have to do it on one platform. For modules that actually compile C code or whatever though, you will probably have to build them on each platform.
The other option, rather than a wrapper, is to simply make sure that the appropriate architecture's bin directory in in your PATH.
Now, I should admit that I haven't done this in quote some time, so your mileage may vary. But in principle, that's all there is to it.
|