mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-27 02:19:10 +00:00
Allow reLyX to be run from the source directory
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2608 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ccb3cb54e5
commit
ae3b2c7874
@ -1,3 +1,6 @@
|
|||||||
|
2001-08-28 José Matos <jamatos@fep.up.pt>
|
||||||
|
* reLyX/reLyX.in: allow reLyX to be run from the source directory.
|
||||||
|
|
||||||
2001-08-15 John Levon <moz@compsoc.man.ac.uk>
|
2001-08-15 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
* ui/default.ui: sanitise math/tabular entries
|
* ui/default.ui: sanitise math/tabular entries
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
############################# reLyX wrapper
|
############################# reLyX wrapper
|
||||||
use strict;
|
use strict;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
|
use Cwd 'abs_path';
|
||||||
$^W = 1; # same as 'perl -w'
|
$^W = 1; # same as 'perl -w'
|
||||||
|
|
||||||
# Variables to make global, so subroutines can use them
|
# Variables to make global, so subroutines can use them
|
||||||
@ -14,6 +15,7 @@ use vars qw($lyxdir $lyxname);
|
|||||||
|
|
||||||
my (@maybe_dir);
|
my (@maybe_dir);
|
||||||
my $mainscript = "reLyXmain.pl";
|
my $mainscript = "reLyXmain.pl";
|
||||||
|
my $relyxdir;
|
||||||
|
|
||||||
# Do this in a BEGIN block so it's done before the 'use lib' below
|
# Do this in a BEGIN block so it's done before the 'use lib' below
|
||||||
BEGIN{
|
BEGIN{
|
||||||
@ -33,19 +35,37 @@ my $dir = &dirname($name);
|
|||||||
# are OK, but empty or undefined values will make 'use lib' complain
|
# are OK, but empty or undefined values will make 'use lib' complain
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
# case 1: for developers, e.g. - reLyX and $mainscript in same directory
|
# case 1: for developers, e.g. - reLyX and $mainscript in same directory
|
||||||
$maybe_dir[$i++] = ".";
|
$maybe_dir[$i++] = "$dir";
|
||||||
# case 2: environment variable LYX_DIR_11x has been set
|
# case 2: ran make but not make install.
|
||||||
if (exists $ENV{LYX_DIR_11x}) { $maybe_dir[$i++] = "$ENV{LYX_DIR_11x}/reLyX"};
|
|
||||||
# case 3: ran make but not make install.
|
|
||||||
$maybe_dir[$i++] = "$dir/$srcdir";
|
$maybe_dir[$i++] = "$dir/$srcdir";
|
||||||
|
# case 3: environment variable LYX_DIR_11x has been set
|
||||||
|
if (exists $ENV{LYX_DIR_11x}) { $maybe_dir[$i++] = "$ENV{LYX_DIR_11x}/reLyX"};
|
||||||
# case 4: e.g., reLyX in /opt/bin, $mainscript in /opt/share/lyx/reLyX
|
# case 4: e.g., reLyX in /opt/bin, $mainscript in /opt/share/lyx/reLyX
|
||||||
$maybe_dir[$i++] = "$dir/../share/$lyxname/reLyX"; # case 4
|
$maybe_dir[$i++] = "$dir/../share/$lyxname/reLyX"; # case 4
|
||||||
# case 5: configure figured out where $mainscript is
|
# case 5: configure figured out where $mainscript is
|
||||||
$maybe_dir[$i++] = "$lyxdir/reLyX";
|
$maybe_dir[$i++] = "$lyxdir/reLyX";
|
||||||
|
|
||||||
|
# Decide which one is the real directory, based on the existence of
|
||||||
|
# "$dir/$mainscript"
|
||||||
|
my $found=0;
|
||||||
|
foreach $dir (@maybe_dir) {
|
||||||
|
if( -e "$dir/$mainscript" ) {
|
||||||
|
$lyxdir = abs_path("$dir/..");
|
||||||
|
$relyxdir = abs_path($dir);
|
||||||
|
$found = 1;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$found) {
|
||||||
|
print "reLyX directory not found.\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
} # end BEGIN block
|
} # end BEGIN block
|
||||||
|
|
||||||
# Now put those directories into @INC
|
# Now put those directories into @INC
|
||||||
use lib @maybe_dir;
|
use lib $relyxdir;
|
||||||
|
|
||||||
# Now run the script. Perl will look in @INC to find the script (and
|
# Now run the script. Perl will look in @INC to find the script (and
|
||||||
# other modules that $mainscript calls)
|
# other modules that $mainscript calls)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user