# Copyright 2026 Nadeŭka <me+oss@nadevko.cc>
# Distributed under the terms of the GNU General Public License v2
EAPI=8

inherit git-r3 toolchain-funcs

DESCRIPTION='C decompress tool for mozilla lz4json format'
HOMEPAGE=https://github.com/andikleen/lz4json
EGIT_REPO_URI="$HOMEPAGE.git"
LICENSE=BSD-2
SLOT=0

RDEPEND=app-arch/lz4
DEPEND="$RDEPEND"
BDEPEND=virtual/pkgconfig

src_prepare() {
	default
	sed -i 's|CFLAGS :=|CFLAGS +=|g' Makefile ||
		die "failed to patch Makefile"
}

src_compile() {
	emake PKG_CONFIG="$(tc-getPKG_CONFIG)"
}

src_install() {
	dobin lz4jsoncat lz4jsonpack
	doman lz4jsoncat.1
}