From d7586e47421a7460721bc819b3995ded3ba0438a Mon Sep 17 00:00:00 2001
From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
Date: Tue, 21 Apr 2009 12:15:26 -0400
Subject: [PATCH] [#1212] Update the manpages generation - edit preinst
 maintainer script

---
 debian/manpages                               |  2 +-
 man/Makefile.am                               | 23 +---------
 man/sflphone.pod                              |  1 -
 man/sflphoned.pod                             |  4 +-
 sflphone-client-gnome/Makefile.am             |  2 +-
 sflphone-client-gnome/autogen.sh              | 42 ++++++++++++++-----
 sflphone-client-gnome/configure.ac            |  1 +
 sflphone-client-gnome/debian/manpages         |  5 +--
 sflphone-client-gnome/debian/preinst          |  7 +++-
 sflphone-client-gnome/man/Makefile.am         | 22 ++++++++++
 sflphone-client-gnome/man/README.manpages     | 13 ++++++
 .../man/sflphone-client-gnome.pod             |  6 +--
 sflphone-client-gnome/man/sflphone.pod        |  1 +
 13 files changed, 83 insertions(+), 46 deletions(-)
 delete mode 120000 man/sflphone.pod
 create mode 100644 sflphone-client-gnome/man/Makefile.am
 create mode 100644 sflphone-client-gnome/man/README.manpages
 rename man/sflphone-gtk.pod => sflphone-client-gnome/man/sflphone-client-gnome.pod (80%)
 create mode 120000 sflphone-client-gnome/man/sflphone.pod

diff --git a/debian/manpages b/debian/manpages
index b50f69d3b8..18f8b41d08 100644
--- a/debian/manpages
+++ b/debian/manpages
@@ -1 +1 @@
-debian/sflphone/usr/share/man/man1/sflphoned.1
+debian/sflphone-common/usr/share/man/man1/sflphoned.1
diff --git a/man/Makefile.am b/man/Makefile.am
index eea40c658d..6df5e801d0 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -1,12 +1,9 @@
 SECTION="1"
 
 TEMPLATES=\
-         sflphone-gtk.pod \
          sflphoned.pod
 
-man_MANS = sflphoned.1 \
-			sflphone-gtk.1 \
-			sflphone.1 
+man_MANS = sflphoned.1
 
 POD2MAN=pod2man
 
@@ -19,23 +16,5 @@ SUFFIXES=.pod .1
 .pod.1:
 	$(POD2MAN) --section=$(SECTION) --release=@VERSION@ --center "" $< > $@ 
 
-
-#install-data-local:
-#	@catalogs='$(man_MANS)'; \
- #       for i in $$catalogs; do \
-  #              destdir=$(data_installdir); \
-   #             $(mkinstalldirs) $(data_installdir); \
-    #            $(INSTALL_DATA) $$i $(data_installdir); \
-     #           echo "installing $$i...done"; \
-      #  done    
-
-#uninstall-local:
-#	@catalogs='$(MANPAGES)'; \
- #       for i in $$catalogs; do \
-  #              destdir=$(data_installdir); \
-   #             rm -f $(data_installdir)/$$i; \
-    #            echo "removing $$i "; \
-     #   done
-
 clean-local:
 	rm -rf *.1
diff --git a/man/sflphone.pod b/man/sflphone.pod
deleted file mode 120000
index 1d3bbc4ecf..0000000000
--- a/man/sflphone.pod
+++ /dev/null
@@ -1 +0,0 @@
-sflphone-gtk.pod
\ No newline at end of file
diff --git a/man/sflphoned.pod b/man/sflphoned.pod
index b1b739566a..bd1e40a2db 100644
--- a/man/sflphoned.pod
+++ b/man/sflphoned.pod
@@ -10,7 +10,7 @@ sflphoned --help
 
 SFLphone is meant to be a robust enterprise-class desktop phone. It provides functions like call transfer, call hold, multiple lines, multiple accounts support.
 SFLphone audio layer is build upon a native ALSA interface and and a native PulseAudio interface.
-B<sflphoned> is the core of SFLphone; it communicates with the client side through DBus. SFLphone package comes with a GTK+ client, B<sflphone-gtk>.
+B<sflphoned> is the core of SFLphone; it communicates with the client side through DBus. You need to install a client to use the daemon, for instance GTK+ client, B<sflphone-client-gnome>.
 
 =head1 BUGS
 
@@ -24,7 +24,7 @@ This manual page was written by Emmanuel Milou <emmanuel.milou@savoirfairelinux.
 
 =head1 SEE ALSO
 
-B<sflphone>(1), B<sflphone-gtk>(1)
+B<sflphone>(1), B<sflphone-client-gnome>(1)
 
 =head1 COPYRIGHT
 
diff --git a/sflphone-client-gnome/Makefile.am b/sflphone-client-gnome/Makefile.am
index 5705a85e23..2b5fd37e02 100644
--- a/sflphone-client-gnome/Makefile.am
+++ b/sflphone-client-gnome/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = src pixmaps tests
+SUBDIRS = src pixmaps tests man
 
 ACLOCAL_AMFLAGS = -I m4
 
diff --git a/sflphone-client-gnome/autogen.sh b/sflphone-client-gnome/autogen.sh
index 68c1e41e81..8c68ffb5ea 100755
--- a/sflphone-client-gnome/autogen.sh
+++ b/sflphone-client-gnome/autogen.sh
@@ -1,15 +1,35 @@
-#!/bin/sh
+#!/bin/bash
+
+function autocmd()
+{
+    echo "Running ${1}..."
+        $* || {
+            echo "Error running ${1}"
+                exit 1
+        }
+}
+
+autocmd libtoolize --force --copy
+autocmd aclocal
+autocmd autoheader
+autocmd autoconf -f
+autocmd automake --add-missing --force-missing --copy -Wall
 
-# could be replaced with autoconf -v -f (verbose, force rebuild of ltmain, .in files, etc.)
-if [ ! -d "m4" ]; then
-	mkdir m4
-fi
-
-aclocal -I m4
-libtoolize --force
-autoheader
-autoconf -f
-automake -a
 ./configure $@
 
 
+#!/bin/sh
+
+# could be replaced with autoconf -v -f (verbose, force rebuild of ltmain, .in files, etc.)
+#if [ ! -d "m4" ]; then
+#	mkdir m4
+#fi
+#
+#aclocal -I m4
+#libtoolize --force
+#autoheader
+#autoconf -f
+#automake -a
+#./configure $@
+#
+#
diff --git a/sflphone-client-gnome/configure.ac b/sflphone-client-gnome/configure.ac
index 118a3f6536..eed5be91f2 100644
--- a/sflphone-client-gnome/configure.ac
+++ b/sflphone-client-gnome/configure.ac
@@ -75,6 +75,7 @@ src/contacts/addressbook/Makefile
 pixmaps/Makefile
 sflphone.desktop
 tests/Makefile
+man/Makefile
 ])
 
 
