aboutsummaryrefslogtreecommitdiff
blob: 634400a408d8660f8d6fcaef28984bca88f3bf11 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{10..12} )

inherit check-reqs cmake flag-o-matic python-single-r1

DESCRIPTION="A fast very high compression read-only FUSE file system"
HOMEPAGE="https://github.com/mhx/dwarfs"
SRC_URI="https://github.com/mhx/dwarfs/releases/download/v${PV}/${P}.tar.xz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"
IUSE="python +jemalloc test man"
S="${WORKDIR}/dwarfs-${PV}"

RDEPEND="
	${PYTHON_DEPS}
	app-arch/libarchive
	app-arch/lz4
	app-arch/snappy
	app-arch/xz-utils
	app-arch/zstd
	dev-cpp/gflags
	dev-cpp/glog[gflags]
	dev-cpp/parallel-hashmap:=
	dev-libs/boost[context,python?]
	dev-libs/double-conversion
	dev-libs/libevent
	dev-libs/libfmt
	dev-libs/utfcpp
	dev-libs/xxhash
	sys-fs/fuse:3
	dev-libs/fsst
	sys-libs/binutils-libs
	sys-libs/libunwind
	sys-libs/zlib
	!dev-cpp/fbthrift
	!dev-cpp/fizz
	!dev-cpp/folly
	!dev-cpp/wangle
	jemalloc? ( >=dev-libs/jemalloc-5.3.0-r1 )
"

DEPEND="${RDEPEND}"
BDEPEND="
	sys-devel/bison
	sys-devel/flex
	virtual/pkgconfig
	man? ( app-text/ronn-ng )
	test? ( dev-cpp/gtest )
"

DOCS=( "README.md" "CHANGES.md" "TODO" )
RESTRICT="!test? ( test )"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

CHECKREQS_DISK_BUILD="1300M"
CMAKE_IN_SOURCE_BUILD=1
CMAKE_WARN_UNUSED_CLI=0
#These files supposed to have no symlink
QA_SONAME=(
"/usr/sbin/dwarfs"
"/usr/bin/dwarfsbench"
"/usr/bin/dwarfsck"
"/usr/bin/dwarfsextract"
"/usr/bin/mkdwarfs"
)

src_prepare(){
	rm -r zstd xxHash parallel-hashmap || die
	sed "s/DESTINATION lib/DESTINATION $(get_libdir)/" -i CMakeLists.txt || die

	# Bug #900016, but upstream discourages O3
	sed '/FLAGS_RELEASE/s# -O2 -g##' -i CMakeLists.txt || die
	sed '/CMAKE_CXX_FLAGS_COMMON/s#-g ##' -i folly/CMake/FollyCompilerUnix.cmake || die
	sed '/^\s*-g$/d' -i folly/CMake/FollyCompilerUnix.cmake || die
	replace-flags -O3 -O2

	cmake_src_prepare
}

src_configure(){
	append-cxxflags "-I/usr/include"
	append-ldflags $(no-as-needed)

	mycmakeargs=(
		-DUSE_JEMALLOC=$(usex jemalloc ON OFF)
		-DWITH_PYTHON=$(usex python ON OFF)
		-DWITH_TESTS=$(usex test ON OFF)
		-DWITH_MAN_PAGES=$(usex man ON OFF)
		-DPREFER_SYSTEM_ZSTD=ON
		-DPREFER_SYSTEM_XXHASH=ON
		-DPREFER_SYSTEM_GTEST=ON
		-DPREFER_SYSTEM_LIBFMT=ON
		-DWITH_LEGACY_FUSE=OFF
		-DDISABLE_CCACHE=ON  # Use FEATURES=ccache
	)
	use python && mycmakeargs+=( "-DWITH_PYTHON_VERSION=${EPYTHON#python}" )
	cmake_src_configure
}

src_install(){
	# Perform install
	cmake_src_install
	dolib.so libdwarfs.so libdwarfs_main.so libdwarfs_tool.so libdwarfs_compression.so libthrift_light.so libmetadata_thrift.so || die "Install failed"
	dolib.so folly/libfolly.so folly/libfolly.so.0.58.0-dev libmkdwarfs_main.so libdwarfsbench_main.so || die "Install failed"
	dolib.so libdwarfsck_main.so libdwarfsextract_main.so || die "Install failed"
}

pkg_postinst(){
	elog "You may find more information in the"
	elog "${HOMEPAGE}"
	elog "About creating: ${HOMEPAGE}/blob/main/doc/mkdwarfs.md"
	elog "About mounting: ${HOMEPAGE}/blob/main/doc/dwarfs.md"
}