OPAC VirtualShelves overhaul -- bugfix 1413 (among others)
[koha.git] / Makefile.PL
index d9bee63..d050c1f 100644 (file)
@@ -24,7 +24,6 @@ use warnings;
 use ExtUtils::MakeMaker;
 use POSIX;
 use File::Spec;
-use Cwd;
 
 my $DEBUG = 0;
 die "perl 5.6.1 or later required" unless ($] >= 5.006001);
@@ -244,6 +243,7 @@ my $target_map = {
   './MANIFEST.SKIP'             => 'NONE',
   './members'                   => 'INTRANET_CGI_DIR',
   './misc'                      => { target => 'SCRIPT_DIR', trimdir => -1 }, 
+  './misc/bin'                  => { target => 'SCRIPT_DIR', trimdir => -1 }, 
   './misc/info'                 => { target => 'DOC_DIR', trimdir => 2 },
   './misc/release notes'        => { target => 'DOC_DIR', trimdir => 2 },
   './misc/translator'           => { target => 'MISC_DIR', trimdir => 2 }, 
@@ -420,8 +420,11 @@ get_file_map($target_map, $dirtree, $file_map, $config{'INSTALL_ZEBRA'} eq "yes"
 my $pl_files = {
       'rewrite-config.PL' => [
          'blib/KOHA_CONF_DIR/koha-conf.xml',
-         'blib/KOHA_CONF_DIR/koha-httpd.conf',
-         ]
+         'blib/KOHA_CONF_DIR/koha-httpd.conf'
+         ],
+         'fix-perl-path.PL' => [       # this script ensures the correct shebang line for the platform installed on...
+                'blib'
+                ]
 };
 
 if ($config{'INSTALL_ZEBRA'} eq "yes") {
@@ -430,6 +433,12 @@ if ($config{'INSTALL_ZEBRA'} eq "yes") {
         'blib/ZEBRA_CONF_DIR/zebra-biblios.cfg',
         'blib/ZEBRA_CONF_DIR/zebra-authorities.cfg'
     );
+    if ($config{'INSTALL_MODE'} ne 'dev') {
+        push @{ $pl_files->{'rewrite-config.PL'} }, (
+            'blib/SCRIPT_DIR/koha-zebra-ctl.sh',
+            'blib/SCRIPT_DIR/koha-zebraqueue-ctl.sh',
+        );
+    }
 }
 
 if ($config{'INSTALL_MODE'} ne "dev") {
@@ -447,14 +456,16 @@ WriteMakefile(
     AUTHOR => 'Koha Developers <koha-devel@nongnu.org>',
     NO_META => 1,
     PREREQ_PM => {
-'Algorithm::CheckDigits' => 0.48,
+# awaiting package maintainer's use of $VERSION
+#'Algorithm::CheckDigits' => 0.48,
+#'Algorithm::CheckDigits::M43_001' => 0.48,
 'Biblio::EndnoteStyle' => 0.05,
 'CGI' => 3.15,
 'CGI::Carp' => 1.29,
 'CGI::Session' => '4.10',
-'Class::Factory::Util' => 1.7,
+'Class::Factory::Util' => 1.6,
 'Class::Accessor' => 0.30,
-'DBD::mysql' => 3.0008,
+'DBD::mysql' => 4.004,
 'DBI' => 1.53,
 'Data::ICal' => 0.13,
 'Data::Dumper' => 2.121_08,
@@ -473,7 +484,7 @@ WriteMakefile(
 'LWP::UserAgent' => 2.033,
 'Lingua::Stem' => 0.82,
 'List::Util' => 1.18,
-'List::MoreUtils' => 0.22,
+'List::MoreUtils' => 0.21,
 'Locale::Language' => 2.07,
 'MARC::Charset' => 0.98,
 'MARC::Crosswalk::DublinCore' => 0.02,
@@ -482,8 +493,8 @@ WriteMakefile(
 'MIME::Base64' => 3.07,
 'MIME::QuotedPrint' => 3.07,
 'Mail::Sendmail' => 0.79,
-'Net::LDAP' => 0.34,
-'Net::LDAP::Filter' => 0.34,
+'Net::LDAP' => 0.33,
+'Net::LDAP::Filter' => 0.14,
 'Net::Z3950::ZOOM' => 1.16,
 'PDF::API2' => 2.000,
 'PDF::API2::Page' => 2.000,
@@ -505,10 +516,11 @@ WriteMakefile(
 'Unicode::Normalize' => 0.32,
 'XML::Dumper' => 0.81,
 'XML::LibXML' => 1.59,
-'XML::LibXSLT' => 1.63,
+'XML::LibXSLT' => 1.59,
 'XML::SAX::ParserFactory' => 1.01,
 'XML::Simple' => 2.14,
 'XML::RSS' => 1.31,
+'YAML::Syck' => 0.71,
         },
 
        # File tree mapping
@@ -518,7 +530,7 @@ WriteMakefile(
     INSTALLMAN1DIR => File::Spec->catdir($target_directories->{'MAN_DIR'}, 'man1'),
     INSTALLMAN3DIR => File::Spec->catdir($target_directories->{'MAN_DIR'}, 'man3'),
 
-   PL_FILES => $pl_files,
+    PL_FILES => $pl_files,
 
 );
 
@@ -954,7 +966,7 @@ sub get_target_directories {
         $skipdirs{'INTRANET_TMPL_DIR'} = 1;
         $dirmap{'INTRANET_WWW_DIR'} = File::Spec->catdir($curdir, 'koha-tmpl');
         $skipdirs{'INTRANET_WWW_DIR'} = 1;
-        $dirmap{'OPAC_CGI_DIR'} = File::Spec->catdir($curdir, 'opac');
+        $dirmap{'OPAC_CGI_DIR'} = File::Spec->catdir($curdir);
         $skipdirs{'OPAC_CGI_DIR'} = 1;
         $dirmap{'OPAC_TMPL_DIR'} = File::Spec->catdir($curdir, 'koha-tmpl', 'opac-tmpl');
         $skipdirs{'OPAC_TMPL_DIR'} = 1;
@@ -1050,66 +1062,6 @@ sub display_configuration {
     print "DB_USER=my_koha DOC_DIR=/usr/local/info perl Makefile.PL\n\n";
 }
 
-=head2 fixshebang
-
-This sub will recurse through a given directory and its subdirectories checking for the existence of a shebang
-line in .pl files and replacing it with the correct line for the current OS if needed. It should be called
-in a manner similar to 'fixshebang (getcwd())' but may be supplied with any directory in absolute path form.
-
-=cut
-
-sub fixshebang{
-       # NOTE: this might be dressed up a bit with File::Spec since we're using it here already.
-       my $dir = shift;
-    opendir my $dh, $dir or die $!;
-    while( my $file = readdir($dh) ) {
-               print "Reading $dir contents.\r\n" if $DEBUG;
-               print "Current item = $file\r\n" if $DEBUG;
-               # this may be used to exclude any desired files from the scan
-               if ( $file =~ /shebang|wixgen/ ) { next; }
-               # handle files... other extensions could be substituted/added if needed
-               if ( $file =~ /\.pl$/ ) {
-                       my $pathfile =$dir . '/' . $file;
-                       print "Found a perl script named $pathfile\r\n" if $DEBUG;
-                       open FH, '+<', "$pathfile";
-                       my @file = <FH>;
-                       seek( FH, 0, 0 );
-                       truncate( FH, 0 );
-                       my $line = shift @file;
-                       print "Found shebang line: $line\r\n" if $DEBUG;
-                       # FIXME: these conditionals need to be modified to select shebang line based on OS ($^O)
-                       if ( $line =~ /#!c:\\strawberry-perl\\perl\\bin\\perl -w/ ) {
-                               # FIXME: This can probably be done with less of a hack. -fbcit
-                               print FH $line;
-                               print FH @file;
-                               close (FH);
-                               next;
-                       }
-                       elsif ( $line =~ /#!\/usr\/bin\/perl/ ) {
-                               print "Re-writing shebang line for $pathfile\r\n";
-                               print FH "#!c:\\strawberry-perl\\perl\\bin\\perl -w\n";
-                               print FH @file;
-                               close(FH);
-                       }
-                       else {
-                               # FIXME: This can probably be done with less of a hack. -fbcit
-                               print FH $line;
-                               print FH @file;
-                               close (FH);
-                               next;
-                       }
-               }
-               # handle directories
-               elsif ( -d ($dir . '/' . $file) && $file !~ /^\.{1,2}/ ) {
-                       my $pathfile = $dir . '/' . $file;
-                       print "Found a subdir named $pathfile\r\n" if $DEBUG;
-                       &fixshebang ($pathfile);
-#                      closedir $dh;   # I'm not really sure if this is necessary
-               }
-       }
-       closedir $dh;
-}
-
 package MY;
 
 # This will have to be reworked in order to accommodate Win32...
@@ -1129,7 +1081,7 @@ sub install {
     # installation and uninstallation targets.
 
 # If installation is on Win32, we need to do permissions different from *nix
-    if ( $^O =~ /linux|cygwin/ ) { # this value needs to be verified for each platform and modified accordingly
+    if ( $^O =~ /darwin|linux|cygwin/ ) { # this value needs to be verified for each platform and modified accordingly
            foreach my $key (sort keys %$target_directories) {
                    $install .= qq(
 KOHA_INST_$key = blib/$key
@@ -1190,9 +1142,6 @@ install :: all install_koha warn_koha_env_vars
                                unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or exists $skip_directories->{$key};
                }
        }
-       $install .= "\t\t\$(INST_MAN1DIR) \$(DESTINSTALLMAN1DIR) \\\n";
-       $install .= "\t\t\$(INST_MAN3DIR) \$(DESTINSTALLMAN3DIR)\n";
-
        $install .= "\n";
 
     $install .= "warn_koha_env_vars ::\n";
@@ -1223,24 +1172,27 @@ sub postamble {
     # quote '$' in the two password parameters
     my %config = %config;
     $config{'DB_PASS'} =~ s/\$/\$\$/g;
-    $config{'ZEBRA_PASS'} =~ s/\$/\$\$/g;
+    if ($config{'INSTALL_ZEBRA'} eq "yes") {
+        $config{'ZEBRA_PASS'} =~ s/\$/\$\$/g;
+    }
 
        # Hereagain, we must alter syntax per platform...
-       if ( $^O =~ /linux|cygwin/ ) {
-               my $env = join("\n", map { "export __${_}__ := $target_directories->{$_}" } keys %$target_directories); 
-               $env .= "\n\n";
-               $env .= join("\n", map { "export __${_}__ := $config{$_}" } keys %config);
-               return "$env\n";
-       }
-       elsif ( $^O eq 'MSWin32' ) {
+       if ( $^O eq 'MSWin32' ) {
                # NOTE: it is imperative that there be no whitespaces in ENV=value...
                my $env = join("\n", map { "__${_}__=$target_directories->{$_}" } keys %$target_directories); 
                $env .= "\n\n";
                $env .= join("\n", map { "__${_}__=$config{$_}" } keys %config);
                return "$env\n";
        }
+    else {
+               my $env = join("\n", map { "export __${_}__ := $target_directories->{$_}" } keys %$target_directories); 
+               $env .= "\n\n";
+               $env .= join("\n", map { "export __${_}__ := $config{$_}" } keys %config);
+               return "$env\n";
+       }
 }
 
+
 __END__