This commit was generated by cvs2svn to compensate for changes in r2526,
[freeside.git] / rt / Makefile
1 # $Header: /home/cvs/cvsroot/freeside/rt/Makefile,v 1.1 2002-08-12 06:17:06 ivan Exp $
2 # RT is Copyright 1996-2002 Jesse Vincent <jesse@bestpractical.com>
3 # It is distributed under the terms of the GNU General Public License, version 2
4
5 PERL                    =       /usr/bin/perl
6
7 RT_VERSION_MAJOR        =       2
8 RT_VERSION_MINOR        =       0
9 RT_VERSION_PATCH        =       14
10
11
12 RT_VERSION =    $(RT_VERSION_MAJOR).$(RT_VERSION_MINOR).$(RT_VERSION_PATCH)
13 TAG        =    rt-$(RT_VERSION_MAJOR)-$(RT_VERSION_MINOR)-$(RT_VERSION_PATCH)
14
15 BRANCH                  =       HEAD
16
17 # This is the group that all of the installed files will be chgrp'ed to.
18 RTGROUP                 =       rt
19
20
21 # User which should own rt binaries.
22 BIN_OWNER               =       root
23
24 # User that should own all of RT's libraries, generally root.
25 LIBS_OWNER              =       root
26
27 # Group that should own all of RT's libraries, generally root.
28 LIBS_GROUP              =       bin
29
30
31
32 # {{{ Files and directories 
33
34 # DESTDIR allows you to specify that RT be installed somewhere other than
35 # where it will eventually reside
36
37 DESTDIR                 =       
38
39
40 # RT_PATH is the name of the directory you want make to install RT in
41 # RT must be installed in its own directory (don't set this to /usr/local)
42
43 RT_PATH                 =       /opt/rt2
44
45 # The rest of these paths are all configurable, but you probably don't want to 
46 # put them elsewhere
47
48 RT_LIB_PATH             =       $(RT_PATH)/lib
49 RT_ETC_PATH             =       $(RT_PATH)/etc
50 RT_CONFIG_PATH          =       $(RT_ETC_PATH)
51 RT_BIN_PATH             =       $(RT_PATH)/bin
52 RT_MAN_PATH             =       $(RT_PATH)/man
53 MASON_HTML_PATH         =       $(RT_PATH)/WebRT/html
54
55
56 # RT allows sites to overlay the default web ui with 
57 # local customizations Those files can be placed in MASON_LOCAL_HTML_PATH
58
59 MASON_LOCAL_HTML_PATH   =       $(RT_PATH)/local/WebRT/html
60
61 # RT needs to be able to write to MASON_DATA_PATH and MASON_SESSION_PATH
62 # RT will create and chown these directories. Don't just set them to /tmp
63 MASON_DATA_PATH         =       $(RT_PATH)/WebRT/data
64 MASON_SESSION_PATH      =       $(RT_PATH)/WebRT/sessiondata
65
66 RT_LOG_PATH             =       /tmp
67
68 # RT_READABLE_DIR_MODE is the mode of directories that are generally meant
69 # to be accessable
70 RT_READABLE_DIR_MODE    =       0755
71
72
73
74 # The location of your rt configuration file
75 RT_CONFIG               =       $(RT_CONFIG_PATH)/config.pm
76
77 # RT_MODPERL_HANDLER is the mason handler script for mod_perl
78 RT_MODPERL_HANDLER      =       $(RT_BIN_PATH)/webmux.pl
79
80 # RT_FASTCGI_HANDLER is the mason handler script for FastCGI
81 # THIS HANDLER IS NOT CURRENTLY SUPPORTED
82 RT_FASTCGI_HANDLER      =       $(RT_BIN_PATH)/mason_handler.fcgi
83
84 # RT_SPEEDYCGI_HANDLER is the mason handler script for SpeedyCGI
85 # THIS HANDLER IS NOT CURRENTLY SUPPORTED
86 RT_SPEEDYCGI_HANDLER    =       $(RT_BIN_PATH)/mason_handler.scgi
87
88 # The following are the names of the various binaries which make up RT 
89
90 RT_CLI_BIN              =       $(RT_BIN_PATH)/rt
91 RT_CLI_ADMIN_BIN        =       $(RT_BIN_PATH)/rtadmin
92 RT_MAILGATE_BIN         =       $(RT_BIN_PATH)/rt-mailgate
93
94 # }}}
95
96 # {{{ Database setup
97
98 #
99 # DB_TYPE defines what sort of database RT trys to talk to
100 # "mysql" is known to work.
101 # "Pg" is known to work
102 # "Oracle" is in the early stages of working.
103
104 DB_TYPE                 =       mysql
105
106 # DB_HOME is where the Database's commandline tools live.  $DB_HOME/bin
107 # should contain the binaries themselves, e.g. if "which mysql" gives
108 # "/usr/local/mysql/bin/mysql", $DB_HOME should be "/usr/local/mysql"
109
110 DB_HOME                 = /usr
111
112 # Set DBA to the name of a unix account with the proper permissions and 
113 # environment to run your commandline SQL tools
114
115 # Set DB_DBA to the name of a DB user with permission to create new databases 
116 # Set DB_DBA_PASSWORD to that user's password (if you don't, you'll be prompted
117 # later)
118
119 # For mysql, you probably want 'root'
120 # For Pg, you probably want 'postgres' 
121 # For oracle, you want 'system'
122
123 DB_DBA                  =       root
124 DB_DBA_PASSWORD         =       
125  
126 #
127 # Set this to the Fully Qualified Domain Name of your database server.
128 # If the database is local, rather than on a remote host, using "localhost" 
129 # will greatly enhance performance.
130
131 DB_HOST                 =       localhost
132
133 # If you're not running your database server on its default port, 
134 # specifiy the port the database server is running on below.
135 # It's generally safe to leave this blank 
136
137 DB_PORT                 =       
138
139 #
140 # Set this to the canonical name of the interface RT will be talking to the 
141 # database on.  If you said that the RT_DB_HOST above was "localhost," this 
142 # should be too. This value will be used to grant rt access to the database.
143 # If you want to access the RT database from multiple hosts, you'll need
144 # to grant those database rights by hand.
145 #
146
147 DB_RT_HOST              =       localhost
148
149 # set this to the name you want to give to the RT database in 
150 # your database server. For Oracle, this should be the name of your sid
151
152 DB_DATABASE             =       rt2
153
154 # Set this to the name of the rt database user
155
156 DB_RT_USER              =       rt_user
157
158 # Set this to the password used by the rt database user
159 # *** Change This Before Installation***
160
161 DB_RT_PASS              =       rt_pass
162
163 # }}}
164
165 # {{{ Web configuration 
166
167 # The user your webserver runs as. needed so that webrt can cache mason
168 # objectcode
169
170 WEB_USER                =       www
171 WEB_GROUP               =       rt
172
173 # }}}
174
175
176 ####################################################################
177 # No user servicable parts below this line.  Frob at your own risk #
178 ####################################################################
179
180 default:
181         @echo "Please read RT's readme before installing. Not doing so could"
182         @echo "be dangerous."
183
184 install: dirs initialize.$(DB_TYPE) upgrade insert instruct
185
186 instruct:
187         @echo "Congratulations. RT has been installed. "
188         @echo "You must now configure it by editing $(RT_CONFIG)."
189         @echo "From here on in, you should refer to the users guide."
190
191
192 insert: insert-install
193         $(PERL) -I$(DESTDIR)/$(RT_ETC_PATH) -I$(DESTDIR)/$(RT_LIB_PATH) $(DESTDIR)/$(RT_ETC_PATH)/insertdata
194
195 upgrade: dirs config-replace upgrade-noclobber  upgrade-instruct
196
197 upgrade-instruct: 
198         @echo "Congratulations. RT has been upgraded. You should now check-over"
199         @echo "$(RT_CONFIG) for any necessary site customization. Additionally,"
200         @echo "you should update RT's system database objects by running "
201         @echo "    $(RT_ETC_PATH)/insertdata <version>"
202         @echo "where <version> is the version of RT you're upgrading from."
203
204 upgrade-noclobber: insert-install libs-install html-install bin-install nondestruct
205
206 nondestruct: fixperms
207
208 testdeps:
209         $(PERL) ./tools/testdeps -warn $(DB_TYPE)
210
211 fixdeps:
212         $(PERL) ./tools/testdeps -fix $(DB_TYPE)
213
214
215
216 all:
217         @echo "Read the readme."
218
219 fixperms:
220         # Make the libraries readable
221         chmod -R $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_PATH)
222         chown -R $(LIBS_OWNER) $(DESTDIR)/$(RT_LIB_PATH)
223         chgrp -R $(LIBS_GROUP) $(DESTDIR)/$(RT_LIB_PATH)
224
225         chown -R $(BIN_OWNER) $(DESTDIR)/$(RT_BIN_PATH)
226         chgrp -R $(RTGROUP) $(DESTDIR)/$(RT_BIN_PATH)
227
228
229         chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_BIN_PATH)
230         chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_BIN_PATH) 
231
232         chmod 0755 $(DESTDIR)/$(RT_ETC_PATH)
233         chmod 0500 $(DESTDIR)/$(RT_ETC_PATH)/*
234
235         #TODO: the config file should probably be able to have its
236         # owner set seperately from the binaries.
237         chown -R $(BIN_OWNER) $(DESTDIR)/$(RT_ETC_PATH)
238         chgrp -R $(RTGROUP) $(DESTDIR)/$(RT_ETC_PATH)
239
240         chmod 0550 $(DESTDIR)/$(RT_CONFIG)
241
242         # Make the interfaces executable and setgid rt
243         chown $(BIN_OWNER) $(DESTDIR)/$(RT_MAILGATE_BIN) \
244                         $(DESTDIR)/$(RT_FASTCGI_HANDLER) \
245                         $(DESTDIR)/$(RT_SPEEDYCGI_HANDLER) \
246                         $(DESTDIR)/$(RT_CLI_BIN) \
247                         $(DESTDIR)/$(RT_CLI_ADMIN_BIN)
248
249         chgrp $(RTGROUP) $(DESTDIR)/$(RT_MAILGATE_BIN) \
250                         $(DESTDIR)/$(RT_FASTCGI_HANDLER) \
251                         $(DESTDIR)/$(RT_SPEEDYCGI_HANDLER) \
252                         $(DESTDIR)/$(RT_CLI_BIN) \
253                         $(DESTDIR)/$(RT_CLI_ADMIN_BIN)
254
255         chmod 0755      $(DESTDIR)/$(RT_MAILGATE_BIN) \
256                         $(DESTDIR)/$(RT_FASTCGI_HANDLER) \
257                         $(DESTDIR)/$(RT_SPEEDYCGI_HANDLER) \
258                         $(DESTDIR)/$(RT_CLI_BIN) \
259                         $(DESTDIR)/$(RT_CLI_ADMIN_BIN)
260
261         chmod g+s       $(DESTDIR)/$(RT_MAILGATE_BIN) \
262                         $(DESTDIR)/$(RT_FASTCGI_HANDLER) \
263                         $(DESTDIR)/$(RT_SPEEDYCGI_HANDLER) \
264                         $(DESTDIR)/$(RT_CLI_BIN) \
265                         $(DESTDIR)/$(RT_CLI_ADMIN_BIN)
266
267         # Make the web ui readable by all. 
268         chmod -R  u+rwX,go-w,go+rX      $(DESTDIR)/$(MASON_HTML_PATH) \
269                                         $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
270         chown -R $(LIBS_OWNER)  $(DESTDIR)/$(MASON_HTML_PATH) \
271                                 $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
272         chgrp -R $(LIBS_GROUP)  $(DESTDIR)/$(MASON_HTML_PATH) \
273                                 $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
274
275         # Make the web ui's data dir writable
276         chmod 0770      $(DESTDIR)/$(MASON_DATA_PATH) \
277                         $(DESTDIR)/$(MASON_SESSION_PATH)
278         chown -R $(WEB_USER)    $(DESTDIR)/$(MASON_DATA_PATH) \
279                                 $(DESTDIR)/$(MASON_SESSION_PATH)
280         chgrp -R $(WEB_GROUP)   $(DESTDIR)/$(MASON_DATA_PATH) \
281                                 $(DESTDIR)/$(MASON_SESSION_PATH)
282 dirs:
283         mkdir -p $(DESTDIR)/$(RT_BIN_PATH)
284         mkdir -p $(DESTDIR)/$(MASON_DATA_PATH)
285         mkdir -p $(DESTDIR)/$(MASON_SESSION_PATH)
286         mkdir -p $(DESTDIR)/$(RT_ETC_PATH)
287         mkdir -p $(DESTDIR)/$(RT_LIB_PATH)
288         mkdir -p $(DESTDIR)/$(MASON_HTML_PATH)
289         mkdir -p $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
290
291 libs-install: 
292         [ -d $(DESTDIR)/$(RT_LIB_PATH) ] || mkdir $(DESTDIR)/$(RT_LIB_PATH)
293         chown -R $(LIBS_OWNER) $(DESTDIR)/$(RT_LIB_PATH)
294         chgrp -R $(LIBS_GROUP) $(DESTDIR)/$(RT_LIB_PATH)
295         chmod -R $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_LIB_PATH)
296         ( cd ./lib; \
297           $(PERL) Makefile.PL INSTALLSITELIB=$(DESTDIR)/$(RT_LIB_PATH) \
298                               INSTALLMAN1DIR=$(DESTDIR)/$(RT_MAN_PATH)/man1 \
299                               INSTALLMAN3DIR=$(DESTDIR)/$(RT_MAN_PATH)/man3 \
300             && make \
301             && make test \
302             && $(PERL) -p -i -e " s'!!RT_VERSION!!'$(RT_VERSION)'g;" blib/lib/RT.pm ;\
303             make install \
304                            INSTALLSITEMAN1DIR=$(DESTDIR)/$(RT_MAN_PATH)/man1 \
305                            INSTALLSITEMAN3DIR=$(DESTDIR)/$(RT_MAN_PATH)/man3 \
306         )
307
308 html-install:
309         cp -rp ./webrt/* $(DESTDIR)/$(MASON_HTML_PATH)
310
311
312
313 genschema:
314         $(PERL) tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DATABASE)' generate
315
316
317 initialize.Pg: createdb initdb.dba acls 
318
319 initialize.mysql: createdb acls initdb.rtuser
320
321 initialize.Oracle: acls initdb.rtuser
322
323 acls:
324         cp etc/acl.$(DB_TYPE) '$(DESTDIR)/$(RT_ETC_PATH)/acl.$(DB_TYPE)'
325         $(PERL) -p -i -e " s'!!DB_TYPE!!'"$(DB_TYPE)"'g;\
326                                 s'!!DB_HOST!!'"$(DB_HOST)"'g;\
327                                 s'!!DB_RT_PASS!!'"$(DB_RT_PASS)"'g;\
328                                 s'!!DB_RT_HOST!!'"$(DB_RT_HOST)"'g;\
329                                 s'!!DB_RT_USER!!'"$(DB_RT_USER)"'g;\
330                                 s'!!DB_DATABASE!!'"$(DB_DATABASE)"'g;" $(DESTDIR)/$(RT_ETC_PATH)/acl.$(DB_TYPE)
331         bin/initacls.$(DB_TYPE) '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DBA_PASSWORD)' '$(DB_DATABASE)' '$(DESTDIR)/$(RT_ETC_PATH)/acl.$(DB_TYPE)' 
332
333
334
335 dropdb: 
336         $(PERL) tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DATABASE)' drop
337
338
339 createdb: 
340         $(PERL) tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DATABASE)' create
341 initdb.dba:
342         $(PERL) tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DATABASE)' insert
343
344 initdb.rtuser:
345         $(PERL) tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_RT_USER)' '$(DB_DATABASE)' insert
346
347
348
349 insert-install:
350         cp -rp ./tools/insertdata \
351                  $(DESTDIR)/$(RT_ETC_PATH)
352         $(PERL) -p -i -e " s'!!RT_ETC_PATH!!'$(RT_ETC_PATH)'g;\
353                            s'!!RT_LIB_PATH!!'$(RT_LIB_PATH)'g;"\
354                 $(DESTDIR)/$(RT_ETC_PATH)/insertdata
355
356 bin-install:
357         cp -p ./bin/webmux.pl $(DESTDIR)/$(RT_MODPERL_HANDLER)
358         cp -p ./bin/rt-mailgate $(DESTDIR)/$(RT_MAILGATE_BIN)
359         cp -p ./bin/rtadmin $(DESTDIR)/$(RT_CLI_ADMIN_BIN)
360         cp -p ./bin/rt $(DESTDIR)/$(RT_CLI_BIN)
361         cp -p ./bin/mason_handler.fcgi $(DESTDIR)/$(RT_FASTCGI_HANDLER)
362         cp -p ./bin/mason_handler.scgi $(DESTDIR)/$(RT_SPEEDYCGI_HANDLER)
363
364         $(PERL) -p -i -e "s'!!RT_PATH!!'"$(RT_PATH)"'g;\
365                                 s'!!PERL!!'"$(PERL)"'g;\
366                                 s'!!RT_VERSION!!'"$(RT_VERSION)"'g;\
367                                 s'!!RT_ETC_PATH!!'"$(RT_CONFIG_PATH)"'g;\
368                                 s'!!RT_LIB_PATH!!'"$(RT_LIB_PATH)"'g;"\
369                 $(DESTDIR)/$(RT_MODPERL_HANDLER) \
370                 $(DESTDIR)/$(RT_FASTCGI_HANDLER) \
371                 $(DESTDIR)/$(RT_SPEEDYCGI_HANDLER) \
372                 $(DESTDIR)/$(RT_CLI_BIN) \
373                 $(DESTDIR)/$(RT_CLI_ADMIN_BIN) \
374                 $(DESTDIR)/$(RT_MAILGATE_BIN)
375
376
377 config-replace:
378         -[ -f $(DESTDIR)/$(RT_CONFIG) ] && \
379                 mv $(DESTDIR)/$(RT_CONFIG) $(DESTDIR)/$(RT_CONFIG).old && \
380                 chmod 000 $(DESTDIR)/$(RT_CONFIG).old
381         cp -rp ./etc/config.pm $(DESTDIR)/$(RT_CONFIG)
382         $(PERL) -p -i -e "\
383         s'!!DB_TYPE!!'"$(DB_TYPE)"'g;\
384         s'!!DB_HOST!!'"$(DB_HOST)"'g;\
385         s'!!DB_PORT!!'"$(DB_PORT)"'g;\
386         s'!!DB_RT_PASS!!'"$(DB_RT_PASS)"'g;\
387         s'!!DB_RT_USER!!'"$(DB_RT_USER)"'g;\
388         s'!!DB_DATABASE!!'"$(DB_DATABASE)"'g;\
389         s'!!MASON_HTML_PATH!!'"$(MASON_HTML_PATH)"'g;\
390         s'!!MASON_LOCAL_HTML_PATH!!'"$(MASON_LOCAL_HTML_PATH)"'g;\
391         s'!!MASON_SESSION_PATH!!'"$(MASON_SESSION_PATH)"'g;\
392         s'!!MASON_DATA_PATH!!'"$(MASON_DATA_PATH)"'g;\
393         s'!!RT_LOG_PATH!!'"$(RT_LOG_PATH)"'g;\
394         s'!!RT_VERSION!!'"$(RT_VERSION)"'g;\
395         " $(DESTDIR)/$(RT_CONFIG)
396
397
398 commit:
399         cvs commit
400
401 predist: commit
402         cvs tag -r $(BRANCH) -F $(TAG)
403         rm -rf /tmp/$(TAG)
404         cvs co -d /tmp/$(TAG) -r $(TAG) rt
405         cd /tmp/$(TAG); chmod 600 Makefile; /usr/local/bin/cvs2cl.pl \
406                 --no-wrap --separate-header \
407                 --window 120
408         cd /tmp; tar czvf /home/ftp/pub/rt/devel/$(TAG).tar.gz $(TAG)/
409         chmod 644 /home/ftp/pub/rt/devel/$(TAG).tar.gz
410
411 dist: commit predist
412         rm -rf /home/ftp/pub/rt/devel/rt.tar.gz
413         ln -s ./$(TAG).tar.gz /home/ftp/pub/rt/devel/rt.tar.gz
414
415
416 rpm:
417         (cd ..; tar czvf /usr/src/redhat/SOURCES/rt.tar.gz rt)
418         rpm -ba etc/rt.spec