New installer and exclusions file
[koha.git] / Makefile.PL
1 # Copyright 2007 MJ Ray
2 #
3 # This file is part of Koha.
4 #
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.
9 #
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.
13 #
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
17 #
18 # Current maintainer MJR http://mjr.towers.org.uk/
19 # See http://www.koha.org/wiki/?page=KohaInstaller
20
21 use ExtUtils::MakeMaker;
22 use POSIX;
23
24 die "perl 5.6.1 or later required" unless ($] >= 5.006001);
25
26 =head1 NAME
27
28 Makefile.PL - Koha packager and installer
29
30 =head1 SYNOPSIS
31
32 perl Makefile.PL
33 make
34
35 =head1 DESCRIPTION
36
37 This is a packager and installer that uses
38 ExtUtils::MakeMaker, which is fairly common
39 on perl systems.
40 As well as building tar or zip files
41 and installing,
42 it allows us to check pre-requisites
43 and generate configuration files.
44
45 =head1 VARIABLES
46
47 =head2 NAME, VERSION, ABSTRACT, AUTHOR
48
49 Basic metadata about this software.
50
51 =head2 NO_META
52
53 Suppress generation of META.yml file.
54
55 =head2 PREREQ_PM
56
57 Hash of perl modules and versions required.
58
59 =head2 PM
60
61 Hash of file mappings
62
63 =head2 CONFIGURE
64
65 Maybe use prompt() here in future to get configuration values at installation time.
66
67 =head2 PL_FILES
68
69 This is a hash of PL scripts to run after installation and
70 the files to ask them to generate.
71 Maybe use the values from CONFIGURE
72 to generate initial configuration files.
73
74 =cut
75
76 WriteMakefile(
77
78     NAME => 'koha',
79     VERSION => strftime('2.9.%Y%m%d%H'),
80     ABSTRACT => 'Award-winning integrated library system (ILS) and Web OPAC',
81     AUTHOR => 'Koha Developers <koha-devel@nongnu.org>',
82     NO_META => 1,
83     PREREQ_PM => {
84 'CGI' => 3.15,
85 'CGI::Carp' => 1.29,
86 'DBI' => 1.53,
87 'Data::Dumper' => 2.121_08,
88 'Data::Random' => 0.05,
89 'Date::Calc' => 5.4,
90 'Date::Manip' => 5.44,
91 'Digest::MD5' => 2.36,
92 'File::Temp' => 0.16,
93 'GD::Barcode::UPCE' => 1.1,
94 'Getopt::Long' => 2.35,
95 'Getopt::Std' => 1.05,
96 'HTML::Template::Pro' => 0.65,
97 'HTML::Tree' => 3.1901,
98 'HTTP::Cookies' => 1.39,
99 'HTTP::Request::Common' => 1.26,
100 'LWP::Simple' => 1.41,
101 'LWP::UserAgent' => 2.033,
102 'Lingua::Stem' => 0.82,
103 'List::Util' => 1.18,
104 'Locale::Language' => 2.07,
105 'MARC::Charset' => 0.95,
106 'MARC::File::XML' => 0.86,
107 'MARC::Record' => 1.38,
108 'MIME::Base64' => 3.07,
109 'MIME::QuotedPrint' => 3.07,
110 'Mail::Sendmail' => 0.79,
111 'PDF::API2' => 2.000,
112 'PDF::API2::Page' => 2.000,
113 'PDF::API2::Util' => 2.000,
114 'PDF::Reuse' => 0.33,
115 'PDF::Reuse::Barcode' => 0.05,
116 'POSIX' => 1.09,
117 'Term::ANSIColor' => 1.10,
118 'Test' => 1.25,
119 'Test::Harness' => 2.56,
120 'Test::More' => 0.62,
121 'Text::Wrap' => 2005.082401,
122 'Time::HiRes' => 1.86,
123 'Time::localtime' => 1.02,
124 'Unicode::Normalize' => 0.32,
125 'XML::LibXML' => 1.59,
126 'XML::SAX::ParserFactory' => 1.01,
127 'XML::Simple' => 2.14,
128 'ZOOM' => 0,
129         },
130
131         # File tree mapping
132         PM => map_tree(),
133
134 #   CONFIGURE => sub {
135 #     # Ask for options with prompt($question,$default) calls here?
136 #     return { macro => { 'export TEST' => '755' } }
137 #     },
138
139 #   PL_FILES => { # generator => target
140 #     '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'],
141 #     'misc/koha.conf.PL' => '$(INST_LIBDIR)/../etc/koha.conf',
142 #     'misc/apache-koha.conf.PL' => '$(INST_LIBDIR)/../etc/apache-koha.conf',
143 #     'misc/koha.sql.PL' => '$(INST_LIBDIR)/intranet/scripts/koha.sql',
144 #     'z3950/z3950-daemon-options.PL' => '$(INST_LIBDIR)/intranet/scripts/z3950daemon/z3950-daemon-options',
145 #     # fake target to check permissions
146 #     'misc/chmod.PL' => '$(INST_LIBDIR)/fake-target'
147 #     }
148    # need to set ownerships
149    # need to load koha.sql
150    # need to link koha-httpd.conf
151    # need to start z3950-daemon
152 );
153
154 =head1 FUNCTIONS
155
156 =head2 map_tree
157
158 This function lists all files and where to install each one.
159 It returns a hash reference suitable for PM.
160
161 =cut
162
163 sub map_tree {
164         my %result => ();
165
166 =pod
167
168 C4/*.pm is copied to perl's lib namespace.
169
170 =cut
171         foreach my $src (glob("C4/*.pm")) {
172                 $result{$src} = '$(INST_LIBDIR)/'.$src;
173         }
174
175 =pod
176
177 CGIs are copied to koha/cgi-bin
178 and other scripts to koha/examples.
179
180 =cut
181         # Misc scripts to koha/examples
182         foreach my $src (glob("*.pl"),glob("*/*.pl"),glob("installer/*.pm"),glob("*/*/*.pl"),glob("*/*/*/*.pl")) {
183                 if ($src =~ /(misc|updater|rss)\//) {
184                         $result{$src} = '$(INST_LIBDIR)/koha/scripts/'.$src;
185                 } else {
186                         $result{$src} = '$(INST_LIBDIR)/koha/cgi-bin/'.$src;
187                 }
188         }
189
190 =pod
191
192 Templates are copied to koha/templates,
193
194 =cut
195         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/*/*/*/*/*")) {
196
197 =pod
198
199 excluding non-files, CVS files and whitespace in filenames.
200
201 =cut
202                 if ((-f $src) && ($src !~ /(\/CVS\/|\s)/)) {
203                         $result{$src} = '$(INST_LIBDIR)/koha/templates/'.$src;
204                 }
205         }
206
207         return \%result;
208 }
209
210 __END__
211
212
213 =head1 SEE ALSO
214
215 ExtUtils::MakeMaker(3)
216
217 =cut
218