# Copyright 2022-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 inherit cmake DESCRIPTION="C implementation of the Aaru file format" HOMEPAGE="https://www.aaru.app" SRC_URI="https://github.com/aaru-dps/libaaruformat/archive/refs/tags/v1.0.0-beta.2.tar.gz -> ${P}.tar.gz" S="${WORKDIR}/${PN}-1.0.0-beta.2" LICENSE="LGPL-2.1" SLOT="0" KEYWORDS="~amd64" PATCHES=( "${FILESDIR}/replace-slog-logger.patch" ) BDEPEND="virtual/pkgconfig" RDEPEND=" >=dev-libs/xxhash-0.8.3:= >=app-arch/zstd-1.4:= >=media-libs/flac-1.3.3:= " DEPEND=" >=dev-libs/blake3-1.8.4 >=dev-libs/uthash-2.3.0 ${RDEPEND} " src_prepare() { default rm -rf 3rdparty/{BLAKE3,flac,slog,uthash,xxHash,zstd} tests/lib cp "${FILESDIR}/zstd.cmake" 3rdparty/zstd.cmake || die cp "${FILESDIR}/xxhash.cmake" 3rdparty/xxhash.cmake || die cp "${FILESDIR}/blake3.cmake" 3rdparty/blake3.cmake || die cp "${FILESDIR}/flac.cmake" 3rdparty/flac.cmake || die # hash headers are public API but move them under aaruformat/ # to avoid collisions with other packages mv include/{md5,sha1,sha256}.h include/aaruformat/ || die sed -i -e 's|include/md5\.h|include/aaruformat/md5.h|' \ -e 's|include/sha1\.h|include/aaruformat/sha1.h|' \ -e 's|include/sha256\.h|include/aaruformat/sha256.h|' CMakeLists.txt || die # unbundle uthash sed -i '/3rdparty\/uthash/d' CMakeLists.txt || die cat >> CMakeLists.txt <<-EOF set_target_properties(aaruformat PROPERTIES VERSION 1.0.0 SOVERSION 1) EOF cmake_prepare } src_configure() { local mycmakeargs=( -DBUILD_SHARED_LIBS=ON -DAARU_BUILD_PACKAGE=ON -DCMAKE_C_VISIBILITY_PRESET=hidden ) cmake_src_configure } src_install() { dolib.so "${BUILD_DIR}"/libaaruformat.so.1.0.0 dosym libaaruformat.so.1.0.0 "/usr/$(get_libdir)/libaaruformat.so.1" dosym libaaruformat.so.1 "/usr/$(get_libdir)/libaaruformat.so" insinto /usr/include doins include/aaru.h include/aaruformat.h insinto /usr/include/aaruformat doins include/aaruformat/*.h doins -r include/aaruformat/structs insinto /usr/$(get_libdir)/pkgconfig doins "${FILESDIR}/libaaruformat.pc" sed -i -e "s!@PACKAGE_VERSION@!${PV}!" \ -e "s!@prefix@!${EPREFIX}/usr!g" \ -e "s!@libdir@!$(get_libdir)!" \ "${ED}"/usr/$(get_libdir)/pkgconfig/libaaruformat.pc || die }