# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=libotr
pkgver=4.1.1
pkgrel=5
pkgdesc='Off-the-Record Messaging Library and Toolkit'
url='https://otr.cypherpunks.ca/'
license=(
  'GPL-2.0-only'
  'LGPL-2.1-only'
)
arch=('x86_64')
depends=(
  'glibc'
  'libgcrypt'
  'libgpg-error'
)
source=(https://otr.cypherpunks.ca/${pkgname}-${pkgver}.tar.gz{,.asc}
        "$pkgname-4.1.1-include-socket.h.patch")
sha256sums=('8b3b182424251067a952fb4e6c7b95a21e644fbb27fbd5f8af2b2ed87ca419f5'
            'SKIP'
            'cfda75f8c5bba2e735d2b4f1bb90f60b45fa1d554a97fff75cac467f7873ebde')

prepare() {
    # FS#75450
    patch -d "$pkgname-$pkgver" -N -p 1 -i "${srcdir}/$pkgname-4.1.1-include-socket.h.patch"
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  # --disable-gcc-hardening: Arch Linux already passes more strict CFLAGS to all builds,
  # libotr tries to pass _FORTIFY_SOURCE=2, but Arch Linux has _FORTIFY_SOURCE=3
  ./configure --prefix=/usr --mandir=/usr/share/man --disable-gcc-hardening
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
}
