diff options
-rwxr-xr-x | Master/install-tl | 77 | ||||
-rwxr-xr-x | Master/install-tl-windows.bat | 34 | ||||
-rwxr-xr-x | Master/tlpkg/installer/install-tl-gui.tcl | 5 |
3 files changed, 63 insertions, 53 deletions
diff --git a/Master/install-tl b/Master/install-tl index ca87f9947cd..0a52727c3d6 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -41,60 +41,69 @@ BEGIN { unshift (@INC, "$::installerdir/tlpkg"); } -# Unix-only: want tcl GUI? -# If so, this run of install-tl does duty as a wrapper for install-tl-gui.tcl, -# which in its turn will start an actual run of install-tl. -# On windows an external batch wrapper replaces the built-in wrapper below. - -if ($^O !~ /^MSWin/i) { +# On unix, this run of install-tl may do duty as a wrapper for +# install-tl-gui.tcl, which in its turn will start an actual run of install-tl. +# Skip this wrapper block if we can easily rule out a tcl gui: + +if (($^O !~ /^MSWin/i) && + # this wrapper is only for unix, since windows has its own wrapper + ($#ARGV >= 0 || ($^O eq 'darwin')) && + # tcl parameter may still come, or tcl is default + ($#ARGV < 0 || $ARGV[0] ne '-from_ext_gui') + # this run is not invoked by tcl + ) { + my $want_tcl = ($^O eq 'darwin'); my $i=-1; my @new_args = (); - my $want_tcl = 0; while ($i<$#ARGV) { - # build argument array for install-tl-gui.tcl. - # But once we know that install-tl-gui.tcl is not going to be invoked, - # we quit scanning and continue with the original @ARGV - $i++; - my $p = $ARGV[$i]; - if ($p eq 'from_ext_gui') { - $want_tcl = 0; - last; - } elsif ($p =~ /^-?-gui=(.*$)/) { + # build argument array @new_args for install-tl-gui.tcl. + # quit scanning and building @new_args once tcl is ruled out. + my $p = $ARGV[++$i]; + if ($p =~ /^-?-gui=(.*$)/) { if ($1 eq 'tcl') { $want_tcl = 1; } else { - last; # other gui: can forget about @new_args + last; # other gui } } elsif ($p =~ /^-?-gui/) { + # look ahead at next parameter if ($i == $#ARGV) { - last; # default gui => not tcl + $want_tcl = 1; # default gui + last; } elsif ($ARGV[$i+1] eq 'tcl') { $i++; $want_tcl = 1; - } else { + } elsif ($ARGV[$i+1] eq 'expert' || $ARGV[$i+1] eq 'perltk' || + $ARGV[$i+1] eq 'wizard' || $ARGV[$i+1] eq 'text') { + $want_tcl = 0; last; + } else { + # next parameter relates to something else, so default gui is wanted + $want_tcl = 1; } + } elsif ($p =~ /^-?-no-gui/) { + $want_tcl = 0; + last; } else { # not gui-related, continue collecting @new_args push (@new_args, $p); } } + # done scanning arguments if ($want_tcl) { unshift (@new_args, "--"); unshift (@new_args, "$::installerdir/tlpkg/installer/install-tl-gui.tcl"); - if (!(defined $ENV{'WISH'}) || !exec($ENV{'WISH'}, @new_args)) { - if (!exec('wish', @new_args)) { - if (!exec('wish8.6', @new_args)) { - if (!exec('wish8.5', @new_args)) { - if (!exec('tclkit', @new_args)) { - die "wish not found\n"; - } - } - } + my @wishes = qw /wish wish8.6 wish8.5 tclkit/; + unshift @wishes, $ENV{'WISH'} if (defined $ENV{'WISH'}); + foreach my $w (@wishes) { + if (!exec($w, @new_args)) { + next; # no return on successful exec } } - } + # no succesful exec of wish + } # else continue with main installer below } +# end of wrapper block, start of the real installer use Cwd 'abs_path'; use Getopt::Long qw(:config no_autoabbrev); @@ -231,7 +240,8 @@ my %path_keys = ( my $opt_allow_ftp = 0; my $opt_custom_bin; my $opt_force_arch; -my $opt_gui = (win32() ? "wizard" : "text"); +# tcl gui weeded out at start +my $opt_gui = "text"; my $opt_help = 0; my $opt_init_from_profile = ""; my $opt_location = ""; @@ -340,12 +350,13 @@ GetOptions( "warn-checksums!" => \$opt_warn_checksums, "help|?" => \$opt_help) or pod2usage(2); -if ($opt_gui eq "") { - # the --gui option was given with an empty argument, set it to perltk +if ($opt_gui eq "expert") { $opt_gui = "perltk"; } -if ($opt_gui eq "expert") { +if ($opt_gui eq "" || $opt_gui eq "tcl") { + # tried and failed tcl, try perltk instead $opt_gui = "perltk"; + warn "Setting opt_gui to perltk instead"; } if ($from_ext_gui) { $opt_gui = "extl"; diff --git a/Master/install-tl-windows.bat b/Master/install-tl-windows.bat index 871f22e1427..2ec5f2f77fd 100755 --- a/Master/install-tl-windows.bat +++ b/Master/install-tl-windows.bat @@ -30,7 +30,7 @@ rem set instroot before %0 gets overwritten during argument processing set instroot=%~dp0
set notcl=no
-set tcl=no
+set tcl=yes
set args=
goto rebuildargs
@@ -38,12 +38,13 @@ rem check for a gui argument rem handle -gui tcl here and do not pass it on to perl or tcl.
rem cmd.exe converts '=' to a space:
rem '-parameter=value' becomes '-parameter value': two arguments
+rem we test for value == parameter rather than the other way around
+rem to avoid some weird parsing errors
rem code block for gui argument
:dogui
if x == x%1 (
-set tcl=no
-set args=%args% -gui wizard
+set tcl=yes
shift
goto rebuildargs
)
@@ -52,30 +53,27 @@ set tcl=no set args=%args% -no-gui
shift
goto rebuildargs
-)
-if wizard == %1 (
-set tcl=no
-set args=%args% -gui wizard
+) else if wizard == %1 (
+set tcl=yes
shift
goto rebuildargs
-)
-if perltk == %1 (
-set tcl=no
-set args=%args% -gui perltk
+) else if perltk == %1 (
+set tcl=yes
shift
goto rebuildargs
-)
-if expert == %1 (
-set tcl=no
-set args=%args% -gui perltk
+) else if expert == %1 (
+set tcl=yes
shift
goto rebuildargs
-)
-if tcl == %1 (
+) else if tcl == %1 (
set tcl=yes
shift
goto rebuildargs
+) else (
+set tcl=yes
+goto rebuildargs
)
+rem last case: -gui without parameter, do not shift
rem loop for argument scanning
:rebuildargs
@@ -95,6 +93,7 @@ if -print-platform == %p% set tcl=no if -version == %p% set tcl=no
if -no-gui == %p% (
set notcl=yes
+set args=%args% -no-gui
goto rebuildargs
)
if -gui == %p% goto dogui
@@ -131,7 +130,6 @@ if "%path:~,1%"==";" set "path=%path:~1%" rem Use TL Perl
path=%instroot%tlpkg\tlperl\bin;%path%
set PERL5LIB=%instroot%tlpkg\tlperl\lib
-rem for now, assume tcl/tk is on path
rem Clean environment from other Perl variables
set PERL5OPT=
diff --git a/Master/tlpkg/installer/install-tl-gui.tcl b/Master/tlpkg/installer/install-tl-gui.tcl index a2b764ac85c..c81e97a15bc 100755 --- a/Master/tlpkg/installer/install-tl-gui.tcl +++ b/Master/tlpkg/installer/install-tl-gui.tcl @@ -133,7 +133,7 @@ proc maybe_print_welcome {} { .log.tx insert end [__ "Welcome to TeX Live!"] center .log.tx insert end "\n\n" # tags appear to interfere with --/::msgcat::mc !?! - set s [__ "See %s/index.html for links to documentation.\nThe TeX Live web site (http://tug.org/texlive/) contains any updates and corrections. TeX Live is a joint project of the TeX user groups around the world; please consider supporting it by joining the group best for you. The list of groups is available on the web at http://tug.org/usergroups.html." $::vars(TEXDIR)] + set s [__ "See %s/index.html for links to documentation.\nThe TeX Live web site (https://tug.org/texlive/) contains any updates and corrections. TeX Live is a joint project of the TeX user groups around the world; please consider supporting it by joining the group best for you. The list of groups is available on the web at https://tug.org/usergroups.html." $::vars(TEXDIR)] .log.tx insert end $s center if {$::tcl_platform(platform) ne "windows"} { .log.tx insert end "\n\n" @@ -1220,7 +1220,7 @@ proc run_menu {} { incr rw if {!$::alltrees} { - ttk::button .tmoreb -text [__ "More..."] -command { + ttk::button .tmoreb -text [__ "More ..."] -command { set ::menu_ans "alltrees" if [info exists ::env(dbgui)] {puts "dbgui: requested alltrees"} } @@ -1673,6 +1673,7 @@ proc main_prog {} { incr i } unset i + # tk_messageBox -message [join $cmd " "] -title "debugging" show_time "opening pipe" if [catch {open "|[join $cmd " "] 2>@1" r+} ::inst] { # "2>@1" ok under Windows >= XP |