Files
liblistSerialsj/liblistSerialsj.spec

75 lines
2.7 KiB
RPMSpec

#
# spec file for package liblistSerialsj
#
# Copyright (c) 2024 SUSE LLC
#
# 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/
#
%{!?make_build:%global make_build make %{?_smp_mflags}}
%define javaincdir %{_libdir}/jvm/java/include
%define tool listSerialC
%define upstream_name listSerialPortsC
%define libserial_hash 16e35cfa29ecf4292f19f07141c6b112a6848c69
Name: liblistSerialsj
Version: 1.4.0
Release: 0
Summary: Arduino IDE ulility for listing serial ports
License: LGPL-3.0-only
# FIXME: use correct group or remove it, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group: Software/Development/Libraries/Hardware
URL: https://github.com/arduino/%{upstream_name}
Source: https://github.com/arduino/%{upstream_name}/archive/%{version}.tar.gz
Source1: https://github.com/arduino/libserialport/archive/%{libserial_hash}.tar.gz
Patch0: fix-random-return-value.patch
BuildRequires: autoconf
BuildRequires: java-devel
BuildRequires: libtool
%description
This is a utility library built around libserialport from sigrok.
The main function is listing serial ports which is useful for presenting
a choice to the user in a GUI application or an interactive script.
JNI library and commandline utility is provided.
%prep
%setup -q -n %{upstream_name}-%{version}
%patch -P 0 -p1
tar -zxf %{SOURCE1}
rmdir libserialport
mv libserialport-%{libserial_hash} libserialport
%build
cd libserialport
./autogen.sh
%configure
%make_build
cd ..
gcc %{optflags} main.c libserialport/linux_termios.c libserialport/linux.c libserialport/serialport.c -Ilibserialport/ -o %{tool}
gcc %{optflags} jnilib.c libserialport/linux_termios.c libserialport/linux.c libserialport/serialport.c -Ilibserialport/ -I%{javaincdir} -I%{javaincdir}/linux/ -shared -fPIC -o %{name}.so
%install
install -m 755 -D -t %{buildroot}/%{_bindir} %{tool}
install -m 644 -D -t %{buildroot}/%{_libdir} %{name}.so
%files
%license libserialport/COPYING LICENSE.md
%doc libserialport/NEWS libserialport/README libserialport/AUTHORS README.md
%{_bindir}/%{tool}
%{_libdir}/%{name}.so
%changelog