File wiringpi.spec of Package wiringpi
#
# spec file for package wiringpi
#
# Copyright (c) 2016 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/
#
%bcond_without docs
Name: wiringpi
Version: 2.50
%define so_ver 2
Release: 0
Url: http://wiringpi.com/
Summary: GPIO interface library for Raspberry Pi
License: LGPL-3.0+
Group: Development/Tools
Source0: wiringpi-%{version}.tar.gz
Source1: %{name}-rpmlintrc
Patch0: arm64-revision.patch
Patch1: fix-dev-deps.patch
Patch2: no-suid.patch
Patch3: install.diff
Patch4: wiringpi-linkerror.patch
%if %{with docs}
BuildRequires: texlive-latex-bin-bin
BuildRequires: ghostscript
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: %arm aarch64 x86_64
%description
Wiring compatible library for the Raspberry Pi.
This package contains the gpio utility (wiringpi-gpio).
%package -n libwiringPi%{so_ver}
Summary: GPIO interface library for Raspberry Pi
Group: System/Libraries
%description -n libwiringPi%{so_ver}
Wiring compatible library for the Raspberry Pi.
This sub-package contains the wiringPi library.
%package -n libwiringPiDev%{so_ver}
Summary: GPIO interface library for Raspberry Pi
Group: System/Libraries
%description -n libwiringPiDev%{so_ver}
Wiring compatible library for the Raspberry Pi.
This sub-package contains the devLib.
%if %{with docs}
%package docs
Summary: Docs for wiringPi
%description docs
This is documentation relating to the pi's GPIO pins
%endif
%package devel
Summary: GPIO interface library for Raspberry Pi -- development files
Group: Development/Libraries/C and C++
Requires: libwiringPi%{so_ver} = %{version}
Requires: libwiringPiDev%{so_ver} = %{version}
%description devel
Wiring compatible library for the Raspberry Pi.
This sub-package contains development files.
%prep
%setup -q -n wiringpi-%{version}
%autopatch -p1
%build
%define mflags %{?_smp_mflags} V=1 DEBUG="%{optflags}" WIRINGPI_SONAME_SUFFIX=.%{so_ver}
make %{mflags} -C wiringPi
make %{mflags} -C devLib INCLUDE='-I../wiringPi'
ln -sf ../wiringPi/libwiringPi.so.%{version} gpio/libwiringPi.so
ln -sf ../devLib/libwiringPiDev.so.%{version} gpio/libwiringPiDev.so
make %{mflags} -C gpio INCLUDE='-I../wiringPi -I../devLib' LDFLAGS='-L.'
%if 1 == 0
make %{mflags} -C pins
%endif
%install
%define mflags --trace DESTDIR=%{buildroot} PREFIX=%{_prefix} BINDIR=%{_bindir} INCLUDEDIR=%{_includedir} LIBDIR=%{_libdir} MANDIR=%{_mandir} LDCONFIG=: WIRINGPI_SUID=0
make %{mflags} install -C wiringPi
ln -sf libwiringPi.so.%{version} %{buildroot}%{_libdir}/libwiringPi.so.%{so_ver}
make %{mflags} install -C devLib
ln -sf libwiringPiDev.so.%{version} %{buildroot}%{_libdir}/libwiringPiDev.so.%{so_ver}
make %{mflags} install -C gpio
# Multiple packages provide a "gpio" utility, so rename this one.
mv %{buildroot}%{_bindir}/gpio %{buildroot}%{_bindir}/wiringpi-gpio
mv %{buildroot}%{_mandir}/man1/gpio.1 %{buildroot}%{_mandir}/man1/wiringpi-gpio.1
%post -n libwiringPi%{so_ver} -p /sbin/ldconfig
%postun -n libwiringPi%{so_ver} -p /sbin/ldconfig
%post -n libwiringPiDev%{so_ver} -p /sbin/ldconfig
%postun -n libwiringPiDev%{so_ver} -p /sbin/ldconfig
%files
%defattr(-,root,root,-)
%doc COPYING.LESSER README.TXT People
%{_bindir}/wiringpi-gpio
%{_mandir}/man1/wiringpi-gpio.1.gz
%files -n libwiringPi%{so_ver}
%defattr(-,root,root,-)
%{_libdir}/libwiringPi.so.%{version}
%{_libdir}/libwiringPi.so.%{so_ver}
%files -n libwiringPiDev%{so_ver}
%defattr(-,root,root,-)
%{_libdir}/libwiringPiDev.so.%{version}
%{_libdir}/libwiringPiDev.so.%{so_ver}
%if %{with docs}
%files docs
%doc pins/*pdf
%endif
%files devel
%defattr(-,root,root,-)
%{_includedir}/*.h
%{_libdir}/libwiringPi.so
%{_libdir}/libwiringPiDev.so
%changelog