Autoconfiscation (Was Re: [rt-devel] 2.1.39: Makefile notes)

darren chamberlain darren at boston.com
Fri Oct 11 14:17:07 EDT 2002


* Jesse Vincent <jesse at bestpractical.com> [2002-10-11 12:43]:
> > What about getting use of autoconf/automake? 
> 
> Autoconf scares me. 

It does not, however, scare me, at least to the extent that I know it.
I autoconfiscated the Makefile for 2.0.15pre1; attached it the
configure.in and Makefile.in that I used.  It worked for my install.

To use it, do:

  $ autoconf
  $ ./configure --help

The proper invocation of configure (with the correct options, which are
pretty obvious from the --help output) will produce a Makefile with the
appropriate settings.  I've tested it by modifying the original Makefile
such that it contains all the settings I needed to modify, moving it to
Makefile.orig, running configure, and then diffing Makefile and
Makefile.orig.

All of the appropriate rt variables are --with variables, with defaults
and descriptions taken from the Makefile:

Features and packages:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --x-includes=DIR        X include files are in DIR
  --x-libraries=DIR       X library files are in DIR
--enable and --with options recognized:
  --with-rt-path=PATH         Name of the directory you want to install RT in (default: /opt/rt2)
  --with-rt-lib-path=PATH     Name of the directory you want to install RT libraries in (default: $RT_PATH/lib)
  --with-rt-etc-path=PATH     Name of the directory you want to install RT config in (default: $RT_PATH/etc)
  --with-rt-bin-path=PATH     Name of the directory you want to install RT binaries in (default: $RT_PATH/bin)
  --with-rt-man-path=PATH     Name of the directory you want to install RT man pages in (default: $RT_PATH/man)
  --with-mason-html-path=PATH Name of the directory you want to be the HTML::Mason docroot (default: $RT_PATH/WebRT/html)
  --with-destdir=PATH         path where RT will eventuall reside (if different from $RT_PATH)
  --with-rt-group=GROUP       chgrp all files to GROUP (default: rt)
  --with-bin-owner=OWNER      User that should own rt binaries (default root)
  --with-libs-owner=OWNER     User that should own all of RT's libraries (default root)
  --with-libs-group=GROUP     Group that should own rt binaries (default bin)
  --with-rt-log-path=PATH     Name of the directory in which you want logs to appear (default: /tmp)
  --with-db-type=TYPE         what sort of database RT trys to talk to (default: mysql)
  --with-db-home=PATH         where the database's commandline tools live (default: /usr)
  --with-db-dba=USER          name of the DB user with permission to create new databases (default: root)
  --with-db-dba-password=TYPE password for $DB_DBA 
  --with-db-host=HOSTNAME     FQDN of database server (default: localhost)
  --with-db-port=PORT         Port on which the database server on $DB_HOST listen
  --with-db-rt-host=HOSTNAME  FQDN of database server (default: localhost)
  --with-db-database=DBNAME   name of the rt database (default: rt2)
  --with-db-rt-user=DBUSER    name of database user (default: rt_user)
  --with-db-rt-pass=PASSWORD  password for $DBUSER (default: rt_pass)
  --with-web-user=USER        name of web server (default: www)
  --with-web-group=GROUP      group of web server (default: rt)

There is some room for improvement (I only had an hour to do this -- my
train ride is only an hour ;), like using the standard --libdir for what
is --with-rt-lib-dir, and the same for rt-bin-path, rt-man-path, and so
on.  Patches welcome, of course. ;)

Finally, I have not been following RT 2.1 development, so I have no idea
if/how this will translate to it.

(darren)

-- 
We are not who we think we are.
We are not who others think we are.
We are who we think others think we are.
    -- Anonymous
-------------- next part --------------
AC_REVISION($Revision: 1.1 $)

AC_INIT(Makefile.in)

dnl version numbers
RT_VERSION_MAJOR=2
RT_VERSION_MINOR=0
RT_VERSION_PATCH="15pre1"

