# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
MY_P="UUID_${PV//./_}"
GENTOO_DEPEND_ON_PERL="no"
inherit autotools perl-module verify-sig
DESCRIPTION="An ISO-C:1999 API with CLI for generating DCE, ISO/IEC and RFC compliant UUID"
HOMEPAGE="https://sr.ht/~nabijaczleweli/ossp/"
SRC_URI="
https://git.sr.ht/~nabijaczleweli/ossp-uuid/archive/${MY_P}.tar.gz
-> ${PN}-${MY_P}.tar.gz
verify-sig? (
https://git.sr.ht/~nabijaczleweli/ossp-uuid/archive/${MY_P}.tar.gz.asc
-> ${PN}-${MY_P}.tar.gz.asc
)
"
S="${WORKDIR}/${PN}-${MY_P}"
LICENSE="ISC"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-macos"
IUSE="+cxx perl static-libs ${GENTOO_PERL_USESTRING}"
DEPEND="
app-crypt/libmd
perl? (
${GENTOO_PERL_DEPSTRING}
dev-lang/perl:=
)
"
RDEPEND="${DEPEND}"
BDEPEND="perl? ( dev-lang/perl )"
BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-nabijaczleweli )"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/nabijaczleweli.asc
src_prepare() {
default
eautoreconf
}
src_configure() {
local myconf=(
# collides with e2fstools libs and includes if not moved around
--includedir="${EPREFIX}"/usr/include/ossp
--with-dce
--without-perl
--with-libname=libossp-uuid
$(use_with cxx)
$(use_enable static-libs static)
)
econf "${myconf[@]}"
}
src_compile() {
default
if use perl; then
cd perl || die
# configure needs the ossp-uuid.la generated by `make` in $S
LIBNAME=ossp-uuid perl-module_src_configure
perl-module_src_compile
fi
}
src_test() {
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${S}/.libs" # required for the perl-bindings to load the (correct) library
default
use perl && emake -C perl test
}
src_install() {
default
dodoc BINDINGS HISTORY
if use perl ; then
cd perl || die
perl-module_src_install
fi
find "${ED}" -name '*.la' -delete || die
mv "${ED}"/usr/share/man/man3/uuid.3{,ossp} || die
if use cxx; then
mv "${ED}"/usr/share/man/man3/uuid++.3{,ossp} || die
fi
}