Name libgcrypt
Description General purpose cryptographic library based on the code from GnuPG
Version 1.12.1-1
Package Base libgcrypt
Homepage https://www.gnupg.org
Maintainers ['Andreas Radke <andyrtr@archlinux.org>']
Contributors []
Distro-repo https://gitlab.archlinux.org/archlinux/packaging/packages/libgcrypt
Sources ['https://gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.12.1.tar.bz2', 'https://gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.12.1.tar.bz2.sig']
Dependencies ['glibc', 'libgpg-error']
Optional-Dependencies []
Build-Dependencies []
Provides []
Builddate 20-02-2026 22:33:27
Architecture x86_64
Distro-Version
Licenses ['BSD-3-Clause', 'BSD-3-Clause OR GPL-2.0-only', 'GPL-2.0-or-later', 'LGPL-2.0-or-later', 'LGPL-2.1-or-later', 'LicenseRef-OCB1', 'LicenseRef-scancode-public-domain', 'X11']
Hash 362cd1339eabe594a36cf4b8aac16e6b2dd17dfcec8445d03d9b9ffc2c560c7c
# Maintainer: Andreas Radke <andyrtr@archlinux.org>

# after a .so bump first rebuild dirmngr
# with sudo testing-x86_64-build -- -I libgcrypt-1.6.0-1-x86_64.pkg.tar.xz
# then cp /usr/lib/libgcrypt.so.11 /var/lib/archbuild/staging-x86_64/root/usr/lib/ and do staging-x86_64-build

pkgname=libgcrypt
pkgver=1.12.1
pkgrel=1
pkgdesc="General purpose cryptographic library based on the code from GnuPG"
arch=(x86_64)
url="https://www.gnupg.org"
license=(
    'BSD-3-Clause'
    'BSD-3-Clause OR GPL-2.0-only'
    'GPL-2.0-or-later'
    'LGPL-2.0-or-later'
    'LGPL-2.1-or-later'
    'X11'
    'LicenseRef-scancode-public-domain'
    'LicenseRef-OCB1'
)
depends=('libgpg-error' 'glibc')
options=('!emptydirs')
# https://www.gnupg.org/download/integrity_check.html
source=(https://gnupg.org/ftp/gcrypt/${pkgname}/${pkgname}-${pkgver}.tar.bz2{,.sig})
sha256sums=('7df5c08d952ba33f9b6bdabdb06a61a78b2cf62d2122c2d1d03a91a79832aa3c'
            'SKIP')
# validpgpkeys=('6DAA6E64A76D2840571B4902528897B826403ADA'  # "Werner Koch (dist signing 2020)"
#               'AC8E115BF73E2D8D47FA9908E98E9B2D19C6C8BD') # Niibe Yutaka (GnuPG Release Key)

validpgpkeys=('6DAA6E64A76D2840571B4902528897B826403ADA')  # "Werner Koch (dist signing 2020)"

prepare() {
  cd "${pkgname}"-${pkgver}

  # tests fail due to systemd+libseccomp preventing memory syscalls when building in chroots
  #  t-secmem: line 176: gcry_control (GCRYCTL_INIT_SECMEM, pool_size, 0) failed: General error
  #  FAIL: t-secmem
  #  t-sexp: line 1174: gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0) failed: General error
  #  FAIL: t-sexp
  sed -i "s:t-secmem::" tests/Makefile.am
  sed -i "s:t-sexp::" tests/Makefile.am

  # fix version - due to autoreconf
  sed -i 's/beta=yes/beta=no/; s/tmp="-unknown"/tmp=""/' autogen.sh

  autoreconf -vfi
}

build() {
  cd "${pkgname}"-${pkgver}
  ./configure --prefix=/usr \
	--disable-static \
	--disable-padlock-support
  make
}

check() {
  cd "${pkgname}"-${pkgver}
  make check
}

package() {
  cd "${pkgname}"-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
  install -m644 {COPYING.LIB,LICENSES} "${pkgdir}/usr/share/licenses/${pkgname}/"
}