fix ticketing system error on bootstrap of new install
[freeside.git] / rt / Makefile.in
index f963faa..158e703 100644 (file)
@@ -2,7 +2,7 @@
 #
 # COPYRIGHT:
 #
-# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
 #                                          <sales@bestpractical.com>
 #
 # (Except where explicitly superseded by other copyright notices)
@@ -53,6 +53,7 @@
 
 PERL                   =       @PERL@
 INSTALL                        =       @INSTALL@
+CC                             =       @CC@
 
 RT_LAYOUT              =       @rt_layout_name@
 
@@ -85,11 +86,6 @@ LIBS_GROUP           =       @LIBS_GROUP@
 WEB_USER               =       @WEB_USER@
 WEB_GROUP              =       @WEB_GROUP@
 
-
-APACHECTL              =       @APACHECTL@
-
-# {{{ Files and directories 
-
 # DESTDIR allows you to specify that RT be installed somewhere other than
 # where it will eventually reside. DESTDIR _must_ have a trailing slash
 # if it's defined.
@@ -107,11 +103,14 @@ RT_MAN_PATH               =       @RT_MAN_PATH_R@
 RT_VAR_PATH            =       @RT_VAR_PATH_R@
 RT_DOC_PATH            =       @RT_DOC_PATH_R@
 RT_FONT_PATH           =       @RT_FONT_PATH_R@
+RT_LEXICON_PATH                =       @RT_LEXICON_PATH_R@
+RT_STATIC_PATH         =       @RT_STATIC_PATH_R@
 RT_LOCAL_PATH          =       @RT_LOCAL_PATH_R@
 LOCAL_PLUGIN_PATH      =       @RT_LOCAL_PATH_R@/plugins
 LOCAL_ETC_PATH         =       @LOCAL_ETC_PATH_R@
 LOCAL_LIB_PATH         =       @LOCAL_LIB_PATH_R@
 LOCAL_LEXICON_PATH     =       @LOCAL_LEXICON_PATH_R@
+LOCAL_STATIC_PATH      =       @LOCAL_STATIC_PATH_R@
 MASON_HTML_PATH                =       @MASON_HTML_PATH_R@
 MASON_LOCAL_HTML_PATH  =       @MASON_LOCAL_HTML_PATH_R@
 MASON_DATA_PATH                =       @MASON_DATA_PATH_R@
@@ -125,20 +124,7 @@ RT_READABLE_DIR_MODE       =       0755
 
 
 
-# {{{ all these define the places that RT's binaries should get installed
 
-# RT_MODPERL_HANDLER is the mason handler script for mod_perl
-RT_MODPERL_HANDLER     =       webmux.pl
-# RT_STANDALONE_SERVER is a stand-alone HTTP server
-RT_STANDALONE_SERVER   =       standalone_httpd
-# RT_SPEEDYCGI_HANDLER is the mason handler script for SpeedyCGI
-RT_SPEEDYCGI_HANDLER   =       mason_handler.scgi
-# RT_FASTCGI_HANDLER is the mason handler script for FastCGI
-RT_FASTCGI_HANDLER     =       mason_handler.fcgi
-# RT_FASTCGI_SERVER is the FastCGI server
-RT_FASTCGI_SERVER      =       fastcgi_server
-# RT_WIN32_FASTCGI_HANDLER is the mason handler script for FastCGI
-RT_WIN32_FASTCGI_HANDLER       =       mason_handler.svc
 # RT's CLI
 RT_CLI_BIN             =       rt
 # RT's mail gateway
@@ -146,66 +132,53 @@ RT_MAILGATE_BIN           =       rt-mailgate
 # RT's cron tool
 RT_CRON_BIN            =       rt-crontool
 
-# }}}
 
 
-BINARIES               =       $(RT_MODPERL_HANDLER) \
-                               $(RT_MAILGATE_BIN) \
+BINARIES               =       $(RT_MAILGATE_BIN) \
                                $(RT_CLI_BIN) \
