aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore13
-rw-r--r--Makefile73
-rw-r--r--doc/urubu.en.0.adoc5
-rwxr-xr-xmkdeps.sh32
-rw-r--r--po/doc/de.po22
-rw-r--r--po/doc/doc.pot21
-rw-r--r--po/doc/eo.po22
-rw-r--r--po/doc/es.po22
-rw-r--r--po/doc/fr.po22
-rw-r--r--po/doc/note.txt5
-rw-r--r--po/doc/po4a.cfg5
-rw-r--r--po/doc/pt.po22
-rw-r--r--po/urubu/de.po10
-rw-r--r--po/urubu/eo.po10
-rw-r--r--po/urubu/es.po10
-rw-r--r--po/urubu/fr.po10
-rw-r--r--po/urubu/po4a.cfg3
-rw-r--r--po/urubu/pt.po10
-rw-r--r--po/urubu/urubu.pot10
-rw-r--r--src/urubu.go17
-rw-r--r--tests/urubu.go5
21 files changed, 314 insertions, 35 deletions
diff --git a/.gitignore b/.gitignore
index 44e1343..ba92f54 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,8 @@
-/src/version.go
+/doc/*
+!/doc/*.en.*.adoc
+/po/*/*.mo
+/src/meta.go
/*.bin
-/*.db*
/src/*.a
/src/*.bin
/src/*cgo*
@@ -8,18 +10,11 @@
/tests/*.bin
/tests/functional/*/*.a
/tests/functional/*/*.bin
-/tests/functional/*/*.go.db*
/tests/fuzz/*/*.a
/tests/fuzz/*/*.bin
/tests/benchmarks/*/*.a
/tests/benchmarks/*/*.bin
/tests/benchmarks/*/*.txt
/tests/fuzz/corpus/
-
*.a
*.bin
-/src/urubu/cmd/*.bin
-
-
-
-spec/grammar/clexspec.json
diff --git a/Makefile b/Makefile
index c699027..7982f53 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,6 @@ DATE = 1970-01-01
VERSION = 0.1.0
NAME = urubu
NAME_UC = $(NAME)
-LANGUAGES = en
## Installation prefix. Defaults to "/usr".
PREFIX = /usr
BINDIR = $(PREFIX)/bin
@@ -24,28 +23,37 @@ GOLDFLAGS = -L $(GOLIBDIR)
.SUFFIXES:
-.SUFFIXES: .go .a .bin .bin-check
+.SUFFIXES: .go .a .bin .bin-check .adoc .po .mo
.go.a:
go tool compile -I $(@D) $(GOCFLAGS) -o $@ -p $(*F) \
`find $< $$(if [ $(*F) != main ]; then \
- echo src/$(NAME).go src/version.go; fi) | uniq`
+ echo src/$(NAME).go src/meta.go; fi) | uniq`
.a.bin:
go tool link -L $(@D) $(GOLDFLAGS) -o $@ --extldflags '$(LDLIBS)' $<
+.adoc:
+ asciidoctor -b manpage -o $@ $<
+
+.po.mo:
+ msgfmt -cfv -o $@ $<
+
all:
include deps.mk
-libs.a = $(libs.go:.go=.a)
-mains.a = $(mains.go:.go=.a)
-mains.bin = $(mains.go:.go=.bin)
-functional-tests/lib.a = $(functional-tests/lib.go:.go=.a)
-fuzz-targets/lib.a = $(fuzz-targets/lib.go:.go=.a)
-benchmarks/lib.a = $(benchmarks/lib.go:.go=.a)
+libs.a = $(libs.go:.go=.a)
+mains.a = $(mains.go:.go=.a)
+mains.bin = $(mains.go:.go=.bin)
+functional/lib.a = $(functional/lib.go:.go=.a)
+fuzz/lib.a = $(fuzz/lib.go:.go=.a)
+benchmarks/lib.a = $(benchmarks/lib.go:.go=.a)
+manpages.N.adoc = $(manpages.en.N.adoc) $(manpages.XX.N.adoc)
+manpages.N = $(manpages.N.adoc:.adoc=)
+sources.mo = $(sources.po:.po=.mo)
existing = \
src/urubu/utf8 \
@@ -107,7 +115,7 @@ xtmains.bin = $(xtmains:.go=.bin)
sources = \
src/$(NAME).go \
- src/version.go \
+ src/meta.go \
src/main.go \
@@ -118,11 +126,14 @@ derived-assets = \
$(existing.a) \
$(xmains.a) \
$(xmains.bin) \
- src/version.go \
+ src/meta.go \
$(libs.a) \
$(mains.a) \
$(mains.bin) \
$(NAME).bin \
+ $(manpages.XX.N.adoc) \
+ $(manpages.N) \
+ $(sources.mo) \
side-assets = \
tests/fuzz/corpus/ \
@@ -137,7 +148,7 @@ all: $(derived-assets)
$(existing.a) $(xmains.a): Makefile deps.mk
$(libs.a): Makefile deps.mk
-$(libs.a): src/$(NAME).go src/version.go
+$(libs.a): src/$(NAME).go src/meta.go
$(existing.a):
@@ -159,21 +170,27 @@ $(xtmains.a):
$(xtmains.bin):
go tool link -L $(@D) -L src -o $@ --extldflags '$(LDLIBS)' $*.a
-$(fuzz-targets/lib.a):
+$(fuzz/lib.a):
go tool compile $(GOCFLAGS) -o $@ -p $(NAME) -d=libfuzzer \
- $*.go src/$(NAME).go src/version.go
+ $*.go src/$(NAME).go src/meta.go
-src/version.go: Makefile
- echo 'package $(NAME); const Version = "$(VERSION)"' > $@
+src/meta.go: Makefile
+ echo 'package $(NAME)' > $@
+ echo 'const Version = "$(VERSION)"' >> $@
+ echo 'const Name = "$(NAME)"' >> $@
+ echo 'const LOCALEDIR = "$(LOCALEDIR)"' >> $@
$(NAME).bin: src/main.bin
ln -fs src/main.bin $@
+$(manpages.XX.N.adoc): po/doc/po4a.cfg
+ po4a --no-update --translate-only $@ po/doc/po4a.cfg
+
tests.bin-check = \
tests/main.bin-check \
- $(functional-tests/main.go:.go=.bin-check) \
+ $(functional/main.go:.go=.bin-check) \
$(xtmains:.go=.bin-check) \
$(tests.bin-check):
@@ -203,12 +220,12 @@ check: check-unit check-integration
FUZZSEC=1
-fuzz-targets/main.bin-check = $(fuzz-targets/main.go:.go=.bin-check)
-$(fuzz-targets/main.bin-check):
+fuzz/main.bin-check = $(fuzz/main.go:.go=.bin-check)
+$(fuzz/main.bin-check):
$(EXEC)$*.bin --test.fuzztime=$(FUZZSEC)s \
--test.fuzz='.*' --test.fuzzcachedir=tests/fuzz/corpus
-fuzz: $(fuzz-targets/main.bin-check)
+fuzz: $(fuzz/main.bin-check)
@@ -222,6 +239,17 @@ bench: $(benchmarks/main.bin-check)
+i18n-doc:
+ po4a po/doc/po4a.cfg
+
+i18n-code:
+ gotext src/$(NAME).go > po/$(NAME)/$(NAME).pot
+ po4a po/$(NAME)/po4a.cfg
+
+i18n: i18n-doc i18n-code
+
+
+
## Remove *all* derived artifacts produced during the build.
## A dedicated test asserts that this is always true.
clean:
@@ -239,6 +267,8 @@ install: all
cp $(NAME).bin '$(DESTDIR)$(BINDIR)'/$(NAME)
cp src/$(NAME).a '$(DESTDIR)$(GOLIBDIR)'
cp $(sources) '$(DESTDIR)$(SRCDIR)'
+ instool '$(DESTDIR)$(MANDIR)' install man $(manpages.N)
+ instool '$(DESTDIR)$(LOCALEDIR)' install mo $(sources.mo)
## Uninstalls from $(DESTDIR)$(PREFIX). This is a perfect mirror
## of the "install" target, and removes *all* that was installed.
@@ -249,6 +279,9 @@ uninstall:
'$(DESTDIR)$(GOLIBDIR)'/$(NAME).a \
'$(DESTDIR)$(SRCDIR)' \
+ instool '$(DESTDIR)$(MANDIR)' uninstall man $(manpages.N)
+ instool '$(DESTDIR)$(LOCALEDIR)' uninstall mo $(sources.mo)
+
ALWAYS:
diff --git a/doc/urubu.en.0.adoc b/doc/urubu.en.0.adoc
new file mode 100644
index 0000000..33b21bb
--- /dev/null
+++ b/doc/urubu.en.0.adoc
@@ -0,0 +1,5 @@
+= urubu(0)
+
+== NAME
+
+urubu - .
diff --git a/mkdeps.sh b/mkdeps.sh
index e8da8a4..ae6fffc 100755
--- a/mkdeps.sh
+++ b/mkdeps.sh
@@ -5,21 +5,41 @@ export LANG=POSIX.UTF-8
libs() {
- find src tests -name '*.go' | grep -v '/main\.go$' |
- grep -v '/version\.go$'
+ find src tests -name '*.go' |
+ grep -Ev '/(main|meta)\.go$' |
+ grep -Ev '/_cgo_(import|gotypes)\.go$' |
+ grep -Ev '\.cgo1\.go$'
}
mains() {
find src tests -name '*.go' | grep '/main\.go$'
}
+docs() {
+ find doc/*.en.*.adoc
+}
+
+xdocs() {
+ for l in `find po/doc/*.po | xargs -I% basename % .po`; do
+ docs | sed 's|/\(.*\)\.en\.\(.*\)$|/\1.'"$l"'.\2|'
+ done
+}
+
+pos() {
+ find po/ -name '*.po' | grep -Ev '^po/(doc|tests)/'
+}
+
+
libs | varlist 'libs.go'
mains | varlist 'mains.go'
+docs | varlist 'manpages.en.N.adoc'
+xdocs | varlist 'manpages.XX.N.adoc'
+pos | varlist 'sources.po'
-find tests/functional/*/*.go -not -name main.go | varlist 'functional-tests/lib.go'
-find tests/functional/*/main.go | varlist 'functional-tests/main.go'
-find tests/fuzz/*/*.go -not -name main.go | varlist 'fuzz-targets/lib.go'
-find tests/fuzz/*/main.go | varlist 'fuzz-targets/main.go'
+find tests/functional/*/*.go -not -name main.go | varlist 'functional/lib.go'
+find tests/functional/*/main.go | varlist 'functional/main.go'
+find tests/fuzz/*/*.go -not -name main.go | varlist 'fuzz/lib.go'
+find tests/fuzz/*/main.go | varlist 'fuzz/main.go'
find tests/benchmarks/*/*.go -not -name main.go | varlist 'benchmarks/lib.go'
find tests/benchmarks/*/main.go | varlist 'benchmarks/main.go'
diff --git a/po/doc/de.po b/po/doc/de.po
new file mode 100644
index 0000000..ab906a1
--- /dev/null
+++ b/po/doc/de.po
@@ -0,0 +1,22 @@
+msgid ""
+msgstr ""
+"Language: de\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#. type: Title =
+#: doc/urubu.en.0.adoc:1
+#, no-wrap
+msgid "urubu(0)"
+msgstr ""
+
+#. type: Title ==
+#: doc/urubu.en.0.adoc:3
+#, no-wrap
+msgid "NAME"
+msgstr ""
+
+#. type: Plain text
+#: doc/urubu.en.0.adoc:5
+msgid "urubu - ."
+msgstr ""
diff --git a/po/doc/doc.pot b/po/doc/doc.pot
new file mode 100644
index 0000000..d1e460b
--- /dev/null
+++ b/po/doc/doc.pot
@@ -0,0 +1,21 @@
+msgid ""
+msgstr ""
+"Language: \n"
+"Content-Type: text/plain; charset=UTF-8\n"
+
+#. type: Title =
+#: doc/urubu.en.0.adoc:1
+#, no-wrap
+msgid "urubu(0)"
+msgstr ""
+
+#. type: Title ==
+#: doc/urubu.en.0.adoc:3
+#, no-wrap
+msgid "NAME"
+msgstr ""
+
+#. type: Plain text
+#: doc/urubu.en.0.adoc:5
+msgid "urubu - ."
+msgstr ""
diff --git a/po/doc/eo.po b/po/doc/eo.po
new file mode 100644
index 0000000..9cce5d4
--- /dev/null
+++ b/po/doc/eo.po
@@ -0,0 +1,22 @@
+msgid ""
+msgstr ""
+"Language: eo\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#. type: Title =
+#: doc/urubu.en.0.adoc:1
+#, no-wrap
+msgid "urubu(0)"
+msgstr ""
+
+#. type: Title ==
+#: doc/urubu.en.0.adoc:3
+#, no-wrap
+msgid "NAME"
+msgstr ""
+
+#. type: Plain text
+#: doc/urubu.en.0.adoc:5
+msgid "urubu - ."
+msgstr ""
diff --git a/po/doc/es.po b/po/doc/es.po
new file mode 100644
index 0000000..3f4b2ec
--- /dev/null
+++ b/po/doc/es.po
@@ -0,0 +1,22 @@
+msgid ""
+msgstr ""
+"Language: es\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#. type: Title =
+#: doc/urubu.en.0.adoc:1
+#, no-wrap
+msgid "urubu(0)"
+msgstr ""
+
+#. type: Title ==
+#: doc/urubu.en.0.adoc:3
+#, no-wrap
+msgid "NAME"
+msgstr ""
+
+#. type: Plain text
+#: doc/urubu.en.0.adoc:5
+msgid "urubu - ."
+msgstr ""
diff --git a/po/doc/fr.po b/po/doc/fr.po
new file mode 100644
index 0000000..7e2e1f7
--- /dev/null
+++ b/po/doc/fr.po
@@ -0,0 +1,22 @@
+msgid ""
+msgstr ""
+"Language: fr\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#. type: Title =
+#: doc/urubu.en.0.adoc:1
+#, no-wrap
+msgid "urubu(0)"
+msgstr ""
+
+#. type: Title ==
+#: doc/urubu.en.0.adoc:3
+#, no-wrap
+msgid "NAME"
+msgstr ""
+
+#. type: Plain text
+#: doc/urubu.en.0.adoc:5
+msgid "urubu - ."
+msgstr ""
diff --git a/po/doc/note.txt b/po/doc/note.txt
new file mode 100644
index 0000000..45279a4
--- /dev/null
+++ b/po/doc/note.txt
@@ -0,0 +1,5 @@
+PO4A-HEADER: mode=eof
+
+
+
+// Generated from po4a(1).
diff --git a/po/doc/po4a.cfg b/po/doc/po4a.cfg
new file mode 100644
index 0000000..1255fca
--- /dev/null
+++ b/po/doc/po4a.cfg
@@ -0,0 +1,5 @@
+[options] --keep 0 --master-charset UTF-8 --localized-charset UTF-8 --addendum-charset UTF-8
+
+[po_directory] po/doc
+
+[type: asciidoc] doc/urubu.en.0.adoc $lang:doc/urubu.$lang.0.adoc
diff --git a/po/doc/pt.po b/po/doc/pt.po
new file mode 100644
index 0000000..d789ae9
--- /dev/null
+++ b/po/doc/pt.po
@@ -0,0 +1,22 @@
+msgid ""
+msgstr ""
+"Language: pt\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#. type: Title =
+#: doc/urubu.en.0.adoc:1
+#, no-wrap
+msgid "urubu(0)"
+msgstr ""
+
+#. type: Title ==
+#: doc/urubu.en.0.adoc:3
+#, no-wrap
+msgid "NAME"
+msgstr ""
+
+#. type: Plain text
+#: doc/urubu.en.0.adoc:5
+msgid "urubu - ."
+msgstr ""
diff --git a/po/urubu/de.po b/po/urubu/de.po
new file mode 100644
index 0000000..fbb8487
--- /dev/null
+++ b/po/urubu/de.po
@@ -0,0 +1,10 @@
+msgid ""
+msgstr ""
+"Language: de\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: src/urubu.go:15
+#, c-format
+msgid "Usage: %s\n"
+msgstr ""
diff --git a/po/urubu/eo.po b/po/urubu/eo.po
new file mode 100644
index 0000000..e2533c1
--- /dev/null
+++ b/po/urubu/eo.po
@@ -0,0 +1,10 @@
+msgid ""
+msgstr ""
+"Language: eo\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: src/urubu.go:15
+#, c-format
+msgid "Usage: %s\n"
+msgstr ""
diff --git a/po/urubu/es.po b/po/urubu/es.po
new file mode 100644
index 0000000..62b856f
--- /dev/null
+++ b/po/urubu/es.po
@@ -0,0 +1,10 @@
+msgid ""
+msgstr ""
+"Language: es\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: src/urubu.go:15
+#, c-format
+msgid "Usage: %s\n"
+msgstr ""
diff --git a/po/urubu/fr.po b/po/urubu/fr.po
new file mode 100644
index 0000000..5ac18a6
--- /dev/null
+++ b/po/urubu/fr.po
@@ -0,0 +1,10 @@
+msgid ""
+msgstr ""
+"Language: fr\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#: src/urubu.go:15
+#, c-format
+msgid "Usage: %s\n"
+msgstr ""
diff --git a/po/urubu/po4a.cfg b/po/urubu/po4a.cfg
new file mode 100644
index 0000000..22893b1
--- /dev/null
+++ b/po/urubu/po4a.cfg
@@ -0,0 +1,3 @@
+[options] --keep 0 --master-charset UTF-8 --localized-charset UTF-8 --addendum-charset UTF-8
+
+[po_directory] po/urubu
diff --git a/po/urubu/pt.po b/po/urubu/pt.po
new file mode 100644
index 0000000..9e4e0db
--- /dev/null
+++ b/po/urubu/pt.po
@@ -0,0 +1,10 @@
+msgid ""
+msgstr ""
+"Language: pt\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: src/urubu.go:15
+#, c-format
+msgid "Usage: %s\n"
+msgstr ""
diff --git a/po/urubu/urubu.pot b/po/urubu/urubu.pot
new file mode 100644
index 0000000..e377823
--- /dev/null
+++ b/po/urubu/urubu.pot
@@ -0,0 +1,10 @@
+msgid ""
+msgstr ""
+"Language: \n"
+"Content-Type: text/plain; charset=UTF-8\n"
+
+#: src/urubu.go:15
+#, c-format
+msgid "Usage: %s\n"
+msgstr ""
+
diff --git a/src/urubu.go b/src/urubu.go
index 024989a..41ec5a7 100644
--- a/src/urubu.go
+++ b/src/urubu.go
@@ -1,5 +1,22 @@
package urubu
+import (
+ "fmt"
+ "io"
+
+ gt "gotext"
+)
+
+
+
+func usage(argv0 string, w io.Writer) {
+ fmt.Fprintf(
+ w,
+ gt.Gettext("Usage: %s\n"),
+ argv0,
+ )
+}
+
func Main() {
diff --git a/tests/urubu.go b/tests/urubu.go
index e36fe88..d2980ad 100644
--- a/tests/urubu.go
+++ b/tests/urubu.go
@@ -1,6 +1,11 @@
package urubu
+import (
+ g "gobang"
+)
+
func MainTest() {
+ g.Init()
}