From 14af50642c9e3b3f8c1e2f8901667dfc95c4d93e Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 16 Oct 2017 11:35:34 -0500 Subject: [PATCH] qrencode: Update to 4.0.0 Adds a minor patch to optionally omit the XML tag when including svg inline. Singed-off-by: Jonathan Bennett --- libs/qrencode/Makefile | 13 +- .../qrencode/patches/001-add-inline-svg.patch | 67 ++++ libs/qrencode/patches/001-disable-png.patch | 306 ------------------ 3 files changed, 74 insertions(+), 312 deletions(-) create mode 100644 libs/qrencode/patches/001-add-inline-svg.patch delete mode 100644 libs/qrencode/patches/001-disable-png.patch diff --git a/libs/qrencode/Makefile b/libs/qrencode/Makefile index 95a353cd4..a6a4e2f25 100644 --- a/libs/qrencode/Makefile +++ b/libs/qrencode/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006-2012 OpenWrt.org +# Copyright (C) 2006-2017 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qrencode -PKG_VERSION:=3.4.4 -PKG_RELEASE:=2 +PKG_VERSION:=4.0.0 +PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://fukuchi.org/works/qrencode/ -PKG_HASH:=e794e26a96019013c0e3665cb06b18992668f352c5553d0a553f5d144f7f2a72 +PKG_HASH:=c90035e16921117d4086a7fdee65aab85be32beb4a376f6b664b8a425d327d0b PKG_MAINTAINER:=Jonathan Bennett PKG_LICENSE:=LGPL-2.1+ PKG_INSTALL:=1 @@ -56,7 +56,8 @@ CONFIGURE_ARGS+= \ --enable-static \ --disable-rpath \ --disable-sdltest \ - --without-tests + --without-tests \ + --without-png TARGET_LDFLAGS+= -s diff --git a/libs/qrencode/patches/001-add-inline-svg.patch b/libs/qrencode/patches/001-add-inline-svg.patch new file mode 100644 index 000000000..02f7d2ae5 --- /dev/null +++ b/libs/qrencode/patches/001-add-inline-svg.patch @@ -0,0 +1,67 @@ +From 7dd8a1b6f4efab84025c735195ad9d84f6477359 Mon Sep 17 00:00:00 2001 +From: Jonathan Bennett +Date: Mon, 16 Oct 2017 11:59:23 -0500 +Subject: [PATCH] Adds the --inline option, which omits the xml tag for SVG + output. + +--- + qrenc.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/qrenc.c b/qrenc.c +index ed83d8a..373352e 100644 +--- a/qrenc.c ++++ b/qrenc.c +@@ -45,6 +45,7 @@ static int structured = 0; + static int rle = 0; + static int svg_path = 0; + static int micro = 0; ++static int inline_svg = 0; + static QRecLevel level = QR_ECLEVEL_L; + static QRencodeMode hint = QR_MODE_8; + static unsigned char fg_color[4] = {0, 0, 0, 255}; +@@ -80,6 +81,7 @@ static const struct option options[] = { + {"margin" , required_argument, NULL, 'm'}, + {"dpi" , required_argument, NULL, 'd'}, + {"type" , required_argument, NULL, 't'}, ++ {"inline" , no_argument , NULL, 'I'}, + {"structured" , no_argument , NULL, 'S'}, + {"kanji" , no_argument , NULL, 'k'}, + {"casesensitive", no_argument , NULL, 'c'}, +@@ -95,7 +97,7 @@ static const struct option options[] = { + {NULL, 0, NULL, 0} + }; + +-static char *optstring = "ho:r:l:s:v:m:d:t:Skci8MV"; ++static char *optstring = "ho:r:l:s:v:m:d:t:ISkci8MV"; + + static void usage(int help, int longopt, int status) + { +@@ -132,6 +134,7 @@ static void usage(int help, int longopt, int status) + " -t {PNG,PNG32,EPS,SVG,XPM,ANSI,ANSI256,ASCII,ASCIIi,UTF8,ANSIUTF8},\n" + " --type={PNG,PNG32,EPS,SVG,XPM,ANSI,ANSI256,ASCII,ASCIIi,UTF8,ANSIUTF8}\n" + " specify the type of the generated image. (default=PNG)\n\n" ++" -I, --inline Only useful for SVG output, generates an svg without the XML tag\n" + " -S, --structured\n" + " make structured symbols. Version must be specified.\n\n" + " -k, --kanji assume that the input text contains kanji (shift-jis).\n\n" +@@ -551,7 +554,8 @@ static int writeSVG(const QRcode *qrcode, const char *outfile) + bg_opacity = (float)bg_color[3] / 255; + + /* XML declaration */ +- fputs( "\n", fp ); ++ if (!inline_svg) ++ fputs( "\n", fp ); + + /* DTD + No document type specified because "while a DTD is provided in [the SVG] +@@ -1324,6 +1328,9 @@ int main(int argc, char **argv) + exit(EXIT_FAILURE); + } + break; ++ case 'I': ++ inline_svg = 1; ++ break; + case 'S': + structured = 1; + break; diff --git a/libs/qrencode/patches/001-disable-png.patch b/libs/qrencode/patches/001-disable-png.patch deleted file mode 100644 index 345bb6008..000000000 --- a/libs/qrencode/patches/001-disable-png.patch +++ /dev/null @@ -1,306 +0,0 @@ ---- a/qrenc.c -+++ b/qrenc.c -@@ -25,7 +25,6 @@ - #include - #include - #include --#include - #include - - #include "qrencode.h" -@@ -49,7 +48,6 @@ - static int verbose = 0; - - enum imageType { -- PNG_TYPE, - EPS_TYPE, - SVG_TYPE, - ANSI_TYPE, -@@ -60,7 +58,7 @@ - ANSIUTF8_TYPE - }; - --static enum imageType image_type = PNG_TYPE; -+static enum imageType image_type = SVG_TYPE; - - static const struct option options[] = { - {"help" , no_argument , NULL, 'h'}, -@@ -96,13 +94,13 @@ - if(longopt) { - fprintf(stderr, - "Usage: qrencode [OPTION]... [STRING]\n" --"Encode input data in a QR Code and save as a PNG or EPS image.\n\n" -+"Encode input data in a QR Code and save as a SVG or EPS image.\n\n" - " -h, --help display the help message. -h displays only the help of short\n" - " options.\n\n" - " -o FILENAME, --output=FILENAME\n" - " write image to FILENAME. If '-' is specified, the result\n" - " will be output to standard output. If -S is given, structured\n" --" symbols are written to FILENAME-01.png, FILENAME-02.png, ...\n" -+" symbols are written to FILENAME-01.svg, FILENAME-02.svg, ...\n" - " (suffix is removed from FILENAME, if specified)\n" - " -s NUMBER, --size=NUMBER\n" - " specify module size in dots (pixels). (default=3)\n\n" -@@ -116,9 +114,9 @@ - " specify the width of the margins. (default=4 (2 for Micro QR)))\n\n" - " -d NUMBER, --dpi=NUMBER\n" - " specify the DPI of the generated PNG. (default=72)\n\n" --" -t {PNG,EPS,SVG,ANSI,ANSI256,ASCII,ASCIIi,UTF8,ANSIUTF8}, --type={PNG,EPS,\n" -+" -t {EPS,SVG,ANSI,ANSI256,ASCII,ASCIIi,UTF8,ANSIUTF8}, --type={EPS,\n" - " SVG,ANSI,ANSI256,ASCII,ASCIIi,UTF8,ANSIUTF8}\n" --" specify the type of the generated image. (default=PNG)\n\n" -+" specify the type of the generated image. (default=SVG)\n\n" - " -S, --structured\n" - " make structured symbols. Version must be specified.\n\n" - " -k, --kanji assume that the input text contains kanji (shift-jis).\n\n" -@@ -133,7 +131,7 @@ - " --background=RRGGBB[AA]\n" - " specify foreground/background color in hexadecimal notation.\n" - " 6-digit (RGB) or 8-digit (RGBA) form are supported.\n" --" Color output support available only in PNG and SVG.\n" -+" Color output support available only in SVG.\n" - " -V, --version\n" - " display the version number and copyrights of the qrencode.\n\n" - " --verbose\n" -@@ -153,12 +151,12 @@ - } else { - fprintf(stderr, - "Usage: qrencode [OPTION]... [STRING]\n" --"Encode input data in a QR Code and save as a PNG or EPS image.\n\n" -+"Encode input data in a QR Code and save as a SVG or EPS image.\n\n" - " -h display this message.\n" - " --help display the usage of long options.\n" - " -o FILENAME write image to FILENAME. If '-' is specified, the result\n" - " will be output to standard output. If -S is given, structured\n" --" symbols are written to FILENAME-01.png, FILENAME-02.png, ...\n" -+" symbols are written to FILENAME-01.svg, FILENAME-02.svg, ...\n" - " (suffix is removed from FILENAME, if specified)\n" - " -s NUMBER specify module size in dots (pixels). (default=3)\n" - " -l {LMQH} specify error correction level from L (lowest) to H (highest).\n" -@@ -166,8 +164,8 @@ - " -v NUMBER specify the version of the symbol. (default=auto)\n" - " -m NUMBER specify the width of the margins. (default=4 (2 for Micro))\n" - " -d NUMBER specify the DPI of the generated PNG. (default=72)\n" --" -t {PNG,EPS,SVG,ANSI,ANSI256,ASCII,ASCIIi,UTF8,ANSIUTF8}\n" --" specify the type of the generated image. (default=PNG)\n" -+" -t {EPS,SVG,ANSI,ANSI256,ASCII,ASCIIi,UTF8,ANSIUTF8}\n" -+" specify the type of the generated image. (default=SVG)\n" - " -S make structured symbols. Version must be specified.\n" - " -k assume that the input text contains kanji (shift-jis).\n" - " -c encode lower-case alphabet characters in 8-bit mode. (default)\n" -@@ -178,7 +176,7 @@ - " --background=RRGGBB[AA]\n" - " specify foreground/background color in hexadecimal notation.\n" - " 6-digit (RGB) or 8-digit (RGBA) form are supported.\n" --" Color output support available only in PNG and SVG.\n" -+" Color output support available only in SVG.\n" - " -V display the version number and copyrights of the qrencode.\n" - " [STRING] input data. If it is not specified, data will be taken from\n" - " standard input.\n" -@@ -253,128 +251,6 @@ - return fp; - } - --static int writePNG(QRcode *qrcode, const char *outfile) --{ -- static FILE *fp; // avoid clobbering by setjmp. -- png_structp png_ptr; -- png_infop info_ptr; -- png_colorp palette; -- png_byte alpha_values[2]; -- unsigned char *row, *p, *q; -- int x, y, xx, yy, bit; -- int realwidth; -- -- realwidth = (qrcode->width + margin * 2) * size; -- row = (unsigned char *)malloc((realwidth + 7) / 8); -- if(row == NULL) { -- fprintf(stderr, "Failed to allocate memory.\n"); -- exit(EXIT_FAILURE); -- } -- -- if(outfile[0] == '-' && outfile[1] == '\0') { -- fp = stdout; -- } else { -- fp = fopen(outfile, "wb"); -- if(fp == NULL) { -- fprintf(stderr, "Failed to create file: %s\n", outfile); -- perror(NULL); -- exit(EXIT_FAILURE); -- } -- } -- -- png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); -- if(png_ptr == NULL) { -- fprintf(stderr, "Failed to initialize PNG writer.\n"); -- exit(EXIT_FAILURE); -- } -- -- info_ptr = png_create_info_struct(png_ptr); -- if(info_ptr == NULL) { -- fprintf(stderr, "Failed to initialize PNG write.\n"); -- exit(EXIT_FAILURE); -- } -- -- if(setjmp(png_jmpbuf(png_ptr))) { -- png_destroy_write_struct(&png_ptr, &info_ptr); -- fprintf(stderr, "Failed to write PNG image.\n"); -- exit(EXIT_FAILURE); -- } -- -- palette = (png_colorp) malloc(sizeof(png_color) * 2); -- if(palette == NULL) { -- fprintf(stderr, "Failed to allocate memory.\n"); -- exit(EXIT_FAILURE); -- } -- palette[0].red = fg_color[0]; -- palette[0].green = fg_color[1]; -- palette[0].blue = fg_color[2]; -- palette[1].red = bg_color[0]; -- palette[1].green = bg_color[1]; -- palette[1].blue = bg_color[2]; -- alpha_values[0] = fg_color[3]; -- alpha_values[1] = bg_color[3]; -- png_set_PLTE(png_ptr, info_ptr, palette, 2); -- png_set_tRNS(png_ptr, info_ptr, alpha_values, 2, NULL); -- -- png_init_io(png_ptr, fp); -- png_set_IHDR(png_ptr, info_ptr, -- realwidth, realwidth, -- 1, -- PNG_COLOR_TYPE_PALETTE, -- PNG_INTERLACE_NONE, -- PNG_COMPRESSION_TYPE_DEFAULT, -- PNG_FILTER_TYPE_DEFAULT); -- png_set_pHYs(png_ptr, info_ptr, -- dpi * INCHES_PER_METER, -- dpi * INCHES_PER_METER, -- PNG_RESOLUTION_METER); -- png_write_info(png_ptr, info_ptr); -- -- /* top margin */ -- memset(row, 0xff, (realwidth + 7) / 8); -- for(y=0; ydata; -- for(y=0; ywidth; y++) { -- bit = 7; -- memset(row, 0xff, (realwidth + 7) / 8); -- q = row; -- q += margin * size / 8; -- bit = 7 - (margin * size % 8); -- for(x=0; xwidth; x++) { -- for(xx=0; xxcode, filename); -- break; - case EPS_TYPE: - writeEPS(p->code, filename); - break; -@@ -1062,9 +929,7 @@ - } - break; - case 't': -- if(strcasecmp(optarg, "png") == 0) { -- image_type = PNG_TYPE; -- } else if(strcasecmp(optarg, "eps") == 0) { -+ if(strcasecmp(optarg, "eps") == 0) { - image_type = EPS_TYPE; - } else if(strcasecmp(optarg, "svg") == 0) { - image_type = SVG_TYPE; -@@ -1133,11 +998,6 @@ - exit(EXIT_SUCCESS); - } - -- if(outfile == NULL && image_type == PNG_TYPE) { -- fprintf(stderr, "No output filename is given.\n"); -- exit(EXIT_FAILURE); -- } -- - if(optind < argc) { - intext = (unsigned char *)argv[optind]; - length = strlen((char *)intext); ---- a/configure.ac -+++ b/configure.ac -@@ -58,9 +58,6 @@ - [build_tools=$withval], [build_tools=yes]) - - AM_CONDITIONAL(BUILD_TOOLS, [test "x$build_tools" = "xyes" ]) --if test x$build_tools = xyes ; then -- PKG_CHECK_MODULES(png, "libpng") --fi - - dnl --with-tests - AC_ARG_WITH([tests], [AS_HELP_STRING([--with-tests], [build tests [default=no]])], -@@ -80,12 +77,6 @@ - echo "/* #undef WITH_TESTS */" >>confdefs.h - fi - --if test x$build_tests = xyes ; then -- SDL_REQUIRED_VERSION=1.2.0 -- AM_PATH_SDL($SDL_REQUIRED_VERSION,,AC_MSG_WARN([*** SDL $SDL_REQUIRED_VERSION or better is required.])) -- AC_MSG_NOTICE([SDL check done.]) -- AM_ICONV_LINK --fi - AM_CONDITIONAL(HAVE_SDL, [test "x$SDL_CFLAGS" != "x" ]) - -