initial skeleton

Change-Id: I706aa9e11a646aad71bb310fa552d0bdb5084d4b
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
new file mode 100644
index 0000000..3439c97
--- /dev/null
+++ b/contrib/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = systemd
diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh
new file mode 100755
index 0000000..b88d812
--- /dev/null
+++ b/contrib/jenkins.sh
@@ -0,0 +1,68 @@
+#!/usr/bin/env bash
+# jenkins build helper script for osmo-smlc.  This is how we build on jenkins.osmocom.org
+#
+# environment variables:
+# * WITH_MANUALS: build manual PDFs if set to "1"
+# * PUBLISH: upload manuals after building if set to "1" (ignored without WITH_MANUALS = "1")
+#
+
+if ! [ -x "$(command -v osmo-build-dep.sh)" ]; then
+	echo "Error: We need to have scripts/osmo-deps.sh from http://git.osmocom.org/osmo-ci/ in PATH !"
+	exit 2
+fi
+
+
+set -ex
+
+base="$PWD"
+deps="$base/deps"
+inst="$deps/install"
+export deps inst
+
+osmo-clean-workspace.sh
+
+mkdir "$deps" || true
+
+osmo-build-dep.sh libosmocore "" '--disable-doxygen --enable-gnutls'
+
+verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
+
+export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
+export LD_LIBRARY_PATH="$inst/lib"
+export PATH="$inst/bin:$PATH"
+
+osmo-build-dep.sh libosmo-netif
+osmo-build-dep.sh libosmo-sccp
+
+# Additional configure options and depends
+CONFIG=""
+if [ "$WITH_MANUALS" = "1" ]; then
+	osmo-build-dep.sh osmo-gsm-manuals
+	CONFIG="--enable-manuals"
+fi
+
+set +x
+echo
+echo
+echo
+echo " =============================== osmo-smlc ==============================="
+echo
+set -x
+
+cd "$base"
+autoreconf --install --force
+./configure --enable-sanitize --enable-external-tests --enable-werror $CONFIG
+$MAKE $PARALLEL_MAKE
+LD_LIBRARY_PATH="$inst/lib" $MAKE check \
+  || cat-testlogs.sh
+LD_LIBRARY_PATH="$inst/lib" \
+  DISTCHECK_CONFIGURE_FLAGS="--enable-vty-tests --enable-external-tests --enable-werror $CONFIG" \
+  $MAKE distcheck \
+  || cat-testlogs.sh
+
+if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then
+	make -C "$base/doc/manuals" publish
+fi
+
+$MAKE maintainer-clean
+osmo-clean-workspace.sh
diff --git a/contrib/osmo-smlc.spec.in b/contrib/osmo-smlc.spec.in
new file mode 100644
index 0000000..ed2499e
--- /dev/null
+++ b/contrib/osmo-smlc.spec.in
@@ -0,0 +1,88 @@
+#
+# spec file for package osmo-smlc
+#
+# Copyright (c) 2017, Martin Hauke <mardnh@gmx.de>
+#
+# 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.
+
+## Disable LTO for now since it breaks compilation of the tests
+## https://osmocom.org/issues/4113
+%define _lto_cflags %{nil}
+
+Name:           osmo-smlc
+Version:        @VERSION@
+Release:        0
+Summary:        OsmoSMLC: Osmocom's Location Service Center
+License:        AGPL-3.0-or-later
+Group:          Hardware/Mobile
+URL:            https://osmocom.org/projects/osmo-smlc
+Source:         %{name}-%{version}.tar.xz
+BuildRequires:  automake >= 1.9
+BuildRequires:  libtool >= 2
+BuildRequires:  pkgconfig >= 0.20
+%if 0%{?suse_version}
+BuildRequires:  systemd-rpm-macros
+%endif
+BuildRequires:  pkgconfig(libosmo-netif) >= 0.6.0
+BuildRequires:  pkgconfig(libosmo-sccp) >= 0.10.0
+BuildRequires:  pkgconfig(libosmo-sigtran) >= 0.10.0
+BuildRequires:  pkgconfig(libosmocore) >= 1.2.0
+BuildRequires:  pkgconfig(libosmoctrl) >= 1.2.0
+BuildRequires:  pkgconfig(libosmogsm) >= 1.2.0
+BuildRequires:  pkgconfig(libosmovty) >= 1.2.0
+BuildRequires:  pkgconfig(talloc)
+%{?systemd_requires}
+
+%description
+OsmoBSC: Osmocom's Base Station Controller for 2G circuit-switched mobile networks.
+
+%prep
+%setup -q
+
+%build
+echo "%{version}" >.tarball-version
+autoreconf -fi
+%configure \
+  --docdir=%{_docdir}/%{name} \
+  --with-systemdsystemunitdir=%{_unitdir}
+make %{?_smp_mflags}
+
+%install
+%make_install
+
+%if 0%{?suse_version}
+%preun
+%service_del_preun %{name}.service
+
+%postun
+%service_del_postun %{name}.service
+
+%pre
+%service_add_pre %{name}.service
+
+%post
+%service_add_post %{name}.service
+%endif
+
+%check
+make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +)
+
+%files
+%license COPYING
+%doc AUTHORS README
+%{_bindir}/osmo-smlc
+%dir %{_docdir}/%{name}/examples
+%dir %{_docdir}/%{name}/examples/osmo-smlc
+%{_docdir}/%{name}/examples/osmo-smlc/osmo-smlc.cfg
+%dir %{_sysconfdir}/osmocom
+%config(noreplace) %{_sysconfdir}/osmocom/osmo-smlc.cfg
+%{_unitdir}/%{name}.service
+
+%changelog
diff --git a/contrib/systemd/Makefile.am b/contrib/systemd/Makefile.am
new file mode 100644
index 0000000..32cdc71
--- /dev/null
+++ b/contrib/systemd/Makefile.am
@@ -0,0 +1,6 @@
+EXTRA_DIST = osmo-smlc.service
+
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = \
+  osmo-smlc.service
+endif
diff --git a/contrib/systemd/osmo-smlc.service b/contrib/systemd/osmo-smlc.service
new file mode 100644
index 0000000..23a8f86
--- /dev/null
+++ b/contrib/systemd/osmo-smlc.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Osmocom Serving Mobile Location Center (SMLC)
+
+[Service]
+Type=simple
+Restart=always
+ExecStart=/usr/bin/osmo-smlc -c /etc/osmocom/osmo-smlc.cfg -s
+RestartSec=2
+
+[Install]
+WantedBy=multi-user.target