-                               $(RT_CRON_BIN) \
-                               $(RT_STANDALONE_SERVER) \
-                               $(RT_SPEEDYCGI_HANDLER) \
-                               $(RT_FASTCGI_HANDLER) \
-                               $(RT_FASTCGI_SERVER) \
-                               $(RT_WIN32_FASTCGI_HANDLER)
-
-
-
-
+                               $(RT_CRON_BIN)
 
 SYSTEM_BINARIES                =       rt-attributes-viewer \
-                               rt-dump-database \
-                               rt-setup-database \
-                               rt-email-digest \
+                               rt-clean-sessions \
+                               rt-dump-metadata \
                                rt-email-dashboards \
+                               rt-email-digest \
                                rt-email-group-admin \
+                               rt-fulltext-indexer \
+                               rt-importer \
+                               rt-preferences-viewer \
+                               rt-serializer \
                                rt-server \
                                rt-session-viewer \
-                               rt-test-dependencies \
-                               rt-clean-sessions \
+                               rt-server.fcgi \
+                               rt-session-viewer \
+                               rt-setup-database \
+                               rt-setup-fulltext-index \
                                rt-shredder \
-                               rt-validator
+                               rt-test-dependencies \
+                               rt-validator \
+                               rt-validate-aliases \
+                               standalone_httpd
 
 
-ETC_FILES              =       acl.Informix \
-                               acl.Pg \
+ETC_FILES              =       acl.Pg \
                                acl.Oracle \
                                acl.mysql \
-                               acl.Sybase \
-                               schema.Informix \
                                schema.Pg \
                                schema.Oracle \
-                               schema.mysql-4.0 \
-                               schema.mysql-4.1 \
-                               schema.Sybase \
+                               schema.mysql \
                                schema.SQLite \
                                initialdata
 
-# }}}
 
-# {{{ Web frontend
 
 WEB_HANDLER            =       @WEB_HANDLER@
 
-# }}}
 
-# {{{ Database setup
 
 #
 # DB_TYPE defines what sort of database RT trys to talk to
-# "mysql" is known to work.
-# "Pg" is known to work
-# "Informix" is known to work
+# "mysql", "Oracle", "Pg", and "SQLite" are known to work.
 
 DB_TYPE                        =       @DB_TYPE@
 
@@ -217,7 +190,6 @@ DB_TYPE                     =       @DB_TYPE@
 # For mysql, you probably want 'root'
 # For Pg, you probably want 'postgres' 
 # For Oracle, you want 'system'
-# For Informix, you want 'informix'
 
 DB_DBA                 =       @DB_DBA@
 
@@ -249,12 +221,13 @@ DB_DATABASE               =       @DB_DATABASE@
 DB_RT_USER             =       @DB_RT_USER@
 DB_RT_PASS             =       @DB_RT_PASS@
 
-# }}}
 
 
-TEST_FILES = t/*.t t/*/*.t
+TEST_FILES = t/*.t t/*/*.t t/*/*/*.t
 TEST_VERBOSE = 0
 
+RT_TEST_PARALLEL_NUM ?= 5
+
 
 ####################################################################
 
@@ -285,16 +258,11 @@ upgrade-instruct:
        @echo "Congratulations. RT has been upgraded. You should now check over"
        @echo "$(CONFIG_FILE) for any necessary site customization. Additionally,"
        @echo "you should update RT's system database objects by running "
-       @echo "    $(RT_SBIN_PATH)/rt-setup-database --dba $(DB_DBA) --prompt-for-dba-password --action upgrade"
+       @echo "    make upgrade-database"
 
 
 upgrade: testdeps config-install dirs files-install fixperms upgrade-instruct
 
