[24446] | 1 |
|
---|
| 2 | BEGIN {
|
---|
| 3 | die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
|
---|
| 4 | die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
|
---|
| 5 | unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
|
---|
| 6 | unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
|
---|
| 7 | }
|
---|
| 8 |
|
---|
| 9 | use Cwd;
|
---|
| 10 | require util;
|
---|
| 11 |
|
---|
| 12 | my $env_ext = "GEXT_SOLR";
|
---|
| 13 | my $ext_desc = "the SOLR Extension";
|
---|
| 14 |
|
---|
| 15 | if (!defined $ENV{$env_ext}) {
|
---|
| 16 |
|
---|
| 17 | my $ext_home = cwd();
|
---|
| 18 | $ENV{$env_ext} = $ext_home;
|
---|
| 19 |
|
---|
| 20 | my $ext_bin_script = &util::filename_cat($ENV{$env_ext},"bin","script");
|
---|
| 21 | my $ext_lib = &util::filename_cat($ENV{$env_ext},"lib");
|
---|
| 22 |
|
---|
| 23 | if (-d $ext_bin_script) {
|
---|
| 24 | &util::envvar_prepend("PATH",$ext_bin_script);
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | if (-d $ext_lib) {
|
---|
| 28 | if ($ENV{'GSDLOS'} =~ m/windows/i) {
|
---|
| 29 | &util::envvar_prepend("PATH",$ext_lib);
|
---|
| 30 | }
|
---|
| 31 | elsif ($ENV{'GSDLOS'} =~ m/darwin/i) {
|
---|
| 32 | &util::envvar_prepend("DYLD_LIBRARY_PATH",$ext_lib);
|
---|
| 33 | }
|
---|
| 34 | else { # linux
|
---|
| 35 | &util::envvar_prepend("LD_LIBRARY_PATH",$ext_lib);
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | if ($ENV{'GSDLOS'} =~ m/windows/i) {
|
---|
| 40 | $ENV{'GS_CP_SET'} = "yes";
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | my ($ext_dir,$_prefix_dir) = File::Basename::fileparse($ext_home);
|
---|
| 44 | # GSDLEXTS always uses : as a separator
|
---|
| 45 | if (defined $ENV{'GSDLEXTS'}) {
|
---|
| 46 | $ENV{'GSDLEXTS'} .= ":$ext_dir";
|
---|
| 47 | }
|
---|
| 48 | else {
|
---|
| 49 | $ENV{'GSDLEXTS'} = $ext_dir;
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | print STDERR "+Your environment is now setup for $ext_desc\n";
|
---|
| 53 | }
|
---|
| 54 | else {
|
---|
| 55 | print STDERR "+Your environment is already setup for $ext_desc\n";
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | if (scalar(@ARGV>0)) {
|
---|
| 59 |
|
---|
| 60 | print STDERR "\n";
|
---|
| 61 |
|
---|
| 62 | my $cmd = join(" ",map {$_ = "\"$_\""} @ARGV);
|
---|
| 63 |
|
---|
| 64 | if (system($cmd)!=0) {
|
---|
| 65 | print STDERR "\nError: Failed to run '$cmd'\n";
|
---|
| 66 | print STDERR "$!\n";
|
---|
| 67 | }
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | 1;
|
---|