1.7 has no per_agent config
[freeside.git] / rt / Makefile
1 # BEGIN BPS TAGGED BLOCK {{{
2
3 # COPYRIGHT:
4 #  
5 # This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC 
6 #                                          <jesse@bestpractical.com>
7
8 # (Except where explicitly superseded by other copyright notices)
9
10
11 # LICENSE:
12
13 # This work is made available to you under the terms of Version 2 of
14 # the GNU General Public License. A copy of that license should have
15 # been provided with this software, but in any event can be snarfed
16 # from www.gnu.org.
17
18 # This work is distributed in the hope that it will be useful, but
19 # WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21 # General Public License for more details.
22
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27
28 # CONTRIBUTION SUBMISSION POLICY:
29
30 # (The following paragraph is not intended to limit the rights granted
31 # to you to modify and distribute this software under the terms of
32 # the GNU General Public License and is only of importance to you if
33 # you choose to contribute your changes and enhancements to the
34 # community by submitting them to Best Practical Solutions, LLC.)
35
36 # By intentionally submitting any modifications, corrections or
37 # derivatives to this work, or any other work intended for use with
38 # Request Tracker, to Best Practical Solutions, LLC, you confirm that
39 # you are the copyright holder for those contributions and you grant
40 # Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
41 # royalty-free, perpetual, license to use, copy, create derivative
42 # works based on those contributions, and sublicense and distribute
43 # those contributions and any derivatives thereof.
44
45 # END BPS TAGGED BLOCK }}}
46 #
47 # DO NOT HAND-EDIT the file named 'Makefile'. This file is autogenerated.
48 # Have a look at "configure" and "Makefile.in" instead
49 #
50
51
52 PERL                    =       /usr/bin/perl
53
54 CONFIG_FILE_PATH        =       /opt/rt3/etc
55 CONFIG_FILE             =       $(CONFIG_FILE_PATH)/RT_Config.pm
56 SITE_CONFIG_FILE                =       $(CONFIG_FILE_PATH)/RT_SiteConfig.pm
57
58
59 RT_VERSION_MAJOR        =       3
60 RT_VERSION_MINOR        =       4
61 RT_VERSION_PATCH        =       6
62
63 RT_VERSION =    $(RT_VERSION_MAJOR).$(RT_VERSION_MINOR).$(RT_VERSION_PATCH)
64 TAG        =    rt-$(RT_VERSION_MAJOR)-$(RT_VERSION_MINOR)-$(RT_VERSION_PATCH)
65
66
67 # This is the group that all of the installed files will be chgrp'ed to.
68 RTGROUP                 =       freeside
69
70
71 # User which should own rt binaries.
72 BIN_OWNER               =       root
73
74 # User that should own all of RT's libraries, generally root.
75 LIBS_OWNER              =       root
76
77 # Group that should own all of RT's libraries, generally root.
78 LIBS_GROUP              =       bin
79
80 WEB_USER                =       freeside
81 WEB_GROUP               =       freeside
82
83
84 APACHECTL               =       
85
86 # {{{ Files and directories 
87
88 # DESTDIR allows you to specify that RT be installed somewhere other than
89 # where it will eventually reside
90
91 DESTDIR                 =       
92
93
94 RT_PATH                 =       /opt/rt3
95 RT_ETC_PATH             =       /opt/rt3/etc
96 RT_BIN_PATH             =       /opt/rt3/bin
97 RT_SBIN_PATH            =       /opt/rt3/sbin
98 RT_LIB_PATH             =       /opt/rt3/lib
99 RT_MAN_PATH             =       /opt/rt3/man
100 RT_VAR_PATH             =       /opt/rt3/var
101 RT_DOC_PATH             =       /opt/rt3/share/doc
102 RT_LOCAL_PATH           =       /opt/rt3/local
103 LOCAL_ETC_PATH          =       /opt/rt3/local/etc
104 LOCAL_LIB_PATH          =       /opt/rt3/local/lib
105 LOCAL_LEXICON_PATH      =       /opt/rt3/local/po
106 MASON_HTML_PATH         =       /var/www/freeside/rt
107 MASON_LOCAL_HTML_PATH   =       /opt/rt3/local/html
108 MASON_DATA_PATH         =       /usr/local/etc/freeside/masondata
109 MASON_SESSION_PATH      =       /opt/rt3/var/session_data
110 RT_LOG_PATH         =       /opt/rt3/var/log
111
112 # RT_READABLE_DIR_MODE is the mode of directories that are generally meant
113 # to be accessable
114 RT_READABLE_DIR_MODE    =       0755
115
116
117
118
119 # {{{ all these define the places that RT's binaries should get installed
120
121 # RT_MODPERL_HANDLER is the mason handler script for mod_perl
122 RT_MODPERL_HANDLER      =       $(RT_BIN_PATH)/webmux.pl
123 # RT_STANDALONE_SERVER is a stand-alone HTTP server
124 RT_STANDALONE_SERVER    =       $(RT_BIN_PATH)/standalone_httpd
125 # RT_SPEEDYCGI_HANDLER is the mason handler script for SpeedyCGI
126 RT_SPEEDYCGI_HANDLER    =       $(RT_BIN_PATH)/mason_handler.scgi
127 # RT_FASTCGI_HANDLER is the mason handler script for FastCGI
128 RT_FASTCGI_HANDLER      =       $(RT_BIN_PATH)/mason_handler.fcgi
129 # RT_WIN32_FASTCGI_HANDLER is the mason handler script for FastCGI
130 RT_WIN32_FASTCGI_HANDLER        =       $(RT_BIN_PATH)/mason_handler.svc
131 # RT's CLI
132 RT_CLI_BIN              =       $(RT_BIN_PATH)/rt
133 # RT's mail gateway
134 RT_MAILGATE_BIN         =       $(RT_BIN_PATH)/rt-mailgate
135 # RT's cron tool
136 RT_CRON_BIN             =       $(RT_BIN_PATH)/rt-crontool
137
138 # }}}
139
140
141 BINARIES                =       $(DESTDIR)/$(RT_MODPERL_HANDLER) \
142                                 $(DESTDIR)/$(RT_MAILGATE_BIN) \
143                                 $(DESTDIR)/$(RT_CLI_BIN) \
144                                 $(DESTDIR)/$(RT_CRON_BIN) \
145                                 $(DESTDIR)/$(RT_STANDALONE_SERVER) \
146                                 $(DESTDIR)/$(RT_SPEEDYCGI_HANDLER) \
147                                 $(DESTDIR)/$(RT_FASTCGI_HANDLER) \
148                                 $(DESTDIR)/$(RT_WIN32_FASTCGI_HANDLER)
149 SYSTEM_BINARIES         =       $(DESTDIR)/$(RT_SBIN_PATH)/
150
151
152 # }}}
153
154 # {{{ Database setup
155
156 #
157 # DB_TYPE defines what sort of database RT trys to talk to
158 # "mysql" is known to work.
159 # "Pg" is known to work
160 # "Informix" is known to work
161
162 DB_TYPE                 =       Pg
163
164 # Set DBA to the name of a unix account with the proper permissions and 
165 # environment to run your commandline SQL sbin
166
167 # Set DB_DBA to the name of a DB user with permission to create new databases 
168
169 # For mysql, you probably want 'root'
170 # For Pg, you probably want 'postgres' 
171 # For Oracle, you want 'system'
172 # For Informix, you want 'informix'
173
174 DB_DBA                  =       freeside
175
176 DB_HOST                 =       localhost
177
178 # If you're not running your database server on its default port, 
179 # specifiy the port the database server is running on below.
180 # It's generally safe to leave this blank 
181
182 DB_PORT                 =       
183
184
185
186
187 #
188 # Set this to the canonical name of the interface RT will be talking to the 
189 # database on.  If you said that the RT_DB_HOST above was "localhost," this 
190 # should be too. This value will be used to grant rt access to the database.
191 # If you want to access the RT database from multiple hosts, you'll need
192 # to grant those database rights by hand.
193 #
194
195 DB_RT_HOST              =       localhost
196
197 # set this to the name you want to give to the RT database in 
198 # your database server. For Oracle, this should be the name of your sid
199
200 DB_DATABASE             =       freeside
201 DB_RT_USER              =       freeside
202 DB_RT_PASS              =       
203
204 # }}}
205
206
207 ####################################################################
208
209 all: default
210
211 default:
212         @echo "Please read RT's readme before installing. Not doing so could"
213         @echo "be dangerous."
214
215
216
217 instruct:
218         @echo "Congratulations. RT has been installed. "
219         @echo ""
220         @echo ""
221         @echo "You must now configure RT by editing $(SITE_CONFIG_FILE)."
222         @echo ""
223         @echo "(You will definitely need to set RT's database password in "
224         @echo "$(SITE_CONFIG_FILE) before continuing. Not doing so could be "
225         @echo "very dangerous.  Note that you do not have to manually add a "
226         @echo "database user or set up a database for RT.  These actions will be "
227         @echo "taken care of in the next step.)"
228         @echo ""
229         @echo "After that, you need to initialize RT's database by running" 
230         @echo " 'make initialize-database'"
231
232 #       @echo " or by executing "       
233 #       @echo " '$(RT_SBIN_PATH)/rt-setup-database --action init \ "
234 #       @echo "     --dba $(DB_DBA) --prompt-for-dba-password'"
235
236
237
238 upgrade-instruct: 
239         @echo "Congratulations. RT has been upgraded. You should now check-over"
240         @echo "$(CONFIG_FILE) for any necessary site customization. Additionally,"
241         @echo "you should update RT's system database objects by running "
242         @echo "   ls etc/upgrade"
243         @echo ""
244         @echo "For each item in that directory whose name is greater than"
245         @echo "your previously installed RT version, run:"
246         @echo "    $(RT_SBIN_PATH)/rt-setup-database --dba $(DB_DBA) --prompt-for-dba-password --action schema --datadir etc/upgrade/<version>"
247         @echo "    $(RT_SBIN_PATH)/rt-setup-database --dba $(DB_DBA) --prompt-for-dba-password --action acl --datadir etc/upgrade/<version>"
248         @echo "    $(RT_SBIN_PATH)/rt-setup-database --dba $(DB_DBA) --prompt-for-dba-password --action insert --datadir etc/upgrade/<version>"
249
250
251 upgrade: config-install dirs files-install fixperms upgrade-instruct
252
253 upgrade-noclobber: config-install libs-install html-install bin-install local-install doc-install fixperms
254
255
256 # {{{ dependencies
257 testdeps:
258         $(PERL) ./sbin/rt-test-dependencies --verbose --with-$(DB_TYPE)
259
260 depends: fixdeps
261
262 fixdeps:
263         $(PERL) ./sbin/rt-test-dependencies --verbose --install --with-$(DB_TYPE)
264
265 #}}}
266
267 # {{{ fixperms
268 fixperms:
269         # Make the libraries readable
270         chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_PATH)
271         chown -R $(LIBS_OWNER) $(DESTDIR)/$(RT_LIB_PATH)
272         chgrp -R $(LIBS_GROUP) $(DESTDIR)/$(RT_LIB_PATH)
273         chmod -R  u+rwX,go-w,go+rX      $(DESTDIR)/$(RT_LIB_PATH)
274
275
276         chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_BIN_PATH)
277         chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_BIN_PATH) 
278
279         chmod 0755 $(DESTDIR)/$(RT_ETC_PATH)
280         chmod 0500 $(DESTDIR)/$(RT_ETC_PATH)/*
281
282         #TODO: the config file should probably be able to have its
283         # owner set separately from the binaries.
284         chown -R $(BIN_OWNER) $(DESTDIR)/$(RT_ETC_PATH)
285         chgrp -R $(RTGROUP) $(DESTDIR)/$(RT_ETC_PATH)
286
287         chmod 0550 $(DESTDIR)/$(CONFIG_FILE)
288         chmod 0550 $(DESTDIR)/$(SITE_CONFIG_FILE)
289
290         # Make the interfaces executable
291         chown $(BIN_OWNER) $(BINARIES)
292         chgrp $(RTGROUP) $(BINARIES)
293         chmod 0755  $(BINARIES)
294
295         # Make the web ui readable by all. 
296         chmod -R  u+rwX,go-w,go+rX      $(DESTDIR)/$(MASON_HTML_PATH) \
297                                         $(DESTDIR)/$(MASON_LOCAL_HTML_PATH) \
298                                         $(DESTDIR)/$(LOCAL_LEXICON_PATH)
299         chown -R $(LIBS_OWNER)  $(DESTDIR)/$(MASON_HTML_PATH) \
300                                 $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
301         chgrp -R $(LIBS_GROUP)  $(DESTDIR)/$(MASON_HTML_PATH) \
302                                 $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
303
304         # Make the web ui's data dir writable
305         chmod 0770      $(DESTDIR)/$(MASON_DATA_PATH) \
306                         $(DESTDIR)/$(MASON_SESSION_PATH)
307         chown -R $(WEB_USER)    $(DESTDIR)/$(MASON_DATA_PATH) \
308                                 $(DESTDIR)/$(MASON_SESSION_PATH)
309         chgrp -R $(WEB_GROUP)   $(DESTDIR)/$(MASON_DATA_PATH) \
310                                 $(DESTDIR)/$(MASON_SESSION_PATH)
311 # }}}
312
313 # {{{ dirs
314 dirs:
315         mkdir -p $(DESTDIR)/$(RT_LOG_PATH)
316         mkdir -p $(DESTDIR)/$(MASON_DATA_PATH)
317         mkdir -p $(DESTDIR)/$(MASON_DATA_PATH)/cache
318         mkdir -p $(DESTDIR)/$(MASON_DATA_PATH)/etc
319         mkdir -p $(DESTDIR)/$(MASON_DATA_PATH)/obj
320         mkdir -p $(DESTDIR)/$(MASON_SESSION_PATH)
321         mkdir -p $(DESTDIR)/$(MASON_HTML_PATH)
322         mkdir -p $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
323         mkdir -p $(DESTDIR)/$(LOCAL_ETC_PATH)
324         mkdir -p $(DESTDIR)/$(LOCAL_LIB_PATH)
325         mkdir -p $(DESTDIR)/$(LOCAL_LEXICON_PATH)
326 # }}}
327
328 install: config-install dirs files-install fixperms instruct
329
330 files-install: libs-install etc-install bin-install sbin-install html-install local-install doc-install
331
332 config-install:
333         mkdir -p $(DESTDIR)/$(CONFIG_FILE_PATH) 
334         -cp etc/RT_Config.pm $(DESTDIR)/$(CONFIG_FILE)
335         [ -f $(DESTDIR)/$(SITE_CONFIG_FILE) ] || cp etc/RT_SiteConfig.pm $(DESTDIR)/$(SITE_CONFIG_FILE) 
336
337         chgrp $(RTGROUP) $(DESTDIR)/$(CONFIG_FILE)
338         chown $(BIN_OWNER) $(DESTDIR)/$(CONFIG_FILE)
339
340         chgrp $(RTGROUP) $(DESTDIR)/$(SITE_CONFIG_FILE)
341         chown $(BIN_OWNER) $(DESTDIR)/$(SITE_CONFIG_FILE)
342
343         @echo "Installed configuration. about to install rt in  $(RT_PATH)"
344
345 test: 
346         $(PERL) -Ilib lib/t/00smoke.t
347
348 regression-install: config-install
349         $(PERL) -pi -e 's/Set\(\$$DatabaseName.*\);/Set\(\$$DatabaseName, "rt3regression"\);/' $(DESTDIR)/$(CONFIG_FILE)
350
351 regression: regression-install dirs files-install libs-install sbin-install bin-install regression-instruct regression-reset-db  testify-pods fixperms apachectl run-regression
352
353 run-regression:
354         prove -Ilib lib/t/setup_regression.t  lib/t/autogen/ lib/t/regression/
355
356
357 regression-noapache: regression-install dirs files-install libs-install sbin-install bin-install regression-instruct regression-reset-db  testify-pods fixperms start-httpd  run-regression
358
359 regression-quiet:
360         $(PERL) sbin/regression_harness
361
362 regression-instruct:
363         @echo "About to wipe your database for a regression test. ABORT NOW with Control-C"
364
365
366 # {{{ database-installation
367
368 regression-reset-db:
369         $(PERL) $(DESTDIR)/$(RT_SBIN_PATH)/rt-setup-database --action drop --dba $(DB_DBA) --dba-password '' --force
370         $(PERL) $(DESTDIR)/$(RT_SBIN_PATH)/rt-setup-database --action init --dba $(DB_DBA) --dba-password ''
371
372 initdb :: initialize-database
373
374 initialize-database: 
375         $(PERL) $(DESTDIR)/$(RT_SBIN_PATH)/rt-setup-database --action init --dba $(DB_DBA) --prompt-for-dba-password
376
377 dropdb: 
378         $(PERL) $(DESTDIR)/$(RT_SBIN_PATH)/rt-setup-database --action drop --dba $(DB_DBA) --prompt-for-dba-password
379
380 insert-approval-data: 
381         $(PERL) $(DESTDIR)/$(RT_SBIN_PATH)/insert_approval_scrips
382 # }}}
383
384 # {{{ libs-install
385 libs-install: 
386         [ -d $(DESTDIR)/$(RT_LIB_PATH) ] || mkdir -p $(DESTDIR)/$(RT_LIB_PATH)
387         -cp -rp lib/* $(DESTDIR)/$(RT_LIB_PATH)
388 # }}}
389
390 # {{{ html-install
391 html-install:
392         [ -d $(DESTDIR)/$(MASON_HTML_PATH) ] || mkdir -p $(DESTDIR)/$(MASON_HTML_PATH)
393         -cp -rp ./html/* $(DESTDIR)/$(MASON_HTML_PATH)
394 # }}}
395
396 # {{{ doc-install
397 doc-install:
398         # RT 3.0.0 - RT 3.0.2 would accidentally create a file instead of a dir
399         -[ -f $(DESTDIR)/$(RT_DOC_PATH) ] && rm $(DESTDIR)/$(RT_DOC_PATH) 
400         [ -d $(DESTDIR)/$(RT_DOC_PATH) ] || mkdir -p $(DESTDIR)/$(RT_DOC_PATH)
401         -cp -rp ./README $(DESTDIR)/$(RT_DOC_PATH)
402 # }}}
403
404 # {{{ etc-install
405
406 etc-install:
407         mkdir -p $(DESTDIR)/$(RT_ETC_PATH)
408         -cp -rp \
409                 etc/acl.* \
410                 etc/initialdata \
411                 etc/schema.* \
412                 $(DESTDIR)/$(RT_ETC_PATH)
413 # }}}
414
415 # {{{ sbin-install
416
417 sbin-install:
418         mkdir -p $(DESTDIR)/$(RT_SBIN_PATH)
419         chmod +x \
420                 sbin/rt-dump-database \
421                 sbin/rt-setup-database \
422                 sbin/rt-test-dependencies
423         -cp -rp \
424                 sbin/rt-dump-database \
425                 sbin/rt-setup-database \
426                 sbin/rt-test-dependencies \
427                 $(DESTDIR)/$(RT_SBIN_PATH)
428
429 # }}}
430
431 # {{{ bin-install
432
433 bin-install:
434         mkdir -p $(DESTDIR)/$(RT_BIN_PATH)
435         chmod +x bin/rt-mailgate \
436                 bin/rt-crontool
437         -cp -rp \
438                 bin/rt-mailgate \
439                 bin/mason_handler.fcgi \
440                 bin/mason_handler.scgi \
441                 bin/standalone_httpd \
442                 bin/mason_handler.svc \
443                 bin/rt \
444                 bin/webmux.pl \
445                 bin/rt-crontool \
446                 $(DESTDIR)/$(RT_BIN_PATH)
447 # }}}
448
449 # {{{ local-install
450 local-install:
451         -cp -rp ./local/html/* $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
452         -cp -rp ./local/po/* $(DESTDIR)/$(LOCAL_LEXICON_PATH)
453         -cp -rp ./local/etc/* $(DESTDIR)/$(LOCAL_ETC_PATH)
454 # }}}
455
456 # {{{ Best Practical Build targets -- no user servicable parts inside
457
458
459 POD2TEST_EXE = sbin/extract_pod_tests
460
461 testify-pods:
462         [ -d lib/t/autogen ] || mkdir lib/t/autogen
463         find lib -name \*pm |grep -v .svn | grep -v \*.in |xargs -n 1 $(PERL) $(POD2TEST_EXE)
464         find bin -type f |grep -v .svn | grep -v \~ | grep -v "\.in" | xargs -n 1 $(PERL) $(POD2TEST_EXE)
465         find lib -name \*pm |grep -v .svn | grep -v \*.in |xargs -n 1 $(PERL) $(POD2TEST_EXE)
466         find bin -type f |grep -v .svn | grep -v \~ | grep -v "\.in" | xargs -n 1 $(PERL) $(POD2TEST_EXE)
467
468
469
470 regenerate-catalogs:
471         $(PERL) sbin/extract-message-catalog
472
473 license-tag:
474         $(PERL) sbin/license_tag
475
476 factory: initialize-database
477         cd lib; $(PERL) ../sbin/factory  $(DB_DATABASE) RT
478
479 reconfigure:
480         aclocal -I m4
481         autoconf
482         chmod 755 ./configure
483         ./configure
484
485 start-httpd:
486         $(PERL) bin/standalone_httpd 80 &
487
488 apachectl:
489         $(APACHECTL) stop
490         sleep 10
491         $(APACHECTL) start
492         sleep 5
493 # }}}