File twaindsm.spec of Package twaindsm

#
# spec file for package twaindsm
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Summary:        TWAIN Data Source Manager
License:        LGPL-2.0
Group:          Development/Libraries/C++
Name:           twaindsm
Version:        2.3.1
Release:        0
Url:            http://www.twain.org
Source0:        twaindsm-2.3.1.source.zip
Patch0:         fix_compiler_errors.patch
BuildRequires:  cmake
BuildRequires:  dos2unix
BuildRequires:  gcc-c++
BuildRequires:  unzip

%package devel
Summary:        Development files for the TWAIN data source manager
Group:          Development/Libraries/C and C++

%package -n libtwaindsm2
Summary:        The TWAIN data source manager library
Group:          System/Libraries

%description
The TWAIN Working Group's Data Source Manager (DSM) for managing communication
between applications and TWAIN drivers (data sources).

%description devel
Development files for the TWAIN Working Group's Data Source Manager (DSM).

%description -n libtwaindsm2
This package contains the library files for the TWAIN Data Source Manager.

%prep
%setup -q -c -T
unzip %{S:0}
%patch0 -p0

# define the destination directory to the correct place
pushd twaindsm-%{version}.orig/TWAIN_DSM/src
sed -i "s@LIBRARY DESTINATION lib@LIBRARY DESTINATION %{_lib}@g" CMakeLists.txt

%build
pushd twaindsm-%{version}.orig/TWAIN_DSM/src
# define the output format for CMAKE
cmake -G "Unix Makefiles"

%{cmake}

cd ..
make %{?_smp_mflags}

%install
pushd twaindsm-%{version}.orig/TWAIN_DSM/src
make DESTDIR=$RPM_BUILD_ROOT install

cd ..
dos2unix *txt

%post -n libtwaindsm2 -p /sbin/ldconfig

%postun -n libtwaindsm2 -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc twaindsm-%{version}.orig/TWAIN_DSM/doc/* 
%doc twaindsm-%{version}.orig/TWAIN_DSM/README.txt 
%doc twaindsm-%{version}.orig/TWAIN_DSM/ChangeLog.txt
%doc twaindsm-%{version}.orig/TWAIN_DSM/license.txt

%files devel
%defattr(-,root,root)
%{_includedir}/twain.h

%files -n libtwaindsm2
%defattr(-,root,root)
%{_libdir}/libtwaindsm*

%changelog
openSUSE Build Service is sponsored by