##
##  libodbcplus.spec -- OpenPKG RPM Package Specification
##  Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

#   package information
Name:         libodbcplus
Summary:      Unix ODBC C++ Abstraction Library
URL:          http://libodbcxx.sourceforge.net/
Vendor:       Manush Dodunekov
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        Database
License:      LGPL
Version:      0.2.3
Release:      20120623

#   package options
%option       with_threads  yes

#   list of sources
Source0:      http://download.sourceforge.net/libodbcxx/libodbc++-%{version}.tar.gz
Patch0:       libodbcplus.patch

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, unixodbc, gcc
PreReq:       OpenPKG, openpkg >= 20160101, unixodbc

%description
    Libodbc++ is a C++ class library for accessing SQL databases. It
    is designed with standards in mind, so it provides a subset of the
    well known JDBC 2.0(tm) and runs on top of ODBC. The main goal of the
    libodbc++ project is to create a complete C++ development environment
    for SQL database access in form of a class library and a set of tools.

%track
    prog libodbcplus = {
        comment   = "cs: 0.2.4pre1: doc/progref/Makefile.in is missing in vendor tarball"
        version   = %{version}
        url       = http://sourceforge.net/projects/libodbcxx/files/
        regex     = libodbc\+\+-(\d+\.\d+(\.\d+)*)\.tar\.gz
    }

%prep
    %setup -q -n libodbc++-%{version}
    %patch -p0
    touch aclocal.m4 config.h.in `find . -name Makefile.in`

%build
    CXX="%{l_cxx}" \
    CXXFLAGS="%{l_cxxflags -O}" \
    CPPFLAGS="%{l_cppflags}" \
    ./configure \
        --prefix=%{l_prefix} \
        --datadir=%{l_prefix}/share/libodbcplus \
        --sysconfdir=%{l_prefix}/etc/libodbcplus \
        --localstatedir=%{l_prefix}/var/libodbcplus \
        --disable-shared \
        --without-isqlxx \
%if "%{with_threads}" == "yes"
        --enable-threads \
%else
        --disable-threads \
%endif
        --without-qt \
        --with-odbc=%{l_prefix} \
        --with-odbc-includes=%{l_prefix}/include \
        --with-odbc-libraries=%{l_prefix}/lib
    %{l_make} %{l_mflags -O}

%install
    %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
    rm -rf $RPM_BUILD_ROOT/%{l_prefix}/share
    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

