# Maintainer: AndyRTR <andyrtr@archlinux.org>
# Contributor: Judd Vinet <jvinet@zeroflux.org>
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>

pkgname=unixodbc
pkgver=2.3.12
pkgrel=1.1
pkgdesc="ODBC is an open specification for providing application developers with a predictable API with which to access Data Sources"
license=('GPL2' 'LGPL2.1')
url="http://www.unixodbc.org/"
backup=("$MPKG_BACKUPETCPATH/odbc.ini" "$MPKG_BACKUPETCPATH/odbcinst.ini")
ncxfab_makedepends=(base-devel sh make sed coreutils crosspacman)
ncxfat_makedepends=(binutils readline libltdl glibc gcc)
source=(ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-$pkgver.tar.gz)
sha256sums=('f210501445ce21bf607ba51ef8c125e10e22dffdffec377646462df5f01915ec')

build() {
    cd unixODBC-${pkgver}
    ./configure --prefix=$MPKG_USRPATH --sysconfdir=$MPKG_ETCPATH --host=$MPKG_TARGETMACHINE
    sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
    make
}

check() {
    cd unixODBC-${pkgver}
    make -k check
}

package() {
    ncxfat_depends=(readline libltdl glibc)
    cd unixODBC-${pkgver}
    make DESTDIR="${pkgdir}" install
    touch "$pkgdir"$ETC_PATH/{odbc,odbcinst}.ini
}
