--- /dev/null
+# $Id$
+lappend components "CVS" "CVS Integration" "1.00"
--- /dev/null
+# $Id$
+lappend components "Subversion" "Subversion Integration" "1.00"
--- /dev/null
+# $Id$
+
+PREFIX = /usr/local
+REPLACE = sed "s%@@PREFIX@@%$(PREFIX)%g"
+
+.PHONY: install
+
+install: Components/* Tool/* koakuma.cgi.in
+ mkdir -p $(PREFIX)/lib/koakuma/components/
+ mkdir -p $(PREFIX)/lib/koakuma/htdocs/static/
+ mkdir -p $(PREFIX)/etc/koakuma/
+ mkdir -p $(PREFIX)/lib/koakuma/cgi-bin/
+ mkdir -p $(PREFIX)/bin/
+ cp -rf Components/* $(PREFIX)/lib/koakuma/components/
+ cp -rf Tool/* $(PREFIX)/bin/
+ cp -rf koakuma.png $(PREFIX)/lib/koakuma/htdocs/static/
+ $(REPLACE) koakuma.cgi.in > $(PREFIX)/lib/koakuma/cgi-bin/koakuma.cgi
+ $(REPLACE) apache.conf.in > $(PREFIX)/etc/koakuma/apache.conf
+ chmod +x $(PREFIX)/lib/koakuma/cgi-bin/koakuma.cgi
+ chmod +x $(PREFIX)/bin/create-task
+ chmod +x $(PREFIX)/bin/launch-job
--- /dev/null
+#!/usr/bin/env tclsh
+# $Id$
--- /dev/null
+#!/usr/bin/env tclsh
+# $Id$
--- /dev/null
+# $Id$
+# vim: syntax=apache
+
+DocumentRoot @@PREFIX@@/lib/koakuma/htdocs
+<Directory @@PREFIX@@/lib/koakuma/htdocs>
+ Require all granted
+</Directory>
+<Directory @@PREFIX@@/lib/koakuma/cgi-bin>
+ Options +ExecCGI
+ Require all granted
+</Directory>
+ScriptAlias /koakuma @@PREFIX@@/lib/koakuma/cgi-bin/koakuma.cgi
+
+RewriteEngine on
+RewriteRule ^/$ /koakuma [END,NE,R=permanent]
--- /dev/null
+#!/usr/bin/env tclsh
+# $Id$
+
+set KOAKUMA_VERSION "1.00"
+set components ""
+
+proc exiting {code} {
+ exit $code
+}
+
+proc crash {reason} {
+ global components KOAKUMA_VERSION
+ puts stderr "----- Start Koakuma Crash dump log -----"
+ puts stderr "Included components:"
+ foreach {name description version} $components {
+ puts stderr " $name: $description, version $version"
+ }
+ puts stderr "Reason: $reason"
+ puts stderr "----- End Koakuma Crash dump log -----"
+ puts "Content-Type: text/html"
+ puts "Status: 500 Internal Server Error"
+ puts ""
+ puts "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">"
+ puts "<html>"
+ puts " <head>"
+ puts " <meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">"
+ puts " <title>Oops</title>"
+ puts " </head>"
+ puts " <body>"
+ puts " <h1>Oops</h1>"
+ puts " <hr>"
+ puts " Koakuma version $KOAKUMA_VERSION crashed, reason: <code>$reason</code><br>"
+ puts " See the server error log for details."
+ puts " </body>"
+ puts "</html>"
+ exiting 1
+}
+
+foreach path [glob @@PREFIX@@/lib/koakuma/components/*.tcl] {
+ source "$path"
+}
+
+proc start_html {title} {
+ puts "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"
+ puts "<html>"
+ puts " <head>"
+ puts " <meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">"
+ puts " <title>$title - Koakuma</title>"
+ puts " </head>"
+ puts " <body>"
+}
+proc end_html {} {
+ puts " </body>"
+ puts "</html>"
+}