From 3bcd25a372c79d2514f8245e5267c4771c3cea46 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Sun, 24 Mar 2019 18:50:54 -0700
Subject: [PATCH] fcgi: Update to 2.4.2

Removed most patches as they are no longer necessary for compilation.

Added some compiler and linker flags to reduce size.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 libs/fcgi/Makefile                            |  7 ++--
 .../fcgi/patches/100-fcgio-int-type-fix.patch |  8 ++---
 libs/fcgi/patches/110-no_examples.patch       | 13 --------
 libs/fcgi/patches/120-stdio.patch             | 12 -------
 ...AUTOMAKE-AC_INIT-and-trigger-non-GNU.patch | 33 -------------------
 5 files changed, 7 insertions(+), 66 deletions(-)
 delete mode 100644 libs/fcgi/patches/110-no_examples.patch
 delete mode 100644 libs/fcgi/patches/120-stdio.patch
 delete mode 100644 libs/fcgi/patches/200-Convert-AM_INIT_AUTOMAKE-AC_INIT-and-trigger-non-GNU.patch

diff --git a/libs/fcgi/Makefile b/libs/fcgi/Makefile
index 293ffebe6..32acaefc6 100644
--- a/libs/fcgi/Makefile
+++ b/libs/fcgi/Makefile
@@ -6,12 +6,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=fcgi
-PKG_VERSION:=2.4.1
+PKG_VERSION:=2.4.2
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)2-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/FastCGI-Archives/fcgi2/tar.gz/$(PKG_VERSION)?
-PKG_HASH:=53cc36624bb92a88e3d5a3d696282e1af24b280c3f275604123d9c6d407173e2
+PKG_HASH:=1fe83501edfc3a7ec96bb1e69db3fd5ea1730135bd73ab152186fd0b437013bc
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)2-$(PKG_VERSION)
 
 PKG_MAINTAINER:=Jacob Siverskog <jacob@teenageengineering.com>
@@ -50,6 +50,9 @@ define Package/fcgi/description
  server specific APIs.
 endef
 
+TARGET_CXXFLAGS += -fno-rtti -flto
+TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
+
 define Build/InstallDev
 	$(INSTALL_DIR) $(1)/usr/include
 	$(CP) $(PKG_INSTALL_DIR)/usr/include/fastcgi.h $(1)/usr/include/
diff --git a/libs/fcgi/patches/100-fcgio-int-type-fix.patch b/libs/fcgi/patches/100-fcgio-int-type-fix.patch
index c517551d9..1aec5f04c 100644
--- a/libs/fcgi/patches/100-fcgio-int-type-fix.patch
+++ b/libs/fcgi/patches/100-fcgio-int-type-fix.patch
@@ -1,5 +1,3 @@
-diff --git a/include/fcgio.h b/include/fcgio.h
-index 20d222a..92eda3c 100644
 --- a/include/fcgio.h
 +++ b/include/fcgio.h
 @@ -77,10 +77,10 @@ protected:
@@ -15,11 +13,9 @@ index 20d222a..92eda3c 100644
  
      // Use a buffer.  The only reasons that a buffer would be useful is
      // to support the use of the unget()/putback() or seek() methods.  Using
-diff --git a/libfcgi/fcgio.cpp b/libfcgi/fcgio.cpp
-index 5a54c11..e57b622 100644
 --- a/libfcgi/fcgio.cpp
 +++ b/libfcgi/fcgio.cpp
-@@ -89,7 +89,7 @@ int fcgi_streambuf::sync()
+@@ -86,7 +86,7 @@ int fcgi_streambuf::sync()
  }
  
  // uflow() removes the char, underflow() doesn't
@@ -28,7 +24,7 @@ index 5a54c11..e57b622 100644
  {
      if (this->bufsize)
      {
-@@ -103,7 +103,7 @@ int fcgi_streambuf::uflow()
+@@ -100,7 +100,7 @@ int fcgi_streambuf::uflow()
      }
  }
  				
diff --git a/libs/fcgi/patches/110-no_examples.patch b/libs/fcgi/patches/110-no_examples.patch
deleted file mode 100644
index dc015b61c..000000000
--- a/libs/fcgi/patches/110-no_examples.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/Makefile.am b/Makefile.am
-index b35f7f3..c34a274 100755
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -4,7 +4,7 @@
- #  $Id: Makefile.am,v 1.8 2003/11/02 21:42:47 robs Exp $
- #
- 
--SUBDIRS = libfcgi cgi-fcgi examples include
-+SUBDIRS = libfcgi cgi-fcgi include
- 
- include_HEADERS = fcgi_config.h
- 
diff --git a/libs/fcgi/patches/120-stdio.patch b/libs/fcgi/patches/120-stdio.patch
deleted file mode 100644
index 404d1d43d..000000000
--- a/libs/fcgi/patches/120-stdio.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/libfcgi/fcgio.cpp b/libfcgi/fcgio.cpp
-index 5a54c11..9ecca45 100644
---- a/libfcgi/fcgio.cpp
-+++ b/libfcgi/fcgio.cpp
-@@ -23,6 +23,7 @@
- #endif
- 
- #include <limits.h>
-+#include <stdio.h>
- #include "fcgio.h"
- 
- using std::streambuf;
diff --git a/libs/fcgi/patches/200-Convert-AM_INIT_AUTOMAKE-AC_INIT-and-trigger-non-GNU.patch b/libs/fcgi/patches/200-Convert-AM_INIT_AUTOMAKE-AC_INIT-and-trigger-non-GNU.patch
deleted file mode 100644
index 7481f21c1..000000000
--- a/libs/fcgi/patches/200-Convert-AM_INIT_AUTOMAKE-AC_INIT-and-trigger-non-GNU.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 78fac26891fe7494355021dbac109b807b8c6d53 Mon Sep 17 00:00:00 2001
-From: Joachim Nilsson <troglobit@gmail.com>
-Date: Mon, 14 May 2018 15:40:43 +0200
-Subject: [PATCH] Convert AM_INIT_AUTOMAKE() --> AC_INIT() and trigger non-GNU
- project
-
-Converts from old-style configure syntax with AM_INIT_AUTOMAKE to
-AC_INIT and enable "foreign" mode, i.e. non-GNU conformant tree
-to avoid copying in COPYING and other files when autogen.sh runs.
-
-Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
----
- configure.in | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/configure.in b/configure.in
-index 2f72645..c5fbc4b 100755
---- a/configure.in
-+++ b/configure.in
-@@ -4,8 +4,8 @@ dnl     This file is an input file used by the GNU "autoconf" program to
- dnl     generate the file "configure", which is run during the build
- dnl     to configure the system for the local environment.
- 
--AC_INIT
--AM_INIT_AUTOMAKE(fcgi, 2.4.1-SNAP-0910052249)
-+AC_INIT(fcgi, 2.4.1-SNAP-0910052249)
-+AM_INIT_AUTOMAKE([1.11 foreign])
- 
- AM_CONFIG_HEADER(fcgi_config.h)
- 
--- 
-2.20.0
-