From 716ca530e1c4515d8683c9d5be3d56b301758b66 Mon Sep 17 00:00:00 2001
From: James <>
Date: Wed, 4 Nov 2015 11:49:21 +0000
Subject: trunk-47381

---
 tools/quilt/Makefile                      |  36 +++++++
 tools/quilt/patches/000-relocatable.patch | 170 ++++++++++++++++++++++++++++++
 tools/quilt/patches/001-fix_compile.patch |  18 ++++
 3 files changed, 224 insertions(+)
 create mode 100644 tools/quilt/Makefile
 create mode 100644 tools/quilt/patches/000-relocatable.patch
 create mode 100644 tools/quilt/patches/001-fix_compile.patch

(limited to 'tools/quilt')

diff --git a/tools/quilt/Makefile b/tools/quilt/Makefile
new file mode 100644
index 0000000..939ba69
--- /dev/null
+++ b/tools/quilt/Makefile
@@ -0,0 +1,36 @@
+# 
+# Copyright (C) 2006-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=quilt
+PKG_VERSION:=0.64
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SAVANNAH/quilt
+PKG_MD5SUM:=fc0310db5868a0873d602d4332a76d43
+
+include $(INCLUDE_DIR)/host-build.mk
+
+define Host/Configure
+	cd $(HOST_BUILD_DIR) && autoconf
+	$(call Host/Configure/Default)
+	[ -f $(HOST_BUILD_DIR)/Makefile ]
+endef
+
+define Host/Compile
+	$(MAKE) -C $(HOST_BUILD_DIR) SHELL="$(BASH)" all
+endef
+
+define Host/Install
+	$(MAKE) -C $(HOST_BUILD_DIR) SHELL="$(BASH)" install
+endef
+
+define Host/Clean
+	rm -f $(STAGING_DIR_HOST)/bin/quilt
+endef
+
+$(eval $(call HostBuild))
diff --git a/tools/quilt/patches/000-relocatable.patch b/tools/quilt/patches/000-relocatable.patch
new file mode 100644
index 0000000..ed4f00a
--- /dev/null
+++ b/tools/quilt/patches/000-relocatable.patch
@@ -0,0 +1,170 @@
+--- a/bin/quilt.in
++++ b/bin/quilt.in
+@@ -15,14 +15,22 @@ unset POSIXLY_CORRECT
+ unset GREP_OPTIONS
+ 
+ export TEXTDOMAIN=quilt
+-export TEXTDOMAINDIR=@LOCALEDIR@
+ 
+-: ${QUILT_DIR=@QUILT_DIR@}
++if test -n "$STAGING_DIR"; then
++	export TEXTDOMAINDIR="$STAGING_DIR/../host/share/locale"
++	: ${QUILT_DIR=$STAGING_DIR/../host/share/quilt} ${QUILT_LIB=$STAGING_DIR/../host/lib/quilt}
++	: ${QUILT_ETC=$STAGING_DIR/../host/etc}
++else
++	export TEXTDOMAINDIR=@LOCALEDIR@
++	: ${QUILT_DIR=@QUILT_DIR@}
++	: ${QUILT_ETC=@ETCDIR@}
++fi
++
+ export QUILT_DIR
+ 
+ if [ -z "$QUILTRC" ]
+ then
+-	for QUILTRC in $HOME/.quiltrc @ETCDIR@/quilt.quiltrc; do
++	for QUILTRC in $HOME/.quiltrc $QUILT_ETC/quilt.quiltrc; do
+ 		[ -e $QUILTRC ] && break
+ 	done
+ 	export QUILTRC
+--- a/quilt/scripts/edmail.in
++++ b/quilt/scripts/edmail.in
+@@ -1,4 +1,6 @@
+-#! @PERL@ -w
++#! @PERL@
++
++use warnings;
+ 
+ # RFCs important for this script:
+ #
+@@ -29,7 +31,7 @@ BEGIN {
+ }
+ 
+ setlocale(LC_MESSAGES, "");
+-bindtextdomain("quilt", "@LOCALEDIR@");
++bindtextdomain("quilt", $ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/locale' : "@LOCALEDIR@");
+ textdomain("quilt");
+ 
+ sub _($) {
+--- a/quilt/scripts/patchfns.in
++++ b/quilt/scripts/patchfns.in
+@@ -8,7 +8,11 @@
+ #  See the COPYING and AUTHORS files for more details.
+ 
+ export TEXTDOMAIN=quilt
+-export TEXTDOMAINDIR=@LOCALEDIR@
++if [ -n "$STAGING_DIR" ]; then
++	export TEXTDOMAINDIR="$STAGING_DIR/../host/share/locale"
++else
++	export TEXTDOMAINDIR=@LOCALEDIR@
++fi
+ 
+ : ${LC_CTYPE:=$LANG}
+ : ${LC_MESSAGES:=$LANG}
+--- a/quilt/scripts/remove-trailing-ws.in
++++ b/quilt/scripts/remove-trailing-ws.in
+@@ -1,4 +1,6 @@
+-#! @PERL@ -w
++#! @PERL@
++
++use warnings;
+ 
+ # Remove trailing whitespace from modified lines in working files.
+ #
+@@ -31,7 +33,7 @@ BEGIN {
+ }
+ 
+ setlocale(LC_MESSAGES, "");
+-bindtextdomain("quilt", "@LOCALEDIR@");
++bindtextdomain("quilt", $ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/locale' : "@LOCALEDIR@");
+ textdomain("quilt");
+ 
+ sub _($) {
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -21,8 +21,8 @@ COLUMN :=	@COLUMN@
+ GETOPT :=	@GETOPT@
+ CP :=		@CP@
+ DATE :=		@DATE@
+-PERL :=		@PERL@
+-BASH :=		@BASH@
++PERL :=		/usr/bin/env perl
++BASH :=		/usr/bin/env bash
+ SHELL:=		@BASH@ # It does not work if dash is used as a shell, for example
+ GREP :=		@GREP@
+ TAIL :=		@TAIL@
+@@ -32,7 +32,7 @@ AWK :=		@AWK@
+ FIND :=		@FIND@
+ XARGS :=	@XARGS@
+ DIFF :=		@DIFF@
+-PATCH :=	@PATCH@
++PATCH :=	/usr/bin/env patch
+ MKTEMP :=	@MKTEMP@
+ MSGMERGE :=	@MSGMERGE@
+ MSGFMT :=	@MSGFMT@
+@@ -48,8 +48,8 @@ USE_NLS :=	@USE_NLS@
+ STAT_HARDLINK := @STAT_HARDLINK@
+ PATCH_WRAPPER := @PATCH_WRAPPER@
+ 
+-COMPAT_SYMLINKS	:= @COMPAT_SYMLINKS@
+-COMPAT_PROGRAMS	:= @COMPAT_PROGRAMS@
++COMPAT_SYMLINKS	:=
++COMPAT_PROGRAMS	:=
+ 
+ default: all
+ 
+--- a/quilt/scripts/backup-files.in
++++ b/quilt/scripts/backup-files.in
+@@ -53,7 +53,12 @@ usage ()
+ "
+ }
+ 
+-: ${QUILT_DIR=@QUILT_DIR@}
++if test -n "$STAGING_DIR"; then
++	: ${QUILT_DIR="$STAGING_DIR/../host/share/quilt"}
++else
++	: ${QUILT_DIR=@QUILT_DIR@}
++fi
++
+ . $QUILT_DIR/scripts/utilfns
+ 
+ ensure_nolinks()
+--- a/bin/guards.in
++++ b/bin/guards.in
+@@ -1,4 +1,6 @@
+-#!@PERL@ -w
++#!@PERL@
++
++use warnings;
+ 
+ #  This script is free software; you can redistribute it and/or modify
+ #  it under the terms of the GNU General Public License version 2 as
+--- a/compat/date.in
++++ b/compat/date.in
+@@ -1,4 +1,6 @@
+-#! @PERL@ -w
++#! @PERL@
++
++use warnings;
+ 
+ #  This script is free software; you can redistribute it and/or modify
+ #  it under the terms of the GNU General Public License version 2 as
+--- a/compat/getopt.in
++++ b/compat/getopt.in
+@@ -1,4 +1,6 @@
+-#! @PERL@ -w
++#! @PERL@
++
++use warnings;
+ 
+ #  This script is free software; you can redistribute it and/or modify
+ #  it under the terms of the GNU General Public License version 2 as
+--- a/quilt/scripts/dependency-graph.in
++++ b/quilt/scripts/dependency-graph.in
+@@ -1,4 +1,6 @@
+-#!@PERL@ -w
++#!@PERL@
++
++use warnings;
+ 
+ #  This script is free software; you can redistribute it and/or modify
+ #  it under the terms of the GNU General Public License version 2 as
diff --git a/tools/quilt/patches/001-fix_compile.patch b/tools/quilt/patches/001-fix_compile.patch
new file mode 100644
index 0000000..3ce93f0
--- /dev/null
+++ b/tools/quilt/patches/001-fix_compile.patch
@@ -0,0 +1,18 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -271,13 +271,10 @@ $(patsubst %.in,%,$(wildcard bin/*.in qu
+ 	@$(if $(filter $@,$(NON_EXEC_IN)),,chmod +x $@)
+ 
+ configure : configure.ac aclocal.m4
+-	autoconf
+-	@echo "Please run ./configure"
+-	@false
++	@touch $@
+ 
+ Makefile : Makefile.in configure
+-	@echo "Please run ./configure"
+-	@false
++	@touch $@
+ 
+ compat_leftover := $(filter-out $(COMPAT),$(shell $(FIND) compat -type f -perm -0100))
+ 
-- 
cgit v1.2.3