AC_SUBST(RT_VERSION_MAJOR)
AC_SUBST(RT_VERSION_MINOR)
AC_SUBST(RT_VERSION_PATCH)

dnl perl
AC_PATH_PROG(PERL, perl, no)
if test $PERL = no ; then
    echo "Can't find perl!"
    exit
fi

dnl RT_PATH -> --prefix
AC_ARG_WITH(rt-path,
            [  --with-rt-path=PATH         Name of the directory you want to install RT in (default: /opt/rt2)],
            RT_PATH=$withval,
            RT_PATH=/opt/rt2)
AC_SUBST(RT_PATH)

dnl RT_LIB_PATH -> --libdir
AC_ARG_WITH(rt-lib-path,
            [  --with-rt-lib-path=PATH     Name of the directory you want to install RT libraries in (default: \$RT_PATH/lib)],
            RT_LIB_PATH=$withval,
            RT_LIB_PATH='$(RT_PATH)/lib')
AC_SUBST(RT_LIB_PATH)

dnl RT_ETC_PATH -> --sysconfdir
AC_ARG_WITH(rt-etc-path,
            [  --with-rt-etc-path=PATH     Name of the directory you want to install RT config in (default: \$RT_PATH/etc)],
            RT_ETC_PATH=$withval,
            RT_ETC_PATH='$(RT_PATH)/etc')
AC_SUBST(RT_ETC_PATH)

dnl RT_BIN_PATH -> --bindir
AC_ARG_WITH(rt-bin-path,
            [  --with-rt-bin-path=PATH     Name of the directory you want to install RT binaries in (default: \$RT_PATH/bin)],
            RT_BIN_PATH=$withval,
            RT_BIN_PATH='$(RT_PATH)/bin')
AC_SUBST(RT_BIN_PATH)

dnl RT_MAN_PATH -> --mandir
AC_ARG_WITH(rt-man-path,
            [  --with-rt-man-path=PATH     Name of the directory you want to install RT man pages in (default: \$RT_PATH/man)],
            RT_MAN_PATH=$withval,
            RT_MAN_PATH='$(RT_PATH)/man')
AC_SUBST(RT_MAN_PATH)

dnl MASON_HTML_PATH
AC_ARG_WITH(rt-mason-html-path,
            [  --with-mason-html-path=PATH Name of the directory you want to be the HTML::Mason docroot (default: \$RT_PATH/WebRT/html)],
            MASON_HTML_PATH=$withval,
            MASON_HTML_PATH='$(RT_PATH)/WebRT/html')
AC_SUBST(MASON_HTML_PATH)

dnl DESTDIR
AC_ARG_WITH(rt-destdir,
            [  --with-destdir=PATH         path where RT will eventuall reside (if different from \$RT_PATH)],
            DESTDIR=$withval,
            DESTDIR=)
AC_SUBST(DESTDIR)

dnl RTGROUP
AC_ARG_WITH(rt-group,
            [  --with-rt-group=GROUP       chgrp all files to GROUP (default: rt)],
            RTGROUP=$withval,
            RTGROUP=rt)
AC_SUBST(RTGROUP)

dnl BIN_OWNER
AC_ARG_WITH(bin-owner,
            [  --with-bin-owner=OWNER      User that should own rt binaries (default root)],
            BIN_OWNER=$withval,
            BIN_OWNER=root)
AC_SUBST(BIN_OWNER)

