summaryrefslogtreecommitdiff
path: root/Master/tlpkg
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2011-03-18 08:36:58 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2011-03-18 08:36:58 +0000
commit73e9e24d45dd4416e978feac22d0b88380f2eb7a (patch)
tree02d67fb0565c4746ae2e196ad653ca9ecca68eb9 /Master/tlpkg
parent465a935770799bc60e2ab2bf06efb189a3165951 (diff)
TeX Live platform names for biber
git-svn-id: svn://tug.org/texlive/trunk@21755 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm56
1 files changed, 34 insertions, 22 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 6ddab3c3df8..3b51ca04074 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -30,6 +30,7 @@ C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure
=head2 Platform Detection
TeXLive::TLUtils::platform();
+ TeXLive::TLUtils::platform_name($canonical_host);
TeXLive::TLUtils::platform_desc($platform);
TeXLive::TLUtils::win32();
TeXLive::TLUtils::unix();
@@ -122,6 +123,7 @@ BEGIN {
@ISA = qw(Exporter);
@EXPORT_OK = qw(
&platform
+ &platform_name
&platform_desc
&unix
&getenv
@@ -202,19 +204,8 @@ $::opt_verbosity = 0; # see process_logging_options
If C<$^O=~/MSWin(32|64)$/i> is true we know that we're on
Windows and we set the global variable C<$::_platform_> to C<win32>.
-Otherwise we call C<config.guess>. The output of C<config.guess>
-is filtered as described below.
-
-CPU type is determined by a regexp, and any C</^i.86/> name is replaced
-by C<i386>.
-
-For OS we need a list because what's returned is not likely to match our
-historical names, e.g., C<config.guess> returns C<linux-gnu> but we need
-C<linux>. This list might/should contain OSs which are not currently
-supported.
-
-If a particular platform is not found in this list we use the regexp
-C</.*-(.*$)/> as a last resort and hope it provides something useful.
+Otherwise we call C<platform_name> with the output of C<config.guess>
+as argument.
The result is stored in a global variable C<$::_platform_>, and
subsequent calls just return that value.
@@ -226,10 +217,7 @@ sub platform {
if ($^O =~ /^MSWin/i) {
$::_platform_ = "win32";
} else {
- # the copy of this file in biber uses a different config.guess dir.
- my $config_guess_dir = $TeXLive::TLConfig::Config_Guess_Dir
- || "$::installerdir/tlpkg/installer";
- my $config_guess = "$config_guess_dir/config.guess";
+ my $config_guess = "$::installerdir/tlpkg/installer/config.guess";
# We cannot rely on #! in config.guess but have to call /bin/sh
# explicitly because sometimes the 'noexec' flag is set in
@@ -240,6 +228,34 @@ sub platform {
die "$0: could not run $config_guess, cannot proceed, sorry"
if ! $guessed_platform;
+ $::_platform_ = platform_name($guessed_platform);
+ }
+ }
+ return $::_platform_;
+}
+
+
+=item C<platform_name($canonical_host)>
+
+Convert a canonical host names as returned by C<config.guess> into
+TeX Live platform names.
+
+CPU type is determined by a regexp, and any C</^i.86/> name is replaced
+by C<i386>.
+
+For OS we need a list because what's returned is not likely to match our
+historical names, e.g., C<config.guess> returns C<linux-gnu> but we need
+C<linux>. This list might/should contain OSs which are not currently
+supported.
+
+If a particular platform is not found in this list we use the regexp
+C</.*-(.*$)/> as a last resort and hope it provides something useful.
+
+=cut
+
+sub platform_name {
+ my ($guessed_platform) = @_;
+
$guessed_platform =~ s/^x86_64-(.*-k?)freebsd/amd64-$1freebsd/;
my $CPU; # CPU type as reported by config.guess.
my $OS; # O/S type as reported by config.guess.
@@ -269,13 +285,9 @@ sub platform {
($OS = $guessed_platform) =~ s/.*-(.*)/$1/;
}
- $::_platform_ = "$CPU-$OS";
- }
- }
- return $::_platform_;
+ return "$CPU-$OS";
}
-
=item C<platform_desc($platform)>
Return a string which describes a particular platform identifier, e.g.,