summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--cqrlogo.c8
2 files changed, 8 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 1e3c2e2..8ea936a 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,7 @@ CP := cp
RM := rm
CFLAGS += -O2 -Wall -Werror
CFLAGS += $(shell pkg-config --cflags --libs libpng) \
+ $(shell pkg-config --cflags --libs zlib) \
$(shell pkg-config --cflags --libs libqrencode)
VERSION = $(shell git describe --tags --long)
diff --git a/cqrlogo.c b/cqrlogo.c
index a9a4a5e..52d216d 100644
--- a/cqrlogo.c
+++ b/cqrlogo.c
@@ -47,6 +47,11 @@ int generate_png (struct bitmap_t *bitmap, char *http_referer) {
#ifdef PNG_TEXT_SUPPORTED
png_text text[3];
+ char *version;
+ const char *v_libpng = png_libpng_ver, *v_zlib = zlib_version;
+
+ version = malloc(18 + strlen(VERSION) + strlen(v_libpng) + strlen(v_zlib));
+ sprintf(version, VERSION " (libpng %s, zlib %s)", png_libpng_ver, zlib_version);
text[0].compression = PNG_TEXT_COMPRESSION_zTXt;
text[0].key = "comment";
@@ -54,13 +59,14 @@ int generate_png (struct bitmap_t *bitmap, char *http_referer) {
text[1].compression = PNG_TEXT_COMPRESSION_zTXt;
text[1].key = "version";
- text[1].text = VERSION;
+ text[1].text = version;
text[2].compression = PNG_TEXT_COMPRESSION_zTXt;
text[2].key = "referer";
text[2].text = http_referer;
png_set_text(png_ptr, info_ptr, text, 3);
+ free(version);
#endif
row_pointers = png_malloc (png_ptr, bitmap->height * sizeof (png_byte *));