commit: f54a845b495a1b1eaf1e8e8694e60e809231dfa4 Author: Jan-Espen Oversand <sigsegv <AT> radiotube <DOT> org> AuthorDate: Mon Jan 5 16:21:45 2026 +0000 Commit: Kenton Groombridge <concord <AT> gentoo <DOT> org> CommitDate: Tue Jan 6 18:08:21 2026 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f54a845b
dev-db/soci: fix relying on backend auto magic Parameters SOCI_* disables/enables backends. This is straight forward for most of the backends. The mysql backend can either use mysql-connector-c or mariadb-connector-c. Which one of them is decided by the find_package mysql script provided by upstream. That does not work since we need to respect the use flags by the user and declare a dependency to the correct connector. Most of the complexity of this is due to mysql/mariadb and that is solved by providing a FindMySQL.cmake that takes parameters for mysql libs and headers. The cmake scripts do not call find_package for disabled backends, passing CMAKE_DISABLE_FIND_PACKAGE_*=TRUE in addition to SOCI_*=off will therefore produce cmake warnings. Signed-off-by: Jan-Espen Oversand <sigsegv <AT> radiotube.org> Closes: https://bugs.gentoo.org/968287 Part-of: https://github.com/gentoo/gentoo/pull/45248 Closes: https://github.com/gentoo/gentoo/pull/45248 Signed-off-by: Kenton Groombridge <concord <AT> gentoo.org> dev-db/soci/files/FindMySQL.cmake | 8 ++++ dev-db/soci/metadata.xml | 3 ++ dev-db/soci/soci-4.1.2-r1.ebuild | 47 ----------------------- dev-db/soci/soci-4.1.2-r2.ebuild | 79 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 47 deletions(-) diff --git a/dev-db/soci/files/FindMySQL.cmake b/dev-db/soci/files/FindMySQL.cmake new file mode 100644 index 000000000000..7860c9f8b125 --- /dev/null +++ b/dev-db/soci/files/FindMySQL.cmake @@ -0,0 +1,8 @@ +if (NOT TARGET MySQL::MySQL) + set(MySQL_FOUND TRUE) + add_library(MySQL INTERFACE) + target_link_libraries(MySQL INTERFACE ${MySQL_LIBRARIES}) + target_include_directories(MySQL SYSTEM INTERFACE ${MySQL_INCLUDE_DIRS}) + add_library(MySQL::MySQL ALIAS MySQL) +endif() + diff --git a/dev-db/soci/metadata.xml b/dev-db/soci/metadata.xml index 952ddbea1f66..a35042939313 100644 --- a/dev-db/soci/metadata.xml +++ b/dev-db/soci/metadata.xml @@ -16,4 +16,7 @@ <upstream> <remote-id type="sourceforge">soci</remote-id> </upstream> + <use> + <flag name="mariadb">Enable mysql plugin with <pkg>dev-db/mariadb-connector-c</pkg> as the client library</flag> + </use> </pkgmetadata> diff --git a/dev-db/soci/soci-4.1.2-r1.ebuild b/dev-db/soci/soci-4.1.2-r1.ebuild deleted file mode 100644 index 59941ec9120a..000000000000 --- a/dev-db/soci/soci-4.1.2-r1.ebuild +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2024-2025 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit cmake - -DESCRIPTION="SOCI - The C++ Database Access Library" -HOMEPAGE="https://sourceforge.net/projects/soci/" -SRC_URI="https://sourceforge.net/projects/soci/files/soci/${P}/${P}.tar.gz/download -> ${P}.tar.gz" - -LICENSE="Boost-1.0" -SLOT="0" -KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86" -IUSE="mysql odbc oracle postgres sqlite static-libs test" -RESTRICT="!test? ( test )" - -CMAKE_SKIP_TESTS=( - soci_odbc_test_mssql - soci_odbc_test_mssql_static - soci_odbc_test_mysql - soci_odbc_test_mysql_static - soci_odbc_test_postgresql - soci_odbc_test_postgresql_static - soci_postgresql_test - soci_postgresql_test_static - soci_mysql_test - soci_mysql_test_static -) - -RDEPEND=" - >=dev-libs/boost-1.85.0-r1 - mysql? ( dev-db/mysql:* ) - odbc? ( dev-db/unixODBC ) - oracle? ( dev-db/oracle-instantclient:=[sdk] ) - postgres? ( dev-db/postgresql:= ) - sqlite? ( dev-db/sqlite ) -" -DEPEND="${RDEPEND}" - -src_configure() { - local mycmakeargs=( - -DSOCI_STATIC="$(usex static-libs)" - -DSOCI_TESTS="$(usex test)" - ) - cmake_src_configure -} diff --git a/dev-db/soci/soci-4.1.2-r2.ebuild b/dev-db/soci/soci-4.1.2-r2.ebuild new file mode 100644 index 000000000000..43c6c2bb66f5 --- /dev/null +++ b/dev-db/soci/soci-4.1.2-r2.ebuild @@ -0,0 +1,79 @@ +# Copyright 2024-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake toolchain-funcs + +DESCRIPTION="SOCI - The C++ Database Access Library" +HOMEPAGE="https://sourceforge.net/projects/soci/" +SRC_URI="https://sourceforge.net/projects/soci/files/soci/${P}/${P}.tar.gz/download -> ${P}.tar.gz" + +LICENSE="Boost-1.0" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86" +IUSE="mariadb mysql odbc oracle postgres sqlite test" +REQUIRED_USE="?? ( mysql mariadb )" +RESTRICT="!test? ( test )" + +CMAKE_SKIP_TESTS=( + soci_odbc_test_mssql + soci_odbc_test_mssql_static + soci_odbc_test_mysql + soci_odbc_test_mysql_static + soci_odbc_test_postgresql + soci_odbc_test_postgresql_static + soci_postgresql_test + soci_postgresql_test_static + soci_mysql_test + soci_mysql_test_static +) + +RDEPEND=" + >=dev-libs/boost-1.85.0-r1:= + mysql? ( dev-db/mysql-connector-c:0= ) + mariadb? ( dev-db/mariadb-connector-c:0= ) + odbc? ( dev-db/unixODBC ) + oracle? ( dev-db/oracle-instantclient:=[sdk] ) + postgres? ( dev-db/postgresql:= ) + sqlite? ( dev-db/sqlite ) +" +DEPEND="${RDEPEND}" +BDEPEND=" + virtual/pkgconfig +" + +src_prepare() { + cmake_src_prepare + cp "${FILESDIR}/FindMySQL.cmake" "cmake/find_modules" || die +} + +src_configure() { + local mysql_backend_driver="$(usex mysql 'mysqlclient' "$(usev mariadb 'libmariadb')")" + local mysql_backend_cmake_args=( + ) + if [[ -n "$mysql_backend_driver" ]]; then + local mysql_backend_include="$($(tc-getPKG_CONFIG) --cflags-only-I $mysql_backend_driver)" + local mysql_backend_libs="$($(tc-getPKG_CONFIG) --libs $mysql_backend_driver)" + if [[ -z "$mysql_backend_include" ]] || [[ -z "$mysql_backend_libs" ]]; then + die + fi + mysql_backend_cmake_args=( + -DMySQL_INCLUDE_DIRS="$(echo "$mysql_backend_include" | sed -e 's/-I//')" + -DMySQL_LIBRARIES="$mysql_backend_libs" + ) + fi + local mycmakeargs=( + -DSOCI_STATIC=OFF + -DSOCI_TESTS="$(usex test)" + -DSOCI_DB2=OFF + -DSOCI_FIREBIRD=OFF + -DSOCI_MYSQL="$(usex mysql 'yes' $(usex mariadb))" + -DSOCI_ODBC="$(usex odbc)" + -DSOCI_ORACLE="$(usex oracle)" + -DSOCI_POSTGRESQL="$(usex postgres)" + -DSOCI_SQLITE3="$(usex sqlite)" + "${mysql_backend_cmake_args[@]}" + ) + cmake_src_configure +}
