[phodav] Make it a public library
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [phodav] Make it a public library
- Date: Tue, 1 Apr 2014 14:35:18 +0000 (UTC)
commit 6459334ffb0ff8e05cf991979cf9fe60150cfa36
Author: Marc-André Lureau <marcandre lureau gmail com>
Date: Tue Apr 1 15:22:54 2014 +0200
Make it a public library
Makefile.am | 40 ++++++++++++++++++++-------
autogen.sh | 2 +-
configure.ac | 10 +++++++
doc/Makefile.am | 2 +
doc/reference/Makefile.am | 39 ++++++++++++++++++++++++++
doc/reference/phodav-docs.sgml.in | 38 +++++++++++++++++++++++++
doc/reference/phodav-sections.txt | 19 +++++++++++++
libphodav-1.0.pc.in | 12 ++++++++
libphodav.syms | 11 +++++++
libphodav/phodav-server.c | 55 +++++++++++++++++++++++++++++++++++--
libphodav/phodav-server.h | 12 ++++----
libphodav/phodav.h | 2 +-
12 files changed, 221 insertions(+), 21 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 6c6c594..9142a96 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,14 +1,15 @@
NULL =
EXTRA_DIST =
BUILT_SOURCES =
+CONFIG_STATUS_DEPENDENCIES =
ACLOCAL_AMFLAGS = -I m4
makeflags_ = $(makeflags_$(AM_DEFAULT_VERBOSITY))
makeflags_0 = --no-print-directory -s
makeflags_1 =
AM_MAKEFLAGS = $(makeflags_$(V))
-SUBDIRS = po spice libphodav doc
-noinst_LTLIBRARIES = libphodav.la
+SUBDIRS = . po spice libphodav doc
+lib_LTLIBRARIES = libphodav-1.0.la
bin_PROGRAMS = chezdav
sbin_PROGRAMS = spice-webdavd
@@ -18,24 +19,40 @@ AM_CPPFLAGS = \
$(WARN_CFLAGS) \
$(NULL)
-libphodav_la_SOURCES = \
+libphodav_includedir = $(includedir)/libphodav-1.0/libphodav
+libphodav_include_HEADERS = \
+ libphodav/phodav-server.h \
+ libphodav/phodav.h \
+ $(NULL)
+
+libphodav_1_0_la_SOURCES = \
libphodav/guuid.c \
libphodav/guuid.h \
libphodav/phodav-server.c \
- libphodav/phodav-server.h \
- libphodav/phodav.h \
$(NULL)
-libphodav_la_CFLAGS = \
+libphodav_1_0_la_CFLAGS = \
$(GIO_CFLAGS) \
$(SOUP_CFLAGS) \
$(NULL)
-libphodav_la_LIBADD = \
+libphodav_1_0_la_LIBADD = \
$(GIO_LIBS) \
$(SOUP_LIBS) \
$(NULL)
+libphodav_1_0_la_LDFLAGS = \
+ -version-info 0:0:0 \
+ -Wl,--version-script=${srcdir}/libphodav.syms \
+ -no-undefined \
+ $(NULL)
+
+libphodav_1_0_la_DEPENDENCIES = libphodav.syms
+EXTRA_DIST += libphodav.syms
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libphodav-1.0.pc
+
spice_webdavd_SOURCES = spice/spice-webdavd.c
spice_webdavd_CFLAGS = \
@@ -56,7 +73,7 @@ deps.txt:
MANUFACTURER = The Spice Project
EXTRA_DIST += chezdav.wxs.in
-CONFIG_STATUS_DEPENDENCIES = chezdav.wxs.in
+CONFIG_STATUS_DEPENDENCIES += chezdav.wxs.in
chezdav-$(WIXL_ARCH)-$(VERSION)$(BUILDID).msi: chezdav.wxs deps.txt all
$(AM_V_GEN)DESTDIR=`mktemp -d`&& \
@@ -68,7 +85,7 @@ chezdav-$(WIXL_ARCH)-$(VERSION)$(BUILDID).msi: chezdav.wxs deps.txt all
MSI = chezdav-$(WIXL_ARCH)-$(VERSION)$(BUILDID).msi
EXTRA_DIST += spice-webdavd.wxs.in
-CONFIG_STATUS_DEPENDENCIES = spice-webdavd.wxs.in
+CONFIG_STATUS_DEPENDENCIES += spice-webdavd.wxs.in
spice-webdavd-$(WIXL_ARCH)-$(VERSION)$(BUILDID).msi: spice-webdavd.wxs deps.txt all
$(AM_V_GEN)DESTDIR=`mktemp -d`&& \
@@ -95,7 +112,7 @@ chezdav_CFLAGS = \
$(NULL)
chezdav_LDADD = \
- libphodav.la \
+ libphodav-1.0.la \
$(GLIB_LIBS) \
$(GIO_LIBS) \
$(AVAHI_LIBS) \
@@ -127,7 +144,10 @@ EXTRA_DIST += \
phodav.doap \
$(NULL)
+AM_DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
+
MAINTAINERCLEANFILES = \
+ $(srcdir)/gtk-doc.make \
$(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL) \
$(GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN) \
$(GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL)
diff --git a/autogen.sh b/autogen.sh
index e1cbf1c..dfc99e2 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -7,4 +7,4 @@ test -z "$srcdir" && srcdir=.
mkdir -p $srcdir/m4
-. gnome-autogen.sh "$@"
+. gnome-autogen.sh --enable-gtk-doc "$@"
diff --git a/configure.ac b/configure.ac
index 438ecb8..f5da918 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,6 +7,12 @@ AC_CONFIG_AUX_DIR([build-aux])
AC_CANONICAL_HOST
AC_PROG_CC
+AC_CHECK_PROG([STOW], [stow], [yes], [no])
+AS_IF([test "x$STOW" = "xyes" && test -d /usr/local/stow], [
+ AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}
***])
+ ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}"
+])
+
AC_MSG_CHECKING([for native Win32])
case "$host_os" in
*mingw*|*cygwin*)
@@ -25,6 +31,7 @@ AM_INIT_AUTOMAKE([foreign -Wall -Wno-portability subdir-objects dist-xz])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AM_MAINTAINER_MODE([enable])
LT_INIT([win32-dll disable-fast-install])
+GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
gl_MANYWARN_ALL_GCC([warnings])
nw=
@@ -153,7 +160,10 @@ AC_SUBST(WIXL_ARCH)
AC_CONFIG_FILES([
Makefile
chezdav.wxs
+libphodav-1.0.pc
doc/Makefile
+doc/reference/Makefile
+doc/reference/phodav-docs.sgml
libphodav/Makefile
po/Makefile.in
spice-webdavd.wxs
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 2cb98cc..2e4ab91 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = reference
+
MAN1_TXT = chezdav.txt
if HAVE_DOCTOOLS
diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
new file mode 100644
index 0000000..c1b62b6
--- /dev/null
+++ b/doc/reference/Makefile.am
@@ -0,0 +1,39 @@
+NULL =
+AUTOMAKE_OPTIONS = 1.6
+
+DOC_MODULE = phodav
+DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.sgml
+DOC_SOURCE_DIR = $(top_srcdir)/libphodav
+
+SCANGOBJ_OPTIONS =
+SCAN_OPTIONS = --rebuild-types
+MKDB_OPTIONS = --xml-mode --output-format=xml
+MKTMPL_OPTIONS =
+MKHTML_OPTIONS =
+FIXXREF_OPTIONS =
+
+# Used for dependencies. The docs will be rebuilt if any of these change.
+HFILE_GLOB = $(top_srcdir)/libphodav/phodav-*.h
+CFILE_GLOB = $(top_srcdir)/libphodav/phodav-*.c
+EXTRA_HFILES =
+IGNORE_HFILES = \
+ guuid.h \
+ glib-compat.h \
+ $(NULL)
+
+GTKDOC_CFLAGS = $(SOUP_CFLAGS)
+GTKDOC_LIBS = $(top_builddir)/libphodav-1.0.la
+
+include $(top_srcdir)/gtk-doc.make
+
+EXTRA_DIST += phodav-docs.sgml.in
+DISTCLEANFILES = $(DOC_MODULE).types
+
+if ENABLE_GTK_DOC
+TESTS_ENVIRONMENT = cd $(srcdir) && \
+ DOC_MODULE=$(DOC_MODULE) DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \
+ SRCDIR=$(abs_srcdir) BUILDDIR=$(abs_builddir)
+#TESTS = $(GTKDOC_CHECK)
+endif
+
+-include $(top_srcdir)/git.mk
diff --git a/doc/reference/phodav-docs.sgml.in b/doc/reference/phodav-docs.sgml.in
new file mode 100644
index 0000000..85c2609
--- /dev/null
+++ b/doc/reference/phodav-docs.sgml.in
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
+]>
+<book id="index">
+ <bookinfo>
+ <title>PhoDAV Reference Manual</title>
+ <releaseinfo>
+ This document is generated from the version @PACKAGE_STRING
+ <!-- <ulink role="online-location"
+ url="http://fixme/reference/index.html">
+ http://fixme/reference/
+ </ulink>. -->
+ </releaseinfo>
+ </bookinfo>
+
+ <chapter>
+ <title>PhoDAV API</title>
+ <xi:include href="xml/phodav-server.xml"/>
+ </chapter>
+
+ <chapter id="object-tree">
+ <title>Object Hierarchy</title>
+ <xi:include href="xml/tree_index.sgml"/>
+ </chapter>
+ <index id="api-index-full">
+ <title>API Index</title>
+ <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
+ </index>
+ <index id="deprecated-api-index" role="deprecated">
+ <title>Index of deprecated API</title>
+ <xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
+ </index>
+
+ <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
+</book>
diff --git a/doc/reference/phodav-sections.txt b/doc/reference/phodav-sections.txt
new file mode 100644
index 0000000..922192b
--- /dev/null
+++ b/doc/reference/phodav-sections.txt
@@ -0,0 +1,19 @@
+<SECTION>
+<FILE>phodav-server</FILE>
+phodav_server_new
+phodav_server_run
+phodav_server_quit
+phodav_server_get_port
+phodav_server_get_soup_server
+PhodavServer
+PhodavServerClass
+<SUBSECTION Standard>
+PHODAV_IS_SERVER
+PHODAV_IS_SERVER_CLASS
+PHODAV_SERVER
+PHODAV_SERVER_CLASS
+PHODAV_SERVER_GET_CLASS
+PHODAV_TYPE_SERVER
+phodav_server_get_type
+</SECTION>
+
diff --git a/libphodav-1.0.pc.in b/libphodav-1.0.pc.in
new file mode 100644
index 0000000..408aa89
--- /dev/null
+++ b/libphodav-1.0.pc.in
@@ -0,0 +1,12 @@
+prefix= prefix@
+exec_prefix= exec_prefix@
+libdir= libdir@
+includedir= includedir@
+
+Name: PhoDAV
+Description: A WebDAV library based on libsoup
+Requires: libsoup-2.4
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lphodav-1.0
+Cflags: -I${includedir}/libphodav-1.0
+
diff --git a/libphodav.syms b/libphodav.syms
new file mode 100644
index 0000000..a7816d5
--- /dev/null
+++ b/libphodav.syms
@@ -0,0 +1,11 @@
+LIBPHODAV1_0.0 {
+ global:
+ phodav_server_get_port;
+ phodav_server_get_soup_server;
+ phodav_server_get_type;
+ phodav_server_new;
+ phodav_server_quit;
+ phodav_server_run;
+ local:
+ *;
+};
diff --git a/libphodav/phodav-server.c b/libphodav/phodav-server.c
index 4eaceaa..2d350c5 100644
--- a/libphodav/phodav-server.c
+++ b/libphodav/phodav-server.c
@@ -33,6 +33,17 @@
#include "guuid.h"
#include "phodav-server.h"
+/**
+ * SECTION:phodav-server
+ * @title: PhodavServer
+ * @short_description: A WebDAV server
+ * @see_also: #SoupServer
+ * @stability: Stable
+ * @include: libphodav/phodav.h
+ *
+ * PhodavServer implements a simple WebDAV server.
+ */
+
typedef struct _PathHandler PathHandler;
struct _PhodavServer
@@ -414,7 +425,7 @@ phodav_server_class_init (PhodavServerClass *klass)
g_param_spec_uint ("port",
"Port",
"Port",
- 0, G_MAXINT16, 0,
+ 0, G_MAXUINT16, 0,
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
@@ -432,8 +443,8 @@ phodav_server_class_init (PhodavServerClass *klass)
g_object_class_install_property
(gobject_class, PROP_SERVER,
g_param_spec_object ("server",
- "Server",
- "Server",
+ "Soup Server",
+ "Soup Server",
SOUP_TYPE_SERVER,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
@@ -3083,6 +3094,15 @@ server_callback (SoupServer *server, SoupMessage *msg,
}
}
+/**
+ * phodav_server_get_port:
+ * @server: a %PhodavServer
+ *
+ * Gets the TCP port that server is listening on. This is most useful
+ * when you did not request a specific port, with value 0.
+*
+ * Returns: the port @server is listening on.
+ **/
guint
phodav_server_get_port (PhodavServer *self)
{
@@ -3091,6 +3111,14 @@ phodav_server_get_port (PhodavServer *self)
return soup_server_get_port (self->server);
}
+/**
+ * phodav_server_get_soup_server:
+ * @server: a %PhodavServer
+ *
+ * Returns the underlying %SoupServer, if any.
+ *
+ * Returns: the associated %SoupServer or %NULL
+ **/
SoupServer *
phodav_server_get_soup_server (PhodavServer *self)
{
@@ -3113,6 +3141,12 @@ thread_func (gpointer data)
return NULL;
}
+/**
+ * phodav_server_run:
+ * @server: a %PhodavServer
+ *
+ * Run the server in a separate thread.
+ **/
void
phodav_server_run (PhodavServer *self)
{
@@ -3125,6 +3159,12 @@ phodav_server_run (PhodavServer *self)
self->thread = g_thread_new ("phodav-server", thread_func, self);
}
+/**
+ * phodav_server_quit:
+ * @server: a %PhodavServer
+ *
+ * Stops the server from running.
+ **/
void
phodav_server_quit (PhodavServer *self)
{
@@ -3140,6 +3180,15 @@ phodav_server_quit (PhodavServer *self)
g_object_unref (self);
}
+/**
+ * phodav_server_new:
+ * @port: Port to listen on.
+ * @root: (allow-none): Root path.
+ *
+ * Creates a new #PhodavServer.
+ *
+ * Returns: a new #PhodavServer
+ **/
PhodavServer *
phodav_server_new (guint port, const gchar *root)
{
diff --git a/libphodav/phodav-server.h b/libphodav/phodav-server.h
index 6558878..7ea3773 100644
--- a/libphodav/phodav-server.h
+++ b/libphodav/phodav-server.h
@@ -25,10 +25,10 @@ G_BEGIN_DECLS
#define PHODAV_TYPE_SERVER (phodav_server_get_type ())
#define PHODAV_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PHODAV_TYPE_SERVER, PhodavServer))
-#define PHODAV_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PHODAV_TYPE_SERVER,
PhodavServerClass))
+#define PHODAV_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PHODAV_TYPE_SERVER,
PhodavServerClass))
#define PHODAV_IS_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PHODAV_TYPE_SERVER))
#define PHODAV_IS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PHODAV_TYPE_SERVER))
-#define PHODAV_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PHODAV_TYPE_SERVER,
PhodavServerClass))
+#define PHODAV_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PHODAV_TYPE_SERVER,
PhodavServerClass))
typedef struct _PhodavServer PhodavServer;
typedef struct _PhodavServerClass PhodavServerClass;
@@ -36,10 +36,10 @@ typedef struct _PhodavServerClass PhodavServerClass;
GType phodav_server_get_type (void);
PhodavServer * phodav_server_new (guint port, const gchar *root);
-void phodav_server_run (PhodavServer *dav);
-void phodav_server_quit (PhodavServer *dav);
-guint phodav_server_get_port (PhodavServer *dav);
-SoupServer * phodav_server_get_soup_server (PhodavServer *dav);
+void phodav_server_run (PhodavServer *server);
+void phodav_server_quit (PhodavServer *server);
+guint phodav_server_get_port (PhodavServer *server);
+SoupServer * phodav_server_get_soup_server (PhodavServer *server);
G_END_DECLS
diff --git a/libphodav/phodav.h b/libphodav/phodav.h
index cb310e3..9ca95e4 100644
--- a/libphodav/phodav.h
+++ b/libphodav/phodav.h
@@ -18,6 +18,6 @@
#ifndef __PHODAV_H__
#define __PHODAV_H__
-#include "phodav-server.h"
+#include <libphodav/phodav-server.h>
#endif /* __PHODAV_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]