MAINTENANCE: revisited RPM creation
diff --git a/Makefile.am b/Makefile.am
index 416a7f7..d3a643a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,6 +2,8 @@
 
 
 SUBDIRS=src
+DIST_SUBDIRS=src conf.d
+
 if MANUAL_CONFD
 SUBDIRS+=conf.d
 endif
@@ -19,7 +21,6 @@
 	rm -rf "$(RPMDIR)/SOURCES/$(RPMFILENAME)"
 	mkdir -p $(RPMDIR)/BUILD/ $(RPMDIR)/SRPMS/ $(RPMDIR)/RPMS/ $(RPMDIR)/SOURCES
 	make ${AM_MAKEFLAGS} distdir='$(RPMDIR)/SOURCES/$(RPMFILENAME)' distdir
-	cp apache/src/mod_netconf.conf "$(RPMDIR)/SOURCES/$(RPMFILENAME)"
 	find "$(RPMDIR)" -name '*.back' -exec rm -f {} \;
 	( cd "$(RPMDIR)/SOURCES/"; tar -z -c -f $(RPMFILENAME)-$(RELEASE).tar.gz $(RPMFILENAME); rm -rf $(RPMFILENAME); )
 	$(RPMBUILD) -ba $(PACKAGE_NAME).spec --define "_topdir `pwd`/$(RPMDIR)";
diff --git a/conf.d/Makefile.am b/conf.d/Makefile.am
index 3eb8a1c..2108c1f 100644
--- a/conf.d/Makefile.am
+++ b/conf.d/Makefile.am
@@ -1,2 +1,4 @@
+EXTRA_DIST=mod_netconf.conf
+
 httpdconfd_DATA=mod_netconf.conf
 
diff --git a/configure.ac b/configure.ac
index d8de51a..5e3fd95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,10 +39,16 @@
 AC_SUBST([CHOWN_GROUP])
 
 AC_ARG_VAR(httpdmoduledir, [Installation directory for Apache module, leave unset to use Apache default.])
+if test "x$httpdmoduledir" != x; then
+	httpdmoduledir="${prefix}/${httpdmoduledir}"
+fi
 AC_SUBST(httpdmoduledir)
 
+AM_CONDITIONAL([MANUAL_CONFD], [test "x$httpdconfddir" != x])
 if test "x$httpdconfddir" == x; then
 	httpdconfddir="/etc/httpd/conf.d"
+else
+	httpdconfddir="${prefix}/${httpdconfddir}"
 fi
 AC_ARG_VAR(httpdconfddir, [Directory for Apache configuration files [/etc/httpd/conf.d]])
 AC_SUBST(httpdconfddir)
@@ -55,7 +61,6 @@
 AC_MSG_ERROR([Apxs for Apache module compilation and installation was not found.])
 fi
 
-AM_CONDITIONAL([MANUAL_CONFD], [test -n "$with_apxs" ])
 
 # Check for rpmbuild
 AC_CHECK_PROG(RPMBUILD, [rpmbuild], [rpmbuild], [""])
@@ -115,6 +120,7 @@
 
 AC_CONFIG_FILES([Makefile
                 config.h
+		mod_netconf.spec
                 conf.d/Makefile
 		src/Makefile
 		])
@@ -143,7 +149,6 @@
 echo "  webgui name..........: $webguiname"
 echo "  httpdmoduledir.......: $(test -z "$httpdmoduledir" && echo "Apache default path" || echo "$httpdmoduledir")"
 echo "  httpdconfddir........: $(test -z "$httpdconfddir" && echo "Apache default path" || echo "$httpdconfddir")"
-echo "  run composer install.: $composerinstall"
 echo "Su user for process:...............: $SU_USER"
 echo "Su group for process:..............: $SU_GROUP"
 echo "Chown user for sock file:...............: $CHOWN_USER"
diff --git a/src/mod_netconf.spec.in b/mod_netconf.spec.in
similarity index 66%
rename from src/mod_netconf.spec.in
rename to mod_netconf.spec.in
index b071560..eb03869 100644
--- a/src/mod_netconf.spec.in
+++ b/mod_netconf.spec.in
@@ -1,30 +1,30 @@
-Summary: Netopeer - client web user interface
+Summary: Netopeer-GUI (backend)
 Name: mod_netconf
-Version: %(cut -f1 ./VERSION | tr -d '\n')
+Version: @VERSION@
 Release: @RELEASE@
-URL: http://www.liberouter.org/
-Source: https://www.liberouter.org/repo/SOURCES/%{name}-%{version}-%{release}.tar.gz
+URL: https://github.com/CESNET/mod_netconf
+Source: %{name}-%{version}-%{release}.tar.gz
 Group: Liberouter
 License: BSD
 Vendor: CESNET, z.s.p.o.
 Packager: @USERNAME@ <@USERMAIL@>
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
 
-BuildRequires: @BUILDREQS@
-Requires: @REQS@
+BuildRequires: apr apr-util libxml2-devel json-c-devel libwebsockets-devel libnetconf-devel
+Requires: json-c libwebsockets libnetconf httpd libxml2
 
 %description
-Back-end for web user interface of Netopeer client.
+Backend for Netopeer-GUI, available at https://github.com/CESNET/Netopeer-GUI
 
 %prep
 %setup
 
 %build
-%configure @LIBNETCONF_WITH@;
+%configure --prefix="$RPM_BUILD_ROOT" httpdmoduledir="/usr/lib64/httpd/modules" httpdconfddir="/etc/httpd/conf.d"
 make
 
 %install
-make DESTDIR=$RPM_BUILD_ROOT RUN="RPM" install
+make install
 
 %post
 #add device module to configuration only when installing, not on update or reinstall.
diff --git a/src/mod_netconf.conf b/src/mod_netconf.conf
deleted file mode 100644
index c712e03..0000000
--- a/src/mod_netconf.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-# This loads mod_netconf
-
-LoadModule netconf_module modules/mod_netconf.so