commit cb11302ca643bbb042a84f1e4784202c0f9a1252 from: Thomas Adam date: Fri Dec 30 22:46:45 2022 UTC portable: gotwebd: use template This updates -portable's gotwebd instance to make use of the new templating engine. commit - 46ecc01f5bf28403be0e41b8438bfbec24faadef commit + cb11302ca643bbb042a84f1e4784202c0f9a1252 blob - 8bc4768e0bb9e81408c523c47cc582c1469e331f blob + 93b03019f080922a7b1ede96f4a85eaad1db446f --- .gitignore +++ .gitignore @@ -1,17 +1,17 @@ +**/*.Po +**/*.a +**/*.core +**/*.o **/*.orig +**/*~ +**/.deps/* +**/.dirstamp **/Makefile **/Makefile.in **/Makefile.linux +**/core **/obj **/tags -**/*.core -**/core -**/*.o -**/*.Po -**/*.a -**/.dirstamp -**/.deps/* -**/*~ .ccls-cache/* .deps/* Makefile.common @@ -24,6 +24,7 @@ etc/* got/got gotadmin/gotadmin gotwebd/gotwebd +gotwebd/pages.c gotwebd/parse.c libexec/got-fetch-pack/got-fetch-pack libexec/got-index-pack/got-index-pack @@ -43,4 +44,6 @@ regress/deltify/deltify_test regress/fetch/fetch_test regress/idset/idset_test regress/path/path_test +template/parse.c +template/template tog/tog blob - b1ff29cbfba069de4f12cd8a9c9f07e52dd41e65 blob + 7215f7f2467e57bd13c5b7ddc7860e96fb842a9b --- Makefile.am +++ Makefile.am @@ -1,5 +1,5 @@ -SUBDIRS = compat libexec got tog gotadmin gotwebd -# TODO: gotd gotsh +SUBDIRS = compat libexec got tog gotadmin template gotwebd +# TODO: gotd gotsh template include $(top_builddir)/Makefile.common blob - ff4b87670004b40d8e5c3cf5d7c7ba5b14994861 blob + 987ad067c1516667b4cef8de39e25bf73e77577e --- Makefile.common.in +++ Makefile.common.in @@ -21,4 +21,5 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/compat \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/include \ + -I$(top_srcdir)/template \ -I. blob - 74d3de0d03d035f18a8b05a2b792e4ad7b57f973 blob + 5cbed704667c0074ac83e8335515f5a52f564c63 --- configure.ac +++ configure.ac @@ -685,6 +685,7 @@ AC_CONFIG_FILES([Makefile got/Makefile gotadmin/Makefile gotwebd/Makefile + template/Makefile tog/Makefile Makefile.common:Makefile.common.in]) AC_OUTPUT blob - 10509966db2d55117a8aa60d968ee5fb6660789b blob + a49f3ce3dbfa1af8e9f1a057a08b54b718de3a48 --- gotwebd/Makefile.am +++ gotwebd/Makefile.am @@ -2,6 +2,12 @@ sbin_PROGRAMS = gotwebd include $(top_builddir)/Makefile.common +# /home/n6tadam/projects/got/gotwebd/../template/template -o pages.c pages.tmpl + +SUFFIXES: .tmpl +.tmpl.c: + $(top_srcdir)/template/template -o pages.c pages.tmpl + gotwebd_SOURCES = config.c \ $(top_srcdir)/lib/blame.c \ $(top_srcdir)/lib/bloom.c \ @@ -51,11 +57,13 @@ gotwebd_SOURCES = config.c \ $(top_srcdir)/lib/utf8.c \ $(top_srcdir)/lib/worktree.c \ $(top_srcdir)/lib/worktree_open.c \ + $(top_srcdir)/template/tmpl.c \ fcgi.c \ got_operations.c \ gotweb.c \ gotwebd.c \ log.c \ + pages.tmpl \ parse.y \ proc.c \ sockets.c @@ -72,7 +80,8 @@ EXTRA_DIST = $(top_srcdir)/gotwebd/*.h \ man5_MANS = gotwebd.conf.5 man8_MANS = gotwebd.8 -LDADD = -L$(top_builddir)/compat -lopenbsd-compat -lm +LDADD = -L$(top_builddir)/compat -L$(top_builddir)/template \ + -lopenbsd-compat -lm if HOST_FREEBSD LDADD += -lmd endif blob - 496645105ab3ccefd1837eaa9e57b785168829b2 blob + 71c7906a3dad2cd5249bd9b1605853ad1d258dab --- gotwebd/gotweb.c +++ gotwebd/gotweb.c @@ -46,6 +46,8 @@ #include "got_commit_graph.h" #include "got_blame.h" #include "got_privsep.h" + +#include "got_compat.h" #include "proc.h" #include "gotwebd.h" blob - c54fe3683dc1d915d6d3fa880753b93adc5252e5 blob + f7b430c6ddc57fe8b534234ef999b266f3db35ce --- gotwebd/gotwebd.h +++ gotwebd/gotwebd.h @@ -23,6 +23,8 @@ #include #include + +#include "tmpl.h" #ifdef DEBUG #define dprintf(x...) do { log_debug(x); } while(0) blob - 7e95545a3d5b04f4123fd275efd2ad5186d17885 (mode 644) blob + /dev/null --- template/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -PROG= template -SRCS= template.c tmpl.c parse.y - -MAN= template.1 template.7 - -.include blob - /dev/null blob + 292681fedf13fdfbd9b6be5c31b9c9074aa66fd4 (mode 644) --- /dev/null +++ template/Makefile.am @@ -0,0 +1,17 @@ +bin_PROGRAMS = template + +include $(top_builddir)/Makefile.common + +template_SOURCES = template.c \ + tmpl.c \ + parse.y + +template_DEPENDENCIES = $(top_builddir)/compat/libopenbsd-compat.a + +man1_MANS = template.1 +man7_MANS = template.7 + +LDADD = -L$(top_builddir)/compat -lopenbsd-compat -lpthread -lm +if HOST_FREEBSD +LDADD += -lmd +endif blob - 1bebb961c5e733837754ec787917a8b8d6bdc572 blob + 3077f08088a85de54324db2cd16bf37f9c1b867c --- template/parse.y +++ template/parse.y @@ -33,6 +33,8 @@ #include #include #include + +#include "got_compat.h" #ifndef nitems #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) blob - d8f3e5383a96a5faf569ee9b566218d8f14189c1 blob + 0c5031c03e0b09bc23862db57030475dcd114da4 --- template/template.c +++ template/template.c @@ -19,6 +19,8 @@ #include #include +#include "got_compat.h" + int parse(FILE *, const char *); int nodebug;