1SUMMARY = "An Open Source ODBC sub-system"
2DESCRIPTION = "unixODBC is an Open Source ODBC sub-system and an ODBC SDK \
3for Linux, Mac OSX, and UNIX."
4
5HOMEPAGE = "http://www.unixodbc.org/"
6LICENSE = "GPL-2.0-only"
7LIC_FILES_CHKSUM = "file://COPYING;md5=d7b37bf80a3df5a65b355433ae36d206"
8
9DEPENDS = "libtool readline"
10
11SRC_URI = "https://www.unixodbc.org/unixODBC-${PV}.tar.gz \
12           file://do-not-use-libltdl-source-directory.patch \
13           file://0001-exe-Makefile.am-add-CROSS_LAUNCHER-to-run-odbc_confi.patch \
14           file://CVE-2024-1013.patch \
15"
16SRC_URI[sha256sum] = "f210501445ce21bf607ba51ef8c125e10e22dffdffec377646462df5f01915ec"
17
18UPSTREAM_CHECK_URI = "https://www.unixodbc.org/download.html"
19UPSTREAM_CHECK_REGEX = "unixODBC-(?P<pver>\d+(\.\d+)+)\.tar"
20
21inherit autotools-brokensep multilib_header qemu
22
23S = "${WORKDIR}/unixODBC-${PV}"
24
25EXTRA_OEMAKE += "LIBS=-lltdl"
26EXTRA_OECONF += "--enable-utf8ini"
27DEPENDS:append:class-target = "${@' qemu-native' if bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', True, False, d) else ''}"
28QEMU_WRAPPER = "${@qemu_wrapper_cmdline(d, '${STAGING_DIR_HOST}', ['${STAGING_DIR_HOST}/${libdir}','${STAGING_DIR_HOST}/${base_libdir}'])}"
29
30do_configure:prepend() {
31    # old m4 files will cause libtool version don't match
32    rm -rf m4/*
33    rm -fr libltdl
34}
35
36do_compile:prepend() {
37    if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then
38	export CROSS_LAUNCHER="${QEMU_WRAPPER} "
39    fi
40}
41
42do_install:prepend() {
43    if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then
44	export CROSS_LAUNCHER="${QEMU_WRAPPER} "
45    fi
46}
47
48do_install:append() {
49    oe_multilib_header unixodbc.h unixODBC/unixodbc_conf.h
50}
51