1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
9 MY_PN="mysql-connector-odbc"
10 MY_P="${MY_PN}-${PV/_p/r}-src"
12 DESCRIPTION="ODBC driver for MySQL"
13 HOMEPAGE="https://dev.mysql.com/downloads/connector/odbc/"
14 SRC_URI="https://dev.mysql.com/get/Downloads/Connector-ODBC/${MAJOR}/${MY_P}.tar.gz"
18 KEYWORDS="amd64 ppc x86"
21 # Broken when built dynamically against libmysqlclient.so
23 dev-db/unixODBC[${MULTILIB_USEDEP}]
24 >=dev-db/mysql-connector-c-8.0:0=[static-libs,${MULTILIB_USEDEP}]
30 DRIVER_NAME="${PN}-${SLOT}"
32 # Patch document path so it doesn't install files to /usr
34 "${FILESDIR}/${MAJOR}-cmake-doc-path.patch"
35 "${FILESDIR}/${PN}-8.0.19-cxxlinkage.patch"
40 sed -i -e "s/ADD_SUBDIRECTORY(test)//" \
43 cmake-utils_src_prepare
46 multilib_src_configure() {
48 -DMYSQLCLIENT_STATIC_LINKING=1
51 -DWITH_DOCUMENTATION_INSTALL_PATH=/usr/share/doc/${PF}
52 -DLIB_SUBDIR="$(get_libdir)/${PN}-${MAJOR}"
53 -DMYSQLCLIENT_NO_THREADS=ON
55 # The NUMA and LIBWRAP options are not really used.
56 # They are just copied from the server code
60 cmake-utils_src_configure
63 multilib_src_install_all() {
64 debug-print-function ${FUNCNAME} "$@"
66 dodir /usr/share/${PN}-${SLOT}
67 for i in odbc.ini odbcinst.ini; do
70 -e "s,__PN__,${DRIVER_NAME},g" \
71 -e "s,__PF__,${MAJOR},g" \
72 -e "s,lib/libmyodbc3.so,$(get_libdir)/${PN}-${MAJOR}/libmyodbc${SLOT:0:1}a.so,g" \
73 >"${D}"/usr/share/${PN}-${SLOT}/${i} \
74 <"${FILESDIR}"/${i}.m4 \
75 || die "Failed to build $i"
77 mv "${D}/usr/bin/myodbc-installer" \
78 "${D}/usr/bin/myodbc-installer-${MAJOR}" || die "failed to move slotted binary"
83 [ "${ROOT}" != "/" ] && \
84 die 'Sorry, non-standard ROOT setting is not supported :-('
86 local msg='MySQL ODBC driver'
87 local drivers=$(/usr/bin/odbcinst -q -d)
89 if echo $drivers | grep -vq "^\[${DRIVER_NAME}\]$" ; then
90 ebegin "Installing ${msg}"
91 /usr/bin/odbcinst -i -d -f /usr/share/${PN}-${SLOT}/odbcinst.ini
96 einfo "Skipping already installed ${msg}"
99 local sources=$(/usr/bin/odbcinst -q -s)
100 msg='sample MySQL ODBC DSN'
101 if echo $sources | grep -vq "^\[${DRIVER_NAME}-test\]$"; then
102 ebegin "Installing ${msg}"
103 /usr/bin/odbcinst -i -s -l -f /usr/share/${PN}-${SLOT}/odbc.ini
108 einfo "Skipping already installed ${msg}"
113 elog "If this is a new install, please run the following command"
114 elog "to configure the MySQL ODBC drivers and sources:"
115 elog "emerge --config =${CATEGORY}/${PF}"
116 elog "Please note that the driver name used to form the DSN now includes the SLOT."
117 elog "The myodbc-install utility is installed as myodbc-install-${MAJOR}"