# # # patch "Makefile.PL" # from [83b18295296a23c35dd2406e6c3a5f4a6dc01975] # to [ec3a12eb0a35b677fa4569ac780d0e14d35a668e] # # patch "README" # from [0144a991a639991398cb6c6f4668ead1e575fd49] # to [7926cf7d2a1f994dd0c5f2f33b1995e6e39c0a40] # # patch "installer-files/DependencyChecker.pm" # from [84176500545fee6843587ada1d3cf7865502792d] # to [94f601d6ee7af29384e5ec3a6fc42d59d803bb9e] # # patch "linux-installer" # from [a47c4e99edfacd26553e5d5b7cf63602d01e9f4a] # to [bb9ea0aef19434b71a3f6991cc4d4c0e87eb1596] # ============================================================ --- Makefile.PL 83b18295296a23c35dd2406e6c3a5f4a6dc01975 +++ Makefile.PL ec3a12eb0a35b677fa4569ac780d0e14d35a668e @@ -4,13 +4,17 @@ my($dest_dir, use IO::File; my($dest_dir, + $globs_file, + $lib_dir, $makefile, + $no_use_dists_mas, $prefix_dir); -my %valid_options = (DESTDIR => \$dest_dir, - PREFIX => \$prefix_dir); +my %valid_options = (DESTDIR => \$dest_dir, + GLOBS_FILE => \$globs_file, + LIBDIR => \$lib_dir, + NO_USE_DISTS_MAS => \$no_use_dists_mas, + PREFIX => \$prefix_dir); -$dest_dir = $prefix_dir = ""; - # Parse command line options. foreach my $arg (@ARGV) @@ -26,14 +30,24 @@ foreach my $arg (@ARGV) else { print(STDERR - "usage: perl Makefile.PL [PREFIX=] [DESTDIR] [DESTDIR=]\n" + . " [GLOBS_FILE=] " + . "[NO_USE_DISTS_MAS=1]\n"); exit(1); } } # Check that the dependencies are satisfied. -system("perl linux-installer --dep-level=1"); +if (defined($no_use_dists_mas) && $no_use_dists_mas != 0) +{ + system("perl linux-installer --dep-level=1 --no-use-dists-mas"); +} +else +{ + system("perl linux-installer --dep-level=1"); +} # Generate Makefile. @@ -42,8 +56,10 @@ DESTDIR=$dest_dir if (! defined($makefile = IO::File->new("Makefile", "w"))); $makefile->print(<print(" \$(INSTALLER)"); EOF ); $makefile->print(" \$(INSTALLER)"); -$makefile->print(" --prefix=\$(PREFIX)") if ($prefix_dir ne ""); -$makefile->print(" --destdir=\$(DESTDIR)") if ($dest_dir ne ""); +$makefile->print(" --globs-file=\$(GLOBS_FILE)") if (defined($globs_file)); +$makefile->print(" --destdir=\$(DESTDIR)") if (defined($dest_dir)); +$makefile->print(" --libdir=\$(LIBDIR)") if (defined($lib_dir)); +$makefile->print(" --no-use-dists-mas") + if (defined($no_use_dists_mas) && $no_use_dists_mas != 0); +$makefile->print(" --prefix=\$(PREFIX)") if (defined($prefix_dir)); $makefile->print("\n"); $makefile->close(); ============================================================ --- README 0144a991a639991398cb6c6f4668ead1e575fd49 +++ README 7926cf7d2a1f994dd0c5f2f33b1995e6e39c0a40 @@ -48,10 +48,24 @@ mechanism for installing Perl modules (or libraries). However, there does not seem to be a standard way of installing a Perl application. Since Perl is largely platform independent, the ./configure; make; make install approach of -automake does not seem right so I have decided to write a custom Makefile.PL -script that supports some basic installation capability. Please note that -Makefile.PL only supports those arguments documented above. +automake does not seem right. So I have decided to write a custom Makefile.PL +script that supports some basic installation capability. +In fact Makefile.PL simply calls the installer script, passing any arguments +through to it. The installer script supports some additional options that can +also be specified via Makefile.PL, meaning that the full list of arguments are: + + perl Makefile.PL PREFIX= DESTDIR= LIBDIR= \ + GLOBS_FILE= NO_USE_DISTS_MAS=1 + +For further information on what these options mean please run: + + ./linux-installer -m + +PREFIX equates to --prefix, DESTDIR equates to --destdir, LIBDIR equates to +--libdir, GLOBS_FILE equates to --globs-file and NO_USE_DISTS_MAS equates to +--no-use-dists-mas. + Alternatively one can run the installer directly. See the next subsection. Using linux-installer @@ -88,37 +102,92 @@ |-- bin | `-- mtn-browse - `-- lib - `-- mtn-browse - |-- perl - | |-- AdvancedFind.pm - | |-- Annotate.pm - | |-- ChangeLog.pm - | |-- ComboAutoCompletion.pm - | |-- Common.pm - | |-- Completion.pm - | |-- FindFiles.pm - | |-- FindText.pm - | |-- Globals.pm - | |-- History.pm - | |-- Monotone <- 1) - | | |-- AutomateStdio.pm - | | `-- AutomateStdio.pod - | |-- Preferences.pm - | `-- WindowManager.pm - `-- ui - |-- annotate.png - |-- diffs.png - |-- external-diffs.png - |-- line.png - |-- monotone-viz.png - |-- mtn-browse-large.png - |-- mtn-browse.glade - `-- mtn-browse.png + |-- lib + | `-- mtn-browse + | |-- perl + | | |-- AdvancedFind.pm + | | |-- Annotate.pm + | | |-- ChangeLog.pm + | | |-- ComboAutoCompletion.pm + | | |-- Common.pm + | | |-- Completion.pm + | | |-- FindFiles.pm + | | |-- FindText.pm + | | |-- Globals.pm + | | |-- History.pm + | | |-- Monotone <- 1) + | | | |-- AutomateStdio.pm + | | | `-- AutomateStdio.pod + | | |-- Preferences.pm + | | `-- WindowManager.pm + | `-- ui + | |-- annotate.png + | |-- diffs.png + | |-- external-diffs.png + | |-- line.png + | |-- monotone-viz.png + | |-- mtn-browse-large.png + | |-- mtn-browse.glade + | `-- mtn-browse.png + `-- share + |-- gnome + | `-- help + | `-- mtn-browse + | `-- C + | |-- figures + | | |-- advanced-find-helper-widgets.png + | | |-- advanced-find-window-advanced-mode.png + | | |-- advanced-find-window-empty.png + | | |-- advanced-find-window-simple-mode.png + | | |-- annotate-button.png + | | |-- annotate-window-with-menu.png + | | |-- branch-combobox-entry-with-completion.png + | | |-- change-log-window.png + | | |-- changelog-button.png + | | |-- close-toolbar-button.png + | | |-- combobox-entry-down-button.png + | | |-- compare-button.png + | | |-- differences-window.png + | | |-- execute-button-small.png + | | |-- execute-button.png + | | |-- external-compare-button.png + | | |-- file-viewer-button.png + | | |-- find-button.png + | | |-- find-files-window-empty.png + | | |-- find-files-window-query.png + | | |-- help-toolbar-button.png + | | |-- information-button.png + | | |-- line-numbers-toggle-button.png + | | |-- main-window-empty.png + | | |-- main-window-showing-file.png + | | |-- main-window-showing-hex-dump.png + | | |-- main-window-showing-image-file.png + | | |-- main-window-showing-tooltip-and-selection.png + | | |-- montone-viz-button.png + | | |-- new-toolbar-button.png + | | |-- non-unique-tag-dialog.png + | | |-- open-database-dialog.png + | | |-- open-toolbar-button.png + | | |-- preferences-toolbar-button.png + | | |-- preferences-window.png + | | |-- reload-toolbar-button.png + | | |-- revision-history-window.png + | | |-- save-button.png + | | |-- stop-button.png + | | |-- up-button-small.png + | | `-- up-button.png + | `-- mtn-browse.xml + `-- locale + `-- + `-- LC_MESSAGES + `-- mtn-browse.mo The only file that needs to be executable is the mtn-browse file under the bin directory. +The mtn-browse.mo file is generated from the relevant .po file by using the +msgfmt(1) command. + Once the files are in place then edit the mtn-browse executable and change the constants at the top containing the "@INST:LIB_DIR@", "@INST:GLOBS_FILE@" and "@INST:PREFIX_DIR@" values so that they contain the correct values. It is ============================================================ --- installer-files/DependencyChecker.pm 84176500545fee6843587ada1d3cf7865502792d +++ installer-files/DependencyChecker.pm 94f601d6ee7af29384e5ec3a6fc42d59d803bb9e @@ -57,7 +57,7 @@ use warnings; # Public routines. -sub check($); +sub check($$); # ***** PACKAGE INFORMATION ***** @@ -79,6 +79,9 @@ our $VERSION = 0.1; # name and the value is the required version # number. If the version number is zero then # only the presence of the package is tested. +# $err_msg : A reference to a buffer that is to contain +# the error message if a dependency is not +# found. # Return Value : True if the dependencies are met, otherwise # false if they are not. # @@ -86,13 +89,15 @@ our $VERSION = 0.1; -sub check($) +sub check($$) { - my $dependencies = $_[0]; + my($dependencies, $err_msg) = @_; my $met = 1; + $$err_msg = undef; + foreach my $dep (sort(keys(%$dependencies))) { @@ -108,9 +113,9 @@ sub check($) # Not installed. - printf(STDERR "Warning: prerequisite %s %s not found.\n", - $dep, - $dependencies->{$dep}); + $$err_msg = sprintf("Prerequisite %s %s not found.", + $dep, + $dependencies->{$dep}); $met = undef; } @@ -131,11 +136,11 @@ sub check($) if ($version < $dependencies->{$dep}) { - printf(STDERR - "Warning: prerequisite %s %s not found. We have %s.\n", - $dep, - $dependencies->{$dep}, - $version); + $$err_msg = + sprintf("Prerequisite %s %s not found. We have %s.", + $dep, + $dependencies->{$dep}, + $version); $met = undef; } ============================================================ --- linux-installer a47c4e99edfacd26553e5d5b7cf63602d01e9f4a +++ linux-installer bb9ea0aef19434b71a3f6991cc4d4c0e87eb1596 @@ -134,6 +134,7 @@ use Installer; { my(%deps, + $err_msg, $met); # Build up the dependency list. @@ -151,11 +152,18 @@ use Installer; # Do the check. - $met = DependencyChecker::check(\%deps); + $met = DependencyChecker::check(\%deps, \$err_msg); # Deal with the result depending upon what the user wants. - exit($met ? 0 : 1) if ($dep_level == 1 || ($dep_level == 2 && ! $met)); + if (! $met) + { + printf(STDERR "%s: %s\n", + ($dep_level == 2) ? "Error" : "Warning", + $err_msg); + exit(1) if ($dep_level < 3); + } + exit(0) if ($dep_level == 1); } @@ -220,8 +228,10 @@ use Installer; ($input) = ($input =~ m/^\s*(.*)\s*$/); $lib_dir = $input if ($input ne ""); } - $lib_prefix_dir = $prefix_dir . $lib_dir; - $lib_dest_dir = $dest_dir . $prefix_dir. $lib_dir; + $lib_prefix_dir = $prefix_dir . "/" . $lib_dir; + $lib_prefix_dir =~ s/\/\//\//g; + $lib_dest_dir = $dest_dir . $prefix_dir. "/" . $lib_dir; + $lib_dest_dir =~ s/\/\//\//g; if (-e $lib_dest_dir && (! -d $lib_dest_dir || ! -w $lib_dest_dir)) { print("Error: Directory `" . $lib_dest_dir . "' is unwritable or " @@ -251,7 +261,7 @@ use Installer; print("GLOBS_FILE = " . $globs_file . "\n"); print("PREFIX_DIR = " . $prefix_dir . "\n"); print("DEST_DIR = " . $dest_dir . "\n"); - print("LIB_DIR = " . $lib_dir . "\n"); + print("LIB_DIR = /" . $lib_dir . "\n"); print("Use my MAS = " . ($use_dists_mas_lib ? "Yes" : "No") . "\n"); } @@ -416,9 +426,9 @@ linux-installer [options] Options: --confirm -c Print out what will happen first - --dep-level LEVEL Specify type of dependency checking + --dep-level= LEVEL Specify type of dependency checking --destdir= -d DIR Specify temp installation location - --globs-file= -g FILE Location of mime globs file + --globs-file= -g FILE Location of MIME globs file --interactive -i Ask questions interactively --libdir= -l DIR Library dir relative to PREFIX_DIR --prefix= -p DIR Installation location @@ -435,7 +445,7 @@ Print out what will be done before actua Print out what will be done before actually doing it. -=item B<--dep-level LEVEL> +=item B<--dep-level=LEVEL> Specify type of dependency checking. Valid values are: