From 83cd20c6425dbe6da853538c910fb1d438943918 Mon Sep 17 00:00:00 2001
From: Stijn Souffriau <stijn.souffriau@essensium.com>
Date: Tue, 1 May 2012 22:02:45 +0200
Subject: [PATCH] Added the gnupg package and prerequisite libraries

---
 package/Config.in                                  |    4 ++
 package/gnupg/Config.in                            |   13 +++++++
 package/gnupg/gnupg.mk                             |   33 +++++++++++++++++++
 package/libassuan/Config.in                        |    5 +++
 package/libassuan/libassuan.mk                     |   24 ++++++++++++++
 package/libgcrypt/libgcrypt.mk                     |    2 +
 package/libgpg-error/libgpg-error.mk               |    1 +
 package/libksba/Config.in                          |    4 ++
 package/libksba/libksba.mk                         |   21 ++++++++++++
 package/libpth/Config.in                           |    5 +++
 ...mmited-L-usr-lib-I-usr-include-from-paths.patch |   34 ++++++++++++++++++++
 package/libpth/libpth-0002-dependencyfix.patch     |   25 ++++++++++++++
 .../libpth-0003-fixed-install-depedency.patch      |   34 ++++++++++++++++++++
 package/libpth/libpth.mk                           |   20 +++++++++++
 14 files changed, 225 insertions(+), 0 deletions(-)
 create mode 100644 package/gnupg/Config.in
 create mode 100644 package/gnupg/gnupg.mk
 create mode 100644 package/libassuan/Config.in
 create mode 100644 package/libassuan/libassuan.mk
 create mode 100644 package/libksba/Config.in
 create mode 100644 package/libksba/libksba.mk
 create mode 100644 package/libpth/Config.in
 create mode 100644 package/libpth/libpth-0001-ommited-L-usr-lib-I-usr-include-from-paths.patch
 create mode 100644 package/libpth/libpth-0002-dependencyfix.patch
 create mode 100644 package/libpth/libpth-0003-fixed-install-depedency.patch
 create mode 100644 package/libpth/libpth.mk

diff --git a/package/Config.in b/package/Config.in
index ed66c05..bc9eaeb 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -280,6 +280,8 @@ source "package/libgpg-error/Config.in"
 source "package/libnss/Config.in"
 source "package/openssl/Config.in"
 source "package/polarssl/Config.in"
+source "package/libassuan/Config.in"
+source "package/libksba/Config.in"
 endmenu
 
 menu "Database"
@@ -402,6 +404,7 @@ source "package/orc/Config.in"
 source "package/poco/Config.in"
 source "package/protobuf/Config.in"
 source "package/startup-notification/Config.in"
+source "package/libpth/Config.in"
 endmenu
 
 menu "Text and terminal handling"
@@ -434,6 +437,7 @@ endmenu
 
 menu "Miscellaneous"
 source "package/shared-mime-info/Config.in"
+source "package/gnupg/Config.in"
 endmenu
 
 menu "Networking applications"
