summaryrefslogtreecommitdiff
path: root/dev-libs/poco/poco-1.12.4.ebuild
blob: af3a59a24aee4afe0e2e118e0f279947585894f6 (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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake

DESCRIPTION="C++ libraries for building network-based applications"
HOMEPAGE="https://pocoproject.org/"
SRC_URI="https://github.com/pocoproject/${PN}/archive/${P}-release.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-${P}-release"

LICENSE="Boost-1.0"
# SHARED_LIBRARY_VERSION -> "${S}"/libversion
SLOT="0/94"
KEYWORDS="amd64 ~arm ~arm64 ppc64 x86"
IUSE="7z activerecord cppparser +data examples +file2pagecompiler iodbc +json jwt mariadb +mongodb mysql +net odbc +pagecompiler pdf pocodoc postgres prometheus sqlite +ssl test +util +xml +zip"
RESTRICT="!test? ( test )"
REQUIRED_USE="
	activerecord? ( util xml )
	7z? ( xml )
	file2pagecompiler? ( pagecompiler )
	iodbc? ( odbc )
	jwt? ( json ssl )
	mongodb? ( data )
	mysql? ( data )
	odbc? ( data )
	postgres? ( data )
	pagecompiler? ( json net util xml )
	pocodoc? ( cppparser util xml )
	sqlite? ( data )
	ssl? ( util )
	test? ( data? ( sqlite ) json util xml )
"

BDEPEND="virtual/pkgconfig"
RDEPEND="
	>=dev-libs/libpcre2-10.40
	activerecord? ( !app-arch/arc )
	mysql? ( dev-db/mysql-connector-c:= )
	mariadb? ( dev-db/mariadb-connector-c:= )
	postgres? ( dev-db/postgresql:= )
	odbc? (
		iodbc? ( dev-db/libiodbc )
		!iodbc? ( dev-db/unixODBC )
	)
	sqlite? ( dev-db/sqlite:3 )
	ssl? (
		dev-libs/openssl:=
	)
	xml? ( dev-libs/expat )
	zip? ( sys-libs/zlib:= )
"
DEPEND="${RDEPEND}"

PATCHES=( "${FILESDIR}/${PN}-1.10.1-iodbc-incdir.patch" )

src_prepare() {
	cmake_src_prepare

	if [[ ${SLOT} != 0/$(< "${S}"/libversion) ]] ; then
		die "Please update subslot in ebuild to the version in ${S}/libversion!"
	fi

	if use test ; then
		# ignore missing tests on experimental library
		# and tests requiring running DB-servers, internet connections, etc.
		sed -i -e '/testsuite/d' \
			{Data/{MySQL,ODBC},MongoDB,Net,NetSSL_OpenSSL,PDF,Redis}/CMakeLists.txt || die
		# Poco expands ~ using passwd, which does not match $HOME in the build environment
		sed -i -e '/CppUnit_addTest.*testExpand/d' \
			Foundation/testsuite/src/PathTest.cpp || die
		# ignore failing Crypto test since upstream does not seem to care,
		# see https://github.com/pocoproject/poco/issues/1209
		sed -i -e '/RSATest, testRSACipherLarge/d' \
			Crypto/testsuite/src/RSATest.cpp || die
	fi

	# Fix MariaDB and MySQL detection
	sed -i -e 's~/usr/include/mysql~~' \
		-e 's/mysqlclient_r/mysqlclient/' \
		-e 's/STATUS "Couldn/FATAL_ERROR "Couldn/' \
		cmake/FindMySQL.cmake || die

	# Add missing directory that breaks the build
	mkdir -p Encodings/testsuite/data || die

	if ! use iodbc ; then
		sed -i -e 's|iodbc||' cmake/FindODBC.cmake || die
	fi
}

src_configure() {
	# apache support is dead and buggy, https://github.com/pocoproject/poco/issues/1764
	local mycmakeargs=(
		-DPOCO_UNBUNDLED=ON
		-DENABLE_APACHECONNECTOR=OFF
		-DENABLE_ACTIVERECORD="$(usex activerecord)"
		-DENABLE_ACTIVERECORD_COMPILER="$(usex activerecord)"
		-DENABLE_CPPPARSER="$(usex cppparser)"
		-DENABLE_CRYPTO="$(usex ssl)"
		-DENABLE_DATA="$(usex data)"
		-DENABLE_DATA_MYSQL="$(usex mysql)"
		-DENABLE_DATA_ODBC="$(usex odbc)"
		-DENABLE_DATA_POSTGRESQL="$(usex postgres)"
		-DENABLE_DATA_SQLITE="$(usex sqlite)"
		-DENABLE_JSON="$(usex util)"
		-DENABLE_JWT="$(usex jwt)"
		-DENABLE_MONGODB="$(usex mongodb)"
		-DENABLE_NET="$(usex net)"
		-DENABLE_NETSSL="$(usex ssl)"
		-DENABLE_NETSSL_WIN=OFF
		-DENABLE_PAGECOMPILER="$(usex pagecompiler)"
		-DENABLE_PAGECOMPILER_FILE2PAGE="$(usex file2pagecompiler)"
		-DENABLE_PDF="$(usex pdf)"
		-DENABLE_POCODOC="$(usex pocodoc)"
		-DENABLE_PROMETHEUS="$(usex prometheus)"
		-DENABLE_SEVENZIP="$(usex 7z)"
		-DENABLE_TESTS="$(usex test)"
		-DENABLE_UTIL="$(usex util)"
		-DENABLE_XML="$(usex xml)"
		-DENABLE_ZIP="$(usex zip)"
	)

	cmake_src_configure
}

src_test() {
	POCO_BASE="${S}" cmake_src_test -E DataPostgreSQL
}

src_install() {
	cmake_src_install

	if use examples ; then
		for sd in */samples ; do
			docinto examples/${sd%/samples}
			dodoc -r ${sd}
		done

		find "${D}/usr/share/doc/${PF}/examples" \
			-iname "*.sln" -or -iname "*.vcproj" -or \
			-iname "*.vmsbuild" -or -iname "*.properties" \
			| xargs rm -v || die
	fi
}