diff --git a/sflphone-client-gnome/debian/manpages b/sflphone-client-gnome/debian/manpages
index 4ef0c7ab2e..1fe5124026 100644
--- a/sflphone-client-gnome/debian/manpages
+++ b/sflphone-client-gnome/debian/manpages
@@ -1,3 +1,2 @@
-debian/sflphone/usr/share/man/man1/sflphone.1
-debian/sflphone/usr/share/man/man1/sflphoned.1
-debian/sflphone/usr/share/man/man1/sflphone-gtk.1
+debian/sflphone-client-gnome/usr/share/man/man1/sflphone.1
+debian/sflphone-client-gnome/usr/share/man/man1/sflphone-gtk.1
diff --git a/sflphone-client-gnome/debian/preinst b/sflphone-client-gnome/debian/preinst
index 6d04e97b45..ab8a90ca57 100644
--- a/sflphone-client-gnome/debian/preinst
+++ b/sflphone-client-gnome/debian/preinst
@@ -5,11 +5,14 @@
 
 set -e
 
-package=sflphone
+package=sflphone-client-gnome
 
 case "$1" in
     install|upgrade)
-        # Clear the old dbus-c++ and iax2 if presents
+        ## Clean up the previous manpage
+        if [ -f /usr/share/man/man1/sflphone-gtk.1 ]; then
+            rm /usr/share/man/man1/sflphone-gtk.1
+        fi
     ;;
 esac
 
