Replace Makefile with redo, keep version in source code

This commit is contained in:
Sergey Matveev 2020-09-05 11:30:25 +03:00
parent 236377e360
commit def58d0f49
10 changed files with 19 additions and 34 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
*.deb
*_tmp
goircd
VERSION

View File

@ -1,3 +0,0 @@
VERSION != git describe --tags
include common.mk

View File

@ -1,20 +0,0 @@
VERSION = $(shell git describe --tags)
BUILD_TMP ?= .rpm_tmp
DEB_MAINTAINER ?= mengzhuo1203@gmail.com
include common.mk
.PHONY: deb
deb:
rm -rf ${BUILD_TMP}
mkdir -p ${BUILD_TMP}/usr/local/bin/
mkdir -p ${BUILD_TMP}/var/log/goircd
mkdir -p ${BUILD_TMP}/etc/systemd/system/
cp goircd ${BUILD_TMP}/usr/local/bin/
cp startup/goircd.service ${BUILD_TMP}/etc/systemd/system/
fpm -s dir -t deb -n goircd -v ${VERSION} \
-m $(DEB_MAINTAINER) \
--deb-compression=bzip2 \
--verbose \
-d logrotate \
-C ${BUILD_TMP}

10
INSTALL
View File

@ -1,6 +1,10 @@
goircd requires only standard Go's libraries and consists of single main
package. You can install it like that:
package. You can install it like either:
* with: go get go.cypherpunks.ru/goircd
* or manually:
$ git clone git://git.cypherpunks.ru/goircd.git
$ make -C goircd
$ goircd/goircd -help
$ cd goircd
$ redo goircd # or just: go build
$ ./goircd -help

2
VERSION.do Normal file
View File

@ -0,0 +1,2 @@
redo-ifchange goircd.go
perl -ne 'print "$1\n" if /Version.*"(.*)"$/' < goircd.go

1
all.do Normal file
View File

@ -0,0 +1 @@
redo-ifchange goircd

View File

@ -1,4 +0,0 @@
LDFLAGS = -X main.version=$(VERSION)
goircd: *.go
go build -ldflags "$(LDFLAGS)"

View File

@ -230,7 +230,7 @@ func ClientRegister(client *Client, cmd string, cols []string) {
}
client.registered = true
client.ReplyNicknamed("001", "Hi, welcome to IRC")
client.ReplyNicknamed("002", "Your host is "+*hostname+", running goircd "+version)
client.ReplyNicknamed("002", "Your host is "+*hostname+", running goircd "+Version)
client.ReplyNicknamed("003", "This server was created sometime")
client.ReplyNicknamed("004", *hostname+" goircd o o")
SendLusers(client)
@ -562,7 +562,7 @@ func Processor(events chan ClientEvent, finished chan struct{}) {
} else {
debug = ""
}
client.ReplyNicknamed("351", fmt.Sprintf("%s.%s %s :", version, debug, *hostname))
client.ReplyNicknamed("351", fmt.Sprintf("%s.%s %s :", Version, debug, *hostname))
default:
client.ReplyNicknamed("421", cmd, "Unknown command")
}

2
goircd.do Normal file
View File

@ -0,0 +1,2 @@
redo-ifchange *.go
${GO:-go} build -o $3

View File

@ -28,8 +28,9 @@ import (
"strings"
)
const Version = "1.8.2"
var (
version string
hostname = flag.String("hostname", "localhost", "Hostname")
bind = flag.String("bind", ":6667", "Address to bind to")
motd = flag.String("motd", "", "Path to MOTD file")
@ -71,7 +72,7 @@ func Run() {
log.Println(*logdir, "logger initialized")
}
log.Println("goircd " + version + " is starting")
log.Println("goircd " + Version + " is starting")
if *statedir == "" {
// Dummy statekeeper
go func() {