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

EAPI=9

COMPOSER_INSTALL_AUTOLOAD="lib/PhpParser"
COMPOSER_INSTALL_PATH="nikic"
COMPOSER_INSTALL_SRC="lib"
COMPOSER_PKG="PHP-Parser"
PHP_REQ_USE="tokenizer"

inherit composer git-r3

DESCRIPTION="A PHP parser written in PHP"
HOMEPAGE="https://github.com/nikic/PHP-Parser"
EGIT_REPO_URI="https://github.com/nikic/PHP-Parser.git"
SRC_URI="https://github.com/SpiderX/portage-overlay/releases/download/${PN}-5.7.0/${PN}-5.7.0-patches.tar.xz"

LICENSE="BSD"
SLOT="0"

PATCHES=( "${WORKDIR}/${PN}-5.7.0-patches/src"
	"${WORKDIR}/${PN}-5.7.0-patches/tests" )

DOCS=( {CHANGELOG,README}.md )

composer_enable_tests phpunit

src_unpack() {
	git-r3_src_unpack
	unpack ${A}
}

src_compile() { :; }

src_install() {
	composer_src_install
	# install files into COMPOSER_INSTALL_PATH
	dobin bin/php-parse
}