# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

EGIT_REPO_URI="https://github.com/leahneukirchen/${PN}.git"

inherit git-r3 toolchain-funcs

DESCRIPTION="Unix command line queue utility"
HOMEPAGE="https://github.com/leahneukirchen/nq"
SRC_URI=""

LICENSE="public-domain"
SLOT="0"
KEYWORDS=""

DOCS=( {NEWS,README}.md )

src_prepare() {
	default

	# Respect CFLAGS, remove options
	sed -i '/CFLAGS/s/=-g -Wall -O2/+=-Wall/' Makefile || die "sed failed"
}

src_compile() {
	emake CC="$(tc-getCC)"
}

src_test() {
	emake check
}

src_install() {
	einstalldocs
	emake DESTDIR="${D}" PREFIX="/usr" install
	insinto /usr/share/zsh/site-functions
	doins _nq
}