-upgrade-noclobber: config-install dirs libs-install html-install bin-install local-install doc-install font-install fixperms
-
-
-# {{{ dependencies
-
 my_with_web_handlers= $(shell $(PERL) -e 'print join " ", map "--with-$$_", grep defined && length, split /,/, "$(WEB_HANDLER)"')
 testdeps:
        $(PERL) ./sbin/rt-test-dependencies --verbose --with-$(DB_TYPE) $(my_with_web_handlers)
@@ -306,7 +274,6 @@ fixdeps:
 
 #}}}
 
-# {{{ fixperms
 fixperms:
        # Make the libraries readable
        chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)$(RT_PATH)
@@ -336,14 +303,31 @@ fixperms:
        # Make the system binaries executable also
        cd $(DESTDIR)$(RT_SBIN_PATH) && ( chmod 0755 $(SYSTEM_BINARIES) ; chown $(BIN_OWNER) $(SYSTEM_BINARIES);  chgrp $(RTGROUP) $(SYSTEM_BINARIES))
 
+       # Make upgrade scripts executable if they are in the source.
+       #
+       ( cd etc/upgrade && find . -type f -not -name '*.in' -perm @FINDPERM@0111 -print ) | while read file ; do \
+               chmod a+x "$(DESTDIR)$(RT_ETC_PATH)/upgrade/$$file" ; \
+       done
+
        # Make the web ui readable by all. 
        chmod -R  u+rwX,go-w,go+rX      $(DESTDIR)$(MASON_HTML_PATH) \
                                        $(DESTDIR)$(MASON_LOCAL_HTML_PATH) \
-                                       $(DESTDIR)$(LOCAL_LEXICON_PATH)
+                                       $(DESTDIR)$(RT_LEXICON_PATH) \
+                                       $(DESTDIR)$(LOCAL_LEXICON_PATH) \
+                                       $(DESTDIR)$(RT_STATIC_PATH) \
+                                       $(DESTDIR)$(LOCAL_STATIC_PATH)
        chown -R $(LIBS_OWNER)  $(DESTDIR)$(MASON_HTML_PATH) \
-                               $(DESTDIR)$(MASON_LOCAL_HTML_PATH)
+                               $(DESTDIR)$(MASON_LOCAL_HTML_PATH) \
+                               $(DESTDIR)$(RT_LEXICON_PATH) \
+                               $(DESTDIR)$(LOCAL_LEXICON_PATH) \
+                               $(DESTDIR)$(RT_STATIC_PATH) \
+                               $(DESTDIR)$(LOCAL_STATIC_PATH)
        chgrp -R $(LIBS_GROUP)  $(DESTDIR)$(MASON_HTML_PATH) \
-                               $(DESTDIR)$(MASON_LOCAL_HTML_PATH)
+                               $(DESTDIR)$(MASON_LOCAL_HTML_PATH) \
+                               $(DESTDIR)$(RT_LEXICON_PATH) \
+                               $(DESTDIR)$(LOCAL_LEXICON_PATH) \
+                               $(DESTDIR)$(RT_STATIC_PATH) \
+                               $(DESTDIR)$(LOCAL_STATIC_PATH)
 
        # Make the web ui's data dir writable
        chmod 0770      $(DESTDIR)$(MASON_DATA_PATH) \
@@ -352,12 +336,12 @@ fixperms:
                                $(DESTDIR)$(MASON_SESSION_PATH)
        chgrp -R $(WEB_GROUP)   $(DESTDIR)$(MASON_DATA_PATH) \
                                $(DESTDIR)$(MASON_SESSION_PATH)
-# }}}
 
-# {{{ dirs
 dirs:
        $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_LOG_PATH)
        $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_FONT_PATH)
+       $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_LEXICON_PATH)
+       $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_STATIC_PATH)
        $(INSTALL) -m 0770 -d $(DESTDIR)$(MASON_DATA_PATH)
        $(INSTALL) -m 0770 -d $(DESTDIR)$(MASON_DATA_PATH)/cache
        $(INSTALL) -m 0770 -d $(DESTDIR)$(MASON_DATA_PATH)/etc
