File rtklib.spec of Package rtklib-beta

#
# spec file for package rtklib
#
# Copyright (c) 2015 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 win32 1
%define useqt 0

Name:           rtklib
Version:        2.4.3.b34
Release:        0
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Url:            http://www.rtklib.com
Summary:        Program Package for GNSS Positioning
License:        BSD-2-Clause
Group:          Productivity/Networking/System
Source:         %{name}-%{version}.tar.bz2
# PATCH-FIX-UPSTREAM https://github.com/tomojitakasu/RTKLIB/issues/569
Patch1:         2.4.3.b34_ntripfix.patch
%if %{win32}
Source1:        %{name}-bin-%{version}.tar.bz2
%endif
BuildRequires:  c_compiler
BuildRequires:  gcc-fortran
%if %{useqt}
BuildRequires:  libqt5-qtbase-common-devel
BuildRequires:  libqt5-qtserialport-devel
%endif
BuildRequires:  lapack-devel
BuildRequires:  unzip

%description
RTKLIB is an open source program package for standard and precise
positioning with GNSS (global navigation satellite system). RTKLIB
consists of a portable program library and several APs (application
programs) utilizing the library.

%if %{win32}
%package win32
Summary:        Program Package for GNSS Positioning - Windows binaries
Group:          Productivity/Networking/System
Requires:       %{name}
Requires:       gzip
Requires:       rnxcmp
Requires:       tar
Requires:       wget
Requires:       wine

%description win32
RTKLIB is an open source program package for standard and precise
positioning with GNSS (global navigation satellite system). RTKLIB
consists of a portable program library and several APs (application
programs) utilizing the library.

This package contains the windows executables and wrappers to call them.
%endif

%prep
%if %{win32}
%setup -b1
%else
%setup
%endif
%patch1 -p1

%build
pushd lib/iers/gcc/
  make
popd
pushd app/consapp
  make
popd

%if %{useqt}
# broken - upstream states in app/qtapp/readme.txt that these apps are not maintained
pushd app/qtapp
qmake-qt5 app.pro && make
%endif

%install
mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/%{_datadir}/rtklib
install -m 755 app/consapp/convbin/gcc/convbin %{buildroot}/%{_bindir}
install -m 755 app/consapp/pos2kml/gcc/pos2kml %{buildroot}/%{_bindir}
install -m 755 app/consapp/str2str/gcc/str2str %{buildroot}/%{_bindir}
install -m 755 app/consapp/rnx2rtkp/gcc/rnx2rtkp %{buildroot}/%{_bindir}
install -m 755 app/consapp/rtkrcv/gcc/rtkrcv %{buildroot}/%{_bindir}
install -m 755 app/consapp/rtkrcv/gcc/rtk*.sh %{buildroot}/%{_bindir}
install -m 644 data/ant/*.atx %{buildroot}/%{_datadir}/rtklib
%if %{win32}
mkdir -p %{buildroot}/%{_datadir}/rtklib/win
cp ../%{name}-bin-%{version}/bin/LICENSE.txt bin/
pushd ../%{name}-bin-%{version}/bin/
  for file in *.exe; do
    name=`echo "%{buildroot}/%{_bindir}/$file" | sed s/\.exe//`
    if [ ! -f $name ]; then
      echo -e '#!/bin/bash\nwine' "%{_datadir}/rtklib/win/$file" '$@' >$name
      chmod 755 $name
      install -m 644 $file %{buildroot}/%{_datadir}/rtklib/win/
    fi
  done
popd
%endif

%files
%defattr(755, root, root, 0755)
%{_bindir}/convbin
%{_bindir}/pos2kml
%{_bindir}/str2str
%{_bindir}/rnx2rtkp
%{_bindir}/rtkrcv
%{_bindir}/rtkstart.sh
%{_bindir}/rtkshut.sh
%dir %{_datadir}/rtklib
%defattr(644, root, root, 0755)
%{_datadir}/rtklib/*.atx
%doc readme.txt app/consapp/rtkrcv/*/*.conf

%if %{win32}
%files win32
%defattr(-, root, root)
%dir %{_datadir}/rtklib/win
%doc bin/LICENSE.txt
%exclude %{_datadir}/rtklib/win/crx2rnx.exe
%exclude %{_datadir}/rtklib/win/gzip.exe
%{_datadir}/rtklib/win/rtkconv.exe
%{_datadir}/rtklib/win/rtkget.exe
%{_datadir}/rtklib/win/rtklaunch.exe
%{_datadir}/rtklib/win/rtknavi.exe
%{_datadir}/rtklib/win/rtkplot.exe
%{_datadir}/rtklib/win/rtkpost.exe
%{_datadir}/rtklib/win/srctblbrows.exe
%{_datadir}/rtklib/win/strsvr.exe
%exclude %{_datadir}/rtklib/win/tar.exe
%exclude %{_datadir}/rtklib/win/teqc.exe
%exclude %{_datadir}/rtklib/win/wget.exe
%exclude %{_bindir}/crx2rnx
%exclude %{_bindir}/gzip
%{_bindir}/rtkconv
%{_bindir}/rtkget
%{_bindir}/rtklaunch
%{_bindir}/rtknavi
%{_bindir}/rtkplot
%{_bindir}/rtkpost
%{_bindir}/srctblbrows
%{_bindir}/strsvr
%exclude %{_bindir}/tar
%exclude %{_bindir}/teqc
%exclude %{_bindir}/wget
%endif

%changelog
openSUSE Build Service is sponsored by