Add "servald version" command and "make copyright"

New COPYRIGHT.txt is regenerated manually using "make copyright" which
invokes the sp-copyright-tool utility from the serval-tools repo.
This commit is contained in:
Andrew Bettison 2013-12-05 13:21:58 +10:30
parent 5226e47ef6
commit 9c124c8ba8
5 changed files with 38 additions and 3 deletions

7
COPYRIGHT.txt Normal file
View File

@ -0,0 +1,7 @@
Portions Copyright (C) 2010-2013 Serval Project Inc.
Portions Copyright (C) 2010-2013 Paul Gardner-Stephen
Portions Copyright (C) 2000-2001 Aaron D. Gifford
Portions Copyright (C) 2010-2012 Serval Project Pty Limited
Portions Copyright (C) 2006-2008 Linpro AS
Portions Copyright (C) 2012 Andrew Tridgell, All Rights Reserved
Portions Copyright (C) 2006 Verdens Gang AS

View File

@ -95,10 +95,11 @@ sqlite-amalgamation-3070900/sqlite3.o: sqlite-amalgamation-3070900/sqlite3.c
@echo CC $<
@$(CC) $(CFLAGS) $(DEFS) -c $< -o sqlite-amalgamation-3070900/sqlite3.o
version.o: *.h *.c version_string.sh
version.o: *.h *.c version_string.sh COPYRIGHT.txt Makefile
@echo CC version_servald.c
@V=`./version_string.sh --ignore-untracked` \
&& $(CC) -c version_servald.c -o $@ -DSERVALD_VERSION="\"$$V\""
&& C="`sed -e :a -e N -e '$$!ba' -e 's/[\\\\"]/\\\\&/g' -e 's/\\n/\\\\n/g' COPYRIGHT.txt`" \
&& $(CC) -c version_servald.c -o $@ -DSERVALD_VERSION="\"$$V\"" -DSERVALD_COPYRIGHT="\"$$C\""
%.o: %.c
@echo CC $<
@ -128,6 +129,14 @@ config_test: config_test.o conf_om.o conf_schema.o conf_parse.o str.o strbuf.o s
@echo LINK $@
@$(CC) $(CFLAGS) -Wall -o $@ config_test.o conf_om.o conf_schema.o conf_parse.o str.o strbuf.o strbuf_helpers.o mem.o dataformats.o net.o log_util.o
copyright: COPYRIGHT.txt
findPATH = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH)))))
COPYRIGHT_TOOL := $(call findPATH,sp-copyright-tool)
COPYRIGHT.txt: *.c *.h $(COPYRIGHT_TOOL)
$(COPYRIGHT_TOOL) -o $@ condense *.c *.h
# This does not build on 64 bit elf platforms as NaCL isn't built with -fPIC
# DOC 20120615
libservald.so: $(OBJS) version.o

View File

@ -56,6 +56,17 @@ int commandline_usage(const struct cli_parsed *parsed, struct cli_context *conte
return cli_usage_parsed(parsed, XPRINTF_STDIO(stdout));
}
int version_message(const struct cli_parsed *parsed, struct cli_context *context)
{
printf("Serval DNA version %s\n%s\n", version_servald, copyright_servald);
printf("\
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.\n\
This is free software: you are free to change and redistribute it.\n\
There is NO WARRANTY, to the extent permitted by law.\n\
");
return 0;
}
/* Data structures for accumulating output of a single JNI call.
*/
@ -2871,6 +2882,8 @@ int app_network_scan(const struct cli_parsed *parsed, struct cli_context *contex
struct cli_schema command_line_options[]={
{commandline_usage,{"help|-h|--help","...",NULL},CLIFLAG_PERMISSIVE_CONFIG,
"Display command usage."},
{version_message,{"version|copyright"},CLIFLAG_PERMISSIVE_CONFIG,
"Display copyright information."},
{app_echo,{"echo","[-e]","[--]","...",NULL},CLIFLAG_PERMISSIVE_CONFIG,
"Output the supplied string."},
{app_log,{"log","error|warn|hint|info|debug","<message>",NULL},CLIFLAG_PERMISSIVE_CONFIG,

View File

@ -139,6 +139,7 @@ struct in_addr {
extern const char version_servald[];
extern const char copyright_servald[];
/* Fundamental types.
*/

View File

@ -1,5 +1,5 @@
/*
Serval DNA version string
Serval DNA version and copyright strings
Copyright (C) 2013 Serval Project Inc.
This program is free software; you can redistribute it and/or
@ -21,4 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#error "SERVALD_VERSION is not defined"
#endif
#ifndef SERVALD_COPYRIGHT
#error "SERVALD_COPYRIGHT is not defined"
#endif
const char version_servald[] = SERVALD_VERSION;
const char copyright_servald[] = SERVALD_COPYRIGHT;