diff --git a/package/gnupg/Config.in b/package/gnupg/Config.in
new file mode 100644
index 0000000..81bedf4
--- /dev/null
+++ b/package/gnupg/Config.in
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_GNUPG
+	bool "gnupg"
+        depends on BR2_TOOLCHAIN_EXTERNAL_GLIBC
+	select BR2_PACKAGE_LIBGPG_ERROR
+	select BR2_PACKAGE_LIBGCRYPT
+	select BR2_PACKAGE_LIBKSBA
+	select BR2_PACKAGE_LIBASSUAN
+	select BR2_PACKAGE_LIBPTH
+	select BR2_PACKAGE_ZLIB
+	help
+	GnuPG 2.0 is the new modularized version of GnuPG supporting OpenPGP and S/MIME
+	http://www.gnupg.org/
+
diff --git a/package/gnupg/gnupg.mk b/package/gnupg/gnupg.mk
new file mode 100644
index 0000000..24fd8b7
--- /dev/null
+++ b/package/gnupg/gnupg.mk
@@ -0,0 +1,33 @@
+#############################################################
+#
+# libgpg-error
+#
+#############################################################
+GNUPG_VERSION:=2.0.19
+GNUPG_SOURCE:=gnupg-$(GNUPG_VERSION).tar.bz2
+GNUPG_SITE:=ftp://ftp.gnupg.org/gcrypt/gnupg/
+GNUPG_DEPENDENCIES= libgpg-error libgcrypt libassuan libksba libpth zlib 
+HOST_GNUPG_DEPENDENCIES= host-libgpg-error host-libgcrypt host-libassuan host-libksba host-libpth host-zlib
+
+GNUPG_INSTALL_STAGING = YES
+
+GNUPG_CONF_OPT = \
+        --disable-optimization \
+        --with-gpg-error-prefix=$(STAGING_DIR)/usr \
+	--with-libgcrypt-prefix=$(STAGING_DIR)/usr \
+	--with-libassuan-prefix=$(STAGING_DIR)/usr \
+	--with-ksba-prefix=$(STAGING_DIR)/usr \
+	--with-pth-prefix=$(STAGING_DIR)/usr \
+	--with-zlib=$(STAGING_DIR)/usr/lib
+
+HOST_GNUPG_CONF_OPT = \
+        --disable-optimization \
+        --with-gpg-error-prefix=$(HOST_DIR)/usr \
+        --with-libgcrypt-prefix=$(HOST_DIR)/usr \
+        --with-libassuan-prefix=$(HOST_DIR)/usr \
+        --with-ksba-prefix=$(HOST_DIR)/usr \
+        --with-pth-prefix=$(HOST_DIR)/usr \
+	--with-zlib=$(HOST_DIR)/usr/lib
+
+$(eval $(call AUTOTARGETS))
+$(eval $(call AUTOTARGETS,host))
diff --git a/package/libassuan/Config.in b/package/libassuan/Config.in
new file mode 100644
index 0000000..7483e48
--- /dev/null
+++ b/package/libassuan/Config.in
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_LIBASSUAN
+	bool "libassuan"
+	help
+	  Libassuan is the IPC library used by some GnuPG related software.
+
diff --git a/package/libassuan/libassuan.mk b/package/libassuan/libassuan.mk
new file mode 100644
index 0000000..0545f36
--- /dev/null
+++ b/package/libassuan/libassuan.mk
@@ -0,0 +1,24 @@
+#############################################################
+#
+# libgcrypt
+#
+#############################################################
+
+LIBASSUAN_VERSION = 2.0.3
+LIBASSUAN_SOURCE = libassuan-$(LIBASSUAN_VERSION).tar.bz2
+LIBASSUAN_SITE = ftp://ftp.gnupg.org/gcrypt/libassuan/
+LIBASSUAN_INSTALL_STAGING = YES
+
+LIBASSUAN_CONF_OPT = \
+	--disable-optimization \
+	--with-gpg-error-prefix=$(STAGING_DIR)/usr
+
+HOST_LIBASSUAN_CONF_OPT = \
+	--disable-optimization \
+	--with-gpg-error-prefix=$(HOST_DIR)/usr
+
+LIBASSUAN_DEPENDENCIES = libgpg-error
+HOST_LIBASSUAN_DEPENDENCIES = host-libgpg-error
+
+$(eval $(call AUTOTARGETS))
+$(eval $(call AUTOTARGETS,host))
diff --git a/package/libgcrypt/libgcrypt.mk b/package/libgcrypt/libgcrypt.mk
index 68c6c47..050f83f 100644
--- a/package/libgcrypt/libgcrypt.mk
+++ b/package/libgcrypt/libgcrypt.mk
@@ -16,5 +16,7 @@ LIBGCRYPT_CONF_OPT = \
 	--with-gpg-error-prefix=$(STAGING_DIR)/usr
 
 LIBGCRYPT_DEPENDENCIES = libgpg-error
+HOST_LIBGCRYPT_DEPENDENCIES = host-libgpg-error
 
 $(eval $(call AUTOTARGETS))
