# Copyright 2020 Julian Ospald <hasufell@posteo.de>
# Distributed under the terms of the GNU General Public License v2

require autotools [ supported_autoconf=[ 2.5 ] supported_automake=[ 1.16 ] ]

SUMMARY="The UCL Compression Library"
HOMEPAGE="http://www.oberhumer.com/opensource/ucl/"
DOWNLOADS="http://www.oberhumer.com/opensource/ucl/download/${PNV}.tar.gz"

LICENCES="GPL-2"
SLOT="0"
PLATFORMS="~amd64"
MYOPTIONS=""

DEPENDENCIES="
"

BUGS_TO="hasufell@posteo.de"

DEFAULT_SRC_PREPARE_PATCHES=(
    "${FILES}"/${PNV}-CFLAGS.patch
    "${FILES}"/${PNV}-x32.patch
)

src_prepare() {
    edo sed -n -e '/^AC_DEFUN.*mfx_/,/^])#$/p' aclocal.m4 > acinclude.m4
    edo sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/g' configure.ac

    autotools_src_prepare
}

src_configure() {
    econf --enable-shared CFLAGS="${CFLAGS} -std=c90"
}