File hello.spec of Package hello

#
# spec file for package hello
#
# 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 https://bugs.opensuse.org/
#


Name:           hello
Url:            http://www.gnu.org/software/hello/
Version:        1.1
Release:        0
Summary:        The GNU hello implementation
License:        GPL-3.0-or-later

Source0:         %{name}/%{name}-%{version}.tar.gz

#-------------------------------------------------------------------------------
# PO handling [1/3]: let the _service download them from the TranslationProject
# server.
# wget -O - https://translationproject.org/latest/hello \
#   | grep text.gif \
#   | sed 's/^.*href="//; s/".*$//' \
#   | awk '{printf("Source%d:        https://translationproject.org/latest/hello/%s\n", NR+9, $0);}'
Source10:        https://translationproject.org/latest/hello/ast.po
Source11:        https://translationproject.org/latest/hello/bg.po
Source12:        https://translationproject.org/latest/hello/ca.po
Source13:        https://translationproject.org/latest/hello/cs.po
Source14:        https://translationproject.org/latest/hello/da.po
Source15:        https://translationproject.org/latest/hello/de.po
Source16:        https://translationproject.org/latest/hello/el.po
Source17:        https://translationproject.org/latest/hello/eo.po
Source18:        https://translationproject.org/latest/hello/es.po
Source19:        https://translationproject.org/latest/hello/et.po
Source20:        https://translationproject.org/latest/hello/eu.po
Source21:        https://translationproject.org/latest/hello/fa.po
Source22:        https://translationproject.org/latest/hello/fi.po
Source23:        https://translationproject.org/latest/hello/fr.po
Source24:        https://translationproject.org/latest/hello/ga.po
Source25:        https://translationproject.org/latest/hello/gl.po
Source26:        https://translationproject.org/latest/hello/he.po
Source27:        https://translationproject.org/latest/hello/hr.po
Source28:        https://translationproject.org/latest/hello/hu.po
Source29:        https://translationproject.org/latest/hello/id.po
Source30:        https://translationproject.org/latest/hello/it.po
Source31:        https://translationproject.org/latest/hello/ja.po
Source32:        https://translationproject.org/latest/hello/ka.po
Source33:        https://translationproject.org/latest/hello/ko.po
Source34:        https://translationproject.org/latest/hello/lv.po
Source35:        https://translationproject.org/latest/hello/ms.po
Source36:        https://translationproject.org/latest/hello/nb.po
Source37:        https://translationproject.org/latest/hello/nl.po
Source38:        https://translationproject.org/latest/hello/nn.po
Source39:        https://translationproject.org/latest/hello/pl.po
Source40:        https://translationproject.org/latest/hello/pt.po
Source41:        https://translationproject.org/latest/hello/pt_BR.po
Source42:        https://translationproject.org/latest/hello/ro.po
Source43:        https://translationproject.org/latest/hello/ru.po
Source44:        https://translationproject.org/latest/hello/sk.po
Source45:        https://translationproject.org/latest/hello/sl.po
Source46:        https://translationproject.org/latest/hello/sr.po
Source47:        https://translationproject.org/latest/hello/sv.po
Source48:        https://translationproject.org/latest/hello/ta.po
Source49:        https://translationproject.org/latest/hello/th.po
Source50:        https://translationproject.org/latest/hello/tr.po
Source51:        https://translationproject.org/latest/hello/uk.po
Source52:        https://translationproject.org/latest/hello/vi.po
Source53:        https://translationproject.org/latest/hello/zh_CN.po
Source54:        https://translationproject.org/latest/hello/zh_TW.po

# Building the manpage is usually only done in the maintainer tree, i.e.,
# when the '.git/' directory is available.  As the clone is without that,
# we have to patch the 'Makefile.am'.
Patch10:         hello-make-manpage.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# BuildRequire dejagnu for 'runtest' to execute all tests.
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  help2man
BuildRequires:  groff
BuildRequires:  gperf
BuildRequires:  makeinfo
# implicit: Provides:       hello = %%{version}
Obsoletes:      hello < %{version}
Requires(post):  %{install_info_prereq}
Requires(preun): %{install_info_prereq}

%description
Hello prints a friendly greeting.  It also serves as a sample GNU
package, showing practices that may be useful for GNU projects.

%lang_package

%prep
%setup -q
# PO handling [2/3]: Copy the PO files into the build tree.
cp -vt po %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} %{SOURCE15} %{SOURCE16} %{SOURCE17} %{SOURCE18} %{SOURCE19} %{SOURCE20} %{SOURCE21} %{SOURCE22} %{SOURCE23} %{SOURCE24} %{SOURCE25} %{SOURCE26} %{SOURCE27} %{SOURCE28} %{SOURCE29} %{SOURCE30} %{SOURCE31} %{SOURCE32} %{SOURCE33} %{SOURCE34} %{SOURCE35} %{SOURCE36} %{SOURCE37} %{SOURCE38} %{SOURCE39} %{SOURCE40} %{SOURCE41} %{SOURCE42} %{SOURCE43} %{SOURCE44} %{SOURCE45} %{SOURCE46} %{SOURCE47} %{SOURCE48} %{SOURCE49} %{SOURCE50} %{SOURCE51} %{SOURCE52} %{SOURCE53} %{SOURCE54}
%patch -P 10 -p 0

%build
# PO handling [3/3]: Create the LINGUAS file.
cd po
ls -1 *.po | sed 's/\.po$//' > LINGUAS
cd ..

# As we don't have a full git clone (where 'git describe' would work to
# determine the version, derive the version from the directory name.
v_="${PWD##*/hello-v}"
echo "$v_" > .tarball-version

# After all, here come the first regular step: gnulibs' bootstrap,
# but as we don't have network on OBS, suppress the gnulib syncing,
# and the download of the PO files.
./bootstrap --no-bootstrap-sync --no-git --gnulib-srcdir=gnulib --skip-po

# Intermediate step: build a distribution tarball.
mkdir build-dist
cd build-dist
../configure --quiet --prefix=$PWD/inst
make all dist-xz

# Final step: use the above distribution tarball for the well-known
# "configure && make".
cd ..
mkdir build
cd build
tar -xf ../build-dist/%{name}-$v_.tar.xz
cd %{name}-$v_
%configure

make %{?_smp_mflags}

%check
v_="$( cat .tarball-version )"
cd build/%{name}-$v_
make check \
  || { grep . */test-suite.log; exit 1; }

%install
v_="$( cat .tarball-version )"
cd build/%{name}-$v_
make DESTDIR=%{buildroot} install

%find_lang %{name}
cp -lv %{name}.lang ../..
%if 0%{?suse_version} < 1550
mkdir -p %{buildroot}/bin
ln -sf %{_bindir}/hello %{buildroot}/bin
%endif

%post
%install_info --info-dir=%{_infodir} %{_infodir}/hello.info.gz

%preun
%install_info_delete --info-dir=%{_infodir} %{_infodir}/hello.info.gz

%files
%defattr(-,root,root,-)
%license COPYING
%doc AUTHORS NEWS README THANKS TODO
%if 0%{?suse_version} < 1550
/bin/hello
%endif
%{_bindir}/hello
%doc %{_infodir}/hello.info*.gz
%doc %{_mandir}/man1/hello.1.gz

%files lang -f %{name}.lang
%defattr(-,root,root,-)

%changelog
openSUSE Build Service is sponsored by