From f3588e2b51ee483f2a5c6dc2946638baaf58c9bc Mon Sep 17 00:00:00 2001 From: Hunter Sezen Date: Fri, 30 Oct 2020 00:01:55 +0000 Subject: libraries/QR-Code-generator: Added (QR Code generator library) Signed-off-by: Dave Woodfall Signed-off-by: Willy Sudiarto Raharjo --- .../QR-Code-generator/QR-Code-generator.SlackBuild | 112 +++++++++++++++ libraries/QR-Code-generator/QR-Code-generator.info | 10 ++ libraries/QR-Code-generator/README | 6 + .../qr-code-generator-build-fixes.patch | 156 +++++++++++++++++++++ libraries/QR-Code-generator/slack-desc | 19 +++ 5 files changed, 303 insertions(+) create mode 100644 libraries/QR-Code-generator/QR-Code-generator.SlackBuild create mode 100644 libraries/QR-Code-generator/QR-Code-generator.info create mode 100644 libraries/QR-Code-generator/README create mode 100644 libraries/QR-Code-generator/qr-code-generator-build-fixes.patch create mode 100644 libraries/QR-Code-generator/slack-desc (limited to 'libraries/QR-Code-generator') diff --git a/libraries/QR-Code-generator/QR-Code-generator.SlackBuild b/libraries/QR-Code-generator/QR-Code-generator.SlackBuild new file mode 100644 index 0000000000000..5fda6717ef362 --- /dev/null +++ b/libraries/QR-Code-generator/QR-Code-generator.SlackBuild @@ -0,0 +1,112 @@ +#!/bin/sh + +# Slackware build script for QR-Code-generator + +# Copyright 2020 Hunter Sezen California, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=QR-Code-generator +VERSION=${VERSION:-1.6.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -eu + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# Fix makefiles (Modified from Fedora) +# https://src.fedoraproject.org/rpms/qr-code-generator +patch -p1 < $CWD/qr-code-generator-build-fixes.patch + +( + cd c + make CFLAGS="$SLKCFLAGS" + make install \ + PREFIX=/usr \ + LIBDIR=/usr/lib${LIBDIRSUFFIX} \ + DESTDIR=$PKG +) + +( + cd cpp + make CXXFLAGS="$SLKCFLAGS" + make install \ + PREFIX=/usr \ + LIBDIR=/usr/lib${LIBDIRSUFFIX} \ + DESTDIR=$PKG +) + +if python3 -c 'import sys' 2>/dev/null; then + ( + cd python + python3 setup.py install --root=$PKG + ) +fi + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | + grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a Readme.markdown $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/libraries/QR-Code-generator/QR-Code-generator.info b/libraries/QR-Code-generator/QR-Code-generator.info new file mode 100644 index 0000000000000..a06cf5775b6cc --- /dev/null +++ b/libraries/QR-Code-generator/QR-Code-generator.info @@ -0,0 +1,10 @@ +PRGNAM="QR-Code-generator" +VERSION="1.6.0" +HOMEPAGE="https://www.nayuki.io/page/qr-code-generator-library" +DOWNLOAD="https://github.com/nayuki/QR-Code-generator/archive/v1.6.0/QR-Code-generator-1.6.0.tar.gz" +MD5SUM="b0015162c613dea118c69d34b77fea7a" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Hunter Sezen" +EMAIL="orbea@riseup.net" diff --git a/libraries/QR-Code-generator/README b/libraries/QR-Code-generator/README new file mode 100644 index 0000000000000..e281d4ab3e537 --- /dev/null +++ b/libraries/QR-Code-generator/README @@ -0,0 +1,6 @@ +This project aims to be the best, clearest library for generating +QR Codes. My primary goals are flexible options and absolute +correctness. Secondary goals are compact implementation size and good +documentation comments. + +python3 is an optional dependency. diff --git a/libraries/QR-Code-generator/qr-code-generator-build-fixes.patch b/libraries/QR-Code-generator/qr-code-generator-build-fixes.patch new file mode 100644 index 0000000000000..4acdfe4999983 --- /dev/null +++ b/libraries/QR-Code-generator/qr-code-generator-build-fixes.patch @@ -0,0 +1,156 @@ +diff -urN QR-Code-generator-1.6.0.orig/c/Makefile QR-Code-generator-1.6.0/c/Makefile +--- QR-Code-generator-1.6.0.orig/c/Makefile 2020-10-28 13:44:11.561734024 -0700 ++++ QR-Code-generator-1.6.0/c/Makefile 2020-10-28 13:47:38.512702152 -0700 +@@ -29,11 +29,15 @@ + # - CFLAGS: Any extra user-specified compiler flags (can be blank). + + # Recommended compiler flags: +-CFLAGS += -std=c99 -O ++CFLAGS += -O2 ++ ++MAIN_FLAGS := -std=c99 -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion + + # Extra flags for diagnostics: +-# CFLAGS += -g -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -fsanitize=undefined,address ++# MAIN_FLAGS += -g -fsanitize=undefined,address + ++# Version information ++VERSION = 1.6.0 + + # ---- Controlling make ---- + +@@ -51,10 +55,19 @@ + # ---- Targets to build ---- + + LIB = qrcodegen +-LIBFILE = lib$(LIB).a ++LIBFILE = lib$(LIB).so ++# Bump the soname number when the ABI changes and gets incompatible ++SO_NAME = $(LIBFILE).1 ++REAL_NAME = $(LIBFILE).$(VERSION) ++HEADERS = qrcodegen.h + LIBOBJ = qrcodegen.o + MAINS = qrcodegen-demo qrcodegen-test qrcodegen-worker + ++# define paths to install ++PREFIX ?= /usr/local ++INCLUDEDIR ?= $(PREFIX)/include/qrcodegen ++LIBDIR ?= $(PREFIX)/lib ++ + # Build all binaries + all: $(LIBFILE) $(MAINS) + +@@ -63,21 +76,33 @@ + rm -f -- $(LIBOBJ) $(LIBFILE) $(MAINS:=.o) $(MAINS) + rm -rf .deps + ++install-shared: $(LIBFILE) ++ mkdir -p $(DESTDIR)$(LIBDIR) ++ install -m 0755 $(LIBFILE) $(DESTDIR)$(LIBDIR)/$(REAL_NAME) ++ ln -s $(REAL_NAME) $(DESTDIR)$(LIBDIR)/$(SO_NAME) ++ ln -s $(SO_NAME) $(DESTDIR)$(LIBDIR)/$(LIBFILE) ++ ++install-header: $(HEADERS) ++ mkdir -p $(DESTDIR)$(INCLUDEDIR) ++ install -m 0644 $(HEADERS) $(DESTDIR)$(INCLUDEDIR)/ ++ ++install: install-shared install-header ++ + # Executable files + %: %.o $(LIBFILE) + $(CC) $(CFLAGS) -o $@ $< -L . -l $(LIB) + + # Special executable + qrcodegen-test: qrcodegen-test.c $(LIBOBJ:%.o=%.c) +- $(CC) $(CFLAGS) -DQRCODEGEN_TEST -o $@ $^ ++ $(CC) $(CFLAGS) $(MAIN_FLAGS) -DQRCODEGEN_TEST -o $@ $^ + + # The library + $(LIBFILE): $(LIBOBJ) +- $(AR) -crs $@ -- $^ ++ $(CC) $(CFLAGS) $(MAIN_FLAGS) -shared -Wl,-soname,$(SO_NAME) $(LDFLAGS) -o $@ $^ + + # Object files + %.o: %.c .deps/timestamp +- $(CC) $(CFLAGS) -c -o $@ -MMD -MF .deps/$*.d $< ++ $(CC) $(CFLAGS) $(MAIN_FLAGS) -c -o $@ -MMD -MF .deps/$*.d $< + + # Have a place to store header dependencies automatically generated by compiler + .deps/timestamp: +diff -urN QR-Code-generator-1.6.0.orig/cpp/Makefile QR-Code-generator-1.6.0/cpp/Makefile +--- QR-Code-generator-1.6.0.orig/cpp/Makefile 2020-10-28 13:44:11.561734024 -0700 ++++ QR-Code-generator-1.6.0/cpp/Makefile 2020-10-28 13:48:27.218164945 -0700 +@@ -29,11 +29,15 @@ + # - CXXFLAGS: Any extra user-specified compiler flags (can be blank). + + # Recommended compiler flags: +-CXXFLAGS += -std=c++11 -O ++CXXFLAGS ?= -O2 ++ ++MAIN_FLAGS := -std=c++11 -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion + + # Extra flags for diagnostics: +-# CXXFLAGS += -g -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -fsanitize=undefined,address ++# MAIN_FLAGS += -g -fsanitize=undefined,address + ++# Version information ++VERSION = 1.6.0 + + # ---- Controlling make ---- + +@@ -50,11 +54,20 @@ + + # ---- Targets to build ---- + +-LIB = qrcodegen +-LIBFILE = lib$(LIB).a ++LIB = qrcodegencpp ++LIBFILE = lib$(LIB).so ++# Bump the soname number when the ABI changes and gets incompatible ++SO_NAME = $(LIBFILE).1 ++REAL_NAME = $(LIBFILE).$(VERSION) ++HEADERS = QrCode.hpp + LIBOBJ = QrCode.o + MAINS = QrCodeGeneratorDemo QrCodeGeneratorWorker + ++# define paths to install ++PREFIX ?= /usr/local ++INCLUDEDIR ?= $(PREFIX)/include/qrcodegen ++LIBDIR ?= $(PREFIX)/lib ++ + # Build all binaries + all: $(LIBFILE) $(MAINS) + +@@ -63,17 +76,29 @@ + rm -f -- $(LIBOBJ) $(LIBFILE) $(MAINS:=.o) $(MAINS) + rm -rf .deps + ++install-shared: $(LIBFILE) ++ mkdir -p $(DESTDIR)$(LIBDIR) ++ install -m 0755 $(LIBFILE) $(DESTDIR)$(LIBDIR)/$(REAL_NAME) ++ ln -s $(REAL_NAME) $(DESTDIR)$(LIBDIR)/$(SO_NAME) ++ ln -s $(SO_NAME) $(DESTDIR)$(LIBDIR)/$(LIBFILE) ++ ++install-header: $(HEADERS) ++ mkdir -p $(DESTDIR)$(INCLUDEDIR) ++ install -m 0644 $(HEADERS) $(DESTDIR)$(INCLUDEDIR)/ ++ ++install: install-shared install-header ++ + # Executable files + %: %.o $(LIBFILE) +- $(CXX) $(CXXFLAGS) -o $@ $< -L . -l $(LIB) ++ $(CXX) $(CXXFLAGS) $(MAIN_FLAGS) -o $@ $< -L . -l $(LIB) + + # The library + $(LIBFILE): $(LIBOBJ) +- $(AR) -crs $@ -- $^ ++ $(CXX) $(CXXFLAGS) $(MAIN_FLAGS) -shared -Wl,-soname,$(SO_NAME) $(LDFLAGS) -o $@ $^ + + # Object files + %.o: %.cpp .deps/timestamp +- $(CXX) $(CXXFLAGS) -c -o $@ -MMD -MF .deps/$*.d $< ++ $(CXX) $(CXXFLAGS) $(MAIN_FLAGS) -c -o $@ -MMD -MF .deps/$*.d $< + + # Have a place to store header dependencies automatically generated by compiler + .deps/timestamp: diff --git a/libraries/QR-Code-generator/slack-desc b/libraries/QR-Code-generator/slack-desc new file mode 100644 index 0000000000000..4b8b1d02c7add --- /dev/null +++ b/libraries/QR-Code-generator/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +QR-Code-generator: QR-Code-generator (QR Code generator library) +QR-Code-generator: +QR-Code-generator: High-quality QR Code generator library. +QR-Code-generator: +QR-Code-generator: Homepage: https://www.nayuki.io/page/qr-code-generator-library +QR-Code-generator: +QR-Code-generator: +QR-Code-generator: +QR-Code-generator: +QR-Code-generator: +QR-Code-generator: -- cgit v1.2.3