diff --git a/release/src-rt-6.x.4708/router/Makefile b/release/src-rt-6.x.4708/router/Makefile index 22107b4e02..f56b6fc59f 100644 --- a/release/src-rt-6.x.4708/router/Makefile +++ b/release/src-rt-6.x.4708/router/Makefile @@ -18,6 +18,23 @@ include common.mak export PARALLEL_BUILD := -j`grep -c '^processor' /proc/cpuinfo` +define patch_files = + find patches/$(1) -maxdepth 1 -type f -name '*.patch' | sort -t '\0' -n | while read FILE; do \ + ( if ! patch -p0 -Rf --dry-run --silent < $$FILE 2>/dev/null; then \ + patch -p0 < $$FILE; \ + fi ) \ + done +endef + +define unpatch_files = + find patches/$(1) -maxdepth 1 -type f -name '*.patch' | sort -t '\0' -n | while read FILE; do \ + ( if patch -p0 -Rf --dry-run --silent < $$FILE 2>/dev/null; then \ + patch -p0 -Rf < $$FILE; \ + fi ) \ + done +endef + + # # # @@ -926,9 +943,7 @@ bridge-install: dnsmasq: $(if $(TCONFIG_DNSSEC),nettle,) @$(SEP) - ( if ! patch -R -f -d dnsmasq/src --dry-run --silent < patches/dnsmasq/101-tomato-specific.patch 2>/dev/null; then \ - patch -b -d dnsmasq/src < patches/dnsmasq/101-tomato-specific.patch; \ - fi ) + $(call patch_files,dnsmasq) @$(MAKE) -C dnsmasq $(PARALLEL_BUILD) \ COPTS="$(if $(TCONFIG_DNSSEC),-I$(TOP)/nettle/include -I$(TOP)/gmp -DHAVE_DNSSEC -DHAVE_DNSSEC_STATIC,) \ $(if $(TCONFIG_IPV6),-DUSE_IPV6,-DNO_IPV6) \ @@ -941,6 +956,9 @@ dnsmasq-install: install -D dnsmasq/src/dnsmasq $(INSTALLDIR)/dnsmasq/usr/sbin/dnsmasq $(STRIP) $(INSTALLDIR)/dnsmasq/usr/sbin/dnsmasq +dnsmasq-clean: + $(call unpatch_files,dnsmasq) + nettle/stamp-h1: gmp @cd nettle && CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) LD=$(LD) \ CPPFLAGS="-I$(TOP)/gmp" \ @@ -1973,9 +1991,7 @@ libpng-clean: php/stamp-h1: pcre zlib libiconv sqlite libxml2 libpng jpeg libcurl @$(SEP) - ( if ! patch -R -f -d php --dry-run --silent < patches/php/101-fix-cross-compiling-issue.patch 2>/dev/null; then \ - patch -b -d php < patches/php/101-fix-cross-compiling-issue.patch; \ - fi ) + $(call patch_files,php) cd php && CC=$(CC) CXX=$(ARCH)-g++ AR=$(AR) RANLIB=$(RANLIB) LD=$(LD) \ CFLAGS="-Os -Wall -I$(TOP)/zlib -I$(TOP)/libxml2/include/libxml -I$(TOP)/libxml2/include -I$(TOP)/pcre -I$(TOP)/libiconv/include \ -I$(TOP)/libpng/staged/usr/include -I$(TOP)/libcurl/staged/include" \ @@ -2055,6 +2071,7 @@ php: php/stamp-h1 php-clean: -@$(MAKE) -C php clean -@rm php/stamp-h1 + $(call unpatch_files,php) php-install: @$(SEP) @@ -2147,12 +2164,7 @@ libncurses-install: mysql/stamp-h1: openssl zlib libncurses @$(SEP) @cp -f $(TOP)/patches/mysql/.host.tgz $(TOP)/mysql/ || true - ( if ! patch -R -f -d mysql/sql --dry-run --silent < patches/mysql/101-bison-compat.patch 2>/dev/null; then \ - patch -b -d mysql/sql < patches/mysql/101-bison-compat.patch; \ - fi ) - ( if ! patch -p0 -R -f --dry-run --silent < patches/mysql/201-fix-cross-compiling.patch 2>/dev/null; then \ - patch -p0 -b < patches/mysql/201-fix-cross-compiling.patch; \ - fi ) + $(call patch_files,mysql) cd mysql && \ CFLAGS="-O2 -Wall -fno-delete-null-pointer-checks -funit-at-a-time --param large-function-growth=800 \ --param max-inline-insns-single=3000 -ffunction-sections -fdata-sections -I$(TOP)/zlib \ @@ -2191,6 +2203,7 @@ mysql-clean: -@rm -f mysql/stamp-h1 -@rm -rf mysql/staged mysql/host -@rm -f mysql/.host.tgz + $(call unpatch_files,mysql) mysql-install: install -d $(INSTALLDIR)/mysql/usr/bin @@ -2283,12 +2296,7 @@ openvpn_plugin_auth_nvram: nvram$(BCMEX) #shibby nano/stamp-h1: libncurses - ( if ! patch -p0 -Rf --dry-run --silent < patches/nano/101-do-not-build-doc.patch 2>/dev/null; then \ - patch -p0 -b < patches/nano/101-do-not-build-doc.patch; \ - fi ) - ( if ! patch -p0 -Rf --dry-run --silent < patches/nano/102-fix-build-with-tiny-option.patch 2>/dev/null; then \ - patch -p0 -b < patches/nano/102-fix-build-with-tiny-option.patch; \ - fi ) + $(call patch_files,nano) cd nano && CC=$(CC) STRIP=$(STRIP) \ autoreconf && \ CFLAGS="-Os -Wall $(EXTRACFLAGS) -I$(TOP)/libncurses/staged/usr/include -ffunction-sections -fdata-sections" \ @@ -2305,6 +2313,7 @@ nano: nano/stamp-h1 nano-clean: -@$(MAKE) -C nano clean @rm -f nano/stamp-h1 nano/Makefile nano/src/Makefile + $(call unpatch_files,nano) nano-install: install -d $(INSTALLDIR)/nano/usr/sbin diff --git a/release/src-rt-6.x.4708/router/patches/dnsmasq/101-tomato-specific.patch b/release/src-rt-6.x.4708/router/patches/dnsmasq/101-tomato-specific.patch index e0a0d59672..200a597d9f 100644 --- a/release/src-rt-6.x.4708/router/patches/dnsmasq/101-tomato-specific.patch +++ b/release/src-rt-6.x.4708/router/patches/dnsmasq/101-tomato-specific.patch @@ -1,5 +1,5 @@ ---- config.h 2017-05-22 23:58:46.000000000 +0200 -+++ config.h 2017-10-03 20:05:34.000000000 +0200 +--- dnsmasq/src/config.h 2017-05-22 23:58:46.000000000 +0200 ++++ dnsmasq/src/config.h 2017-10-03 20:05:34.000000000 +0200 @@ -73,6 +73,10 @@ HAVE_BROKEN_RTC NOTE: when enabling or disabling this, be sure to delete any old leases file, otherwise dnsmasq may get very confused. @@ -40,8 +40,8 @@ #endif ---- dnsmasq.c 2017-05-22 23:58:46.000000000 +0200 -+++ dnsmasq.c 2017-10-03 20:05:34.000000000 +0200 +--- dnsmasq/src/dnsmasq.c 2017-05-22 23:58:46.000000000 +0200 ++++ dnsmasq/src/dnsmasq.c 2017-10-03 20:05:34.000000000 +0200 @@ -13,6 +13,44 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . @@ -123,8 +123,8 @@ if (daemon->lease_stream) fclose(daemon->lease_stream); ---- dnsmasq.h 2017-05-22 23:58:46.000000000 +0200 -+++ dnsmasq.h 2017-10-03 20:05:34.000000000 +0200 +--- dnsmasq/src/dnsmasq.h 2017-05-22 23:58:46.000000000 +0200 ++++ dnsmasq/src/dnsmasq.h 2017-10-03 20:05:34.000000000 +0200 @@ -1356,6 +1356,12 @@ int make_icmp_sock(void); int icmp_ping(struct in_addr addr); int delay_dhcp(time_t start, int sec, int fd, uint32_t addr, unsigned short id); @@ -138,8 +138,8 @@ void queue_event(int event); void send_alarm(time_t event, time_t now); void send_event(int fd, int event, int data, char *msg); ---- lease.c 2017-05-22 23:58:46.000000000 +0200 -+++ lease.c 2017-10-03 20:05:34.000000000 +0200 +--- dnsmasq/src/lease.c 2017-05-22 23:58:46.000000000 +0200 ++++ dnsmasq/src/lease.c 2017-10-03 20:05:34.000000000 +0200 @@ -108,12 +108,15 @@ static int read_leases(time_t now, FILE ei = atol(daemon->dhcp_buff3); diff --git a/release/src-rt-6.x.4708/router/patches/mysql/101-bison-compat.patch b/release/src-rt-6.x.4708/router/patches/mysql/101-bison-compat.patch index 6b8c720fc3..fb3cab0b12 100644 --- a/release/src-rt-6.x.4708/router/patches/mysql/101-bison-compat.patch +++ b/release/src-rt-6.x.4708/router/patches/mysql/101-bison-compat.patch @@ -1,5 +1,5 @@ ---- a/sql/sql_lex.cc -+++ b/sql/sql_lex.cc +--- mysql/sql/sql_lex.cc ++++ mysql/sql/sql_lex.cc @@ -775,14 +775,13 @@ bool consume_comment(Lex_input_stream *l (which can't be followed by a signed number) */ @@ -16,8 +16,8 @@ Lex_input_stream *lip= & thd->m_parser_state->m_lip; LEX *lex= thd->lex; YYSTYPE *yylval=(YYSTYPE*) arg; ---- a/sql/sql_lex.h -+++ b/sql/sql_lex.h +--- mysql/sql/sql_lex.h ++++ mysql/sql/sql_lex.h @@ -2072,7 +2072,7 @@ extern void lex_init(void); extern void lex_free(void); extern void lex_start(THD *thd); @@ -27,8 +27,8 @@ extern void trim_whitespace(CHARSET_INFO *cs, LEX_STRING *str); ---- a/sql/sql_parse.cc -+++ b/sql/sql_parse.cc +--- mysql/sql/sql_parse.cc ++++ mysql/sql/sql_parse.cc @@ -8012,7 +8012,7 @@ bool check_host_name(LEX_STRING *str) } @@ -38,8 +38,8 @@ /** ---- a/sql/sql_yacc.yy -+++ b/sql/sql_yacc.yy +--- mysql/sql/sql_yacc.yy ++++ mysql/sql/sql_yacc.yy @@ -25,17 +25,15 @@ %{ /* thd is passed as an argument to yyparse(), and subsequently to yylex(). diff --git a/release/src-rt-6.x.4708/router/patches/php/101-fix-cross-compiling-issue.patch b/release/src-rt-6.x.4708/router/patches/php/101-fix-cross-compiling-issue.patch index 055e9fb301..d1430b2d17 100644 --- a/release/src-rt-6.x.4708/router/patches/php/101-fix-cross-compiling-issue.patch +++ b/release/src-rt-6.x.4708/router/patches/php/101-fix-cross-compiling-issue.patch @@ -1,5 +1,5 @@ ---- configure 2017-07-06 01:57:38.000000000 +0200 -+++ configure 2017-09-25 19:24:11.000000000 +0200 +--- php/configure 2017-07-06 01:57:38.000000000 +0200 ++++ php/configure 2017-09-25 19:24:11.000000000 +0200 @@ -36577,6 +36577,9 @@ libmagic/is_tar.c libmagic/magic.c libmagic/print.c \ libmagic/readcdf.c libmagic/softmagic.c"