aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--defaults/software.sh35
-rwxr-xr-xgen_configkernel.sh65
-rwxr-xr-xgen_initramfs.sh35
-rw-r--r--gkbuilds/cryptsetup.gkbuild33
-rw-r--r--gkbuilds/json-c.gkbuild2
-rw-r--r--gkbuilds/libgcrypt.gkbuild46
-rw-r--r--gkbuilds/libgpg-error.gkbuild81
-rw-r--r--gkbuilds/popt.gkbuild16
-rw-r--r--patches/libgcrypt/1.8.4/libgcrypt-1.8.4-ac_cv_sys_symbol_underscore.patch37
-rw-r--r--patches/libgpg-error/1.36/libgpg-error-1.36-gawk5-support.patch158
-rw-r--r--patches/libgpg-error/1.36/libgpg-error-1.36-gpg-error-config.patch38
11 files changed, 525 insertions, 21 deletions
diff --git a/defaults/software.sh b/defaults/software.sh
index 5df1c0ca..cecad699 100644
--- a/defaults/software.sh
+++ b/defaults/software.sh
@@ -16,6 +16,13 @@ GKPKG_BUSYBOX_SRCTAR="${GKPKG_BUSYBOX_SRCTAR:-${DISTDIR}/busybox-${GKPKG_BUSYBOX
GKPKG_BUSYBOX_SRCDIR="${GKPKG_BUSYBOX_SRCDIR:-busybox-${GKPKG_BUSYBOX_PV}}"
GKPKG_BUSYBOX_BINPKG="${GKPKG_BUSYBOX_BINPKG:-%%CACHE%%/busybox-${GKPKG_BUSYBOX_PV}-%%ARCH%%.tar.xz}"
+GKPKG_CRYPTSETUP_PN="cryptsetup"
+GKPKG_CRYPTSETUP_PV="${GKPKG_CRYPTSETUP_PV:-VERSION_CRYPTSETUP}"
+GKPKG_CRYPTSETUP_DEPS="util-linux json-c popt libgpg-error libgcrypt lvm"
+GKPKG_CRYPTSETUP_SRCTAR="${GKPKG_CRYPTSETUP_SRCTAR:-${DISTDIR}/cryptsetup-${GKPKG_CRYPTSETUP_PV}.tar.xz}"
+GKPKG_CRYPTSETUP_SRCDIR="${GKPKG_CRYPTSETUP_SRCDIR:-cryptsetup-${GKPKG_CRYPTSETUP_PV}}"
+GKPKG_CRYPTSETUP_BINPKG="${GKPKG_CRYPTSETUP_BINPKG:-%%CACHE%%/cryptsetup-${GKPKG_CRYPTSETUP_PV}-%%ARCH%%.tar.xz}"
+
GKPKG_DMRAID_PN="dmraid"
GKPKG_DMRAID_PV="${GKPKG_DMRAID_PV:-VERSION_DMRAID}"
GKPKG_DMRAID_DEPS="lvm"
@@ -58,6 +65,13 @@ GKPKG_ISCSI_SRCDIR="${GKPKG_ISCSI_SRCDIR:-open-iscsi-${GKPKG_ISCSI_PV}}"
GKPKG_ISCSI_SRCTAR="${GKPKG_ISCSI_SRCTAR:-${DISTDIR}/open-iscsi-${GKPKG_ISCSI_PV}.tar.gz}"
GKPKG_ISCSI_BINPKG="${GKPKG_ISCSI_BINPKG:-%%CACHE%%/iscsi-${GKPKG_ISCSI_PV}-%%ARCH%%.tar.xz}"
+GKPKG_JSON_C_PN="json-c"
+GKPKG_JSON_C_PV="${GKPKG_JSON_C_PV:-VERSION_JSON_C}"
+GKPKG_JSON_C_DEPS=""
+GKPKG_JSON_C_SRCDIR="${GKPKG_JSON_C_SRCDIR:-json-c-${GKPKG_JSON_C_PV}}"
+GKPKG_JSON_C_SRCTAR="${GKPKG_JSON_C_SRCTAR:-${DISTDIR}/json-c-${GKPKG_JSON_C_PV}.tar.gz}"
+GKPKG_JSON_C_BINPKG="${GKPKG_JSON_C_BINPKG:-%%CACHE%%/json-c-${GKPKG_JSON_C_PV}-%%ARCH%%.tar.xz}"
+
GKPKG_LIBAIO_PN="libaio"
GKPKG_LIBAIO_PV="${GKPKG_LIBAIO_PV:-VERSION_LIBAIO}"
GKPKG_LIBAIO_DEPS=""
@@ -65,6 +79,20 @@ GKPKG_LIBAIO_SRCDIR="${GKPKG_LIBAIO_SRCDIR:-libaio-${GKPKG_LIBAIO_PV}}"
GKPKG_LIBAIO_SRCTAR="${GKPKG_LIBAIO_SRCTAR:-${DISTDIR}/libaio-${GKPKG_LIBAIO_PV}.tar.gz}"
GKPKG_LIBAIO_BINPKG="${GKPKG_LIBAIO_BINPKG:-%%CACHE%%/libaio-${GKPKG_LIBAIO_PV}-%%ARCH%%.tar.xz}"
+GKPKG_LIBGCRYPT_PN="libgcrypt"
+GKPKG_LIBGCRYPT_PV="${GKPKG_LIBGCRYPT_PV:-VERSION_LIBGCRYPT}"
+GKPKG_LIBGCRYPT_DEPS="libgpg-error"
+GKPKG_LIBGCRYPT_SRCDIR="${GKPKG_LIBGCRYPT_SRCDIR:-libgcrypt-${GKPKG_LIBGCRYPT_PV}}"
+GKPKG_LIBGCRYPT_SRCTAR="${GKPKG_LIBGCRYPT_SRCTAR:-${DISTDIR}/libgcrypt-${GKPKG_LIBGCRYPT_PV}.tar.bz2}"
+GKPKG_LIBGCRYPT_BINPKG="${GKPKG_LIBGCRYPT_BINPKG:-%%CACHE%%/libgcrypt-${GKPKG_LIBGCRYPT_PV}-%%ARCH%%.tar.xz}"
+
+GKPKG_LIBGPG_ERROR_PN="libgpg-error"
+GKPKG_LIBGPG_ERROR_PV="${GKPKG_LIBGPG_ERROR_PV:-VERSION_LIBGPGERROR}"
+GKPKG_LIBGPG_ERROR_DEPS=""
+GKPKG_LIBGPG_ERROR_SRCDIR="${GKPKG_LIBGPG_ERROR_SRCDIR:-libgpg-error-${GKPKG_LIBGPG_ERROR_PV}}"
+GKPKG_LIBGPG_ERROR_SRCTAR="${GKPKG_LIBGPG_ERROR_SRCTAR:-${DISTDIR}/libgpg-error-${GKPKG_LIBGPG_ERROR_PV}.tar.bz2}"
+GKPKG_LIBGPG_ERROR_BINPKG="${GKPKG_LIBGPG_ERROR_BINPKG:-%%CACHE%%/libgpg-error-${GKPKG_LIBGPG_ERROR_PV}-%%ARCH%%.tar.xz}"
+
GKPKG_LVM_PN="lvm"
GKPKG_LVM_PV="${GKPKG_LVM_PV:-VERSION_LVM}"
GKPKG_LVM_DEPS="util-linux libaio"
@@ -79,6 +107,13 @@ GKPKG_MDADM_SRCDIR="${GKPKG_MDADM_SRCDIR:-mdadm-${GKPKG_MDADM_PV}}"
GKPKG_MDADM_SRCTAR="${GKPKG_MDADM_SRCTAR:-${DISTDIR}/mdadm-${GKPKG_MDADM_PV}.tar.xz}"
GKPKG_MDADM_BINPKG="${GKPKG_MDADM_BINPKG:-%%CACHE%%/mdadm-${GKPKG_MDADM_PV}-%%ARCH%%.tar.xz}"
+GKPKG_POPT_PN="popt"
+GKPKG_POPT_PV="${GKPKG_POPT_PV:-VERSION_POPT}"
+GKPKG_POPT_DEPS=""
+GKPKG_POPT_SRCDIR="${GKPKG_POPT_SRCDIR:-popt-${GKPKG_POPT_PV}}"
+GKPKG_POPT_SRCTAR="${GKPKG_POPT_SRCTAR:-${DISTDIR}/popt-${GKPKG_POPT_PV}.tar.gz}"
+GKPKG_POPT_BINPKG="${GKPKG_POPT_BINPKG:-%%CACHE%%/popt-${GKPKG_POPT_PV}-%%ARCH%%.tar.xz}"
+
GKPKG_UNIONFS_FUSE_PN="unionfs-fuse"
GKPKG_UNIONFS_FUSE_PV="${GKPKG_UNIONFS_FUSE_PV:-VERSION_UNIONFS_FUSE}"
GKPKG_UNIONFS_FUSE_DEPS="fuse"
diff --git a/gen_configkernel.sh b/gen_configkernel.sh
index 63f38b0b..5ab0d43d 100755
--- a/gen_configkernel.sh
+++ b/gen_configkernel.sh
@@ -270,6 +270,71 @@ config_kernel() {
&& required_kernel_options+=( 'CONFIG_FILE_LOCKING' )
fi
+ # Make sure all modules required for cryptsetup/LUKS are enabled in the kernel, if --luks
+ if isTrue "${CMD_LUKS}"
+ then
+ print_info 2 "$(get_indent 1)>> Ensure that required kernel options for LUKS support are set ..."
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_BLOCK" "y"
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_CRYPTO" "y"
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_MD" "y"
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_NET" "y"
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_BLK_DEV_DM" "${cfg_CONFIG_BLK_DEV_DM}" &&
+ required_kernel_options+=( 'CONFIG_BLK_DEV_DM' )
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_DM_CRYPT" "${cfg_CONFIG_BLK_DEV_DM}" &&
+ required_kernel_options+=( 'CONFIG_DM_CRYPT' )
+
+ local cfg_CONFIG_CRYPTO_AES=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_CRYPTO_AES")
+ case "${cfg_CONFIG_CRYPTO_AES}" in
+ y|m) ;; # Do nothing
+ *) cfg_CONFIG_CRYPTO_AES=${newcfg_setting}
+ esac
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_CRYPTO_XTS" "${cfg_CONFIG_CRYPTO_AES}" &&
+ required_kernel_options+=( 'CONFIG_CRYPTO_XTS' )
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_CRYPTO_SHA256" "${cfg_CONFIG_CRYPTO_AES}" &&
+ required_kernel_options+=( 'CONFIG_CRYPTO_SHA256' )
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_CRYPTO_AES" "${cfg_CONFIG_CRYPTO_AES}" &&
+ required_kernel_options+=( 'CONFIG_CRYPTO_AES' )
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_CRYPTO_USER_API_HASH" "${cfg_CONFIG_CRYPTO_AES}" &&
+ required_kernel_options+=( 'CONFIG_CRYPTO_USER_API_HASH' )
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_CRYPTO_USER_API_SKCIPHER" "${cfg_CONFIG_CRYPTO_AES}" &&
+ required_kernel_options+=( 'CONFIG_CRYPTO_USER_API_SKCIPHER' )
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_CRYPTO_USER_API_AEAD" "${cfg_CONFIG_CRYPTO_AES}"
+
+ local cfg_CONFIG_X86=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_X86")
+ case "${cfg_CONFIG_X86}" in
+ y|m)
+ cfg_CONFIG_X86=yes
+ ;;
+ *)
+ cfg_CONFIG_X86=no
+ ;;
+ esac
+
+ local cfg_CONFIG_64BIT=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_64BIT")
+ case "${cfg_CONFIG_64BIT}" in
+ y|m)
+ cfg_CONFIG_64BIT=yes
+ ;;
+ *)
+ cfg_CONFIG_64BIT=no
+ ;;
+ esac
+
+ if isTrue "${cfg_CONFIG_X86}"
+ then
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_CRYPTO_AES_NI_INTEL" "${cfg_CONFIG_CRYPTO_AES}"
+
+ if isTrue "${cfg_CONFIG_64BIT}"
+ then
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_CRYPTO_SHA1_SSSE3" "${cfg_CONFIG_CRYPTO_AES}"
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_CRYPTO_SHA256_SSSE3" "${cfg_CONFIG_CRYPTO_AES}"
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_CRYPTO_AES_X86_64" "${cfg_CONFIG_CRYPTO_AES}"
+ else
+ kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_CRYPTO_AES_586" "${cfg_CONFIG_CRYPTO_AES}"
+ fi
+ fi
+ fi
+
# Make sure multipath modules are enabled in the kernel, if --multipath
if isTrue "${CMD_MULTIPATH}"
then
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index 3971fd72..fd26410f 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -724,34 +724,27 @@ append_overlay(){
}
append_luks() {
- local _luks_error_format="LUKS support cannot be included: %s. Please emerge sys-fs/cryptsetup."
- local _luks_source=/sbin/cryptsetup
- local _luks_dest=/sbin/cryptsetup
-
- if [ -d "${TEMP}/initramfs-luks-temp" ]
+ local PN=cryptsetup
+ local TDIR="${TEMP}/initramfs-luks-temp"
+ if [ -d "${TDIR}" ]
then
- rm -r "${TEMP}/initramfs-luks-temp/"
+ rm -r "${TDIR}" || gen_die "Failed to clean out existing '${TDIR}'!"
fi
- mkdir -p "${TEMP}/initramfs-luks-temp/lib/luks/"
- mkdir -p "${TEMP}/initramfs-luks-temp/sbin"
- cd "${TEMP}/initramfs-luks-temp"
+ populate_binpkg ${PN}
- if isTrue "${LUKS}"
- then
- [ -x "${_luks_source}" ] \
- || gen_die "$(printf "${_luks_error_format}" "no file ${_luks_source}")"
+ mkdir -p "${TDIR}" || gen_die "Failed to create '${TDIR}'!"
- print_info 1 "$(getIndent 2)LUKS: Adding support (using system binaries)..."
- copy_binaries "${TEMP}/initramfs-luks-temp/" /sbin/cryptsetup
- fi
+ unpack "$(get_gkpkg_binpkg "${PN}")" "${TDIR}"
+
+ cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!"
+
+ # Delete unneeded files
+ rm -rf usr/
log_future_cpio_content
find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
- || gen_die "appending cryptsetup to cpio"
-
- cd "${TEMP}"
- rm -r "${TEMP}/initramfs-luks-temp/"
+ || gen_die "Failed to append luks to cpio!"
}
append_dropbear() {
@@ -1382,7 +1375,7 @@ create_initramfs() {
append_data 'modprobed'
- if isTrue "${ZFS}" || isTrue "${LUKS}"
+ if isTrue "${ZFS}"
then
append_data 'libgcc_s'
fi
diff --git a/gkbuilds/cryptsetup.gkbuild b/gkbuilds/cryptsetup.gkbuild
new file mode 100644
index 00000000..a99ce28d
--- /dev/null
+++ b/gkbuilds/cryptsetup.gkbuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+src_configure() {
+ export ac_cv_header_security_pam_misc_h=no
+ export ac_cv_header_security_pam_appl_h=no
+
+ local myconf=(
+ --enable-internal-argon2
+ --sbindir=/sbin
+ --disable-nls
+ --enable-static=yes
+ --enable-shared=no
+ --enable-static-cryptsetup
+ --with-crypto_backend=gcrypt
+ )
+
+ gkconf "${myconf[@]}"
+}
+
+src_install() {
+ default
+
+ rm -rf \
+ "${D}"/sbin/* \
+ "${D}"/usr/share/
+
+ cp -a cryptsetup.static "${D}"/sbin/cryptsetup \
+ || die "Failed to copy '${S}/cryptsetup.static' to '${D}/sbin/cryptsetup'!"
+
+ "${STRIP}" --strip-all "${D}"/sbin/cryptsetup \
+ || die "Failed to strip '${D}/sbin/cryptsetup'!"
+}
diff --git a/gkbuilds/json-c.gkbuild b/gkbuilds/json-c.gkbuild
new file mode 100644
index 00000000..c103679e
--- /dev/null
+++ b/gkbuilds/json-c.gkbuild
@@ -0,0 +1,2 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
diff --git a/gkbuilds/libgcrypt.gkbuild b/gkbuilds/libgcrypt.gkbuild
new file mode 100644
index 00000000..a6686d34
--- /dev/null
+++ b/gkbuilds/libgcrypt.gkbuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+src_configure() {
+ export ac_cv_sys_symbol_underscore=no
+
+ local myconf=(
+ --enable-static=yes
+ --disable-padlock-support
+ --enable-static=yes
+ )
+
+ gkconf "${myconf[@]}"
+}
+
+src_install() {
+ default
+
+ rm -rf \
+ "${D}"/usr/bin/dumpsexp \
+ "${D}"/usr/bin/hmac256 \
+ "${D}"/usr/bin/mpicalc \
+ "${D}"/usr/share
+
+ # libgcrypt-config tries to be smart and will omit include
+ # and lib dir due to set prefix
+ sed -i \
+ -e "s|/usr/include|/dont-try-to-be-smart|" \
+ -e "s|/usr/lib|/dont-try-to-be-smart|" \
+ "${D}"/usr/bin/libgcrypt-config \
+ || die "Failed to make libgcrypt-config dumb!"
+
+ mv "${D}"/usr/bin/libgcrypt-config "${D}"/usr/bin/libgcrypt-config.ori \
+ || die "Failed to rename '${D}/usr/bin/libgcrypt-config' to '${D}/usr/bin/libgcrypt-config.ori'!"
+
+ cat >"${D}"/usr/bin/libgcrypt-config <<-EOF
+ #!/bin/sh
+
+ SYSROOT=\$(dirname "\$(dirname "\$(dirname "\$(readlink -fm "\$0")")")")
+
+ exec "\${SYSROOT}"/usr/bin/libgcrypt-config.ori "\$@" | sed -e 's#/#'\${SYSROOT}'/#'
+ EOF
+
+ chmod +x "${D}"/usr/bin/libgcrypt-config \
+ || die "Failed to chmod of '${D}/bin/libgcrypt-config'!"
+}
diff --git a/gkbuilds/libgpg-error.gkbuild b/gkbuilds/libgpg-error.gkbuild
new file mode 100644
index 00000000..7b74bb9a
--- /dev/null
+++ b/gkbuilds/libgpg-error.gkbuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+src_prepare() {
+ if [[ ! -f "${S}/src/syscfg/lock-obj-pub.${CHOST}.h" ]]
+ then
+ print_warning 3 "CHOST '${CHOST}' not known by ${P} -- workaround for bug 584052 needed ..."
+ local CHOST_KNOWN=
+ local -a CHOST_ARRAY=( ${CHOST//-/ } )
+
+ i=0
+ while [[ ${i} -lt ${#CHOST_ARRAY[@]} ]]
+ do
+ if [[ ${i} -eq 0 ]]
+ then
+ case "${CHOST_ARRAY[${i}]}" in
+ arm*)
+ CHOST_ARRAY[${i}]=arm
+ ;;
+ esac
+ elif [[ ${i} -eq 1 && "${CHOST_ARRAY[${i}]}" != "unknown" ]]
+ then
+ CHOST_ARRAY[${i}]=unknown
+ fi
+
+ if [[ ${CHOST_KNOWN} != "*${CHOST_ARRAY[${i}]}*" ]]
+ then
+ CHOST_KNOWN+="${CHOST_ARRAY[${i}]}-"
+ fi
+
+ i=$((i + 1))
+ done
+
+ CHOST_KNOWN=${CHOST_KNOWN%-}
+ if [[ ! -f "${S}/src/syscfg/lock-obj-pub.${CHOST_KNOWN}.h" ]]
+ then
+ print_warning 3 "We tried our best but even '${CHOST_KNOWN}' looks unknown -- good luck!"
+ else
+ export CHOST=${CHOST_KNOWN}
+ print_warning 3 "CHOST set to '${CHOST_KNOWN}'!"
+ fi
+ fi
+
+ default
+}
+
+src_configure() {
+ local myconf=(
+ --disable-nls
+ --enable-static
+ )
+
+ gkconf "${myconf[@]}"
+}
+
+src_install() {
+ default
+
+ rm -rf \
+ "${D}"/usr/bin/gpg-error \
+ "${D}"/usr/bin/gpgrt-config \
+ "${D}"/usr/bin/yat2m \
+ "${D}"/usr/share
+
+ mv "${D}"/usr/bin/gpg-error-config "${D}"/usr/bin/gpg-error-config.ori \
+ || die "Failed to rename '${D}/usr/bin/gpg-error-config' to '${D}/usr/bin/gpg-error-config.ori'!"
+
+ cat >"${D}"/usr/bin/gpg-error-config <<-EOF
+ #!/bin/sh
+
+ SYSROOT=\$(dirname "\$(dirname "\$(dirname "\$(readlink -fm "\$0")")")")
+
+ exec "\${SYSROOT}"/usr/bin/gpg-error-config.ori "\$@" | sed -e 's#/#'\${SYSROOT}'/#'
+ EOF
+
+ chmod +x "${D}"/usr/bin/gpg-error-config \
+ || die "Failed to chmod of '${D}/bin/gpg-error-config'!"
+
+ ln -s gpg-error-config "${D}"/usr/bin/gpgrt-config \
+ || die "Failed to symlink '${D}/bin/gpgrt-config' to '${D}/bin/gpg-error-config'!"
+}
diff --git a/gkbuilds/popt.gkbuild b/gkbuilds/popt.gkbuild
new file mode 100644
index 00000000..9bfb5600
--- /dev/null
+++ b/gkbuilds/popt.gkbuild
@@ -0,0 +1,16 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+src_configure() {
+ local myconf=(
+ --disable-nls
+ )
+
+ gkconf "${myconf[@]}"
+}
+
+src_install() {
+ default
+
+ rm -rf "${D}"/usr/share
+}
diff --git a/patches/libgcrypt/1.8.4/libgcrypt-1.8.4-ac_cv_sys_symbol_underscore.patch b/patches/libgcrypt/1.8.4/libgcrypt-1.8.4-ac_cv_sys_symbol_underscore.patch
new file mode 100644
index 00000000..d2bb5d11
--- /dev/null
+++ b/patches/libgcrypt/1.8.4/libgcrypt-1.8.4-ac_cv_sys_symbol_underscore.patch
@@ -0,0 +1,37 @@
+fix incorrect setting of $ac_cv_sys_symbol_underscore.
+There is no reason not to AC_COMPILE and use the set cross-nm to look for
+the symbol mangling scheme. Thus it is incorrect to check for cross compilation
+in the GNUPG_SYS_SYMBOL_UNDERSCORE check.
+
+Origin:
+
+aldot at uclibc.org aldot at uclibc.org
+Wed Sep 19 12:20:53 UTC 2007
+
+http://lists.uclibc.org/pipermail/buildroot/2007-September/017322.html
+
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -76,13 +76,14 @@ case "${host}" in
+ i386-emx-os2 | i[3456]86-pc-os2*emx | i386-pc-msdosdjgpp)
+ ac_cv_sys_symbol_underscore=yes
+ ;;
+- *)
+- if test "$cross_compiling" = yes; then
+- if test "x$ac_cv_sys_symbol_underscore" = x ; then
+- ac_cv_sys_symbol_underscore=yes
+- fi
+- else
+- tmp_do_check="yes"
++ *) if test -z "$ac_cv_sys_symbol_underscore"; then
++ if test "$cross_compiling" = yes; then
++ if test "x$ac_cv_sys_symbol_underscore" = x ; then
++ ac_cv_sys_symbol_underscore=yes
++ fi
++ else
++ tmp_do_check="yes"
++ fi
+ fi
+ ;;
+ esac
+
diff --git a/patches/libgpg-error/1.36/libgpg-error-1.36-gawk5-support.patch b/patches/libgpg-error/1.36/libgpg-error-1.36-gawk5-support.patch
new file mode 100644
index 00000000..17e88164
--- /dev/null
+++ b/patches/libgpg-error/1.36/libgpg-error-1.36-gawk5-support.patch
@@ -0,0 +1,158 @@
+From 7865041c77f4f7005282f10f9b6666b19072fbdf Mon Sep 17 00:00:00 2001
+From: NIIBE Yutaka <gniibe@fsij.org>
+Date: Mon, 15 Apr 2019 15:10:44 +0900
+Subject: [PATCH] awk: Prepare for Gawk 5.0.
+
+* src/Makefile.am: Use pkg_namespace (instead of namespace).
+* src/mkerrnos.awk: Likewise.
+* lang/cl/mkerrcodes.awk: Don't escape # in regexp.
+* src/mkerrcodes.awk, src/mkerrcodes1.awk, src/mkerrcodes2.awk: Ditto.
+
+--
+
+In Gawk 5.0, regexp routines are replaced by Gnulib implementation,
+which only allows escaping specific characters.
+
+GnuPG-bug-id: 4459
+Reported-by: Marius Schamschula
+Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
+---
+ lang/cl/mkerrcodes.awk | 2 +-
+ src/Makefile.am | 2 +-
+ src/mkerrcodes.awk | 2 +-
+ src/mkerrcodes1.awk | 2 +-
+ src/mkerrcodes2.awk | 2 +-
+ src/mkerrnos.awk | 2 +-
+ src/mkstrtable.awk | 10 +++++-----
+ 7 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/lang/cl/mkerrcodes.awk b/lang/cl/mkerrcodes.awk
+index ae29043..9a1fc18 100644
+--- a/lang/cl/mkerrcodes.awk
++++ b/lang/cl/mkerrcodes.awk
+@@ -122,7 +122,7 @@ header {
+ }
+
+ !header {
+- sub (/\#.+/, "");
++ sub (/#.+/, "");
+ sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
+
+ if (/^$/)
+diff --git a/src/Makefile.am b/src/Makefile.am
+index ce1b882..f2590cb 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -293,7 +293,7 @@ code-from-errno.h: mkerrcodes$(EXEEXT_FOR_BUILD) Makefile
+
+ errnos-sym.h: Makefile mkstrtable.awk errnos.in
+ $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=2 -v nogettext=1 \
+- -v prefix=GPG_ERR_ -v namespace=errnos_ \
++ -v prefix=GPG_ERR_ -v pkg_namespace=errnos_ \
+ $(srcdir)/errnos.in >$@
+
+
+diff --git a/src/mkerrcodes.awk b/src/mkerrcodes.awk
+index 46d436c..e9c857c 100644
+--- a/src/mkerrcodes.awk
++++ b/src/mkerrcodes.awk
+@@ -85,7 +85,7 @@ header {
+ }
+
+ !header {
+- sub (/\#.+/, "");
++ sub (/#.+/, "");
+ sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
+
+ if (/^$/)
+diff --git a/src/mkerrcodes1.awk b/src/mkerrcodes1.awk
+index a771a73..4578e29 100644
+--- a/src/mkerrcodes1.awk
++++ b/src/mkerrcodes1.awk
+@@ -81,7 +81,7 @@ header {
+ }
+
+ !header {
+- sub (/\#.+/, "");
++ sub (/#.+/, "");
+ sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
+
+ if (/^$/)
+diff --git a/src/mkerrcodes2.awk b/src/mkerrcodes2.awk
+index ea58503..188f7a4 100644
+--- a/src/mkerrcodes2.awk
++++ b/src/mkerrcodes2.awk
+@@ -91,7 +91,7 @@ header {
+ }
+
+ !header {
+- sub (/\#.+/, "");
++ sub (/#.+/, "");
+ sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
+
+ if (/^$/)
+diff --git a/src/mkerrnos.awk b/src/mkerrnos.awk
+index f79df66..15b1aad 100644
+--- a/src/mkerrnos.awk
++++ b/src/mkerrnos.awk
+@@ -83,7 +83,7 @@ header {
+ }
+
+ !header {
+- sub (/\#.+/, "");
++ sub (/#.+/, "");
+ sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
+
+ if (/^$/)
+diff --git a/src/mkstrtable.awk b/src/mkstrtable.awk
+index c9de9c1..285e45f 100644
+--- a/src/mkstrtable.awk
++++ b/src/mkstrtable.awk
+@@ -77,7 +77,7 @@
+ #
+ # The variable prefix can be used to prepend a string to each message.
+ #
+-# The variable namespace can be used to prepend a string to each
++# The variable pkg_namespace can be used to prepend a string to each
+ # variable and macro name.
+
+ BEGIN {
+@@ -102,7 +102,7 @@ header {
+ print "/* The purpose of this complex string table is to produce";
+ print " optimal code with a minimum of relocations. */";
+ print "";
+- print "static const char " namespace "msgstr[] = ";
++ print "static const char " pkg_namespace "msgstr[] = ";
+ header = 0;
+ }
+ else
+@@ -110,7 +110,7 @@ header {
+ }
+
+ !header {
+- sub (/\#.+/, "");
++ sub (/#.+/, "");
+ sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
+
+ if (/^$/)
+@@ -150,7 +150,7 @@ END {
+ else
+ print " gettext_noop (\"" last_msgstr "\");";
+ print "";
+- print "static const int " namespace "msgidx[] =";
++ print "static const int " pkg_namespace "msgidx[] =";
+ print " {";
+ for (i = 0; i < coded_msgs; i++)
+ print " " pos[i] ",";
+@@ -158,7 +158,7 @@ END {
+ print " };";
+ print "";
+ print "static GPG_ERR_INLINE int";
+- print namespace "msgidxof (int code)";
++ print pkg_namespace "msgidxof (int code)";
+ print "{";
+ print " return (0 ? 0";
+
+--
+2.21.0
+
diff --git a/patches/libgpg-error/1.36/libgpg-error-1.36-gpg-error-config.patch b/patches/libgpg-error/1.36/libgpg-error-1.36-gpg-error-config.patch
new file mode 100644
index 00000000..e94d57e6
--- /dev/null
+++ b/patches/libgpg-error/1.36/libgpg-error-1.36-gpg-error-config.patch
@@ -0,0 +1,38 @@
+diff --git a/configure.ac b/configure.ac
+index e46b240..4606c31 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -531,16 +531,6 @@ fi
+ GPG_ERROR_CONFIG_HOST="$host"
+
+ case "$includedir" in
+- /usr/include|/include) ;;
+- '${prefix}/include')
+- if test "$prefix" != / -a "$prefix" != /usr; then
+- if test -z "$GPG_ERROR_CONFIG_CFLAGS"; then
+- GPG_ERROR_CONFIG_CFLAGS="-I$includedir"
+- else
+- GPG_ERROR_CONFIG_CFLAGS="-I$includedir $GPG_ERROR_CONFIG_CFLAGS"
+- fi
+- fi
+- ;;
+ *)
+ if test -z "$GPG_ERROR_CONFIG_CFLAGS"; then
+ GPG_ERROR_CONFIG_CFLAGS="-I$includedir"
+@@ -550,16 +540,6 @@ case "$includedir" in
+ ;;
+ esac
+ case "$libdir" in
+- /usr/lib|/usr/lib64|/lib|/lib64) ;;
+- '${exec_prefix}/lib')
+- if test "$exec_prefix" = "NONE"; then
+- if test "$prefix" != / -a "$prefix" != /usr; then
+- GPG_ERROR_CONFIG_LIBS="-L$libdir $GPG_ERROR_CONFIG_LIBS"
+- fi
+- elif test "$exec_prefix" != / -a "$exec_prefix" != /usr; then
+- GPG_ERROR_CONFIG_LIBS="-L$libdir $GPG_ERROR_CONFIG_LIBS"
+- fi
+- ;;
+ *) GPG_ERROR_CONFIG_LIBS="-L$libdir $GPG_ERROR_CONFIG_LIBS" ;;
+ esac
+