summaryrefslogtreecommitdiff
path: root/dev-libs/libaaruformat/libaaruformat-1.0.0_beta2.ebuild
blob: 07cda7f6492328471cb41484556fcb55df24b411 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# 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
}