diff --git a/sflphone-client-gnome/man/Makefile.am b/sflphone-client-gnome/man/Makefile.am
new file mode 100644
index 0000000000..eed294e21e
--- /dev/null
+++ b/sflphone-client-gnome/man/Makefile.am
@@ -0,0 +1,22 @@
+SECTION="1"
+
+TEMPLATES=\
+         sflphone-client-gnome.pod
+
+man_MANS = \
+			sflphone-client-gnome.1 \
+			sflphone.1 
+
+POD2MAN=pod2man
+
+EXTRA_DIST= $(man_MANS)
+
+all:    $(MANPAGES)
+
+SUFFIXES=.pod .1
+
+.pod.1:
+	$(POD2MAN) --section=$(SECTION) --release=@VERSION@ --center "" $< > $@ 
+
+clean-local:
+	rm -rf *.1
diff --git a/sflphone-client-gnome/man/README.manpages b/sflphone-client-gnome/man/README.manpages
new file mode 100644
index 0000000000..f794a0d257
--- /dev/null
+++ b/sflphone-client-gnome/man/README.manpages
@@ -0,0 +1,13 @@
+CREATING MANPAGES
+
+Procedure:
+
+ - Creating the manual pages under POD format. A template is available in this directory.
+ - Convert the pdo file in a manpage file:
+     pod2man --section=1 --release=$(VERSION) --center "" myapp.pod > myapp.1
+ - You are done! You can read the manpage file with: 
+     groff -man -Tascii myapp.1
+
+
+
+     Ref: https://wiki.ubuntu.com/PackagingGuide/Complete#Man%20Pages
diff --git a/man/sflphone-gtk.pod b/sflphone-client-gnome/man/sflphone-client-gnome.pod
similarity index 80%
rename from man/sflphone-gtk.pod
rename to sflphone-client-gnome/man/sflphone-client-gnome.pod
index 6e08e5fa23..9a445bf30b 100644
--- a/man/sflphone-gtk.pod
+++ b/sflphone-client-gnome/man/sflphone-client-gnome.pod
@@ -1,16 +1,16 @@
 =head1 NAME
 
-sflphone-gtk - SIP and IAX2 compatible voice over IP softphone GTK+ client.
+sflphone-client-gnome - SIP and IAX2 compatible voice over IP softphone GTK+ client.
 
 =head1 SYNOPSIS
 
-sflphone-gtk 
+sflphone-client-gnome 
 
 =head1 DESCRIPTION
 
 SFLphone is meant to be a robust enterprise-class desktop phone. It provides functions like call transfer, call hold, multiple lines, multiple accounts support.
 SFLphone audio layer is build upon a native ALSA interface and and a native PulseAudio interface.
-B<sflphone-gtk> is a GTK+ client for SFLphone; it communicates with the core side through DBus. SFLphone package comes with the core, B<sflphoned>.
+B<sflphone-client-gnome> is a GTK+ client for SFLphone; it communicates with the core side through DBus. SFLphone package comes with the core, B<sflphoned>.
 
 =head1 BUGS
 
diff --git a/sflphone-client-gnome/man/sflphone.pod b/sflphone-client-gnome/man/sflphone.pod
new file mode 120000
index 0000000000..40e241fa81
--- /dev/null
+++ b/sflphone-client-gnome/man/sflphone.pod
@@ -0,0 +1 @@
+sflphone-client-gnome.pod
\ No newline at end of file
-- 
GitLab