1 # Copyright 2007 MJ Ray
3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA 02111-1307 USA
18 # Current maintainer MJR http://mjr.towers.org.uk/
19 # See http://www.koha.org/wiki/?page=KohaInstaller
24 use ExtUtils::MakeMaker;
29 die "perl 5.6.1 or later required" unless ($] >= 5.006001);
31 # Hash up directory structure & files beginning with the directory we were called from (should be the base of koha)...
33 my $dirtree = hashdir('.');
38 Makefile.PL - Koha packager and installer
42 =head2 BASIC INSTALLATION
48 =head2 PACKAGING RELEASE TARBALLS
59 This is a packager and installer that uses
60 ExtUtils::MakeMaker, which is fairly common
62 As well as building tar or zip files
63 and installing with the above commands,
64 it allows us to check pre-requisites
65 and generate configuration files.
69 =head2 NAME, VERSION_FROM, ABSTRACT, AUTHOR
71 Basic metadata about this software.
75 Suppress generation of META.yml file.
79 Hash of perl modules and versions required.
87 Maybe use prompt() here in future to get configuration values
88 interactively at installation time.
92 This is a hash of PL scripts to run after installation and
93 the files to ask them to generate.
94 Maybe use the values from CONFIGURE
95 to generate initial configuration files in future.
101 This is a hash mapping directories and files in the
102 source tree to installation target directories. The rules
103 for this mapping are:
107 =item If a directory or file is specified, it and its
108 contents will be copied to the installation target directory.
110 =item If a subdirectory of a mapped directory is specified,
111 its target overrides the parent's target for that subdirectory.
113 =item The value of each map entry may either be a scalar containing
114 one target or a reference to an array of targets, in which case
115 the directory or file is copied to each target.
117 =item Any files at the top level of the source tree that are
118 not included in the map will not be installed.
120 =item Any directories at the top level of the source tree
121 that are not included in the map will be installed in
122 INTRANET_CGI_DIR. This is a sensible default given the
123 current organization of the source tree, but (FIXME) it
124 would be better to reorganize the source tree to better
125 match the installation system, to allow adding new directories
126 without having to adjust Makefile.PL each time. The idea
127 is to make the C<$target_map> hash as minimal as possible.
131 The permitted installation targets are:
135 =item INTRANET_CGI_DIR
137 CGI scripts for intranet (staff) interface.
139 =item INTRANET_TMPL_DIR
141 HTML templates for the intranet interface.
143 =item INTRANET_WWW_DIR
145 HTML files, images, etc. for DocumentRoot for the intranet interface.
149 CGI scripts for OPAC (public) interface.
153 HTML templates for the OPAC interface.
157 HTML files, images, etc. for DocumentRoot for the OPAC interface.
159 =item PERL_MODULE_DIR
161 Perl modules (at present just the C4 modules) that are intimately
162 tied to Koha. Depending on the installation options, these
163 may or may not be installed one of the standard directories
164 in Perl's default @LIB.
168 Directory for Koha configuration files.
172 Directory for Zebra configuration files.
176 Directory for Zebra's lock files.
180 Directory for Zebra's data files.
184 Directory for Zebra's UNIX-domain sockets.
188 Directory for example configuration files. This directory
189 exists primarily to make it easier to change the
190 MARC format or language of the active Zebra
195 Directory for command-line scripts and daemons.
199 Directory for man pages created from POD -- will mostly
200 contain information of interest to Koha developers.
204 Directory for Koha documentation accessed from the
205 command-line, e.g., READMEs.
209 Directory for Apache and Zebra logs produced by Koha.
213 This is a dummy target used to explicitly state
214 that a given file or directory is not to be installed.
215 This is used either for parts of the installer itself
216 or for development tools that are not applicable to a
217 production installation.
224 './about.pl' => 'INTRANET_CGI_DIR',
225 './acqui' => 'INTRANET_CGI_DIR',
226 './admin' => 'INTRANET_CGI_DIR',
227 './authorities' => 'INTRANET_CGI_DIR',
228 './C4' => 'PERL_MODULE_DIR',
229 './C4/SIP/t' => 'NONE',
230 './C4/SIP/koha_test' => 'NONE',
231 './C4/tests' => 'NONE',
232 './catalogue' => 'INTRANET_CGI_DIR',
233 './cataloguing' => 'INTRANET_CGI_DIR',
234 './changelanguage.pl' => [ 'INTRANET_CGI_DIR', 'OPAC_CGI_DIR' ],
235 './check_sysprefs.pl' => 'NONE',
236 './circ' => 'INTRANET_CGI_DIR',
237 './edithelp.pl' => 'INTRANET_CGI_DIR',
238 './etc' => { target => 'KOHA_CONF_DIR', trimdir => -1 },
239 './etc/zebradb' => { target => 'ZEBRA_CONF_DIR', trimdir => -1 },
240 './installer-CPAN.pl' => 'NONE',
241 './installer' => 'INTRANET_CGI_DIR',
242 './koha-tmpl' => 'NONE',
243 './koha-tmpl/intranet-tmpl' => {target => 'INTRANET_TMPL_DIR', trimdir => -1},
244 './koha-tmpl/opac-tmpl' => {target => 'OPAC_TMPL_DIR', trimdir => -11},
245 './koha-version.pl' => 'INTRANET_CGI_DIR', # FIXME this may need to be in OPAC_CGI_DIR as well, with an update to C4::Context
246 './labels' => 'INTRANET_CGI_DIR',
247 './mainpage.pl' => 'INTRANET_CGI_DIR',
248 './Makefile.PL' => 'NONE',
249 './MANIFEST.SKIP' => 'NONE',
250 './members' => 'INTRANET_CGI_DIR',
251 './misc' => { target => 'SCRIPT_DIR', trimdir => -1 },
252 './misc/info' => { target => 'DOC_DIR', trimdir => 2 },
253 './misc/release notes' => { target => 'DOC_DIR', trimdir => 2 },
254 './misc/translator' => { target => 'EXAMPLE_DIR', trimdir => 2 },
255 './misc/installer_devel_notes' => 'NONE',
256 './opac' => 'OPAC_CGI_DIR',
257 './README.txt' => 'NONE',
258 './reports' => 'INTRANET_CGI_DIR',
259 './reserve' => 'INTRANET_CGI_DIR',
260 './reviews' => 'INTRANET_CGI_DIR',
261 './rewrite-config.PL' => 'NONE',
262 './reviews' => 'INTRANET_CGI_DIR',
263 './rss' => 'NONE', # FIXME deal with a little later
264 './serials' => 'INTRANET_CGI_DIR',
265 './sms' => 'INTRANET_CGI_DIR',
266 './suggestion' => 'INTRANET_CGI_DIR',
267 './svc' => 'INTRANET_CGI_DIR',
269 './tmp' => 'NONE', # FIXME deal with later
270 './tools' => 'INTRANET_CGI_DIR',
271 './virtualshelves' => 'INTRANET_CGI_DIR',
272 # ignore files and directories created by the install itself
273 './pm_to_blib' => 'NONE',
277 =head1 CONFIGURATION OPTIONS
279 The following configuration options are used by the installer.
285 Specifies whether installation will be FHS-compliant (default,
286 assumes user has root), put everything under
287 a single directory (for users installing on a web host
288 that allows CGI scripts and a MySQL database but not root
289 access), or development (for a developer who wants to run
290 Koha from a git clone with no fuss).
294 Directory under which most components will go. Default
295 value will vary depending on INSTALL_MODE.
299 Whether to install Zebra configuration files and data
302 =item ZEBRA_MARC_FORMAT
304 Specifies format of MARC records to be indexed by Zebra.
308 Specifies primary language of records that will be
315 # default configuration options
316 my %config_defaults = (
317 'INSTALL_MODE' => 'standard',
318 'INSTALL_BASE' => '/usr/share/koha',
319 'INSTALL_ZEBRA' => 'yes',
320 'ZEBRA_MARC_FORMAT' => 'marc21',
321 'ZEBRA_LANGUAGE' => 'en',
324 # valid values for certain configuration options
325 my %valid_config_values = (
326 'INSTALL_MODE' => { 'standard' => 1, 'single' => 1, 'dev' => 1 },
327 'INSTALL_ZEBRA' => { 'yes' => 1, 'no' => 1 },
328 'ZEBRA_MARC_FORMAT' => { 'marc21' => 1, 'unimarc' => 1 }, # FIXME should generate from contents of distributation
329 'ZEBRA_LANGUAGE' => { 'en' => 1, 'fr' => 1 }, # FIXME should generate from contents of distribution
332 my %config = get_configuration(\%config_defaults, \%valid_config_values);
333 my %target_directories = get_target_directories(\%config);
335 get_file_map($target_map, $dirtree, $file_map);
339 #VERSION => strftime('2.9.%Y%m%d%H',gmtime),
340 VERSION_FROM => 'C4/Context.pm',
341 ABSTRACT => 'Award-winning integrated library system (ILS) and Web OPAC',
342 AUTHOR => 'Koha Developers <koha-devel@nongnu.org>',
347 'CGI::Session' => '4.10',
348 'Class::Factory::Util' => 1.7,
349 'Class::Accessor' => 0.30,
350 'DBD::mysql' => 3.0008,
352 'Data::Dumper' => 2.121_08,
354 'Date::Manip' => 5.44,
355 'Digest::MD5' => 2.36,
356 'File::Temp' => 0.16,
357 'GD::Barcode::UPCE' => 1.1,
358 'Getopt::Long' => 2.35,
359 'Getopt::Std' => 1.05,
360 'HTML::Template::Pro' => 0.65,
361 'HTTP::Cookies' => 1.39,
362 'HTTP::Request::Common' => 1.26,
363 'LWP::Simple' => 1.41,
364 'LWP::UserAgent' => 2.033,
365 'Lingua::Stem' => 0.82,
366 'List::Util' => 1.18,
367 'Locale::Language' => 2.07,
368 'MARC::Charset' => 0.98,
369 'MARC::Crosswalk::DublinCore' => 0.03,
370 'MARC::File::XML' => 0.88,
371 'MARC::Record' => 2.00,
372 'MIME::Base64' => 3.07,
373 'MIME::QuotedPrint' => 3.07,
374 'Mail::Sendmail' => 0.79,
375 'PDF::API2' => 2.000,
376 'PDF::API2::Page' => 2.000,
377 'PDF::API2::Util' => 2.000,
378 'PDF::Reuse' => 0.33,
379 'PDF::Reuse::Barcode' => 0.05,
381 'Schedule::At' => 1.06,
382 'Term::ANSIColor' => 1.10,
384 'Test::Harness' => 2.56,
385 'Test::More' => 0.62,
387 'Text::CSV_XS' => 0.32,
388 'Text::Wrap' => 2005.082401,
389 'Time::HiRes' => 1.86,
390 'Time::localtime' => 1.02,
391 'Unicode::Normalize' => 0.32,
392 'XML::Dumper' => 0.81,
393 'XML::LibXML' => 1.59,
394 'XML::SAX::ParserFactory' => 1.01,
395 'XML::Simple' => 2.14,
403 # Man pages generated from POD
404 INSTALLMAN1DIR => File::Spec->catdir($target_directories{'MAN_DIR'}, 'man1'),
405 INSTALLMAN3DIR => File::Spec->catdir($target_directories{'MAN_DIR'}, 'man3'),
408 # # Ask for options with prompt($question,$default) calls here?
409 # return { macro => { 'export TEST' => '755' } }
412 PL_FILES => { # generator => target(s)
413 'rewrite-config.PL' => [
414 'blib/KOHA_CONF_DIR/koha-conf.xml',
415 'blib/KOHA_CONF_DIR/koha-httpd.conf',
416 'blib/ZEBRA_CONF_DIR/etc/passwd',
417 'blib/ZEBRA_CONF_DIR/zebra-biblios.cfg',
418 'blib/ZEBRA_CONF_DIR/zebra-authorities.cfg'
421 # 'opac/getfromintranet.PL' => ['$(INST_LIBDIR)/opac/cgi-bin/detail.pl','$(INST_LIBDIR)/opac/cgi-bin/moredetail.pl','$(INST_LIBDIR)/opac/cgi-bin/search.pl','$(INST_LIBDIR)/opac/cgi-bin/subjectsearch.pl','$(INST_LIBDIR)/opac/cgi-bin/logout.pl'],
422 # 'misc/koha.conf.PL' => '$(INST_LIBDIR)/../etc/koha.conf',
423 # 'misc/apache-koha.conf.PL' => '$(INST_LIBDIR)/../etc/apache-koha.conf',
424 # 'misc/koha.sql.PL' => '$(INST_LIBDIR)/intranet/scripts/koha.sql',
425 # 'z3950/z3950-daemon-options.PL' => '$(INST_LIBDIR)/intranet/scripts/z3950daemon/z3950-daemon-options',
426 # # fake target to check permissions
427 # 'misc/chmod.PL' => '$(INST_LIBDIR)/fake-target'
429 # need to set ownerships
430 # need to load koha.sql
431 # need to link koha-httpd.conf
432 # need to start z3950-daemon
439 This function recurses through the directory structure and builds
440 a hash of hashes containing the structure with arrays holding filenames.
441 This directory hashing routine was taken from BrowserUK @ http://www.perlmonks.org/?node_id=219919
447 opendir my $dh, $dir or die $!;
448 my $tree = {}->{$dir} = {};
449 while( my $file = readdir($dh) ) {
450 next if $file =~ m/^\.{1,2}/ and $file !~ /^\.htaccess/; # .htaccess is a special case
451 my $path = $dir .'/' . $file;
452 $tree->{$file} = hashdir($path), next if -d $path;
453 push @{$tree->{'.'}}, $file;
460 This function combines the target_map and file hash to
461 map each source file to its destination relative to
462 the set of installation targets.
464 Output will be a hash mapping from each source file
465 to its destination value, like this:
467 'mainpage.pl' => '$(INTRANET_CGI_DIR)/mainpage.pl'
472 my $target_map = shift;
474 my $file_map = shift;
475 my $curr_path = @_ ? shift : ['.'];
477 # Traverse the directory tree.
478 # For each file or directory, identify the
479 # most specific match in the target_map
480 foreach my $dir (sort keys %{ $dirtree }) {
482 # deal with files in directory
483 foreach my $file (sort @{ $dirtree->{$dir} }) {
484 my $targetdir = undef;
485 my $matchlevel = undef;
486 # first, see if there is a match on this specific
487 # file in the target map
488 my $filepath = join("/", @$curr_path, $file);
489 if (exists $target_map->{$filepath}) {
490 $targetdir = $target_map->{$filepath};
491 $matchlevel = scalar(@$curr_path) + 1;
493 # no match on the specific file; look for
495 for (my $i = scalar(@$curr_path) - 1; $i >= 0; $i--) {
496 my $dirpath = join("/", @$curr_path[0..$i]);
497 if (exists $target_map->{$dirpath}) {
498 $targetdir = $target_map->{$dirpath};
499 $matchlevel = $i + 1;
504 if (defined $targetdir) {
505 _add_to_file_map($file_map, $targetdir, $curr_path, $file, $matchlevel);
507 my $path = join("/", @$curr_path);
508 print "failed to map: $path/$file\n" if $DEBUG;
512 # dealing with subdirectory
513 push @$curr_path, $dir;
514 get_file_map($target_map, $dirtree->{$dir}, $file_map, $curr_path);
520 sub _add_to_file_map {
521 my $file_map = shift;
522 my $targetdir = shift;
523 my $curr_path = shift;
525 my $matchlevel = shift;
526 my $dest_path = @_ ? shift : $curr_path;
528 # The target can be one of the following:
529 # 1. scalar representing target symbol
530 # 2. hash ref containing target and trimdir keys
531 # 3. array ref containing list of #1 and #2
533 # Consequently, this routine traverses this structure,
534 # calling itself recursively, until it deals with
535 # all of the scalar target symbols.
536 if (ref $targetdir eq 'ARRAY') {
537 foreach my $subtarget (sort @$targetdir) {
538 _add_to_file_map($file_map, $subtarget, $curr_path, $file, $matchlevel);
540 } elsif (ref $targetdir eq 'HASH') {
541 my $subtarget = $targetdir->{target};
542 if (exists $targetdir->{trimdir}) {
543 # if we get here, we've specified that
544 # rather than installing the file to
545 # $(TARGET)/matching/dirs/subdirs/file,
546 # we want to install it to
547 # $(TARGET)/subdirs/file
549 # Note that this the only place where
550 # $matchlevel is used.
551 my @new_dest_path = @$dest_path;
552 if ($targetdir->{trimdir} == -1) {
553 splice @new_dest_path, 0, $matchlevel;
555 splice @new_dest_path, 0, $targetdir->{trimdir};
557 _add_to_file_map($file_map, $subtarget, $curr_path, $file, $matchlevel, \@new_dest_path);
559 # actually getting here means that the
560 # target was unnecessarily listed
561 # as a hash, but we'll forgive that
562 _add_to_file_map($file_map, $subtarget, $curr_path, $file, $matchlevel);
564 } elsif ($targetdir ne 'NONE' and $targetdir ne '') {
565 my $source = File::Spec->catfile(@$curr_path, $file);
566 my $destination = File::Spec->catfile('blib', $targetdir, @$dest_path, $file);
567 #print "$source => $destination\n"; # DEBUG
568 # quote spaces in file names
569 # FIXME: this is of questionable portability and
570 # probably depends on user's make recognizing this
571 # quoting syntax -- probably better to remove
572 # spaces and shell metacharacters from all file names
573 $source =~ s/ /\\ /g;
574 $destination =~ s/ /\\ /g;
576 $file_map->{$source} = $destination;
580 =head2 get_configuration_options
582 This prompts the user for various configuration options.
586 sub get_configuration {
587 my $defaults = shift;
588 my $valid_values = shift;
592 By default, Koha can be installed in one of three ways:
594 standard: Install files in conformance with the Filesystem
595 Hierarchy Standard (FHS). This is the default mode
596 and should be used when installing a production
597 Koha system. On Unix systems, root access is
598 needed to complete a standard installation.
600 single: Install files under a single directory. This option
601 is useful for installing Koha without root access, e.g.,
602 on a web host that allows CGI scripts and MySQL databases
603 but requires the user to keep all files under the user's
606 dev: Create a set of symbolic links and configuration files to
607 allow Koha to run directly from the source distribution.
608 This mode is useful for developers who want to run
609 Koha from a git clone.
611 Please choose the installation mode);
612 $msg .= _add_valid_values_disp('INSTALL_MODE', $valid_values);
613 $config{'INSTALL_MODE'} = _get_value('INSTALL_MODE', $msg, $defaults->{'INSTALL_MODE'}, $valid_values);
615 # set message and default value for INSTALL_BASE
616 # depending on value of INSTALL_MODE
617 my $install_base_default = $defaults->{'INSTALL_BASE'};
618 if ($config{'INSTALL_MODE'} eq 'dev') {
620 Please specify the directory in which to install Koha's
621 active configuration files and (if applicable) the
622 Zebra database. Koha's CGI scripts and templates will
623 be run from the current directory.);
624 # FIXME - home directory portability consideration apply
625 $install_base_default = (exists $ENV{'HOME'}) ? "$ENV{'HOME'}/koha-dev" : "/usr/share/koha-dev";
626 } elsif ($config{'INSTALL_MODE'} eq 'single') {
627 $msg = "\nPlease specify the directory in which to install Koha";
628 # FIXME -- we're assuming under a 'single' mode install
629 # that user will likely want to install under the home
630 # directory. This is OK in and of itself, but we should
631 # use File::HomeDir to locate the home directory portably.
632 # This is deferred for now because File::HomeDir is not yet
634 $install_base_default = (exists $ENV{'HOME'}) ? "$ENV{'HOME'}/koha" : "/usr/share/koha";
638 Please specify the directory under which most Koha files
641 Note that if you are planning in installing more than
642 one instance of Koha, you may want to modify the last
643 component of the directory path, which will be used
644 as the package name in the FHS layout.);
646 $config{'INSTALL_BASE'} = _get_value('INSTALL_BASE', $msg, $install_base_default, $valid_values);
647 $config{'INSTALL_BASE'} = File::Spec->rel2abs($config{'INSTALL_BASE'});
650 Koha can use the Zebra search engine for high-performance
651 searching of bibliographic and authority records. If you
652 have installed the Zebra software and would like to use it,
653 please answer 'yes' to the following question. Otherwise,
654 Koha will default to using its internal search engine.
656 Please specify whether to install the Zebra configuration files);
657 $msg .= _add_valid_values_disp('INSTALL_ZEBRA', $valid_values);
658 $config{'INSTALL_ZEBRA'} = _get_value('INSTALL_ZEBRA', $msg, $defaults->{'INSTALL_ZEBRA'}, $valid_values);
660 if ($config{'INSTALL_ZEBRA'} eq 'yes') {
662 Since you've chosen to use Zebra with Koha,
663 you must specify the primary MARC format of the
664 records to be indexed by Zebra.
666 Koha provides Zebra configuration files for MARC 21
669 Please specify the MARC format);
670 $msg .= _add_valid_values_disp('ZEBRA_MARC_FORMAT', $valid_values);
671 $config{'ZEBRA_MARC_FORMAT'} = _get_value('ZEBRA_MARC_FORMAT', $msg, $defaults->{'ZEBRA_MARC_FORMAT'}, $valid_values);
673 Koha supplies Zebra configuration files tuned for
674 searching either English (en) or French (fr) MARC
677 Please specify the primary language of the MARC records);
678 $msg .= _add_valid_values_disp('ZEBRA_LANGUAGE', $valid_values);
679 $config{'ZEBRA_LANGUAGE'} = _get_value('ZEBRA_LANGUAGE', $msg, $defaults->{'ZEBRA_LANGUAGE'}, $valid_values);
684 sub _add_valid_values_disp {
686 my $valid_values = shift;
689 if (exists $valid_values->{$key}) {
690 $disp = " (" . join(", ", sort keys %{ $valid_values->{$key} }) . ")";
699 my $valid_values = shift;
701 my $val = prompt($msg, $default);
702 while (exists $valid_values->{$key} and not exists $valid_values->{$key}->{$val}) {
703 my $retry_msg = "Value '$val' is not a valid option.\n";
704 $retry_msg .= "Please enter a value";
705 $retry_msg .= _add_valid_values_disp($key, $valid_values);
706 $val = prompt($retry_msg, $default);
711 =head2 get_target_directories
713 Creates a hash mapping from symbols for installation target
714 directories to actual directory paths.
718 sub get_target_directories {
721 my $base = $config->{'INSTALL_BASE'};
722 my $mode = $config->{'INSTALL_MODE'};
724 # get last component of install base directory
725 # to treat as package name
726 my ($volume, $directories, $file) = File::Spec->splitpath($base, 1);
727 my @basedir = File::Spec->splitdir($directories);
728 my $package = pop @basedir;
731 if ($mode eq 'single') {
732 $dirmap{'INTRANET_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'cgi-bin');
733 $dirmap{'INTRANET_TMPL_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'templates');
734 $dirmap{'INTRANET_WWW_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'htdocs');
735 $dirmap{'OPAC_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'cgi-bin');
736 $dirmap{'OPAC_TMPL_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'templates');
737 $dirmap{'OPAC_WWW_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'htdocs');
738 $dirmap{'PERL_MODULE_DIR'} = File::Spec->catdir(@basedir, $package, 'lib');
739 $dirmap{'KOHA_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc');
740 $dirmap{'ZEBRA_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'zebradb');
741 $dirmap{'EXAMPLE_DIR'} = File::Spec->catdir(@basedir, $package, 'example');
742 $dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
743 $dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
744 $dirmap{'DOC_DIR'} = File::Spec->catdir(@basedir, $package, 'doc');
745 $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb');
746 $dirmap{'LOG_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'log');
747 $dirmap{'ZEBRA_DATA_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb');
748 $dirmap{'ZEBRA_RUN_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb');
749 } elsif ($mode eq 'dev') {
750 my $curdir = File::Spec->rel2abs(File::Spec->curdir());
751 $dirmap{'INTRANET_CGI_DIR'} = File::Spec->catdir($curdir);
752 $dirmap{'INTRANET_TMPL_DIR'} = File::Spec->catdir($curdir, 'koha-tmpl', 'intranet-tmpl');
753 $dirmap{'INTRANET_WWW_DIR'} = File::Spec->catdir($curdir, 'koha-tmpl', 'intranet-tmpl');
754 $dirmap{'OPAC_CGI_DIR'} = File::Spec->catdir($curdir, 'opac');
755 $dirmap{'OPAC_TMPL_DIR'} = File::Spec->catdir($curdir, 'koha-tmpl', 'opac-tmpl');
756 $dirmap{'OPAC_WWW_DIR'} = File::Spec->catdir($curdir, 'koha-tmpl', 'opac-tmpl');
757 $dirmap{'PERL_MODULE_DIR'} = File::Spec->catdir($curdir);
758 $dirmap{'KOHA_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc');
759 $dirmap{'ZEBRA_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'zebradb');
760 $dirmap{'EXAMPLE_DIR'} = File::Spec->catdir(@basedir, $package, 'example');
761 $dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
762 $dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
763 $dirmap{'DOC_DIR'} = File::Spec->catdir(@basedir, $package, 'doc');
764 $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb');
765 $dirmap{'LOG_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'log');
766 $dirmap{'ZEBRA_DATA_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb');
767 $dirmap{'ZEBRA_RUN_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb');
769 # mode is standard, i.e., 'fhs'
770 $dirmap{'INTRANET_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'cgi-bin');
771 $dirmap{'INTRANET_TMPL_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'templates');
772 $dirmap{'INTRANET_WWW_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'htdocs');
773 $dirmap{'OPAC_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'cgi-bin');
774 $dirmap{'OPAC_TMPL_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'templates');
775 $dirmap{'OPAC_WWW_DIR'} = File::Spec->catdir(@basedir, $package, 'opac', 'htdocs');
776 $dirmap{'PERL_MODULE_DIR'} = File::Spec->catdir(@basedir, $package, 'lib');
777 $dirmap{'KOHA_CONF_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'etc', $package);
778 $dirmap{'ZEBRA_CONF_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'etc', $package, 'zebradb');
779 $dirmap{'EXAMPLE_DIR'} = File::Spec->catdir(@basedir, $package, 'example');
780 $dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
781 $dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
782 $dirmap{'DOC_DIR'} = File::Spec->catdir(@basedir, $package, 'doc');
783 $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lock', $package, 'zebradb');
784 $dirmap{'LOG_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'log', $package);
785 $dirmap{'ZEBRA_DATA_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lib', $package, 'zebradb');
786 $dirmap{'ZEBRA_RUN_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'run', $package, 'zebradb');
789 foreach my $key (sort keys %dirmap) {
790 print sprintf("%-25.25s%s\n", $key, $dirmap{$key});
799 my $test = $self->SUPER::test(@_);
800 $test =~ s!\$\(INST_LIB\)!blib/PERL_MODULE_DIR!g;
807 # NOTE: we're *not* doing this: my $install = $self->SUPER::install(@_);
808 # This means that we're completely overriding EU::MM's default
809 # installation and uninstallation targets.
810 foreach my $key (sort keys %target_directories) {
812 KOHA_INST_$key = blib/$key
813 KOHA_DEST_$key = $target_directories{$key}
818 install :: all install_koha
819 \t\$(NOECHO) \$(NOOP)
821 $install .= "install_koha ::\n";
822 $install .= "\t\$(NOECHO) umask 022; \$(MOD_INSTALL) \\\n";
823 foreach my $key (sort keys %target_directories) {
824 $install .= "\t\t\$(KOHA_INST_$key) \$(KOHA_DEST_$key) \\\n";
826 $install .= "\t\t\$(INST_MAN1DIR) \$(DESTINSTALLMAN1DIR) \\\n";
827 $install .= "\t\t\$(INST_MAN3DIR) \$(DESTINSTALLMAN3DIR)\n";
832 # put directory mappings into Makefile
833 # so that Make will export as environment
834 # variables -- this is for the use of
836 my $env = join("\n", map { "export __${_}__ = $target_directories{$_}" } keys %target_directories);
845 ExtUtils::MakeMaker(3)
849 MJ Ray mjr at phonecoop.coop
852 FIXME: Zebra lang/MARC mapping
853 FIXME: deal with .htaccess