@@ -369,11 +353,16 @@ dirs:
        $(INSTALL) -m 0755 -d $(DESTDIR)$(LOCAL_LIB_PATH)
        $(INSTALL) -m 0755 -d $(DESTDIR)$(LOCAL_PLUGIN_PATH)
        $(INSTALL) -m 0755 -d $(DESTDIR)$(LOCAL_LEXICON_PATH)
-# }}}
+       $(INSTALL) -m 0755 -d $(DESTDIR)$(LOCAL_STATIC_PATH)
+
+clean-mason-cache:
+       rm -rf $(DESTDIR)$(MASON_DATA_PATH)/cache/*
+       rm -rf $(DESTDIR)$(MASON_DATA_PATH)/etc/*
+       rm -rf $(DESTDIR)$(MASON_DATA_PATH)/obj/*
 
 install: testdeps config-install dirs files-install fixperms instruct
 
-files-install: libs-install etc-install config-install bin-install sbin-install html-install local-install doc-install font-install
+files-install: libs-install etc-install config-install bin-install sbin-install html-install doc-install font-install po-install static-install
 
 config-install:
 @COMMENT_INPLACE_LAYOUT@       $(INSTALL) -m 0755 -o $(BIN_OWNER) -g $(RTGROUP) -d $(DESTDIR)$(CONFIG_FILE_PATH)
@@ -387,30 +376,28 @@ test:
 parallel-test: test-parallel
 
 test-parallel: 
-       RT_TEST_PARALLEL=1 HARNESS_OPTIONS="j4" $(PERL) "-MExtUtils::Command::MM" -e "test_harness($(TEST_VERBOSE), 'lib')" $(TEST_FILES)
-
-regression-install: config-install
-       $(PERL) -pi -e 's/Set\(\$$DatabaseName.*\);/Set\(\$$DatabaseName, "rt3regression"\);/' $(DESTDIR)$(CONFIG_FILE)
-
-# {{{ database-installation
+       RT_TEST_PARALLEL=1 $(PERL) "-MApp::Prove" -e 'my $$p = App::Prove->new(); $$p->process_args("-wlrj$(RT_TEST_PARALLEL_NUM)","--state=slow,save", "t"); exit( $$p->run() ? 0 : 1 )'
 
 regression-reset-db: force-dropdb
-       $(PERL) -I$(LOCAL_LIB_PATH) -I$(RT_LIB_PATH) sbin/rt-setup-database --action init --dba $(DB_DBA) --dba-password ''
+       $(PERL) -I$(LOCAL_LIB_PATH) -I$(RT_LIB_PATH) sbin/rt-setup-database --action init --dba-password ''
 
 initdb :: initialize-database
 
 initialize-database: 
-       $(PERL) -I$(LOCAL_LIB_PATH) -I$(RT_LIB_PATH) sbin/rt-setup-database --action init --dba $(DB_DBA) --prompt-for-dba-password
+       $(PERL) -I$(LOCAL_LIB_PATH) -I$(RT_LIB_PATH) sbin/rt-setup-database --action init --prompt-for-dba-password
+
+upgrade-database:
+       $(PERL) -I$(LOCAL_LIB_PATH) -I$(RT_LIB_PATH) sbin/rt-setup-database --action upgrade --prompt-for-dba-password
 
 dropdb: 
-       $(PERL) -I$(LOCAL_LIB_PATH) -I$(RT_LIB_PATH) sbin/rt-setup-database --action drop --dba $(DB_DBA) --prompt-for-dba-password
+       $(PERL) -I$(LOCAL_LIB_PATH) -I$(RT_LIB_PATH) sbin/rt-setup-database --action drop --prompt-for-dba-password
 
 force-dropdb: 
-       $(PERL) -I$(LOCAL_LIB_PATH) -I$(RT_LIB_PATH) sbin/rt-setup-database --action drop --dba $(DB_DBA) --dba-password '' --force
+       $(PERL) -I$(LOCAL_LIB_PATH) -I$(RT_LIB_PATH) sbin/rt-setup-database --action drop --dba-password '' --force
 
-# }}}
+critic:
+       perlcritic --quiet sbin bin lib
 
-# {{{ libs-install
 libs-install: 
 @COMMENT_INPLACE_LAYOUT@       [ -d $(DESTDIR)$(RT_LIB_PATH) ] || $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_LIB_PATH)
 @COMMENT_INPLACE_LAYOUT@       -( cd lib && find . -type d -print ) | while read dir ; do \
@@ -419,9 +406,7 @@ libs-install:
 @COMMENT_INPLACE_LAYOUT@       -( cd lib && find . -type f -print ) | while read file ; do \
 @COMMENT_INPLACE_LAYOUT@            $(INSTALL) -m 0644 "lib/$$file" "$(DESTDIR)$(RT_LIB_PATH)/$$file" ; \
 @COMMENT_INPLACE_LAYOUT@       done
-# }}}
 
-# {{{ html-install
 html-install:
 @COMMENT_INPLACE_LAYOUT@       [ -d $(DESTDIR)$(MASON_HTML_PATH) ] || $(INSTALL) -m 0755 -d $(DESTDIR)$(MASON_HTML_PATH)
 @COMMENT_INPLACE_LAYOUT@       -( cd share/html && find . -type d -print ) | while read dir ; do \
@@ -430,34 +415,57 @@ html-install:
 @COMMENT_INPLACE_LAYOUT@       -( cd share/html && find . -type f -print ) | while read file ; do \
 @COMMENT_INPLACE_LAYOUT@           $(INSTALL) -m 0644 "share/html/$$file" "$(DESTDIR)$(MASON_HTML_PATH)/$$file" ; \
 @COMMENT_INPLACE_LAYOUT@       done
-# }}}
+@COMMENT_INPLACE_LAYOUT@       $(MAKE) clean-mason-cache
 
-# {{{ font-install
 font-install:
 @COMMENT_INPLACE_LAYOUT@       [ -d $(DESTDIR)$(RT_FONT_PATH) ] || $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_FONT_PATH)
 @COMMENT_INPLACE_LAYOUT@       -( cd share/fonts && find . -type f -print ) | while read file ; do \
 @COMMENT_INPLACE_LAYOUT@           $(INSTALL) -m 0644 "share/fonts/$$file" "$(DESTDIR)$(RT_FONT_PATH)/$$file" ; \
 @COMMENT_INPLACE_LAYOUT@       done
-# }}}
 
-# {{{ doc-install
+
+po-install:
+@COMMENT_INPLACE_LAYOUT@       [ -d $(DESTDIR)$(RT_LEXICON_PATH) ] || $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_LEXICON_PATH)
+@COMMENT_INPLACE_LAYOUT@       -( cd share/po && find . -type f -print ) | while read file ; do \
+@COMMENT_INPLACE_LAYOUT@           $(INSTALL) -m 0644 "share/po/$$file" "$(DESTDIR)$(RT_LEXICON_PATH)/$$file" ; \
+@COMMENT_INPLACE_LAYOUT@       done
+
+static-install:
+@COMMENT_INPLACE_LAYOUT@       [ -d $(DESTDIR)$(RT_STATIC_PATH) ] || $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_STATIC_PATH)
+@COMMENT_INPLACE_LAYOUT@       -( cd share/static && find . -type d -print ) | while read dir ; do \
+@COMMENT_INPLACE_LAYOUT@           $(INSTALL) -m 0755 -d "$(DESTDIR)$(RT_STATIC_PATH)/$$dir" ; \
+@COMMENT_INPLACE_LAYOUT@       done
+@COMMENT_INPLACE_LAYOUT@       -( cd share/static && find . -type f -print ) | while read file ; do \
+@COMMENT_INPLACE_LAYOUT@           $(INSTALL) -m 0644 "share/static/$$file" "$(DESTDIR)$(RT_STATIC_PATH)/$$file" ; \
+@COMMENT_INPLACE_LAYOUT@       done
+
+
 doc-install:
 @COMMENT_INPLACE_LAYOUT@       # RT 3.0.0 - RT 3.0.2 would accidentally create a file instead of a dir
 @COMMENT_INPLACE_LAYOUT@       -[ -f $(DESTDIR)$(RT_DOC_PATH) ] && rm $(DESTDIR)$(RT_DOC_PATH) 
 @COMMENT_INPLACE_LAYOUT@       [ -d $(DESTDIR)$(RT_DOC_PATH) ] || $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_DOC_PATH)
+@COMMENT_INPLACE_LAYOUT@       -( cd docs && find . -type d -print ) | while read dir ; do \
+@COMMENT_INPLACE_LAYOUT@           $(INSTALL) -m 0755 -d "$(DESTDIR)$(RT_DOC_PATH)/$$dir" ; \
+@COMMENT_INPLACE_LAYOUT@       done
+@COMMENT_INPLACE_LAYOUT@       -( cd docs && find . -type f -print ) | while read file ; do \
+@COMMENT_INPLACE_LAYOUT@           $(INSTALL) -m 0644 "docs/$$file" "$(DESTDIR)$(RT_DOC_PATH)/$$file" ; \
+@COMMENT_INPLACE_LAYOUT@       done
 @COMMENT_INPLACE_LAYOUT@       -$(INSTALL) -m 0644 ./README $(DESTDIR)$(RT_DOC_PATH)/
-# }}}
 
-# {{{ etc-install
 
 etc-install:
 @COMMENT_INPLACE_LAYOUT@       [ -d $(DESTDIR)$(RT_ETC_PATH) ] || $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_ETC_PATH)
 @COMMENT_INPLACE_LAYOUT@       for file in $(ETC_FILES) ; do \
 @COMMENT_INPLACE_LAYOUT@           $(INSTALL) -m 0644 "etc/$$file" "$(DESTDIR)$(RT_ETC_PATH)/" ; \
 @COMMENT_INPLACE_LAYOUT@       done
-# }}}
+@COMMENT_INPLACE_LAYOUT@       [ -d $(DESTDIR)$(RT_ETC_PATH)/upgrade ] || $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_ETC_PATH)/upgrade
+@COMMENT_INPLACE_LAYOUT@       -( cd etc/upgrade && find . -type d -print ) | while read dir ; do \
+@COMMENT_INPLACE_LAYOUT@           $(INSTALL) -m 0755 -d "$(DESTDIR)$(RT_ETC_PATH)/upgrade/$$dir" ; \
+@COMMENT_INPLACE_LAYOUT@       done
+@COMMENT_INPLACE_LAYOUT@       -( cd etc/upgrade && find . -type f -not -name '*.in' -print ) | while read file ; do \
+@COMMENT_INPLACE_LAYOUT@           $(INSTALL) -m 0644 "etc/upgrade/$$file" "$(DESTDIR)$(RT_ETC_PATH)/upgrade/$$file" ; \
+@COMMENT_INPLACE_LAYOUT@       done
 
-# {{{ sbin-install
 
 sbin-install:
 @COMMENT_INPLACE_LAYOUT@       $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_SBIN_PATH)
@@ -465,9 +473,7 @@ sbin-install:
 @COMMENT_INPLACE_LAYOUT@           $(INSTALL) -o $(BIN_OWNER) -g $(RTGROUP) -m 0755 "sbin/$$file" "$(DESTDIR)$(RT_SBIN_PATH)/" ; \
 @COMMENT_INPLACE_LAYOUT@       done
 
-# }}}
 
-# {{{ bin-install
 
 bin-install:
 @COMMENT_INPLACE_LAYOUT@       $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_BIN_PATH)
@@ -475,62 +481,104 @@ bin-install:
 @COMMENT_INPLACE_LAYOUT@           $(INSTALL) -o $(BIN_OWNER) -g $(RTGROUP) -m 0755 "bin/$$file" "$(DESTDIR)$(RT_BIN_PATH)/" ; \
 @COMMENT_INPLACE_LAYOUT@       done
 
-# {{{ local-install
-local-install:
-       -( cd local/html && find . -type d -print ) | while read dir ; do \
-           $(INSTALL) -m 0755 -d "$(DESTDIR)$(MASON_LOCAL_HTML_PATH)/$$dir" ; \
-       done
-       -( cd local/html && find . -type f -print ) | while read file ; do \
-           $(INSTALL) -m 0644 "local/html/$$file" "$(DESTDIR)$(MASON_LOCAL_HTML_PATH)/$$file" ; \
-       done
-       -( cd local/po && find . -type d -print ) | while read dir ; do \
-           $(INSTALL) -m 0755 -d "$(DESTDIR)$(LOCAL_LEXICON_PATH)/$$dir" ; \
-       done
-       -( cd local/po && find . -type f -print ) | while read file ; do \
-           $(INSTALL) -m 0644 "local/po/$$file" "$(DESTDIR)$(LOCAL_LEXICON_PATH)/$$file" ; \
-       done
-       -( cd local/etc && find . -type d -print ) | while read dir ; do \
-           $(INSTALL) -m 0755 -d "$(DESTDIR)$(LOCAL_ETC_PATH)/$$dir" ; \
-       done
-       -( cd local/etc && find . -type f -print ) | while read file ; do \
-           $(INSTALL) -m 0644 "etc/$$file" "$(DESTDIR)$(LOCAL_ETC_PATH)/$$file" ; \
-       done
-# }}}
 
-# {{{ Best Practical Build targets -- no user servicable parts inside
 
 regenerate-catalogs:
-       $(PERL) sbin/extract-message-catalog
+       $(PERL) devel/tools/extract-message-catalog
 
 license-tag:
-       $(PERL) sbin/license_tag
-
-factory: initialize-database
-       cd lib; $(PERL) ../sbin/factory  $(DB_DATABASE) RT
-
-reconfigure:
-       aclocal -I m4
-       autoconf
-       chmod 755 ./configure
-       ./configure
+       $(PERL) devel/tools/license_tag
 
 start-httpd:
-       $(PERL) bin/standalone_httpd &
+       $(PERL) sbin/standalone_httpd &
 
 start-server:
        $(PERL) sbin/rt-server &
 
-apachectl:
-       $(APACHECTL) stop
-       sleep 10
-       $(APACHECTL) start
-       sleep 5
 
 SNAPSHOT=$(shell git describe --tags)
-snapshot:
+THIRD_PARTY=devel/third-party/
+snapshot: build-snapshot build-third-party clearsign-snapshot clearsign-third-party snapshot-shasums
+
+build-snapshot:
        git archive --prefix "$(SNAPSHOT)/"  HEAD | tar -xf -
-       ( cd $(SNAPSHOT) && autoconf && PERL=/usr/bin/perl ./configure )
+       ( cd $(SNAPSHOT)                                         && \
+               echo "$(SNAPSHOT)" > .tag                        && \
+               autoconf                                         && \
+               INSTALL=./install-sh PERL=/usr/bin/perl ./configure \
+                   --with-db-type=SQLite                           \
+                   --enable-layout=relative                        \
+                   --with-web-handler=standalone                && \
+               rm -rf autom4te.cache                               \
+                      config.status config.log config.pld          \
+       )
        tar -czf "$(SNAPSHOT).tar.gz" "$(SNAPSHOT)/"
        rm -fr "$(SNAPSHOT)/"
 
-# }}}
+clearsign-snapshot:
+       gpg --armor --detach-sign "$(SNAPSHOT).tar.gz"
+
+build-third-party:
+       git archive --prefix "$(SNAPSHOT)/$(THIRD_PARTY)" HEAD:$(THIRD_PARTY) \
+               | gzip > "$(SNAPSHOT)-third-party-source.tar.gz"
+       rm -rf "$(SNAPSHOT)/$(THIRD_PARTY)"
+
+clearsign-third-party:
+       gpg --armor --detach-sign "$(SNAPSHOT)-third-party-source.tar.gz"
+
+snapshot-shasums:
+       sha1sum $(SNAPSHOT)*.tar.gz*
+
+vessel-import: build-snapshot
+       [ -d $(VESSEL) ] || (echo "VESSEL isn't a path to your shipwright vessel" && exit -1)
+       cp $(VESSEL)/scripts/RT/build.pl /tmp/build.pl
+       ./sbin/rt-test-dependencies --with-standalone --with-fastcgi --with-sqlite --list > /tmp/rt.yml
+       shipwright import file:$(SNAPSHOT).tar.gz \
+    --require-yml /tmp/rt.yml \
+    --build-script /tmp/build.pl \
+    --name RT \
+       --repository fs:$(VESSEL) \
+     --log-level=info \
+     --skip cpan-capitalization,cpan-mod_perl,cpan-Encode,cpan-PPI,cpan-Test-Exception-LessClever,cpan-Test-Manifest,cpan-Test-Object,cpan-Test-Pod,cpan-Test-Requires,cpan-Test-SubCalls,cpan-Test-cpan-Tester,cpan-Test-Warn --skip-all-recommends
+       mv $(VESSEL)/scripts/RT/build  $(VESSEL)/scripts/RT/build.pl
+
+JSMIN_URL = http://download.bestpractical.com/mirror/jsmin-2013-03-29.c
+JSMIN_SHA = 67dc8d73a8878f88cdaeb1a86775872eae5c3077
+
+jsmin: jsmin-checkcc jsmin-fetch jsmin-verify jsmin-confirm jsmin-build jsmin-install
+       @echo ""
+       @echo "To configure RT to use jsmin, add the following line to $(DESTDIR)$(RT_ETC_PATH)/RT_SiteConfig.pm:"
+       @echo ""
+       @echo "    Set(\$$JSMinPath, '$(DESTDIR)$(RT_BIN_PATH)/jsmin');"
+       @echo ""
+
+jsmin-checkcc:
+       @[ -n "$(CC)" ] || (echo "You don't appear to have a C compiler, please set CC and re-run configure" && exit 1)
+
+jsmin-confirm:
+       @echo "jsmin is distributed under a slightly unusual license and can't be shipped"
+       @echo "with RT.  Before configuring RT to use jsmin, please read jsmin's license"
+       @echo "below:"
+       @echo ""
+       @$(PERL) -pe 'print && exit if /^\*\// or /^#include/' jsmin.c
+       @echo ""
+       @echo "Press Enter to accept the license, or Ctrl-C to stop now."
+       @$(PERL) -e '<STDIN>'
+
+jsmin-fetch:
+       @echo ""
+       @echo "Downloading jsmin.c from $(JSMIN_URL)"
+       @echo ""
+       @$(PERL) -MLWP::Simple -e 'exit not is_success(getstore("$(JSMIN_URL)", "jsmin.c"))' \
+               || (echo "Failed to download $(JSMIN_URL)" && exit 1)
+
+jsmin-verify:
+       @$(PERL) -MDigest::SHA -e \
+               'exit not Digest::SHA->new(1)->addfile("jsmin.c")->hexdigest eq "$(JSMIN_SHA)"' \
+               || (echo "Verification of jsmin.c failed! Possible man in the middle?" && exit 1)
+
+jsmin-build:
+       $(CC) -o jsmin jsmin.c
+
+jsmin-install:
+       $(INSTALL) -o $(BIN_OWNER) -g $(RTGROUP) -m 0755 "jsmin" "$(DESTDIR)$(RT_BIN_PATH)/"