[Cogl] [PATCH] Build and install cogl-path as a shared library

Robert Bragg robert at sixbynine.org
Thu Nov 28 09:01:46 PST 2013


From: Robert Bragg <robert at linux.intel.com>

Since we now have more time to ensure that Clutter is updated to check
for the now separate cogl-path package as part of its build
configuration we are now making the package split, in line with Cogl
master.
---
 Makefile.am               |  7 ++-----
 cogl-path/Makefile.am     | 20 ++++++++++++++++++--
 cogl-path/cogl-path.h     |  4 ++++
 cogl-path/cogl-path.pc.in | 13 +++++++++++++
 cogl/Makefile.am          | 11 +----------
 cogl/cogl-clip-state.c    |  1 -
 cogl/cogl.h               |  9 ++++++++-
 configure.ac              |  1 +
 8 files changed, 47 insertions(+), 19 deletions(-)
 create mode 100644 cogl-path/cogl-path.pc.in

diff --git a/Makefile.am b/Makefile.am
index e24041f..a0c0c76 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,14 +1,11 @@
 SUBDIRS = deps test-fixtures
 
-# Until we can bump the cogl soname cogl-path is built as
-# a noinst_LTLIBRARY and linked into libcogl.so so it needs
-# to be built before cogl...
+SUBDIRS += cogl
+
 if BUILD_COGL_PATH
 SUBDIRS += cogl-path
 endif
 
-SUBDIRS += cogl
-
 if BUILD_COGL_PANGO
 SUBDIRS += cogl-pango
 endif
diff --git a/cogl-path/Makefile.am b/cogl-path/Makefile.am
index 8212a50..197fd89 100644
--- a/cogl-path/Makefile.am
+++ b/cogl-path/Makefile.am
@@ -70,11 +70,19 @@ glib_enum_headers = $(source_1_x_h)
 include $(top_srcdir)/build/autotools/Makefile.am.enums
 endif
 
-noinst_LTLIBRARIES = libcogl-path.la
+lib_LTLIBRARIES = libcogl-path.la
 
 libcogl_path_la_SOURCES = $(source_c) $(source_h)
 nodist_libcogl_path_la_SOURCES = $(BUILT_SOURCES)
-libcogl_path_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_GST_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS)
+libcogl_path_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS)
+libcogl_path_la_LIBADD = $(top_builddir)/cogl/libcogl.la
+libcogl_path_la_LIBADD += $(COGL_DEP_LIBS) $(COGL_EXTRA_LDFLAGS)
+libcogl_path_la_LDFLAGS = \
+	-export-dynamic \
+	-export-symbols-regex "^(cogl|cogl2)_(framebuffer|path|is)_.*" \
+	-no-undefined \
+	-version-info @COGL_LT_CURRENT@:@COGL_LT_REVISION@:@COGL_LT_AGE@ \
+	-rpath $(libdir)
 
 AM_CPPFLAGS = \
 	-DCOGL_COMPILATION		\
@@ -92,6 +100,14 @@ if USE_GLIB
 nodist_cogl_pathheaders_HEADERS = cogl-path-enum-types.h
 endif
 
+pc_files = cogl-path.pc
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = $(pc_files)
+
+EXTRA_DIST += cogl-path.pc.in
+DISTCLEANFILES += $(pc_files)
+
 dist-hook:	\
 	$(top_builddir)/build/win32/vs9/cogl-path.vcproj	\
 	$(top_builddir)/build/win32/vs10/cogl-path.vcxproj	\
diff --git a/cogl-path/cogl-path.h b/cogl-path/cogl-path.h
index 2e76080..3bc834f 100644
--- a/cogl-path/cogl-path.h
+++ b/cogl-path/cogl-path.h
@@ -44,7 +44,11 @@
  * rather then in the absolute coordinates.
  */
 
+#include <cogl/cogl-defines.h>
+
+#ifdef COGL_HAS_GTYPE_SUPPORT
 #include <cogl-path/cogl-path-enum-types.h>
+#endif
 
 #include <cogl-path/cogl-path-types.h>
 
