Move project version to file, add xS manual page

So far Go applications remain independent to handle Nix's inability
to easily combine them with the CMake part.

There is also no "install" target, because any packagers will want to
adjust installation paths manually, and there is no configure step.
This commit is contained in:
Přemysl Eric Janouch 2023-07-03 08:53:20 +02:00
parent abcff46dc4
commit 6f596f1dcb
Signed by: p
GPG Key ID: A0420B94F92B9493
7 changed files with 73 additions and 25 deletions

View File

@ -1,6 +1,11 @@
# Ubuntu 18.04 LTS and OpenBSD 6.4 # Ubuntu 18.04 LTS and OpenBSD 6.4
cmake_minimum_required (VERSION 3.10) cmake_minimum_required (VERSION 3.10)
project (xK VERSION 1.5.0
file (READ xK-version project_version)
configure_file (xK-version xK-version.tag COPYONLY)
string (STRIP "${project_version}" project_version)
project (xK VERSION "${project_version}"
DESCRIPTION "IRC daemon, bot, TUI client and its web frontend" LANGUAGES C) DESCRIPTION "IRC daemon, bot, TUI client and its web frontend" LANGUAGES C)
# Options # Options
@ -18,9 +23,6 @@ if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-function") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-function")
endif () endif ()
# Version
set (project_version "${PROJECT_VERSION}")
# Try to append commit ID if it follows a version tag. It might be nicer if # Try to append commit ID if it follows a version tag. It might be nicer if
# we could also detect dirty worktrees but that's very hard to get right. # we could also detect dirty worktrees but that's very hard to get right.
# If we didn't need this for CPack, we could use add_custom_command to generate # If we didn't need this for CPack, we could use add_custom_command to generate

1
xK-version Normal file
View File

@ -0,0 +1 @@
1.5.0

1
xS/.gitignore vendored
View File

@ -1,2 +1,3 @@
/xS /xS
/xS-replies.go /xS-replies.go
/xS.1

View File

@ -2,16 +2,15 @@
.SUFFIXES: .SUFFIXES:
AWK = env LC_ALL=C awk AWK = env LC_ALL=C awk
outputs = xS xS-version.go xS-replies.go outputs = xS xS-replies.go xS.1
all: $(outputs) all: $(outputs)
xS: xS.go xS-version.go xS-replies.go xS: xS.go ../xK-version xS-replies.go
go build -o $@ go build -ldflags "-X 'main.projectVersion=$$(cat ../xK-version)'" -o $@
xS-version.go: ../liberty/tools/cmake-parser.awk \
xS-gen-version.awk ../CMakeLists.txt
$(AWK) -f ../liberty/tools/cmake-parser.awk \
-f xS-gen-version.awk ../CMakeLists.txt > $@
xS-replies.go: xS-gen-replies.awk xS-replies xS-replies.go: xS-gen-replies.awk xS-replies
$(AWK) -f xS-gen-replies.awk xS-replies > $@ $(AWK) -f xS-gen-replies.awk xS-replies > $@
xS.1: ../xK-version ../liberty/tools/asciiman.awk xS.adoc
env "asciidoc-release-version=$$(cat ../xK-version)" \
$(AWK) -f ../liberty/tools/asciiman.awk xS.adoc > $@
clean: clean:
rm -f $(outputs) rm -f $(outputs)

View File

@ -1,14 +0,0 @@
# xS-gen-version.awk: extract version information from the CMake script
#
# Copyright (c) 2022, Přemysl Eric Janouch <p@janouch.name>
# SPDX-License-Identifier: 0BSD
Command == "project" {
for (i = 2; i in Args; i++)
if (Args[i] == "VERSION") {
print "package main"
print ""
print "const projectVersion = `" Args[++i] "`"
exit
}
}

57
xS/xS.adoc Normal file
View File

@ -0,0 +1,57 @@
xS(1)
=====
:doctype: manpage
:manmanual: xK Manual
:mansource: xK {release-version}
Name
----
xS - IRC daemon
Synopsis
--------
*xS* [_OPTION_]...
Description
-----------
*xS* is a basic IRC daemon for single-server networks, suitable for testing
and private use. When run without a configuration file, it will start listening
on the standard port 6667 and the "any" address.
Options
-------
*-debug*::
Do not daemonize, print more information on the standard error stream
to help debug various issues.
*-systemd*::
Log using the format specified in *sd-daemon*(3).
*-h*, *-help*::
Display a help message and exit.
*-version*::
Output version information and exit.
*-writedefaultcfg*::
Write a configuration file with defaults, show its path and exit.
+
The file will be appropriately commented.
Files
-----
*xS* follows the XDG Base Directory Specification.
_~/.config/xS/xS.conf_::
_/etc/xdg/xS/xS.conf_::
The daemon's configuration file. Use the *-writedefaultcfg* option
to create a new one for editing.
Reporting bugs
--------------
Use https://git.janouch.name/p/xK to report bugs, request features,
or submit pull requests.
See also
--------
*sd-daemon*(3)

View File

@ -42,6 +42,8 @@ import (
const projectName = "xS" const projectName = "xS"
var projectVersion = "?"
var debugMode = false var debugMode = false
// --- Logging ----------------------------------------------------------------- // --- Logging -----------------------------------------------------------------