diff --git a/contrib/src/gpgerror/SHA512SUMS b/contrib/src/gpgerror/SHA512SUMS
new file mode 100644
index 0000000000000000000000000000000000000000..e1f691e18423e0b814a98f4dbccce2164fd7b22b
--- /dev/null
+++ b/contrib/src/gpgerror/SHA512SUMS
@@ -0,0 +1 @@
+db35cff54f12fef121f62bd989147acb8a2bc0711564e7153c1d10c5542e3530d3b3e172210320d312a8438372a099977dc72905e1fcdc29eddfacf8d34998fe  libgpg-error-1.13.tar.bz2
diff --git a/contrib/src/gpgerror/rules.mak b/contrib/src/gpgerror/rules.mak
new file mode 100644
index 0000000000000000000000000000000000000000..9d347a902186893b05693f15287f743db04c062f
--- /dev/null
+++ b/contrib/src/gpgerror/rules.mak
@@ -0,0 +1,22 @@
+# GPG-error library
+
+GPGERROR_VERSION := 1.13
+GPGERROR_URL := http://ftp.heanet.ie/mirrors/ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-$(GPGERROR_VERSION).tar.bz2
+
+ifeq ($(call need_pkg," >= 1.11"),)
+PKGS_FOUND += gpgerror
+endif
+
+$(TARBALLS)/libgpg-error-$(GPGERROR_VERSION).tar.bz2:
+	$(call download,$(GPGERROR_URL))
+
+.sum-gpgerror: libgpg-error-$(GPGERROR_VERSION).tar.bz2
+
+gpgerror: libgpg-error-$(GPGERROR_VERSION).tar.bz2 .sum-gpgerror
+	$(UNPACK)
+	$(MOVE)
+
+.gpgerror: gpgerror
+	cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
+	cd $< && $(MAKE) install
+	touch $@