diff --git a/cogl-path/cogl-path.pc.in b/cogl-path/cogl-path.pc.in
new file mode 100644
index 0000000..d8b3beb
--- /dev/null
+++ b/cogl-path/cogl-path.pc.in
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+apiversion=@COGL_API_VERSION@
+requires=@COGL_PKG_REQUIRES@
+
+Name: Cogl
+Description: A 2D path drawing library for Cogl
+Version: @COGL_VERSION@
+Libs: -L${libdir} -lcogl-path
+Cflags: -I${includedir}/cogl
+Requires: ${requires}
diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index 90c0c2e..bc2f8d1 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -534,9 +534,6 @@ endif
 if UNIT_TESTS
 libcogl_la_LIBADD += $(top_builddir)/test-fixtures/libtest-fixtures.la
 endif
-if BUILD_COGL_PATH
-libcogl_la_LIBADD += $(top_builddir)/cogl-path/libcogl-path.la
-endif
 # XXX: The aim is to eventually get rid of all private API exports
 # for cogl-pango.
 libcogl_la_LDFLAGS = \
@@ -667,13 +664,7 @@ if UNIT_TESTS
 Cogl_1_0_gir_LIBS += $(top_builddir)/test-fixtures/libtest-fixtures.la
 endif
 Cogl_1_0_gir_FILES = $(cogl_1_public_h) cogl-enum-types.h
-if BUILD_COGL_PATH
-Cogl_1_0_gir_FILES += \
-	$(top_builddir)/cogl-path/cogl-path-enum-types.h \
-	$(top_srcdir)/cogl-path/cogl-path-types.h \
-	$(top_srcdir)/cogl-path/cogl1-path-functions.h
-endif
-Cogl_1_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) -UCOGL_ENABLE_EXPERIMENTAL_API -UCOGL_ENABLE_EXPERIMENTAL_2_0_API -UCOGL_COMPILATION -D__COGL_H_INSIDE__ -D__COGL_XLIB_H_INSIDE__
+Cogl_1_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) -UCOGL_ENABLE_EXPERIMENTAL_API -UCOGL_ENABLE_EXPERIMENTAL_2_0_API -UCOGL_COMPILATION -D__COGL_H_INSIDE__ -D__COGL_XLIB_H_INSIDE__ -DCOGL_GIR_SCANNING
 Cogl_1_0_gir_INCLUDES = GL-1.0 GObject-2.0
 Cogl_1_0_gir_EXPORT_PACKAGES = cogl-1.0
 Cogl_1_0_gir_SCANNERFLAGS = --warn-all --c-include='cogl/cogl.h'
diff --git a/cogl/cogl-clip-state.c b/cogl/cogl-clip-state.c
index 4b70f3f..500b0e1 100644
--- a/cogl/cogl-clip-state.c
+++ b/cogl/cogl-clip-state.c
@@ -39,7 +39,6 @@
 #include "cogl-matrix-private.h"
 #include "cogl-clip-state.h"
 #include "cogl1-context.h"
-#include "cogl-path/cogl-path.h"
 
 void
 cogl_clip_push_window_rectangle (int x_offset,
diff --git a/cogl/cogl.h b/cogl/cogl.h
index 940b7dd..5a944cf 100644
--- a/cogl/cogl.h
+++ b/cogl/cogl.h
@@ -152,8 +152,15 @@
  *
  * The cogl_path_ api used to be part of the core Cogl api so for
  * compatability we include cogl-path.h via cogl.h
+ *
+ * Note: we have to make sure not to include cogl-path.h while
+ * building core cogl or generating the Cogl .gir data because
+ * cogl-path now gets built after cogl and some cogl-path headers are
+ * only generated at build time...
  */
-#if defined (COGL_HAS_COGL_PATH_SUPPORT)
+#if defined (COGL_HAS_COGL_PATH_SUPPORT) && \
+  !defined (COGL_COMPILATION) && \
+  !defined (COGL_GIR_SCANNING)
 #include <cogl-path/cogl-path.h>
 #endif
 
diff --git a/configure.ac b/configure.ac
index 44b4a27..83df109 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1470,6 +1470,7 @@ cogl-pango/cogl-pango-1.0.pc
 cogl-pango/cogl-pango-2.0-experimental.pc
 cogl-pango/cogl-pango.rc
 cogl-path/Makefile
+cogl-path/cogl-path.pc
 cogl-gst/Makefile
 cogl-gst/cogl-gst.pc
 cogl-gles2/Makefile
-- 
1.8.3.1



More information about the Cogl mailing list