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_REGEX = "unixODBC-(?P<pver>\d+(\.\d+)+)\.tar"
19
20inherit autotools-brokensep multilib_header qemu
21
22S = "${WORKDIR}/unixODBC-${PV}"
23
24EXTRA_OEMAKE += "LIBS=-lltdl"
25EXTRA_OECONF += "--enable-utf8ini"
26DEPENDS:append:class-target = "${@' qemu-native' if bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', True, False, d) else ''}"
27QEMU_WRAPPER = "${@qemu_wrapper_cmdline(d, '${STAGING_DIR_HOST}', ['${STAGING_DIR_HOST}/${libdir}','${STAGING_DIR_HOST}/${base_libdir}'])}"
28
29do_configure:prepend() {
30    # old m4 files will cause libtool version don't match
31    rm -rf m4/*
32    rm -fr libltdl
33}
34
35do_compile:prepend() {
36    if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then
37	export CROSS_LAUNCHER="${QEMU_WRAPPER} "
38    fi
39}
40
41do_install:prepend() {
42    if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then
43	export CROSS_LAUNCHER="${QEMU_WRAPPER} "
44    fi
45}
46
47do_install:append() {
48    oe_multilib_header unixodbc.h unixODBC/unixodbc_conf.h
49}
50