LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File snap7.spec of Package snap7 (Project home:illuusio)

#
# spec file for package snap7
#
# Copyright (c) 2019 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 https://bugs.opensuse.org/
#


Name:           libsnap7-1
Version:        1.4.2
Release:        0
Summary:        Ethernet communication Siemens S7 PLCs
License:        LGPL-3.0-only
Group:          Development/Languages/C and C++
URL:            http://sourceforge.net/projects/snap7
Source0:        snap7-full-%{version}.tar.xz
Patch0:         snap7-makefile-%{version}.patch
# Until lazarus in available for openSUSE 42.2 it's opt out
#BuildRequires: lazarus
BuildRequires:  dos2unix
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  make

%description
Snap7 is an open source, 32/64 bit, multi-platform Ethernet communication suite for interfacing natively with Siemens S7 PLCs. The new CPUs 1200/1500, the old S7200, the small LOGO 0BA7 and SINAMICS Drives are also partially supported.

Although it has been designed to overcome the limitations of OPC servers when transferring large amounts of high speed data in industrial facilities, it scales well down to small Linux based arm boards such as Raspberry PI, BeagleBone Black, pcDuino, CubieBoard and UDOO.

Three specialized components, Client, Server and Partner, allow you to definitively integrate your PC based systems into a PLC automation chain.

Main features
         * Native multi-architecture design (32/64 bit).
         * Platform independent, currently are supported Windows (from NT 4.0 up to Windows 8), Linux, BSD, Oracle Solaris 11, Apple OSX.
         * Fully scalable, starting from blade servers down to Raspberry PI board.
         * No dependence on any third-party libraries, no installation needed, zero configuration.
         * Three Different native thread models for performance optimization: Win32 threads/ Posix threads / Solaris 11 threads.
         * Two data transfer models: classic synchronous and asynchronous.
         * Two data flow models: polling and unsolicited (PLC transfers data when it wants to).
         * Two specialized ports : Settimino and Moka7 allow you to communicate with S7 PLC with Arduino or Android phones.

Additional benefits
         * LGPL3 - you can distribute your commercial software linked with Snap7 without the requirement to distribute the
           source code of your application and without the requirement that your application be itself distributed under LGPL.
         * Very easy to use, a full working server example is not bigger than the “Hello world”.
         * Hi level object oriented wrappers are provided, currently C/C++, .NET/Mono, Pascal, LabVIEW, Python with many source code examples.
         * Multi-platform rich demos provided.
         * Very detailed documentation provided.
         * Many projects/makefiles are ready to run to easily rebuild Snap7 in any platform without the need of be a C++ guru.

%package -n libsnap7-devel
Summary:        Ethernet communication Siemens S7 PLCs
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description -n libsnap7-devel
Snap7 is an open source, 32/64 bit, multi-platform Ethernet communication suite for interfacing natively with Siemens S7 PLCs. The new CPUs 1200/1500, the old S7200, the small LOGO 0BA7 and SINAMICS Drives are also partially supported.

Although it has been designed to overcome the limitations of OPC servers when transferring large amounts of high speed data in industrial facilities, it scales well down to small Linux based arm boards such as Raspberry PI, BeagleBone Black, pcDuino, CubieBoard and UDOO.

Three specialized components, Client, Server and Partner, allow you to definitively integrate your PC based systems into a PLC automation chain.

Main features
         * Native multi-architecture design (32/64 bit).
         * Platform independent, currently are supported Windows (from NT 4.0 up to Windows 8), Linux, BSD, Oracle Solaris 11, Apple OSX.
         * Fully scalable, starting from blade servers down to Raspberry PI board.
         * No dependence on any third-party libraries, no installation needed, zero configuration.
         * Three Different native thread models for performance optimization: Win32 threads/ Posix threads / Solaris 11 threads.
         * Two data transfer models: classic synchronous and asynchronous.
         * Two data flow models: polling and unsolicited (PLC transfers data when it wants to).
         * Two specialized ports : Settimino and Moka7 allow you to communicate with S7 PLC with Arduino or Android phones.

Additional benefits
         * LGPL3 - you can distribute your commercial software linked with Snap7 without the requirement to distribute the
           source code of your application and without the requirement that your application be itself distributed under LGPL.
         * Very easy to use, a full working server example is not bigger than the “Hello world”.
         * Hi level object oriented wrappers are provided, currently C/C++, .NET/Mono, Pascal, LabVIEW, Python with many source code examples.
         * Multi-platform rich demos provided.
         * Very detailed documentation provided.
         * Many projects/makefiles are ready to run to easily rebuild Snap7 in any platform without the need of be a C++ guru.

Three specialized components, Client, Server and Partner, allow you to definitively integrate your PC based systems into a PLC automation chain.

%prep
echo %{_arch}
%setup -q -n snap7-full-%{version}
%patch0 -p1

%build
cd build/unix
make %{?_smp_mflags} -f %{_arch}_linux.mk clean
make %{?_smp_mflags} -f %{_arch}_linux.mk
strip ../../build/bin/%{_arch}-linux/libsnap7.so.1.2
cd ../..
NOW_PWD=$(pwd)

cd examples/cpp/%{_arch}-linux/
ln -sf ../../../build/bin/%{_arch}-linux/libsnap7.so.1.2 libsnap7.so

make %{?_smp_mflags}
#cd ../../plain-c/%{_arch}-linux/
#ln -sf ../../../build/bin/%{_arch}-linux/libsnap7.so.1.2 libsnap7.so
#make
#cd ../../..
#cd rich-demos/%{_arch}-linux/
#ln -sf ../../build/bin/%{_arch}-linux/libsnap7.so.1.2 libsnap7.so
#lazbuild clientdemo.lpi
#lazbuild partnerdemo.lpi
#lazbuild serverdemo.lpi

%install
install -d %{buildroot}/%{_libdir}
install -d %{buildroot}/%{_bindir}
install -d %{buildroot}/%{_includedir}

install build/bin/%{_arch}-linux/libsnap7.so.1.2 %{buildroot}/%{_libdir}
ln -sf %{_libdir}/libsnap7.so.1.2 %{buildroot}/%{_libdir}/libsnap7.so.1
ln -sf %{_libdir}/libsnap7.so.1.2 %{buildroot}/%{_libdir}/libsnap7.so

dos2unix release/Wrappers/c-cpp/snap7.h
install release/Wrappers/c-cpp/snap7.h %{buildroot}/%{_includedir}
chmod -x %{buildroot}/%{_includedir}/*.h

install examples/cpp/%{_arch}-linux/client %{buildroot}/%{_bindir}/snap7-client
install examples/cpp/%{_arch}-linux/ppartner %{buildroot}/%{_bindir}/snap7-ppartner
install examples/cpp/%{_arch}-linux/server %{buildroot}/%{_bindir}/snap7-server

install rich-demos/%{_arch}-linux/bin/clientdemo %{buildroot}/%{_bindir}/snap7-clientdemo
install rich-demos/%{_arch}-linux/bin/serverdemo %{buildroot}/%{_bindir}/snap7-serverdemo

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%{_libdir}/*.so.*

%files -n libsnap7-devel
%{_libdir}/*.so
%{_includedir}/*.h
%{_bindir}/*

%changelog -n %{name}.changes

%changelog