Commits

murarth committed 152816f

Added build script

Comments (0)

Files changed (5)

 syntax: glob
-
-# Compiled code
-goircd-bin
-*.[568ao]
+# Build directory
+build
 # Generated source file
 version.go
 	}
 
 	sigIncoming := make(chan os.Signal, 5)
-	signal.Notify(sigIncoming)
+	signal.Notify(sigIncoming, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM)
 
 	for {
 		select {
 	"path"
 )
 
+func usage() {
+	fmt.Fprintln(os.Stderr, "GoIRCd", VERSION_NUMBER)
+	flag.PrintDefaults()
+}
+
 func main() {
 	var baseDir string
 	var config string
 
+	flag.Usage = usage
+
 	flag.StringVar(&config, "c", "",
 		"Alternate config file (default {basedir}/conf/goircd.conf)")
 	flag.StringVar(&baseDir, "d", "",
+#!/bin/sh
+
+set -e
+
+ORIG_DIR="`pwd`"
+SRC_DIR="`dirname "$0"`"
+BUILD_DIR="$SRC_DIR/build/goircd"
+
+"$SRC_DIR/mkversion.sh" > "$SRC_DIR/version.go"
+
+if [ ! -e "$BUILD_DIR" ]; then
+	echo >&2 'Creating build directory...'
+	mkdir -p "$BUILD_DIR"
+	cd "$BUILD_DIR"
+
+	# Link all source files here
+	ln -s \
+		../../*.go \
+		../../commands/cmd_*.go \
+		../../modes/?mode_*.go \
+		../../modules/m_*.go \
+		.
+
+	echo >&2 'Done'
+	cd "$ORIG_DIR"
+fi
+
+cd "$BUILD_DIR"
+go build
 echo
 echo 'const ('
 echo '	VERSION = "GoIRCd-0.1"'
+echo '	VERSION_NUMBER = "0.1"'
 echo "	COMPILE_TIME = \"`date +'%H:%M:%S %b %d %Y'`\""
 echo ')'