Add missing auto_install features to new installer
[koha.git] / Makefile.PL
blobedd7781d9f8b935cb9025be181c23f6c2cb752e8
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
8 # version.
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
21 use ExtUtils::MakeMaker;
22 use POSIX;
24 die "perl 5.6.1 or later required" unless ($] >= 5.006001);
26 =head1 NAME
28 Makefile.PL - Koha packager and installer
30 =head1 SYNOPSIS
32         perl Makefile.PL
33         make
34         sudo make install
35         make manifest tardist
36         make manifest zipdist
38 =head1 DESCRIPTION
40 This is a packager and installer that uses
41 ExtUtils::MakeMaker, which is fairly common
42 on perl systems.
43 As well as building tar or zip files
44 and installing,
45 it allows us to check pre-requisites
46 and generate configuration files.
48 =head1 VARIABLES
50 =head2 NAME, VERSION_FROM, ABSTRACT, AUTHOR
52 Basic metadata about this software.
54 =head2 NO_META
56 Suppress generation of META.yml file.
58 =head2 PREREQ_PM
60 Hash of perl modules and versions required.
62 =head2 PM
64 Hash of file mappings
66 =head2 CONFIGURE
68 Maybe use prompt() here in future to get configuration values at installation time.
70 =head2 PL_FILES
72 This is a hash of PL scripts to run after installation and
73 the files to ask them to generate.
74 Maybe use the values from CONFIGURE
75 to generate initial configuration files.
77 =cut
79 WriteMakefile(
81     NAME => 'koha',
82     #VERSION => strftime('2.9.%Y%m%d%H',gmtime),
83     VERSION_FROM => 'C4/Context.pm',
84     ABSTRACT => 'Award-winning integrated library system (ILS) and Web OPAC',
85     AUTHOR => 'Koha Developers <koha-devel@nongnu.org>',
86     NO_META => 1,
87     PREREQ_PM => {
88 'CGI' => 3.15,
89 'CGI::Carp' => 1.29,
90 'CGI::Session' => '4.10',
91 'Class::Accessor' => 0.30,
92 'DBD::mysql' => 3.0008,
93 'DBI' => 1.53,
94 'Data::Dumper' => 2.121_08,
95 'Data::Random' => 0.05,
96 'Date::Calc' => 5.4,
97 'Date::Manip' => 5.44,
98 'Digest::MD5' => 2.36,
99 'Event' => 1.06,
100 'File::Temp' => 0.16,
101 'GD::Barcode::UPCE' => 1.1,
102 'Getopt::Long' => 2.35,
103 'Getopt::Std' => 1.05,
104 'HTML::Template' => 2.8,
105 'HTML::Template::Pro' => 0.65,
106 'HTML::Tree' => 3.1901,
107 'HTTP::Cookies' => 1.39,
108 'HTTP::Request::Common' => 1.26,
109 'LWP::Simple' => 1.41,
110 'LWP::UserAgent' => 2.033,
111 'Lingua::Stem' => 0.82,
112 'List::Util' => 1.18,
113 'Locale::Language' => 2.07,
114 'MARC::Charset' => 0.95,
115 'MARC::File::XML' => 0.86,
116 'MARC::Record' => 1.38,
117 'MIME::Base64' => 3.07,
118 'MIME::QuotedPrint' => 3.07,
119 'Mail::Sendmail' => 0.79,
120 'Net::Z3950' => 0,
121 'Net::Z3950::ZOOM' => 1.16,
122 'PDF::API2' => 2.000,
123 'PDF::API2::Page' => 2.000,
124 'PDF::API2::Util' => 2.000,
125 'PDF::Reuse' => 0.33,
126 'PDF::Reuse::Barcode' => 0.05,
127 'POSIX' => 1.09,
128 'Term::ANSIColor' => 1.10,
129 'Test' => 1.25,
130 'Test::Harness' => 2.56,
131 'Test::More' => 0.62,
132 'Text::Wrap' => 2005.082401,
133 'Time::HiRes' => 1.86,
134 'Time::localtime' => 1.02,
135 'Unicode::Normalize' => 0.32,
136 'XML::LibXML' => 1.59,
137 'XML::SAX::ParserFactory' => 1.01,
138 'XML::Simple' => 2.14,
139 'XML::RSS' => 1.31,
140 'ZOOM' => 0,
141         },
143         # File tree mapping
144         PM => map_tree(),
146         # disable tests
147         'test' => {TESTS => 't/dummy.t'},
149 #   CONFIGURE => sub {
150 #     # Ask for options with prompt($question,$default) calls here?
151 #     return { macro => { 'export TEST' => '755' } }
152 #     },
154    PL_FILES => { # generator => target(s)
155       'rewrite-config.PL' => [
156          '$(INST_LIBDIR)/koha/etc/koha-conf.xml',
157          '$(INST_LIBDIR)/koha/etc/koha-httpd.conf',
158          '$(INST_LIBDIR)/koha/etc/zebra-biblios.cfg',
159          '$(INST_LIBDIR)/koha/etc/zebra-authorities.cfg'
160          ]
161    }
162 #     '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'],
163 #     'misc/koha.conf.PL' => '$(INST_LIBDIR)/../etc/koha.conf',
164 #     'misc/apache-koha.conf.PL' => '$(INST_LIBDIR)/../etc/apache-koha.conf',
165 #     'misc/koha.sql.PL' => '$(INST_LIBDIR)/intranet/scripts/koha.sql',
166 #     'z3950/z3950-daemon-options.PL' => '$(INST_LIBDIR)/intranet/scripts/z3950daemon/z3950-daemon-options',
167 #     # fake target to check permissions
168 #     'misc/chmod.PL' => '$(INST_LIBDIR)/fake-target'
169 #     }
170    # need to set ownerships
171    # need to load koha.sql
172    # need to link koha-httpd.conf
173    # need to start z3950-daemon
176 =head1 FUNCTIONS
178 =head2 map_tree
180 This function lists all files and where to install each one.
181 It returns a hash reference suitable for PM.
183 =cut
185 sub map_tree {
186         my %result => ();
188 =pod
190 C4/*.pm is copied to perl's lib namespace.
192 =cut
193         foreach my $src (glob("C4/*.pm")) {
194                 $result{$src} = '$(INST_LIBDIR)/'.$src;
195         }
197 =pod
199 CGIs are copied to koha/cgi-bin
200 and other scripts to koha/scripts.
202 =cut
203         foreach my $src ("mainpage.pl","help.pl",glob("*/*.pl"),glob("installer/*.pm"),glob("*/*/*.pl"),glob("*/*/*/*.pl")) {
204                 if ($src =~ /(misc|updater|rss)\//) {
205                         $result{$src} = '$(INST_LIBDIR)/koha/scripts/'.$src;
206                 } else {
207                         $result{$src} = '$(INST_LIBDIR)/koha/cgi-bin/'.$src;
208                 }
209         }
211 =pod
213 Templates are copied to koha/templates,
215 =cut
216         foreach my $src (glob("koha-tmpl/*"),glob("koha-tmpl/intranet-tmpl/*/*/*"),glob("koha-tmpl/intranet-tmpl/*/*/*/*"),glob("koha-tmpl/intranet-tmpl/*/*/*/*/*"),glob("koha-tmpl/opac-tmpl/*/*/*"),glob("koha-tmpl/opac-tmpl/*/*/*/*"),glob("koha-tmpl/opac-tmpl/*/*/*/*/*")) {
218 =pod
220 excluding non-files, CVS files and whitespace in filenames.
222 =cut
223                 if ((-f $src) && ($src !~ /(\/CVS\/|\s)/)) {
224                         $result{$src} = '$(INST_LIBDIR)/koha/templates/'.$src;
225                 }
226         }
227 =pod
229 etc files are copied to koha/etc
231 =cut
232         # Misc etc to koha/etc
233         foreach my $src (glob("etc/*")) {
234                 $result{$src} = '$(INST_LIBDIR)/koha/'.$src;
235         }
238         return \%result;
241 __END__
244 =head1 SEE ALSO
246 ExtUtils::MakeMaker(3)
248 =head1 AUTHOR
250 MJ Ray mjr at phonecoop.coop
252 =cut