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
12 RT_VERSION = $(RT_VERSION_MAJOR).$(RT_VERSION_MINOR).$(RT_VERSION_PATCH)
13 TAG = rt-$(RT_VERSION_MAJOR)-$(RT_VERSION_MINOR)-$(RT_VERSION_PATCH)
17 # This is the group that all of the installed files will be chgrp'ed to.
21 # User which should own rt binaries.
24 # User that should own all of RT's libraries, generally root.
27 # Group that should own all of RT's libraries, generally root.
32 # {{{ Files and directories
34 # DESTDIR allows you to specify that RT be installed somewhere other than
35 # where it will eventually reside
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)
45 # The rest of these paths are all configurable, but you probably don't want to
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
56 # RT allows sites to overlay the default web ui with
57 # local customizations Those files can be placed in MASON_LOCAL_HTML_PATH
59 MASON_LOCAL_HTML_PATH = $(RT_PATH)/local/WebRT/html
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
68 # RT_READABLE_DIR_MODE is the mode of directories that are generally meant
70 RT_READABLE_DIR_MODE = 0755
74 # The location of your rt configuration file
75 RT_CONFIG = $(RT_CONFIG_PATH)/config.pm
77 # RT_MODPERL_HANDLER is the mason handler script for mod_perl
78 RT_MODPERL_HANDLER = $(RT_BIN_PATH)/webmux.pl
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
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
88 # The following are the names of the various binaries which make up RT
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
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.
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"
112 # Set DBA to the name of a unix account with the proper permissions and
113 # environment to run your commandline SQL tools
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
119 # For mysql, you probably want 'root'
120 # For Pg, you probably want 'postgres'
121 # For oracle, you want 'system'
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.
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
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.
147 DB_RT_HOST = localhost
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
154 # Set this to the name of the rt database user
158 # Set this to the password used by the rt database user
159 # *** Change This Before Installation***
165 # {{{ Web configuration
167 # The user your webserver runs as. needed so that webrt can cache mason
176 ####################################################################
177 # No user servicable parts below this line. Frob at your own risk #
178 ####################################################################
181 @echo "Please read RT's readme before installing. Not doing so could"
182 @echo "be dangerous."
184 install: dirs initialize.$(DB_TYPE) upgrade insert 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."
192 insert: insert-install
193 $(PERL) -I$(DESTDIR)/$(RT_ETC_PATH) -I$(DESTDIR)/$(RT_LIB_PATH) $(DESTDIR)/$(RT_ETC_PATH)/insertdata
195 upgrade: dirs config-replace upgrade-noclobber 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."
204 upgrade-noclobber: insert-install libs-install html-install bin-install nondestruct
206 nondestruct: fixperms
209 $(PERL) ./tools/testdeps -warn $(DB_TYPE)
212 $(PERL) ./tools/testdeps -fix $(DB_TYPE)
217 @echo "Read the readme."
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)
225 chown -R $(BIN_OWNER) $(DESTDIR)/$(RT_BIN_PATH)
226 chgrp -R $(RTGROUP) $(DESTDIR)/$(RT_BIN_PATH)
229 chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_BIN_PATH)
230 chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_BIN_PATH)
232 chmod 0755 $(DESTDIR)/$(RT_ETC_PATH)
233 chmod 0500 $(DESTDIR)/$(RT_ETC_PATH)/*
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)
240 chmod 0550 $(DESTDIR)/$(RT_CONFIG)
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)
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)
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)
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)
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)
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)
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)
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)
297 $(PERL) Makefile.PL INSTALLSITELIB=$(DESTDIR)/$(RT_LIB_PATH) \
298 INSTALLMAN1DIR=$(DESTDIR)/$(RT_MAN_PATH)/man1 \
299 INSTALLMAN3DIR=$(DESTDIR)/$(RT_MAN_PATH)/man3 \
302 && $(PERL) -p -i -e " s'!!RT_VERSION!!'$(RT_VERSION)'g;" blib/lib/RT.pm ;\
304 INSTALLSITEMAN1DIR=$(DESTDIR)/$(RT_MAN_PATH)/man1 \
305 INSTALLSITEMAN3DIR=$(DESTDIR)/$(RT_MAN_PATH)/man3 \
309 cp -rp ./webrt/* $(DESTDIR)/$(MASON_HTML_PATH)
314 $(PERL) tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DATABASE)' generate
317 initialize.Pg: createdb initdb.dba acls
319 initialize.mysql: createdb acls initdb.rtuser
321 initialize.Oracle: acls initdb.rtuser
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)'
336 $(PERL) tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DATABASE)' drop
340 $(PERL) tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DATABASE)' create
342 $(PERL) tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DATABASE)' insert
345 $(PERL) tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_RT_USER)' '$(DB_DATABASE)' insert
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
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)
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)
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)
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)
402 cvs tag -r $(BRANCH) -F $(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 \
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
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
417 (cd ..; tar czvf /usr/src/redhat/SOURCES/rt.tar.gz rt)