Bug 2505 : use warnings in smart_rules.pl
[koha.git] / Makefile.PL
index 2cc1108..2e414d5 100644 (file)
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 #
 # Current maintainer MJR http://mjr.towers.org.uk/
-# See http://www.koha.org/wiki/?page=KohaInstaller
 #
 
 use strict;
@@ -25,9 +24,16 @@ use ExtUtils::MakeMaker;
 use POSIX;
 use File::Spec;
 use Getopt::Long;
+use FindBin; # we need to enforce which C4::Installer::PerlModule is used in case more than one is installed
+
+use lib $FindBin::Bin;
+
+use C4::Installer;
+
+my $koha_pm = C4::Installer::PerlModules->new;
 
 my $DEBUG = 0;
-die "perl 5.6.1 or later required" unless ($] >= 5.006001);
+die "perl 5.10 or later required" unless ($] >= 5.010000);
 
 # Hash up directory structure & files beginning with the directory we were called from (should be the base of koha)...
 
@@ -260,6 +266,7 @@ my $target_map = {
   './installer-CPAN.pl'         => 'NONE',
   './installer'                 => 'INTRANET_CGI_DIR',
   './errors'                    => {target => 'INTRANET_CGI_DIR'},
+  './Koha'                      => 'PERL_MODULE_DIR',
   './koha-tmpl/intranet-tmpl'   => {target => 'INTRANET_TMPL_DIR', trimdir => -1},
   './koha-tmpl/opac-tmpl'       => {target => 'OPAC_TMPL_DIR', trimdir => -1},
   './kohaversion.pl'            => 'INTRANET_CGI_DIR', 
@@ -306,6 +313,7 @@ my $target_map = {
                                            # that should go in /var/tmp/koha
   './tools'                     => 'INTRANET_CGI_DIR',
   './virtualshelves'            => 'INTRANET_CGI_DIR',
+  './xml_sax.pl'                => 'PERL_MODULE_DIR',
   # ignore files and directories created by the install itself
   './pm_to_blib'                => 'NONE',
   './blib'                      => 'NONE',
@@ -399,9 +407,10 @@ my %config_defaults = (
   'INSTALL_ZEBRA'     => 'yes',
   'INSTALL_SRU'       => 'yes',
   'INSTALL_PAZPAR2'   => 'no',
-  'AUTH_INDEX_MODE'   => 'grs1',
+  'AUTH_INDEX_MODE'   => 'dom',
   'ZEBRA_MARC_FORMAT' => 'marc21',
   'ZEBRA_LANGUAGE'    => 'en',
+  'ZEBRA_TOKENIZER'   => 'chr',
   'ZEBRA_USER'        => 'kohauser',
   'ZEBRA_PASS'        => 'zebrastripes',
   'ZEBRA_SRU_HOST'    => 'localhost',
@@ -451,8 +460,9 @@ my %valid_config_values = (
   'INSTALL_ZEBRA' => { 'yes' => 1, 'no' => 1 },
   'INSTALL_SRU' => { 'yes' => 1, 'no' => 1 },
   'AUTH_INDEX_MODE' => { 'grs1' => 1, 'dom' => 1 },
-  'ZEBRA_MARC_FORMAT' => { 'marc21' => 1, 'unimarc' => 1 }, # FIXME should generate from contents of distributation
-  'ZEBRA_LANGUAGE'    => { 'en' => 1, 'fr' => 1 }, # FIXME should generate from contents of distribution
+  'ZEBRA_MARC_FORMAT' => { 'marc21' => 1, 'normarc' => 1, 'unimarc' => 1 }, # FIXME should generate from contents of distributation
+  'ZEBRA_LANGUAGE'    => { 'en' => 1, 'fr' => 1, 'nb' => 1 }, # FIXME should generate from contents of distribution
+  'ZEBRA_TOKENIZER' => { chr => 1, icu => 1 },
   'RUN_DATABASE_TESTS' => { 'yes' => 1, 'no' => 1 },
   'USE_MEMCACHED'      => { 'yes' => 1, 'no' => 1 },
 );
@@ -479,11 +489,12 @@ my $pl_files = {
       'rewrite-config.PL' => [
          'blib/KOHA_CONF_DIR/koha-conf.xml',
          'blib/KOHA_CONF_DIR/koha-httpd.conf',
+         'blib/ZEBRA_CONF_DIR/etc/default.idx',
          'blib/MISC_DIR/koha-install-log'
          ],
          'fix-perl-path.PL' => [       # this script ensures the correct shebang line for the platform installed on...
                 'blib'
-                ]
+                ],
 };
 
 if ($config{'INSTALL_ZEBRA'} eq "yes") {
@@ -520,6 +531,10 @@ if ($config{'INSTALL_MODE'} ne "dev") {
     );
 }
 
+$config{ZEBRA_TOKENIZER_STMT} = $config{ZEBRA_TOKENIZER} eq 'icu'
+    ? 'icuchain words-icu.xml'
+    : 'charmap word-phrase-utf.chr';
+
 my %test_suite_override_dirs = (
     KOHA_CONF_DIR  => ['etc'],
     ZEBRA_CONF_DIR => ['etc', 'zebradb'],
@@ -535,95 +550,9 @@ WriteMakefile(
               #VERSION     => strftime('2.9.%Y%m%d%H',gmtime),
               VERSION_FROM => 'kohaversion.pl',
               ABSTRACT     => 'Award-winning integrated library system (ILS) and Web OPAC',
-              AUTHOR       => 'Koha Developers <koha-devel@nongnu.org>',
+              AUTHOR       => 'Koha Contributors <http://koha-community.org/>',
               NO_META      => 1,
-              PREREQ_PM => {
-                            'Algorithm::CheckDigits'           => 0.50,
-                            'Biblio::EndnoteStyle'             => 0.05,
-                            'CGI'                              => 3.15,
-                            'CGI::Carp'                        => 1.29,
-                            'CGI::Session'                     => 4.20,
-                            'CGI::Session::Serialize::yaml'    => 4.20,
-                            'Class::Factory::Util'             => 1.6,
-                            'Class::Accessor'                  => 0.30,
-                            'DBD::mysql'                       => 4.004,
-                            'DBD::SQLite2'                     => 0.33, # optional, used for offline circulation
-                            'DBI'                              => 1.53,
-                            'Data::Dumper'                     => 2.121,
-                            'Data::ICal'                       => 0.13,
-                            'Date::Calc'                       => 5.4,
-                            'Date::ICal'                       => 1.72,
-                            'Date::Manip'                      => 5.44,
-                            'Digest::MD5'                      => 2.36,
-                            'Digest::SHA'                      => 5.43,
-                            'Email::Date'                      => 1.103,
-                            'File::Temp'                       => 0.16,
-                            'GD'                               => 2.39,    #optional, used for patron image feature
-                            'GD::Barcode::UPCE'                => 1.1,
-                            'Graphics::Magick'                 => 1.3.7,   #optional, used for patron cards creator
-                            'Getopt::Long'                     => 2.35,
-                            'Getopt::Std'                      => 1.05,
-                            'HTML::Template::Pro'              => 0.69,
-                            'HTML::Scrubber'                   => 0.08,
-                            'HTTP::Cookies'                    => 1.39,
-                            'HTTP::OAI'                        => 3.20,
-                            'HTTP::Request::Common'            => 1.26,
-                            'IPC::Cmd'                         => 0.46,
-                            'JSON'                             => 2.07, # Needed by admin/item_circulation_alerts.pl
-                            'LWP::Simple'                      => 1.41,
-                            'LWP::UserAgent'                   => 2.033,
-                            'Lingua::Stem'                     => 0.82,
-                           'Lingua::Stem::Snowball'           => 0.952,
-                            'List::Util'                       => 1.18,
-                            'List::MoreUtils'                  => 0.21,
-                            'Locale::Language'                 => 2.07,
-                            'MARC::Charset'                    => 0.98,
-                            'MARC::Crosswalk::DublinCore'      => 0.02,
-                            'MARC::File::XML'                  => 0.88,
-                            'MARC::Record'                     => 2.00,
-                            'MIME::Base64'                     => 3.07,
-                            'MIME::Lite'                       => 3.00,
-                            'MIME::QuotedPrint'                => 3.07,
-                            'Mail::Sendmail'                   => 0.79,
-                            'Memoize::Memcached'               => 0.03, # optional
-                            'Net::LDAP'                        => 0.33, # optional
-                            'Net::LDAP::Filter'                => 0.14, # optional
-                            'Net::Z3950::ZOOM'                 => 1.16,
-                            'Number::Format'                   => 1.52,
-                            'PDF::API2'                        => 2.000,
-                            'PDF::API2::Page'                  => 2.000,
-                            'PDF::API2::Util'                  => 2.000,
-                            'PDF::API2::Simple'                => 1.000,
-                            'PDF::Table'                       => 0.9.3,
-                            'PDF::Reuse'                       => 0.33,
-                            'PDF::Reuse::Barcode'              => 0.05,
-                            'POE'                              => 0.9999,
-                            'POSIX'                            => 1.09,
-                            'Schedule::At'                     => 1.06,
-                            'Storable'                        => 2.21,
-                            'SMS::Send'                        => 0.05, # optional
-                            'Term::ANSIColor'                  => 1.10,
-                            'Test'                             => 1.25,
-                            'Test::Harness'                    => 2.56,
-                            'Test::More'                       => 0.80,
-                            'Text::CSV'                        => 0.01,
-                            'Text::CSV_XS'                     => 0.32,
-                            'Text::CSV::Encoded'               => 0.09,
-                            'Text::Iconv'                      => 1.7,
-                            'Text::Wrap'                       => 2005.082401,
-                            'Time::HiRes'                      => 1.86,
-                            'Time::localtime'                  => 1.02,
-                            'Unicode::Normalize'               => 0.32,
-                            'URI::Escape'                      => 1.36,
-                            'XML::Dumper'                      => 0.81,
-                            'XML::LibXML'                      => 1.59,
-                            'XML::LibXSLT'                     => 1.59,
-                            'XML::SAX::ParserFactory'          => 1.01,
-                            'XML::SAX::Writer'                 => 0.44,
-                            'XML::Simple'                      => 2.14,
-                            'XML::RSS'                         => 1.31,
-                            'YAML::Syck'                       => 0.71,
-                        },
+              PREREQ_PM    => $koha_pm->prereq_pm,
 
               # File tree mapping
               PM => $file_map,
@@ -996,8 +925,8 @@ Since you've chosen to use Zebra with Koha,
 you must specify the primary MARC format of the
 records to be indexed by Zebra.
 
-Koha provides Zebra configuration files for MARC 21
-and UNIMARC.
+Koha provides Zebra configuration files for MARC21,
+NORMARC and UNIMARC.
 
 MARC format for Zebra indexing);
         $msg .= _add_valid_values_disp('ZEBRA_MARC_FORMAT', $valid_values);
@@ -1024,6 +953,15 @@ Authorities indexing mode);
         $msg .= _add_valid_values_disp('AUTH_INDEX_MODE', $valid_values);
         $config{'AUTH_INDEX_MODE'} = _get_value('AUTH_INDEX_MODE', $msg, $defaults->{'AUTH_INDEX_MODE'}, $valid_values, $install_log_values);
 
+        $msg = q(
+Zebra has two methods to perform records tokenization
+and characters normalization: CHR and ICU. ICU is
+recommended for catalogs containing non-Latin
+characters.);
+
+        $msg .= _add_valid_values_disp('ZEBRA_TOKENIZER', $valid_values);
+        $config{'ZEBRA_TOKENIZER'} = _get_value('ZEBRA_TOKENIZER', $msg, $defaults->{'ZEBRA_TOKENIZER'}, $valid_values, $install_log_values);
+
         $msg = q(
 Please specify Zebra database user);
         $config{'ZEBRA_USER'} = _get_value('ZEBRA_USER', $msg, $defaults->{'ZEBRA_USER'}, $valid_values, $install_log_values);
@@ -1192,6 +1130,7 @@ sub _get_value {
 
     # take value from install log if present
     if (exists $install_log_values{$key}) {
+        $install_log_values{$key} =~ s/\$/\$\$/g;
         return $install_log_values{$key};
     }
 
@@ -1211,6 +1150,7 @@ sub _get_value {
         $retry_msg .= _add_valid_values_disp($key, $valid_values);
         $val = prompt($retry_msg, $default);
     }
+    $val =~ s/\$/\$\$/g;
     return $val;
 }
 
@@ -1602,13 +1542,6 @@ sub postamble {
     # variables -- this is for the use of
     # rewrite-confg.PL
 
-    # quote '$' in the two password parameters
-    my %config = %config;
-    $config{'DB_PASS'} =~ s/\$/\$\$/g;
-    if ($config{'INSTALL_ZEBRA'} eq "yes") {
-        $config{'ZEBRA_PASS'} =~ s/\$/\$\$/g;
-    }
-
     my $env;
        # Hereagain, we must alter syntax per platform...
        if ( $^O eq 'MSWin32' ) {
@@ -1663,4 +1596,5 @@ MJ Ray mjr at phonecoop.coop
 Galen Charlton galen.charlton at liblime.com
 
 =cut
+
 FIXME: deal with .htaccess