##
##  sqlsync.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 version
%define       V_opkg  1.0.0rc1
%define       V_dist  1.0.0-rc1

#   package information
Name:         sqlsync
Summary:      SQL Database Synchronization
URL:          http://silvercoders.com/index.php?page=sqlsync
Vendor:       Pawel Pluciennik
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        Database
License:      GPL
Version:      %{V_opkg}
Release:      20160305

#   list of sources
Source0:      http://silvercoders.com/download/sqlsync-%{V_dist}.tar.bz2

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

%description
    SqlSync gives the ability to compare data stored in two SQL
    databases, and synchronize it via ODBC. Results contain list of
    records that differ, records that are missing and records that are
    additional. SqlSync can generate SQL queries that will change second
    database in such a way, that it will be identical to first database.
    Generated queries can be executed automatically. It will synchronize
    selected objects in databases or whole databases.

%track
    prog sqlsync = {
        version   = %{V_dist}
        url       = http://silvercoders.com/index.php?page=sqlsync
        regex     = sqlsync-(__VER__)\.tar\.bz2
    }

%prep
    %setup -q -n sqlsync-%{V_dist}

%build
    %{l_make} %{l_mflags -O} \
        CC="%{l_cc}" \
        CFLAGS="%{l_cflags -O}" \
        CPPFLAGS="%{l_cppflags}" \
        LDFLAGS="%{l_ldflags}" \
        WITH_STATIC=YES \
        WITH_SHARED=NO \
        WIN32=NO \
        WINDOWS=NO \
        WITH_DEBUG=NO \
        WITH_TRANSLATION=NO \
        WITH_TESTS=NO \
        WITH_DOCUMENTATION=NO

%install
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/bin \
        $RPM_BUILD_ROOT%{l_prefix}/share/sqlsync
    %{l_shtool} install -c -s -m 755 \
        src/sqlsync_static $RPM_BUILD_ROOT%{l_prefix}/bin/sqlsync
    %{l_shtool} install -c -m 644 \
        doc/sqlsync_en.pdf $RPM_BUILD_ROOT%{l_prefix}/share/sqlsync/
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
        %{l_files_std} \
        '%doc %{l_prefix}/share/sqlsync/*'

%files -f files

%clean

