From fdc29897e59c9f00b4e9dd6a55b63a37d90eefa0 Mon Sep 17 00:00:00 2001 From: mertz Date: Wed, 2 Jul 2003 08:58:38 +0000 Subject: inital release --- Makefile.PL | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 Makefile.PL (limited to 'Makefile.PL') diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..bebc206 --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,94 @@ +# this code has been developped by Somanos Sar from CENA +# $Id$ + +use 5.00404; +use Cwd; +use Config; +use File::Basename; + + +BEGIN +{ + my $IsWin32 = ($^O eq 'MSWin32' || $Config{'ccflags'} =~ /-D_?WIN32_?/); +} + +my %opt = parse_opt(); + +# Libraries +my $tkConfig = $opt{'--tkConfig'}; +my $tclConfig = $opt{'--tclConfig'}; + +$tkConfig = gess_libs('tkConfig.sh') if (!($tkConfig and -d $tkConfig)); +$tclConfig = gess_libs('tclConfig.sh') if (!($tclConfig and -d $tclConfig)); + +my $gl_lib = gess_libs('libGL.so'); +if ($gl_lib) +{ + $gl_lib = 'yes'; +} +else +{ + $gl_lib = 'yes'; +} + +# Directories +my $prefix = $Config{'prefix'}; +$prefix = $opt{'--prefix'} if ($opt{'--prefix'}); + + +############################################# +# SUBROUTINES +############################################# + +# Try to guess which library are to be use for tk and tcl +sub gess_libs +{ + my $lib_name = shift; + print "No $lib_name specified!!! Trying to find it by myself (may be long)...\n"; + + my @libs = split(/[ \t]+/, $Config{'libpth'}); + foreach my $lib (@libs) + { + my @configs = `find /usr/lib -name $lib_name`; + if (@configs) + { + print "Using $configs[0]\n"; + $configs[0] = dirname($configs[0]); + return $configs[0]; + } + } + return undef; +} + +# Parse option from command line +sub parse_opt +{ + my $args = join(/_IFS_/, @ARGV); + my @tokens = split(/_IFS_/, $args); + my %options; + + foreach my $token (@tokens) + { + my ($key, $value) = split(/[ =]+/, $token); + $options{$key} = $value; + } + return %options; +} + + + +#print "$tkConfig $tclConfig $prefix $gl_lib // $opt{'--tkConfig'} $opt{'--tclConfig'}\n"; + +my @args = ("./configure", + "--enable-ptk=yes", + "--enable-gl=yes", + "--enable-gl=$gl_lib", + "--enable-shared=yes", + "--with-tk=$tkConfig", + "--with-tcl=$tclConfig", + "--prefix=$prefix", + "INSTALL_PERL=\"yes\"" + ); +print "\nConfiguring with... ", join (' ', @args), "\n"; + +system (@args); -- cgit v1.1