3 # Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
5 # (Except where explictly superceded by other copyright notices)
7 # This work is made available to you under the terms of Version 2 of
8 # the GNU General Public License. A copy of that license should have
9 # been provided with this software, but in any event can be snarfed
12 # This work is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # Unless otherwise specified, all modifications, corrections or
18 # extensions to this work which alter its source code become the
19 # property of Best Practical Solutions, LLC when submitted for
20 # inclusion in the work.
25 # DO NOT HAND-EDIT the file named 'Makefile'. This file is autogenerated.
26 # Have a look at "configure" and "Makefile.in" instead
32 CONFIG_FILE_PATH = /opt/rt3/etc
33 CONFIG_FILE = $(CONFIG_FILE_PATH)/RT_Config.pm
34 SITE_CONFIG_FILE = $(CONFIG_FILE_PATH)/RT_SiteConfig.pm
41 RT_VERSION = $(RT_VERSION_MAJOR).$(RT_VERSION_MINOR).$(RT_VERSION_PATCH)
42 TAG = rt-$(RT_VERSION_MAJOR)-$(RT_VERSION_MINOR)-$(RT_VERSION_PATCH)
45 # This is the group that all of the installed files will be chgrp'ed to.
49 # User which should own rt binaries.
52 # User that should own all of RT's libraries, generally root.
55 # Group that should own all of RT's libraries, generally root.
64 # {{{ Files and directories
66 # DESTDIR allows you to specify that RT be installed somewhere other than
67 # where it will eventually reside
73 RT_ETC_PATH = /opt/rt3/etc
74 RT_BIN_PATH = /opt/rt3/bin
75 RT_SBIN_PATH = /opt/rt3/sbin
76 RT_LIB_PATH = /opt/rt3/lib
77 RT_MAN_PATH = /opt/rt3/man
78 RT_VAR_PATH = /opt/rt3/var
79 RT_DOC_PATH = /opt/rt3/share/doc
80 RT_LOCAL_PATH = /opt/rt3/local
81 LOCAL_ETC_PATH = /opt/rt3/local/etc
82 LOCAL_LEXICON_PATH = /opt/rt3/local/po
83 MASON_HTML_PATH = /opt/rt3/share/html
84 MASON_LOCAL_HTML_PATH = /opt/rt3/local/html
85 MASON_DATA_PATH = /opt/rt3/var/mason_data
86 MASON_SESSION_PATH = /opt/rt3/var/session_data
87 RT_LOG_PATH = /opt/rt3/var/log
89 # RT_READABLE_DIR_MODE is the mode of directories that are generally meant
91 RT_READABLE_DIR_MODE = 0755
96 # {{{ all these define the places that RT's binaries should get installed
98 # RT_MODPERL_HANDLER is the mason handler script for mod_perl
99 RT_MODPERL_HANDLER = $(RT_BIN_PATH)/webmux.pl
100 # RT_FASTCGI_HANDLER is the mason handler script for FastCGI
101 RT_FASTCGI_HANDLER = $(RT_BIN_PATH)/mason_handler.fcgi
102 # RT_WIN32_FASTCGI_HANDLER is the mason handler script for FastCGI
103 RT_WIN32_FASTCGI_HANDLER = $(RT_BIN_PATH)/mason_handler.svc
105 RT_CLI_BIN = $(RT_BIN_PATH)/rt
107 RT_MAILGATE_BIN = $(RT_BIN_PATH)/rt-mailgate
109 RT_CRON_BIN = $(RT_BIN_PATH)/rt-crontool
113 SETGID_BINARIES = $(DESTDIR)/$(RT_FASTCGI_HANDLER) \
114 $(DESTDIR)/$(RT_WIN32_FASTCGI_HANDLER)
116 BINARIES = $(DESTDIR)/$(RT_MODPERL_HANDLER) \
117 $(DESTDIR)/$(RT_MAILGATE_BIN) \
118 $(DESTDIR)/$(RT_CLI_BIN) \
119 $(DESTDIR)/$(RT_CRON_BIN) \
121 SYSTEM_BINARIES = $(DESTDIR)/$(RT_SBIN_PATH)/
129 # DB_TYPE defines what sort of database RT trys to talk to
130 # "mysql" is known to work.
131 # "Pg" is known to work
132 # "Informix" is known to work
136 # Set DBA to the name of a unix account with the proper permissions and
137 # environment to run your commandline SQL sbin
139 # Set DB_DBA to the name of a DB user with permission to create new databases
141 # For mysql, you probably want 'root'
142 # For Pg, you probably want 'postgres'
143 # For Oracle, you want 'system'
144 # For Informix, you want 'informix'
150 # If you're not running your database server on its default port,
151 # specifiy the port the database server is running on below.
152 # It's generally safe to leave this blank
160 # Set this to the canonical name of the interface RT will be talking to the
161 # database on. If you said that the RT_DB_HOST above was "localhost," this
162 # should be too. This value will be used to grant rt access to the database.
163 # If you want to access the RT database from multiple hosts, you'll need
164 # to grant those database rights by hand.
167 DB_RT_HOST = localhost
169 # set this to the name you want to give to the RT database in
170 # your database server. For Oracle, this should be the name of your sid
172 DB_DATABASE = _DBC_DBNAME_
173 DB_RT_USER = _DBC_DBUSER_
174 DB_RT_PASS = _DBC_DBPASS_
179 ####################################################################
184 @echo "Please read RT's readme before installing. Not doing so could"
185 @echo "be dangerous."
190 @echo "Congratulations. RT has been installed. "
193 @echo "You must now configure RT by editing $(SITE_CONFIG_FILE)."
195 @echo "(You will definitely need to set RT's database password before continuing."
196 @echo " Not doing so could be very dangerous)"
198 @echo "After that, you need to initialize RT's database by running"
199 @echo " 'make initialize-database'"
201 # @echo " or by executing "
202 # @echo " '$(RT_SBIN_PATH)/rt-setup-database --action init \ "
203 # @echo " --dba $(DB_DBA) --prompt-for-dba-password'"
208 @echo "Congratulations. RT has been upgraded. You should now check-over"
209 @echo "$(CONFIG_FILE) for any necessary site customization. Additionally,"
210 @echo "you should update RT's system database objects by running "
211 @echo " ls etc/upgrade"
213 @echo "For each file in that directory whose name is greater than"
214 @echo "your previously installed RT version, run:"
215 @echo " $(RT_SBIN_PATH)/rt-setup-database --dba $(DB_DBA) --prompt-for-dba-password --action schema --datadir etc/upgrade/<version>"
216 @echo " $(RT_SBIN_PATH)/rt-setup-database --dba $(DB_DBA) --prompt-for-dba-password --action acl --datadir etc/upgrade/<version>"
217 @echo " $(RT_SBIN_PATH)/rt-setup-database --dba $(DB_DBA) --prompt-for-dba-password --action insert --datadir etc/upgrade/<version>"
219 upgrade: config-install dirs files-install fixperms upgrade-instruct
221 upgrade-noclobber: config-install libs-install html-install bin-install local-install doc-install fixperms
226 $(PERL) ./sbin/rt-test-dependencies --verbose --with-$(DB_TYPE)
229 $(PERL) ./sbin/rt-test-dependencies --verbose --install --with-$(DB_TYPE)
235 # Make the libraries readable
236 chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_PATH)
237 chown -R $(LIBS_OWNER) $(DESTDIR)/$(RT_LIB_PATH)
238 chgrp -R $(LIBS_GROUP) $(DESTDIR)/$(RT_LIB_PATH)
239 chmod -R u+rwX,go-w,go+rX $(DESTDIR)/$(RT_LIB_PATH)
242 chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_BIN_PATH)
243 chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_BIN_PATH)
245 chmod 0755 $(DESTDIR)/$(RT_ETC_PATH)
246 chmod 0500 $(DESTDIR)/$(RT_ETC_PATH)/*
248 #TODO: the config file should probably be able to have its
249 # owner set separately from the binaries.
250 chown -R $(BIN_OWNER) $(DESTDIR)/$(RT_ETC_PATH)
251 chgrp -R $(RTGROUP) $(DESTDIR)/$(RT_ETC_PATH)
253 chmod 0550 $(DESTDIR)/$(CONFIG_FILE)
254 chmod 0550 $(DESTDIR)/$(SITE_CONFIG_FILE)
256 # Make the interfaces executable
257 chown $(BIN_OWNER) $(BINARIES)
258 chgrp $(RTGROUP) $(BINARIES)
259 chmod 0755 $(BINARIES)
261 # Make the web ui readable by all.
262 chmod -R u+rwX,go-w,go+rX $(DESTDIR)/$(MASON_HTML_PATH) \
263 $(DESTDIR)/$(MASON_LOCAL_HTML_PATH) \
264 $(DESTDIR)/$(LOCAL_LEXICON_PATH)
265 chown -R $(LIBS_OWNER) $(DESTDIR)/$(MASON_HTML_PATH) \
266 $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
267 chgrp -R $(LIBS_GROUP) $(DESTDIR)/$(MASON_HTML_PATH) \
268 $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
270 # Make the web ui's data dir writable
271 chmod 0770 $(DESTDIR)/$(MASON_DATA_PATH) \
272 $(DESTDIR)/$(MASON_SESSION_PATH)
273 chown -R $(WEB_USER) $(DESTDIR)/$(MASON_DATA_PATH) \
274 $(DESTDIR)/$(MASON_SESSION_PATH)
275 chgrp -R $(WEB_GROUP) $(DESTDIR)/$(MASON_DATA_PATH) \
276 $(DESTDIR)/$(MASON_SESSION_PATH)
281 mkdir -p $(DESTDIR)/$(RT_LOG_PATH)
282 mkdir -p $(DESTDIR)/$(MASON_DATA_PATH)
283 mkdir -p $(DESTDIR)/$(MASON_DATA_PATH)/cache
284 mkdir -p $(DESTDIR)/$(MASON_DATA_PATH)/etc
285 mkdir -p $(DESTDIR)/$(MASON_DATA_PATH)/obj
286 mkdir -p $(DESTDIR)/$(MASON_SESSION_PATH)
287 mkdir -p $(DESTDIR)/$(MASON_HTML_PATH)
288 mkdir -p $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
289 mkdir -p $(DESTDIR)/$(LOCAL_ETC_PATH)
290 mkdir -p $(DESTDIR)/$(LOCAL_LIB_PATH)
291 mkdir -p $(DESTDIR)/$(LOCAL_LEXICON_PATH)
294 install: config-install dirs files-install fixperms instruct
296 files-install: libs-install etc-install bin-install sbin-install html-install local-install doc-install
299 mkdir -p $(DESTDIR)/$(CONFIG_FILE_PATH)
300 -cp etc/RT_Config.pm $(DESTDIR)/$(CONFIG_FILE)
301 [ -f $(DESTDIR)/$(SITE_CONFIG_FILE) ] || cp etc/RT_SiteConfig.pm $(DESTDIR)/$(SITE_CONFIG_FILE)
303 chgrp $(RTGROUP) $(DESTDIR)/$(CONFIG_FILE)
304 chown $(BIN_OWNER) $(DESTDIR)/$(CONFIG_FILE)
306 chgrp $(RTGROUP) $(DESTDIR)/$(SITE_CONFIG_FILE)
307 chown $(BIN_OWNER) $(DESTDIR)/$(SITE_CONFIG_FILE)
309 @echo "Installed configuration. about to install rt in $(RT_PATH)"
312 $(PERL) -Ilib lib/t/00smoke.t
314 regression-install: config-install
315 $(PERL) -pi -e 's/Set\(\$$DatabaseName.*\);/Set\(\$$DatabaseName, "rt3regression"\);/' $(DESTDIR)/$(CONFIG_FILE)
317 regression: regression-install dirs files-install libs-install sbin-install bin-install regression-instruct regression-reset-db testify-pods fixperms apachectl run-regression
320 prove -Ilib lib/t/setup_regression.t lib/t/autogen/ lib/t/regression/
322 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
325 $(PERL) sbin/regression_harness
328 @echo "About to wipe your database for a regression test. ABORT NOW with Control-C"
331 # {{{ database-installation
334 $(PERL) $(DESTDIR)/$(RT_SBIN_PATH)/rt-setup-database --action drop --dba $(DB_DBA) --dba-password '' --force
335 $(PERL) $(DESTDIR)/$(RT_SBIN_PATH)/rt-setup-database --action init --dba $(DB_DBA) --dba-password ''
337 initdb :: initialize-database
340 $(PERL) $(DESTDIR)/$(RT_SBIN_PATH)/rt-setup-database --action init --dba $(DB_DBA) --prompt-for-dba-password
343 $(PERL) $(DESTDIR)/$(RT_SBIN_PATH)/rt-setup-database --action drop --dba $(DB_DBA) --prompt-for-dba-password
345 insert-approval-data:
346 $(PERL) $(DESTDIR)/$(RT_SBIN_PATH)/insert_approval_scrips
351 [ -d $(DESTDIR)/$(RT_LIB_PATH) ] || mkdir -p $(DESTDIR)/$(RT_LIB_PATH)
352 -cp -rp lib/* $(DESTDIR)/$(RT_LIB_PATH)
357 [ -d $(DESTDIR)/$(MASON_HTML_PATH) ] || mkdir $(DESTDIR)/$(MASON_HTML_PATH)
358 -cp -rp ./html/* $(DESTDIR)/$(MASON_HTML_PATH)
363 # RT 3.0.0 - RT 3.0.2 would accidentally create a file instead of a dir
364 -[ -f $(DESTDIR)/$(RT_DOC_PATH) ] && rm $(DESTDIR)/$(RT_DOC_PATH)
365 [ -d $(DESTDIR)/$(RT_DOC_PATH) ] || mkdir $(DESTDIR)/$(RT_DOC_PATH)
366 -cp -rp ./README $(DESTDIR)/$(RT_DOC_PATH)
372 mkdir -p $(DESTDIR)/$(RT_ETC_PATH)
377 $(DESTDIR)/$(RT_ETC_PATH)
383 mkdir -p $(DESTDIR)/$(RT_SBIN_PATH)
385 sbin/rt-dump-database \
386 sbin/rt-setup-database \
387 sbin/rt-test-dependencies
389 sbin/rt-dump-database \
390 sbin/rt-setup-database \
391 sbin/rt-test-dependencies \
392 $(DESTDIR)/$(RT_SBIN_PATH)
399 mkdir -p $(DESTDIR)/$(RT_BIN_PATH)
400 chmod +x bin/rt-mailgate \
404 bin/mason_handler.fcgi \
405 bin/mason_handler.scgi \
406 bin/standalone_httpd \
407 bin/mason_handler.svc \
411 $(DESTDIR)/$(RT_BIN_PATH)
416 -cp -rp ./local/html/* $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
417 -cp -rp ./local/po/* $(DESTDIR)/$(LOCAL_LEXICON_PATH)
418 -cp -rp ./local/etc/* $(DESTDIR)/$(LOCAL_ETC_PATH)
421 # {{{ Best Practical Build targets -- no user servicable parts inside
424 POD2TEST_EXE = sbin/extract_pod_tests
427 [ -d lib/t/autogen ] || mkdir lib/t/autogen
428 find lib -name \*pm |grep -v .svn | grep -v \*.in |xargs -n 1 $(PERL) $(POD2TEST_EXE)
429 find bin -type f |grep -v .svn | grep -v \~ | grep -v "\.in" | xargs -n 1 $(PERL) $(POD2TEST_EXE)
430 find lib -name \*pm |grep -v .svn | grep -v \*.in |xargs -n 1 $(PERL) $(POD2TEST_EXE)
431 find bin -type f |grep -v .svn | grep -v \~ | grep -v "\.in" | xargs -n 1 $(PERL) $(POD2TEST_EXE)
436 $(PERL) sbin/extract-message-catalog
439 $(PERL) sbin/license_tag
441 factory: initialize-database
442 cd lib; $(PERL) ../sbin/factory $(DB_DATABASE) RT
447 chmod 755 ./configure