File mingw64-libgps.spec of Package mingw64-libgps

#
# spec file for package mingw64-libgps
#
# Copyright (c) 2018 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/
#


%define tarname gpsd
%define _pkg_name libgps
Name:           mingw64-libgps
Version:        3.17
Release:        0
Summary:        Client library (only) in C for talking to a running gpsd
# Enabling C++ / Python cross build is left as an exercise for the reader...
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
URL:            http://www.catb.org/gpsd/
Source0:        http://download-mirror.savannah.gnu.org/releases/%{tarname}/%{tarname}-%{version}.tar.gz
Source98:       http://download-mirror.savannah.gnu.org/releases/%{tarname}/%{tarname}-%{version}.tar.gz.sig
Patch0:         scons-cross-build.patch
Patch1:         Improved-Windows-build-of-gpspipe.patch
Patch2:         Fixes-SConstruct-for-SCons-300.patch
Patch3:         Fix-SConstruct-to-work-with-Python-3.patch
BuildRequires:  mingw64-cross-binutils
BuildRequires:  mingw64-cross-gcc
BuildRequires:  mingw64-cross-gcc-c++
BuildRequires:  mingw64-cross-pkg-config
BuildRequires:  mingw64-filesystem
BuildRequires:  mingw64-runtime
BuildRequires:  scons >= 2.0.1
%_mingw64_package_header_debug
BuildArch:      noarch

%description
This package provides the shared library for accessing gpsd from other
GPS aware applications via the C API only.

%package devel
Summary:        Client libraries in C for talking to a running gpsd
Group:          Development/Libraries/C and C++

%description devel
This package provides C header files for the gpsd shared libraries that
manage access to a GPS for applications and debugging tools.

%package clients-cli
Summary:        Client programs to access a running gpsd instance
Group:          Productivity/Scientific/Other

%description clients-cli
This package provides applications such as gpxlogger and gpspipe that
outputs information from accessing a gpsd instance.

%_mingw64_debug_package

%prep
%setup -q -n %{tarname}-%{version}
%patch -P 0 -p1
%patch -P 1 -p1
%patch -P 2 -p1
%patch -P 3 -p1

# don't set RPATH
sed -i 's|env.Prepend.*RPATH.*|pass #\0|' SConstruct

%build
# NB Force off the default stack-protector, otherwise need gcc runtime embedded in the dll?
export CFLAGS="%{_mingw64_cflags} -fno-stack-protector -std=gnu99 -mconsole -Wl,--subsystem -Wl,console"
# Currently not been able to successfully pass these into scons (either via command line or environment variable)
# See Patch0
#export SHLINKFLAGS="-Wl,--dll -shared -lws2_32 -lwinpthread -Wl,--output-def,libgps.def -Wl,--out-implib,libgps.a"
#export SHLIBSUFFIX='.dll'
scons target=%{_mingw64_target} \
shared=True \
socket_export=True \
gpsd=False \
gpsdclients=False \
minimal=True

scons target=%{_mingw64_target} \
shared=True \
socket_export=True \
gpsd=False \
gpsdclients=False \
reconfigure=False \
controlsend=False \
minimal=True \
gpspipe \
gpxlogger \
test_libgps

%install
# Simple manual copy to install locally
mkdir -p %{buildroot}%{_mingw64_includedir}
cp gps.h %{buildroot}%{_mingw64_includedir}
mkdir -p %{buildroot}%{_mingw64_bindir}
cp libgps.dll %{buildroot}%{_mingw64_bindir}
mkdir -p %{buildroot}%{_mingw64_libdir}
cp libgps.dll.a %{buildroot}%{_mingw64_libdir}
cp libgps.def %{buildroot}%{_mingw64_libdir}
cp test_libgps.exe %{buildroot}%{_mingw64_bindir}
cp gpxlogger.exe %{buildroot}%{_mingw64_bindir}
cp gpspipe.exe %{buildroot}%{_mingw64_bindir}

%files
%{_mingw64_bindir}/libgps.dll

%files devel
%doc README COPYING
%{_mingw64_includedir}/gps.h
%{_mingw64_libdir}/libgps.dll.a
%{_mingw64_libdir}/libgps.def

%files clients-cli
%{_mingw64_bindir}/gpspipe.exe
%{_mingw64_bindir}/gpxlogger.exe
%{_mingw64_bindir}/test_libgps.exe

%changelog
openSUSE Build Service is sponsored by