more work on the import changes; introduced C4::Matcher
[koha.git] / Makefile.PL
blobf50b23b84e1b0e52e815cdbab88a93bf23c86820
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 =head2 BASIC INSTALLATION
34         perl Makefile.PL
35         make
36         sudo make install
38 =head2 PACKAGING RELEASE TARBALLS
40         make manifest tardist
41         make manifest zipdist
43 =head2 CLEANING UP
45         make clean
47 =head1 DESCRIPTION
49 This is a packager and installer that uses
50 ExtUtils::MakeMaker, which is fairly common
51 on perl systems.
52 As well as building tar or zip files
53 and installing with the above commands,
54 it allows us to check pre-requisites
55 and generate configuration files.
57 =head1 VARIABLES
59 =head2 NAME, VERSION_FROM, ABSTRACT, AUTHOR
61 Basic metadata about this software.
63 =head2 NO_META
65 Suppress generation of META.yml file.
67 =head2 PREREQ_PM
69 Hash of perl modules and versions required.
71 =head2 PM
73 Hash of file mappings
75 =head2 CONFIGURE
77 Maybe use prompt() here in future to get configuration values 
78 interactively at installation time.
80 =head2 PL_FILES
82 This is a hash of PL scripts to run after installation and
83 the files to ask them to generate.
84 Maybe use the values from CONFIGURE
85 to generate initial configuration files in future.
87 =cut
89 WriteMakefile(
91     NAME => 'koha',
92     #VERSION => strftime('2.9.%Y%m%d%H',gmtime),
93     VERSION_FROM => 'C4/Context.pm',
94     ABSTRACT => 'Award-winning integrated library system (ILS) and Web OPAC',
95     AUTHOR => 'Koha Developers <koha-devel@nongnu.org>',
96     NO_META => 1,
97     PREREQ_PM => {
98 'CGI' => 3.15,
99 'CGI::Carp' => 1.29,
100 'CGI::Session' => '4.10',
101 'Class::Accessor' => 0.30,
102 'DBD::mysql' => 3.0008,
103 'DBI' => 1.53,
104 'Data::Dumper' => 2.121_08,
105 'Date::Calc' => 5.4,
106 'Date::Manip' => 5.44,
107 'Digest::MD5' => 2.36,
108 'File::Temp' => 0.16,
109 'GD::Barcode::UPCE' => 1.1,
110 'Getopt::Long' => 2.35,
111 'Getopt::Std' => 1.05,
112 'HTML::Template' => 2.8,
113 'HTML::Template::Pro' => 0.65,
114 'HTTP::Cookies' => 1.39,
115 'HTTP::Request::Common' => 1.26,
116 'LWP::Simple' => 1.41,
117 'LWP::UserAgent' => 2.033,
118 'Lingua::Stem' => 0.82,
119 'List::Util' => 1.18,
120 'Locale::Language' => 2.07,
121 'MARC::Charset' => 0.95,
122 'MARC::File::XML' => 0.86,
123 'MARC::Record' => 1.38,
124 'MIME::Base64' => 3.07,
125 'MIME::QuotedPrint' => 3.07,
126 'Mail::Sendmail' => 0.79,
127 'Net::Z3950' => 0,
128 'Net::Z3950::ZOOM' => 1.16,
129 'PDF::API2' => 2.000,
130 'PDF::API2::Page' => 2.000,
131 'PDF::API2::Util' => 2.000,
132 'PDF::Reuse' => 0.33,
133 'PDF::Reuse::Barcode' => 0.05,
134 'POSIX' => 1.09,
135 'Term::ANSIColor' => 1.10,
136 'Test' => 1.25,
137 'Test::Harness' => 2.56,
138 'Test::More' => 0.62,
139 'Text::Wrap' => 2005.082401,
140 'Time::HiRes' => 1.86,
141 'Time::localtime' => 1.02,
142 'Unicode::Normalize' => 0.32,
143 'XML::LibXML' => 1.59,
144 'XML::SAX::ParserFactory' => 1.01,
145 'XML::Simple' => 2.14,
146 'XML::RSS' => 1.31,
147 'ZOOM' => 0,
148         },
150         # File tree mapping
151         PM => map_tree(),
153         # disable tests
154         'test' => {TESTS => 't/dummy.t'},
156 #   CONFIGURE => sub {
157 #     # Ask for options with prompt($question,$default) calls here?
158 #     return { macro => { 'export TEST' => '755' } }
159 #     },
161    PL_FILES => { # generator => target(s)
162       'rewrite-config.PL' => [
163          '$(PREFIX)/share/koha/etc/koha-conf.xml',
164          '$(PREFIX)/share/koha/etc/koha-httpd.conf',
165          '$(PREFIX)/share/koha/etc/zebradb/tab/passwd',
166          '$(PREFIX)/share/koha/etc/zebradb/zebra-biblios.cfg',
167          '$(PREFIX)/share/koha/etc/zebradb/zebra-authorities.cfg'
168          ]
169    }
170 #     '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'],
171 #     'misc/koha.conf.PL' => '$(INST_LIBDIR)/../etc/koha.conf',
172 #     'misc/apache-koha.conf.PL' => '$(INST_LIBDIR)/../etc/apache-koha.conf',
173 #     'misc/koha.sql.PL' => '$(INST_LIBDIR)/intranet/scripts/koha.sql',
174 #     'z3950/z3950-daemon-options.PL' => '$(INST_LIBDIR)/intranet/scripts/z3950daemon/z3950-daemon-options',
175 #     # fake target to check permissions
176 #     'misc/chmod.PL' => '$(INST_LIBDIR)/fake-target'
177 #     }
178    # need to set ownerships
179    # need to load koha.sql
180    # need to link koha-httpd.conf
181    # need to start z3950-daemon
184 =head1 FUNCTIONS
186 =head2 map_tree
188 This function lists all files and where to install each one.
189 It returns a hash reference suitable for the PM variable above.
191 =cut
193 sub map_tree {
194         my %result => ();
196 =pod
198 C4/*.pm is copied to perl's lib namespace.
200 =cut
201         foreach my $src (glob("C4/*.pm")) {
202                 $result{$src} = '$(INST_LIBDIR)/'.$src;
203         }
205 =pod
207 CGIs are copied to $(PREFIX)/lib/cgi-bin/koha/
208 and other scripts to koha/
210 =cut
211         foreach my $src ("mainpage.pl","help.pl",glob("*/*.pl"),glob("installer/*.pm"),glob("*/*/*.pl"),glob("*/*/*/*.pl")) {
212                 if ($src =~ /(misc|updater|rss)\//) {
213                         $result{$src} = '$(INST_LIBDIR)/koha/'.$src;
214                 } else {
215                         $result{$src} = '$(PREFIX)/lib/cgi-bin/koha/'.$src;
216                 }
217         }
219 =pod
221 Templates are copied to koha/templates,
223 =cut
224         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/*/*/*/*/*")) {
226 =pod
228 excluding non-files, CVS files and whitespace in filenames.
230 =cut
231                 if ((-f $src) && ($src !~ /(\/CVS\/|\s)/)) {
232                         $result{$src} = '$(INST_LIBDIR)/koha/templates/'.$src;
233                 }
234         }
235 =pod
237 etc files are copied to /usr/share/koha/etc/
239 =cut
240         # Misc etc to koha/etc
241         foreach my $src (glob("etc/zebradb/*/*/*"),glob("etc/zebradb/*/*"),glob("etc/zebradb/*"),glob("etc/*")) {
242                 if (-f $src) {
243                         $result{$src} = '$(PREFIX)/share/koha/'.$src;
244                 }
245         }
248         return \%result;
251 __END__
254 =head1 SEE ALSO
256 ExtUtils::MakeMaker(3)
258 =head1 AUTHOR
260 MJ Ray mjr at phonecoop.coop
262 =cut