contrib: integrate RPM spec

Remove OpenSUSE bug report link, set version to @VERSION@, make it build
with CentOS 8 etc.

Related: OS#4550
Change-Id: I38f80d0f867a2bbaa09b5a42cad5028f23a8effa
diff --git a/.gitignore b/.gitignore
index 0965935..3d9c81b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -67,3 +67,5 @@
 doc/manuals/osmomsc-usermanual.xml
 doc/manuals/common
 doc/manuals/build
+
+contrib/osmo-hlr.spec
diff --git a/configure.ac b/configure.ac
index 0e03ff0..4ed6978 100644
--- a/configure.ac
+++ b/configure.ac
@@ -200,6 +200,7 @@
 	contrib/Makefile
 	contrib/systemd/Makefile
 	contrib/dgsm/Makefile
+	contrib/osmo-hlr.spec
 	tests/Makefile
 	tests/auc/Makefile
 	tests/auc/gen_ts_55_205_test_sets/Makefile
diff --git a/contrib/osmo-hlr.spec b/contrib/osmo-hlr.spec.in
similarity index 96%
rename from contrib/osmo-hlr.spec
rename to contrib/osmo-hlr.spec.in
index 3b5a9fa..bd1b278 100644
--- a/contrib/osmo-hlr.spec
+++ b/contrib/osmo-hlr.spec.in
@@ -13,24 +13,22 @@
 # 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/
-#
-
-
 Name:           osmo-hlr
-Version:        1.2.0.48
+Version:        @VERSION@
 Release:        0
 Summary:        Osmocom Home Location Register for GSUP protocol towards OsmoSGSN and OsmoCSCN
 License:        AGPL-3.0-or-later AND GPL-2.0-or-later
 Group:          Productivity/Telephony/Servers
-URL:            https://projects.osmocom.org/projects/osmo-hlr
+URL:            https://osmocom.org/projects/osmo-hlr
 Source:         %{name}-%{version}.tar.xz
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  libtool
 BuildRequires:  pkgconfig >= 0.20
-BuildRequires:  python2
+BuildRequires:  python3
+%if 0%{?suse_version}
 BuildRequires:  systemd-rpm-macros
+%endif
 BuildRequires:  pkgconfig(libosmoabis) >= 0.6.0
 BuildRequires:  pkgconfig(libosmocore) >= 1.2.0
 BuildRequires:  pkgconfig(libosmoctrl) >= 1.2.0
@@ -40,6 +38,7 @@
 BuildRequires:  pkgconfig(talloc) >= 2.0.1
 # only needed for populate_hlr_db.pl
 Requires:       libdbi-drivers-dbd-sqlite3
+%{?systemd_requires}
 
 %description
 The GSUP HLR is a stand-alone HLR (Home Location Register) for SIM
@@ -128,6 +127,7 @@
 %check
 make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +)
 
+%if 0%{?suse_version}
 %preun
 %service_del_preun %{name}.service
 
@@ -139,6 +139,7 @@
 
 %post
 %service_add_post %{name}.service
+%endif
 
 %post   -n libosmo-gsup-client0 -p /sbin/ldconfig
 %postun -n libosmo-gsup-client0 -p /sbin/ldconfig