+$(eval $(call AUTOTARGETS,host))
diff --git a/package/libgpg-error/libgpg-error.mk b/package/libgpg-error/libgpg-error.mk
index 1b78b17..2aa1da3 100644
--- a/package/libgpg-error/libgpg-error.mk
+++ b/package/libgpg-error/libgpg-error.mk
@@ -9,3 +9,4 @@ LIBGPG_ERROR_SITE = ftp://ftp.gnupg.org/gcrypt/libgpg-error
 LIBGPG_ERROR_INSTALL_STAGING = YES
 
 $(eval $(call AUTOTARGETS))
+$(eval $(call AUTOTARGETS,host))
diff --git a/package/libksba/Config.in b/package/libksba/Config.in
new file mode 100644
index 0000000..0d333b2
--- /dev/null
+++ b/package/libksba/Config.in
@@ -0,0 +1,4 @@
+config BR2_PACKAGE_LIBKSBA
+	bool "libksba"
+	help
+	  Libksba is a CMS and X.509 access library under development.
diff --git a/package/libksba/libksba.mk b/package/libksba/libksba.mk
new file mode 100644
index 0000000..4f741a9
--- /dev/null
+++ b/package/libksba/libksba.mk
@@ -0,0 +1,21 @@
+#############################################################
+#
+# libgcrypt
+#
+#############################################################
+
+LIBKSBA_VERSION = 1.2.0
+LIBKSBA_SOURCE = libksba-$(LIBKSBA_VERSION).tar.bz2
+LIBKSBA_SITE = ftp://ftp.gnupg.org/gcrypt/libksba/
+LIBKSBA_INSTALL_STAGING = YES
+
+LIBKSBA_CONF_OPT = \
+	--disable-optimization \
+	--with-gpg-error-prefix=$(STAGING_DIR)/usr
+
+HOST_LIBKSBA_CONF_OPT = \
+	--disable-optimization \
+	--with-gpg-error-prefix=$(HOST_DIR)/usr
+
+$(eval $(call AUTOTARGETS))
+$(eval $(call AUTOTARGETS,host))
diff --git a/package/libpth/Config.in b/package/libpth/Config.in
new file mode 100644
index 0000000..cec5acc
--- /dev/null
+++ b/package/libpth/Config.in
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_LIBPTH
+	bool "libpth"
+	select BR2_PACKAGE_PTH_ERROR
+	help
+	  http://www.gnu.org/software/pth/
diff --git a/package/libpth/libpth-0001-ommited-L-usr-lib-I-usr-include-from-paths.patch b/package/libpth/libpth-0001-ommited-L-usr-lib-I-usr-include-from-paths.patch
new file mode 100644
index 0000000..3c3c69c
--- /dev/null
+++ b/package/libpth/libpth-0001-ommited-L-usr-lib-I-usr-include-from-paths.patch
@@ -0,0 +1,34 @@
+From 92f49db9b1c74691ac82b1f52429ca9b6f98d6f4 Mon Sep 17 00:00:00 2001
+From: Stijn Souffriau <stijn.souffriau@gmail.com>
+Date: Thu, 29 Mar 2012 19:55:02 +0200
+Subject: [PATCH] ommited -L/usr/lib -I/usr/include from paths
+
+---
+ pth-config.in |    8 ++++++--
+ 1 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/pth-config.in b/pth-config.in
+index 24a93d7..802770d 100644
+--- a/pth-config.in
++++ b/pth-config.in
+@@ -109,11 +109,15 @@ do
+             output="$output $pth_acdir"
+             ;;
+         --cflags)
+-            output="$output -I$pth_includedir"
++	    if [[ $pth_includedir != "/usr/include" ]]; then
++		output="$output -I$pth_includedir"
++	    fi
+             output_extra="$output_extra $pth_cflags"
+             ;;
+         --ldflags)
+-            output="$output -L$pth_libdir"
++	    if [[ $pth_libdir != "/usr/lib" ]]; then
++            	output="$output -L$pth_libdir"
++	    fi
+             output_extra="$output_extra $pth_ldflags"
+             ;;
+         --libs)
+-- 
+1.7.0.4
+
diff --git a/package/libpth/libpth-0002-dependencyfix.patch b/package/libpth/libpth-0002-dependencyfix.patch
new file mode 100644
index 0000000..5a9ad51
--- /dev/null
+++ b/package/libpth/libpth-0002-dependencyfix.patch
@@ -0,0 +1,25 @@
+From 92f862503bb934252e9df1d19d7184b5ed57d7aa Mon Sep 17 00:00:00 2001
+From: Stijn Souffriau <stijn.souffriau@gmail.com>
+Date: Mon, 2 Apr 2012 16:00:53 +0200
+Subject: [PATCH] changed Makefile
+
+---
+ Makefile.in |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 477ed81..750ec9f 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -162,6 +162,8 @@ all-normal: $(TARGET_ALL)
+ all-for-install: $(TARGET_ALL)
+ 	@touch .done-all >/dev/null 2>&1 || $(TRUE)
+ 
++$(HSRCS): pth_p.h
++
+ #   build the private shared header file
+ pth_p.h: $(S)pth_p.h.in
+ 	$(SHTOOL) scpp -o pth_p.h -t $(S)pth_p.h.in -Dcpp -Cintern -M '==#==' $(HSRCS)
+-- 
+1.7.0.4
+
diff --git a/package/libpth/libpth-0003-fixed-install-depedency.patch b/package/libpth/libpth-0003-fixed-install-depedency.patch
new file mode 100644
index 0000000..ff384f6
--- /dev/null
+++ b/package/libpth/libpth-0003-fixed-install-depedency.patch
@@ -0,0 +1,34 @@
+From f2079abd360d2f1c531927e8ff7aa034d51aac66 Mon Sep 17 00:00:00 2001
+From: Stijn Souffriau <stijn.souffriau@essensium.com>
+Date: Tue, 3 Apr 2012 13:49:38 +0200
+Subject: [PATCH] fixed install depedency
+
+---
+ Makefile.in |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 750ec9f..f5f3c9c 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -229,7 +229,7 @@ install-dirs:
+ 	$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(mandir)/man1
+ 	$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(mandir)/man3
+ 	$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(datadir)/aclocal
+-install-pth:
++install-pth: install-dirs
+ 	$(SHTOOL) install -c -m 755 pth-config $(DESTDIR)$(bindir)/pth-config
+ 	$(SHTOOL) install -c -m 644 $(S)pth-config.1 $(DESTDIR)$(mandir)/man1/pth-config.1
+ 	$(SHTOOL) install -c -m 644 $(S)pth.3 $(DESTDIR)$(mandir)/man3/pth.3
+@@ -237,7 +237,7 @@ install-pth:
+ 	$(SHTOOL) install -c -m 644 pth.h $(DESTDIR)$(includedir)/pth.h
+ 	@umask 022; $(LIBTOOL) --mode=install \
+ 	$(SHTOOL) install -c libpth.la $(DESTDIR)$(libdir)/libpth.la
+-install-pthread:
++install-pthread: install-dirs
+ 	$(SHTOOL) install -c -m 755 pthread-config $(DESTDIR)$(bindir)/pthread-config
+ 	$(SHTOOL) install -c -m 644 $(S)pthread-config.1 $(DESTDIR)$(mandir)/man1/pthread-config.1
+ 	$(SHTOOL) install -c -m 644 pthread.h $(DESTDIR)$(includedir)/pthread.h
+-- 
+1.7.0.4
+
diff --git a/package/libpth/libpth.mk b/package/libpth/libpth.mk
new file mode 100644
index 0000000..e71b704
--- /dev/null
+++ b/package/libpth/libpth.mk
@@ -0,0 +1,20 @@
+#############################################################
+#
+# libgcrypt
+#
+#############################################################
+
+LIBPTH_VERSION = 2.0.6
+LIBPTH_SOURCE = pth-$(LIBPTH_VERSION).tar.gz
+LIBPTH_SITE = ftp://ftp.gnu.org/gnu/pth/
+LIBPTH_INSTALL_STAGING = YES
+
+LIBPTH_CONF_OPT = \
+	--disable-optimization
+
+HOST_LIBPTH_CONF_OPT = \
+	--disable-optimization
+
+
+$(eval $(call AUTOTARGETS))
+$(eval $(call AUTOTARGETS,host))
-- 
1.7.0.4

