##
##  fping.spec -- OpenPKG RPM Package Specification
##  Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

#   package versions
%define       V_here  5.4
%define       V_real  5.4

#   package information
Name:         fping
Summary:      ICMP Host Pinging Tool
URL:          http://fping.org/
Vendor:       Thomas Dzubin, David Schweikert
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        PLUS
Group:        Mapping
License:      Open Source
Version:      %{V_here}
Release:      20250823

#   list of sources
Source0:      http://fping.org/dist/fping-%{V_real}.tar.gz

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, make, gcc
PreReq:       OpenPKG, openpkg >= 20160101

%description
    fping is a ping(8) like program which uses the Internet Control
    Message Protocol (ICMP) echo request to determine if a host is up.
    fping is different from ping in that you can specify any number of
    hosts on the command line, or specify a file containing the lists
    of hosts to ping. Instead of trying one host until it timeouts or
    replies, fping will send out a ping packet and move on to the next
    host in a round-robin fashion. If a host replies, it is noted and
    removed from the list of hosts to check. If a host does not respond
    within a certain time limit and/or retry limit it will be considered
    unreachable. Unlike ping(8), fping is meant to be used in scripts
    and its output is easy to parse.

%track
    prog fping = {
        version   = %{V_real}
        url       = http://fping.org/dist/
        regex     = fping-(__VER__)\.tar\.gz
    }

%prep
    %setup -q -n fping-%{V_real}
    touch configure

%build
    CC="%{l_cc}" \
    CFLAGS="%{l_cflags -O}" \
    ./configure \
        --prefix=%{l_prefix}
    %{l_make} %{l_mflags -O}

%install
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/sbin \
        $RPM_BUILD_ROOT%{l_prefix}/man/man8
    %{l_shtool} install -c \
        src/fping $RPM_BUILD_ROOT%{l_prefix}/sbin/
    %{l_shtool} install -c -m 644 \
        doc/fping.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
        '%attr(4711,%{l_susr},%{l_sgrp}) %{l_prefix}/sbin/fping'

%files -f files

%clean

