murarth avatar 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 ')'
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.