dnl LIBS_OWNER
AC_ARG_WITH(libs-owner,
            [  --with-libs-owner=OWNER     User that should own all of RT's libraries (default root)],
            LIBS_OWNER=$withval,
            LIBS_OWNER=root)
AC_SUBST(LIBS_OWNER)

dnl LIBS_GROUP
AC_ARG_WITH(libs-group,
            [  --with-libs-group=GROUP     Group that should own rt binaries (default bin)],
            LIBS_GROUP=$withval,
            LIBS_GROUP=bin)
AC_SUBST(LIBS_GROUP)

dnl RT_LOG_PATH
AC_ARG_WITH(rt-log-path,
            [  --with-rt-log-path=PATH     Name of the directory in which you want logs to appear (default: /tmp)],
            RT_LOG_PATH=$withval,
            RT_LOG_PATH=/tmp)
AC_SUBST(RT_LOG_PATH)

dnl DB_TYPE
AC_ARG_WITH(db-type,
            [  --with-db-type=TYPE         what sort of database RT trys to talk to (default: mysql)], 
            DB_TYPE=$withval,
            DB_TYPE=mysql)
AC_SUBST(DB_TYPE)

dnl DB_HOME
AC_ARG_WITH(db-home,
            [  --with-db-home=PATH         where the database's commandline tools live (default: /usr)],
            DB_HOME=$withval,
            DB_HOME=/usr)
AC_SUBST(DB_HOME)

dnl DB_DBA
AC_ARG_WITH(db-dba,
            [  --with-db-dba=USER          name of the DB user with permission to create new databases (default: root)],
            DB_DBA=$withval,
            DB_DBA=root)
AC_SUBST(DB_DBA)


dnl DB_DBA_PASSWORD
AC_ARG_WITH(db-dba-password,
            [  --with-db-dba-password=TYPE password for \$DB_DBA ],
            DB_DBA_PASSWORD=$withval,
            DB_DBA_PASSWORD=)
AC_SUBST(DB_DBA_PASSWORD)

dnl DB_HOST
AC_ARG_WITH(db-host,
            [  --with-db-host=HOSTNAME     FQDN of database server (default: localhost)],
            DB_HOST=$withval,
            DB_HOST=localhost)
AC_SUBST(DB_HOST)



dnl DB_PORT
AC_ARG_WITH(db-port,
            [  --with-db-port=PORT         Port on which the database server on \$DB_HOST listen],
            DB_PORT=$withval,
            DB_PORT=)
AC_SUBST(DB_PORT)



dnl DB_RT_HOST
AC_ARG_WITH(db-rt-host,
            [  --with-db-rt-host=HOSTNAME  FQDN of database server (default: localhost)],
            DB_RT_HOST=$withval,
            DB_RT_HOST=localhost)
AC_SUBST(DB_RT_HOST)


dnl DB_DATABASE
AC_ARG_WITH(db-database,
            [  --with-db-database=DBNAME   name of the rt database (default: rt2)],
            DB_DATABASE=$withval,
            DB_DATABASE=rt2)
AC_SUBST(DB_DATABASE)


dnl DB_RT_USER
AC_ARG_WITH(db-rt-user,
            [  --with-db-rt-user=DBUSER    name of database user (default: rt_user)],
            DB_RT_USER=$withval,
            DB_RT_USER=rt_user)
AC_SUBST(DB_RT_USER)

dnl DB_RT_PASS
AC_ARG_WITH(db-rt-pass,
            [  --with-db-rt-pass=PASSWORD  password for \$DBUSER (default: rt_pass)],
            DB_RT_PASS=$withval,
            DB_RT_PASS=rt_pass)
AC_SUBST(DB_RT_PASS)

dnl WEB_USER
AC_ARG_WITH(web-user,
            [  --with-web-user=USER        name of web server (default: www)],
            WEB_USER=$withval,
            WEB_USER=www)
AC_SUBST(WEB_USER)

dnl WEB_GROUP
AC_ARG_WITH(web-group,
            [  --with-web-group=GROUP      group of web server (default: rt)],
            WEB_GROUP=$withval,
            WEB_GROUP=rt)
AC_SUBST(WEB_GROUP)

AC_OUTPUT(Makefile)
-------------- next part --------------
# $Header: /raid/cvsroot/rt/Makefile,v 1.168 2002/08/16 20:21:43 jesse Exp $
# RT is Copyright 1996-2002 Jesse Vincent <jesse at bestpractical.com>
# It is distributed under the terms of the GNU General Public License, version 2

PERL			= 	@PERL@

RT_VERSION_MAJOR	=	@RT_VERSION_MAJOR@
RT_VERSION_MINOR	=	@RT_VERSION_MINOR@
RT_VERSION_PATCH	=	@RT_VERSION_PATCH@


RT_VERSION =	$(RT_VERSION_MAJOR).$(RT_VERSION_MINOR).$(RT_VERSION_PATCH)
TAG 	   =	rt-$(RT_VERSION_MAJOR)-$(RT_VERSION_MINOR)-$(RT_VERSION_PATCH)

BRANCH			=	HEAD

# This is the group that all of the installed files will be chgrp'ed to.
RTGROUP			=	@RTGROUP@


# User which should own rt binaries.
BIN_OWNER		=	@BIN_OWNER@

# User that should own all of RT's libraries, generally root.
LIBS_OWNER 		=	@LIBS_OWNER@

# Group that should own all of RT's libraries, generally root.
LIBS_GROUP		=	@LIBS_GROUP@



# {{{ Files and directories 

# DESTDIR allows you to specify that RT be installed somewhere other than
# where it will eventually reside

DESTDIR			=	@DESTDIR@


# RT_PATH is the name of the directory you want make to install RT in
# RT must be installed in its own directory (don't set this to /usr/local)

RT_PATH			=	@RT_PATH@

# The rest of these paths are all configurable, but you probably don't want to 
# put them elsewhere

RT_LIB_PATH		=	@RT_LIB_PATH@
RT_ETC_PATH		=	@RT_ETC_PATH@
RT_CONFIG_PATH		=	$(RT_ETC_PATH)
RT_BIN_PATH		=	@RT_BIN_PATH@
RT_MAN_PATH		=	@RT_MAN_PATH@
MASON_HTML_PATH		=	@MASON_HTML_PATH@


# RT allows sites to overlay the default web ui with 
# local customizations Those files can be placed in MASON_LOCAL_HTML_PATH

MASON_LOCAL_HTML_PATH	=	$(RT_PATH)/local/WebRT/html

# RT needs to be able to write to MASON_DATA_PATH and MASON_SESSION_PATH
# RT will create and chown these directories. Don't just set them to /tmp
MASON_DATA_PATH		=       $(RT_PATH)/WebRT/data
MASON_SESSION_PATH	=       $(RT_PATH)/WebRT/sessiondata

RT_LOG_PATH             =       @RT_LOG_PATH@

# RT_READABLE_DIR_MODE is the mode of directories that are generally meant
# to be accessable
RT_READABLE_DIR_MODE	=	0755



# The location of your rt configuration file
RT_CONFIG		=	$(RT_CONFIG_PATH)/config.pm

# RT_MODPERL_HANDLER is the mason handler script for mod_perl
RT_MODPERL_HANDLER	=	$(RT_BIN_PATH)/webmux.pl

# RT_FASTCGI_HANDLER is the mason handler script for FastCGI
# THIS HANDLER IS NOT CURRENTLY SUPPORTED
RT_FASTCGI_HANDLER	=	$(RT_BIN_PATH)/mason_handler.fcgi

# RT_SPEEDYCGI_HANDLER is the mason handler script for SpeedyCGI
# THIS HANDLER IS NOT CURRENTLY SUPPORTED
RT_SPEEDYCGI_HANDLER	=	$(RT_BIN_PATH)/mason_handler.scgi

# The following are the names of the various binaries which make up RT 

RT_CLI_BIN		=	$(RT_BIN_PATH)/rt
RT_CLI_ADMIN_BIN	=	$(RT_BIN_PATH)/rtadmin
RT_MAILGATE_BIN		=	$(RT_BIN_PATH)/rt-mailgate

# }}}

# {{{ Database setup

#
# DB_TYPE defines what sort of database RT trys to talk to
# "mysql" is known to work.
# "Pg" is known to work
# "Oracle" is in the early stages of working.

DB_TYPE			=	@DB_TYPE@

# DB_HOME is where the Database's commandline tools live.  $DB_HOME/bin
# should contain the binaries themselves, e.g. if "which mysql" gives
# "/usr/local/mysql/bin/mysql", $DB_HOME should be "/usr/local/mysql"

DB_HOME			= @DB_HOME@

# Set DBA to the name of a unix account with the proper permissions and 
# environment to run your commandline SQL tools

# Set DB_DBA to the name of a DB user with permission to create new databases 
# Set DB_DBA_PASSWORD to that user's password (if you don't, you'll be prompted
# later)

# For mysql, you probably want 'root'
# For Pg, you probably want 'postgres' 
# For oracle, you want 'system'

DB_DBA			=	@DB_DBA@
DB_DBA_PASSWORD		=	@DB_DBA_PASSWORD@
 
#
# Set this to the Fully Qualified Domain Name of your database server.
# If the database is local, rather than on a remote host, using "localhost" 
# will greatly enhance performance.

DB_HOST			=	@DB_HOST@

# If you're not running your database server on its default port, 
# specifiy the port the database server is running on below.
# It's generally safe to leave this blank 

DB_PORT			=	@DB_PORT@

#
# Set this to the canonical name of the interface RT will be talking to the 
# database on.  If you said that the RT_DB_HOST above was "localhost," this 
# should be too. This value will be used to grant rt access to the database.
# If you want to access the RT database from multiple hosts, you'll need
# to grant those database rights by hand.
#

DB_RT_HOST		=	@DB_RT_HOST@

# set this to the name you want to give to the RT database in 
# your database server. For Oracle, this should be the name of your sid

DB_DATABASE		=	@DB_DATABASE@

# Set this to the name of the rt database user

DB_RT_USER		=	@DB_RT_USER@

# Set this to the password used by the rt database user
# *** Change This Before Installation***

DB_RT_PASS		=	@DB_RT_PASS@

# }}}

# {{{ Web configuration 

# The user your webserver runs as. needed so that webrt can cache mason
# objectcode

WEB_USER		=	@WEB_USER@
WEB_GROUP		=	@WEB_GROUP@

# }}}


####################################################################
# No user servicable parts below this line.  Frob at your own risk #
####################################################################

default:
	@echo "Please read RT's readme before installing. Not doing so could"
	@echo "be dangerous."

install: dirs initialize.$(DB_TYPE) upgrade insert instruct

instruct:
	@echo "Congratulations. RT has been installed. "
	@echo "You must now configure it by editing $(RT_CONFIG)."
	@echo "From here on in, you should refer to the users guide."


insert: insert-install
	$(PERL) -I$(DESTDIR)/$(RT_ETC_PATH) -I$(DESTDIR)/$(RT_LIB_PATH) $(DESTDIR)/$(RT_ETC_PATH)/insertdata

upgrade: dirs config-replace upgrade-noclobber  upgrade-instruct

upgrade-instruct: 
	@echo "Congratulations. RT has been upgraded. You should now check-over"
	@echo "$(RT_CONFIG) for any necessary site customization. Additionally,"
	@echo "you should update RT's system database objects by running "
	@echo "	   $(RT_ETC_PATH)/insertdata <version>"
	@echo "where <version> is the version of RT you're upgrading from."

upgrade-noclobber: insert-install libs-install html-install bin-install nondestruct

nondestruct: fixperms

testdeps:
	$(PERL) ./tools/testdeps -warn $(DB_TYPE)

fixdeps:
	$(PERL) ./tools/testdeps -fix $(DB_TYPE)



all:
	@echo "Read the readme."

fixperms:
	# Make the libraries readable
	chmod -R $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_PATH)
	chown -R $(LIBS_OWNER) $(DESTDIR)/$(RT_LIB_PATH)
	chgrp -R $(LIBS_GROUP) $(DESTDIR)/$(RT_LIB_PATH)

	chown -R $(BIN_OWNER) $(DESTDIR)/$(RT_BIN_PATH)
	chgrp -R $(RTGROUP) $(DESTDIR)/$(RT_BIN_PATH)


	chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_BIN_PATH)
	chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_BIN_PATH)	

	chmod 0755 $(DESTDIR)/$(RT_ETC_PATH)
	chmod 0500 $(DESTDIR)/$(RT_ETC_PATH)/*

	#TODO: the config file should probably be able to have its
	# owner set seperately from the binaries.
	chown -R $(BIN_OWNER) $(DESTDIR)/$(RT_ETC_PATH)
	chgrp -R $(RTGROUP) $(DESTDIR)/$(RT_ETC_PATH)

	chmod 0550 $(DESTDIR)/$(RT_CONFIG)

	# Make the interfaces executable and setgid rt
	chown $(BIN_OWNER) $(DESTDIR)/$(RT_MAILGATE_BIN) \
			$(DESTDIR)/$(RT_FASTCGI_HANDLER) \
			$(DESTDIR)/$(RT_SPEEDYCGI_HANDLER) \
			$(DESTDIR)/$(RT_CLI_BIN) \
			$(DESTDIR)/$(RT_CLI_ADMIN_BIN)

	chgrp $(RTGROUP) $(DESTDIR)/$(RT_MAILGATE_BIN) \
			$(DESTDIR)/$(RT_FASTCGI_HANDLER) \
			$(DESTDIR)/$(RT_SPEEDYCGI_HANDLER) \
			$(DESTDIR)/$(RT_CLI_BIN) \
			$(DESTDIR)/$(RT_CLI_ADMIN_BIN)

	chmod 0755  	$(DESTDIR)/$(RT_MAILGATE_BIN) \
			$(DESTDIR)/$(RT_FASTCGI_HANDLER) \
			$(DESTDIR)/$(RT_SPEEDYCGI_HANDLER) \
			$(DESTDIR)/$(RT_CLI_BIN) \
			$(DESTDIR)/$(RT_CLI_ADMIN_BIN)

	chmod g+s 	$(DESTDIR)/$(RT_MAILGATE_BIN) \
			$(DESTDIR)/$(RT_FASTCGI_HANDLER) \
			$(DESTDIR)/$(RT_SPEEDYCGI_HANDLER) \
			$(DESTDIR)/$(RT_CLI_BIN) \
			$(DESTDIR)/$(RT_CLI_ADMIN_BIN)

	# Make the web ui readable by all. 
	chmod -R  u+rwX,go-w,go+rX 	$(DESTDIR)/$(MASON_HTML_PATH) \
					$(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
	chown -R $(LIBS_OWNER) 	$(DESTDIR)/$(MASON_HTML_PATH) \
				$(DESTDIR)/$(MASON_LOCAL_HTML_PATH)
	chgrp -R $(LIBS_GROUP) 	$(DESTDIR)/$(MASON_HTML_PATH) \
				$(DESTDIR)/$(MASON_LOCAL_HTML_PATH)

	# Make the web ui's data dir writable
	chmod 0770  	$(DESTDIR)/$(MASON_DATA_PATH) \
			$(DESTDIR)/$(MASON_SESSION_PATH)
	chown -R $(WEB_USER) 	$(DESTDIR)/$(MASON_DATA_PATH) \
				$(DESTDIR)/$(MASON_SESSION_PATH)
	chgrp -R $(WEB_GROUP) 	$(DESTDIR)/$(MASON_DATA_PATH) \
				$(DESTDIR)/$(MASON_SESSION_PATH)
dirs:
	mkdir -p $(DESTDIR)/$(RT_BIN_PATH)
	mkdir -p $(DESTDIR)/$(MASON_DATA_PATH)
	mkdir -p $(DESTDIR)/$(MASON_SESSION_PATH)
	mkdir -p $(DESTDIR)/$(RT_ETC_PATH)
	mkdir -p $(DESTDIR)/$(RT_LIB_PATH)
	mkdir -p $(DESTDIR)/$(MASON_HTML_PATH)
	mkdir -p $(DESTDIR)/$(MASON_LOCAL_HTML_PATH)

libs-install: 
	[ -d $(DESTDIR)/$(RT_LIB_PATH) ] || mkdir $(DESTDIR)/$(RT_LIB_PATH)
	chown -R $(LIBS_OWNER) $(DESTDIR)/$(RT_LIB_PATH)
	chgrp -R $(LIBS_GROUP) $(DESTDIR)/$(RT_LIB_PATH)
	chmod -R $(RT_READABLE_DIR_MODE) $(DESTDIR)/$(RT_LIB_PATH)
	( cd ./lib; \
	  $(PERL) Makefile.PL INSTALLSITELIB=$(RT_LIB_PATH) \
			      INSTALLMAN1DIR=$(RT_MAN_PATH)/man1 \
			      INSTALLMAN3DIR=$(RT_MAN_PATH)/man3 \
	    && make \
	    && make test \
	    && $(PERL) -p -i -e " s'!!RT_VERSION!!'$(RT_VERSION)'g;" blib/lib/RT.pm ;\
	    make install \
			   INSTALLSITEMAN1DIR=$(RT_MAN_PATH)/man1 \
			   INSTALLSITEMAN3DIR=$(RT_MAN_PATH)/man3 \
			   DESTDIR=$(DESTDIR) \
	)

html-install:
	cp -rp ./webrt/* $(DESTDIR)/$(MASON_HTML_PATH)



genschema:
	$(PERL)	tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DATABASE)' generate


initialize.Pg: createdb initdb.dba acls 

initialize.mysql: createdb acls initdb.rtuser

initialize.Oracle: acls initdb.rtuser

acls:
	cp etc/acl.$(DB_TYPE) '$(DESTDIR)/$(RT_ETC_PATH)/acl.$(DB_TYPE)'
	$(PERL) -p -i -e " s'!!DB_TYPE!!'"$(DB_TYPE)"'g;\
				s'!!DB_HOST!!'"$(DB_HOST)"'g;\
				s'!!DB_RT_PASS!!'"$(DB_RT_PASS)"'g;\
				s'!!DB_RT_HOST!!'"$(DB_RT_HOST)"'g;\
				s'!!DB_RT_USER!!'"$(DB_RT_USER)"'g;\
				s'!!DB_DATABASE!!'"$(DB_DATABASE)"'g;" $(DESTDIR)/$(RT_ETC_PATH)/acl.$(DB_TYPE)
	bin/initacls.$(DB_TYPE) '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DBA_PASSWORD)' '$(DB_DATABASE)' '$(DESTDIR)/$(RT_ETC_PATH)/acl.$(DB_TYPE)' 



dropdb: 
	$(PERL)	tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DATABASE)' drop


createdb: 
	$(PERL)	tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DATABASE)' create
initdb.dba:
	$(PERL)	tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_DBA)' '$(DB_DATABASE)' insert

initdb.rtuser:
	$(PERL)	tools/initdb '$(DB_TYPE)' '$(DB_HOME)' '$(DB_HOST)' '$(DB_PORT)' '$(DB_RT_USER)' '$(DB_DATABASE)' insert



insert-install:
	cp -rp ./tools/insertdata \
		 $(DESTDIR)/$(RT_ETC_PATH)
	$(PERL) -p -i -e " s'!!RT_ETC_PATH!!'$(RT_ETC_PATH)'g;\
		           s'!!RT_LIB_PATH!!'$(RT_LIB_PATH)'g;"\
		$(DESTDIR)/$(RT_ETC_PATH)/insertdata

bin-install:
	cp -p ./bin/webmux.pl $(DESTDIR)/$(RT_MODPERL_HANDLER)
	cp -p ./bin/rt-mailgate $(DESTDIR)/$(RT_MAILGATE_BIN)
	cp -p ./bin/rtadmin $(DESTDIR)/$(RT_CLI_ADMIN_BIN)
	cp -p ./bin/rt $(DESTDIR)/$(RT_CLI_BIN)
	cp -p ./bin/mason_handler.fcgi $(DESTDIR)/$(RT_FASTCGI_HANDLER)
	cp -p ./bin/mason_handler.scgi $(DESTDIR)/$(RT_SPEEDYCGI_HANDLER)

	$(PERL) -p -i -e "s'!!RT_PATH!!'"$(RT_PATH)"'g;\
				s'!!PERL!!'"$(PERL)"'g;\
			      	s'!!RT_VERSION!!'"$(RT_VERSION)"'g;\
				s'!!RT_ETC_PATH!!'"$(RT_CONFIG_PATH)"'g;\
				s'!!RT_LIB_PATH!!'"$(RT_LIB_PATH)"'g;"\
		$(DESTDIR)/$(RT_MODPERL_HANDLER) \
		$(DESTDIR)/$(RT_FASTCGI_HANDLER) \
		$(DESTDIR)/$(RT_SPEEDYCGI_HANDLER) \
		$(DESTDIR)/$(RT_CLI_BIN) \
		$(DESTDIR)/$(RT_CLI_ADMIN_BIN) \
		$(DESTDIR)/$(RT_MAILGATE_BIN)


config-replace:
	-[ -f $(DESTDIR)/$(RT_CONFIG) ] && \
		mv $(DESTDIR)/$(RT_CONFIG) $(DESTDIR)/$(RT_CONFIG).old && \
	 	chmod 000 $(DESTDIR)/$(RT_CONFIG).old
	cp -rp ./etc/config.pm $(DESTDIR)/$(RT_CONFIG)
	$(PERL) -p -i -e "\
	s'!!DB_TYPE!!'"$(DB_TYPE)"'g;\
	s'!!DB_HOST!!'"$(DB_HOST)"'g;\
	s'!!DB_PORT!!'"$(DB_PORT)"'g;\
	s'!!DB_RT_PASS!!'"$(DB_RT_PASS)"'g;\
	s'!!DB_RT_USER!!'"$(DB_RT_USER)"'g;\
	s'!!DB_DATABASE!!'"$(DB_DATABASE)"'g;\
	s'!!MASON_HTML_PATH!!'"$(MASON_HTML_PATH)"'g;\
	s'!!MASON_LOCAL_HTML_PATH!!'"$(MASON_LOCAL_HTML_PATH)"'g;\
	s'!!MASON_SESSION_PATH!!'"$(MASON_SESSION_PATH)"'g;\
	s'!!MASON_DATA_PATH!!'"$(MASON_DATA_PATH)"'g;\
	s'!!RT_LOG_PATH!!'"$(RT_LOG_PATH)"'g;\
	s'!!RT_VERSION!!'"$(RT_VERSION)"'g;\
	" $(DESTDIR)/$(RT_CONFIG)


commit:
	cvs commit

predist: commit
	cvs tag -r $(BRANCH) -F $(TAG)
	rm -rf /tmp/$(TAG)
	cvs co -d /tmp/$(TAG) -r $(TAG) rt
	cd /tmp/$(TAG); chmod 600 Makefile; /usr/local/bin/cvs2cl.pl \
		--no-wrap --separate-header \
		--window 120
	cd /tmp; tar czvf /home/ftp/pub/rt/devel/$(TAG).tar.gz $(TAG)/
	chmod 644 /home/ftp/pub/rt/devel/$(TAG).tar.gz

dist: commit predist
	rm -rf /home/ftp/pub/rt/devel/rt.tar.gz
	ln -s ./$(TAG).tar.gz /home/ftp/pub/rt/devel/rt.tar.gz


rpm:
	(cd ..; tar czvf /usr/src/redhat/SOURCES/rt.tar.gz rt)
	rpm -ba etc/rt.spec

clean:
	rm -rf config.cache config.log config.status configure Makefile
	(cd lib; if test -e Makefile; then make distclean; fi)


More information about the Rt-devel mailing list