# Maintainer: Martell Malone # Contributor: Alethea Rose # Contributor: Andrew Sun _realname=http-parser pkgbase=mingw-w64-${_realname} pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") pkgver=2.9.4 pkgrel=2 pkgdesc="Parser for HTTP Request/Response written in C (mingw-w64)" arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64') url='https://github.com/nodejs/http-parser' msys2_repository_url=${url} msys2_references=( 'purl: pkg:github/nodejs/http-parser' ) license=('spdx:MIT') makedepends=("${MINGW_PACKAGE_PREFIX}-cc") source=("${msys2_repository_url}/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz") sha256sums=('467b9e30fd0979ee301065e70f637d525c28193449e1b13fbcb1b1fab3ad224f') prepare() { cd "${srcdir}/${_realname}-${pkgver}" sed -s "s|-Werror||g" -i Makefile sed -s "s|-fPIC||g" -i Makefile sed -s "s|-Wl,-soname=\$(SONAME)||g" -i Makefile } build() { [[ -d "${srcdir}"/build-${MSYSTEM} ]] && rm -rf "${srcdir}"/build-${MSYSTEM} mkdir -p "${srcdir}"/build-${MSYSTEM} && cd "${srcdir}"/build-${MSYSTEM} cp -R "${srcdir}"/${_realname}-${pkgver}/. "${srcdir}"/build-${MSYSTEM} AR=${MINGW_PREFIX}/bin/ar \ SONAME=libhttp_parser-2.dll \ LIBNAME=libhttp_parser-2.dll \ LDFLAGS+=' -Wl,--out-implib=libhttp_parser.dll.a' \ make -j1 \ library package } check() { cd "${srcdir}"/build-${MSYSTEM} make test || true } package() { cd "${srcdir}"/build-${MSYSTEM} mkdir -p "${pkgdir}"${MINGW_PREFIX}/{bin,include,lib} install -Dm644 http_parser.h "${pkgdir}${MINGW_PREFIX}/include/http_parser.h" cp *.a "${pkgdir}"${MINGW_PREFIX}/lib/ cp *.dll "${pkgdir}"${MINGW_PREFIX}/bin/ }