(This all needs rechecking)

Adding simple component

Index: subversion/svn_hello_world/svn_hello_world_main.c
===================================================================
--- subversion/svn_hello_world/svn_hello_world_main.c   (revision 0)
+++ subversion/svn_hello_world/svn_hello_world_main.c   (revision 0)
@@ -0,0 +1,8 @@
+#include "svn_hello_world.h"
+
+int
+main(int argc, char ** argv)
+{
+  svn_hello_world();
+  return 0;
+}
Index: subversion/svn_hello_world/svn_hello_world.h
===================================================================
--- subversion/svn_hello_world/svn_hello_world.h        (revision 0)
+++ subversion/svn_hello_world/svn_hello_world.h        (revision 0)
@@ -0,0 +1,6 @@
+#ifndef _SVN_HELLO_WORLD_
+#define _SVN_HELLO_WORLD_ 1
+
+void svn_hello_world(void);
+
+#endif
Index: subversion/svn_hello_world/svn_hello_world.c
===================================================================
--- subversion/svn_hello_world/svn_hello_world.c        (revision 0)
+++ subversion/svn_hello_world/svn_hello_world.c        (revision 0)
@@ -0,0 +1,21 @@
+#include <stdio.h>
+#include <string.h>
+#include "svn_pools.h"
+#include "svn_string.h"
+
+void svn_hello_world()
+{
+  const char * hello = "hello, world\n";
+  apr_pool_t * pool;
+
+  /* Token call into both svn and apr apis, to show that we have
+   successfully linked and compiled against the api */
+   pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));
+
+   printf("%s", hello);
+
+   return;
+}
Index: build.conf
===================================================================
--- build.conf  (revision 1441170)
+++ build.conf  (working copy)
@@ -109,6 +108,14 @@ swig-checkout-files = common.swg swigrun.swg runti
 #    external-project - visual studio project to depend on
 #

+
+[svn_hello_world]
+description = Hello World component
+type = exe
+path = subversion/svn_hello_world
+libs = libsvn_subr aprutil apr
+install = bin
+
 # The subversion command-line client
 [svn]
 description = Subversion Client

Adding component as lib

Note: this may be too trivial and be better described in a short paragraph.

Index: build.conf
===================================================================
--- build.conf  (revision 1441170)
+++ build.conf  (working copy)
@@ -109,6 +108,14 @@ swig-checkout-files = common.swg swigrun.swg runti
 #    external-project - visual studio project to depend on
 #

+
+[libsvn_hello_world]
+description = Hello World component
+type = lib
+path = subversion/libsvn_hello_world
+libs = libsvn_subr aprutil apr
+install = lib
+
 # The subversion command-line client
 [svn]
 description = Subversion Client
Index: subversion/libsvn_hello_world/libsvn_hello_world.c
===================================================================
--- subversion/libsvn_hello_world/libsvn_hello_world.c  (revision 0)
+++ subversion/libsvn_hello_world/libsvn_hello_world.c  (revision 0)
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <string.h>
+#include "svn_pools.h"
+#include "svn_string.h"
+
+void libsvn_hello_world()
+{
+  const char * hello = "hello, world\n";
+  apr_pool_t * pool;
+
+  /* Token call into both svn and apr apis, to show that we have
+   successfully linked and compiled against the api */
+   pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));
+
+   printf("%s", hello);
+
+   return;
+}
Index: subversion/libsvn_hello_world/libsvn_hello_world_main.c
===================================================================
--- subversion/libsvn_hello_world/libsvn_hello_world_main.c     (revision 0)
+++ subversion/libsvn_hello_world/libsvn_hello_world_main.c     (revision 0)
@@ -0,0 +1,8 @@
+#include "libsvn_hello_world.h"
+
+int
+main(int argc, char ** argv)
+{
+  libsvn_hello_world();
+  return 0;
+}
Index: subversion/libsvn_hello_world/libsvn_hello_world.h
===================================================================
--- subversion/libsvn_hello_world/libsvn_hello_world.h  (revision 0)
+++ subversion/libsvn_hello_world/libsvn_hello_world.h  (revision 0)
@@ -0,0 +1,6 @@
+#ifndef _SVN_HELLO_WORLD_
+#define _SVN_HELLO_WORLD_ 1
+
+void libsvn_hello_world(void);
+
+#endif

Adding 3rd party component: Gtest example

Index: configure.ac
===================================================================
--- configure.ac        (revision 1442814)
+++ configure.ac        (working copy)
@@ -633,7 +633,23 @@ fi
 AC_SUBST(SVN_GNOME_KEYRING_INCLUDES)
 AC_SUBST(SVN_GNOME_KEYRING_LIBS)

+dnl gtest -----------------
+AC_ARG_ENABLE([gtest],
+  [AS_HELP_STRING([--enable-gtest],
+                  [Enable tests using the Google C++ Testing Framework.
+                  ])],
+  enable_gtest=yes,
+  [])

+if test "$enable_gtest" = "yes"; then
+  AC_MSG_RESULT([yes])
+  AC_DEFINE([HAVE_GTEST], [1],
+            [Is gtest enabled?])
+else
+  AC_MSG_RESULT([no])
+fi
+AC_SUBST([HAVE_GTEST])
+
 dnl Ev2 experimental features ----------------------
 dnl Note: The Ev2 implementations will be built unconditionally, but by
 dnl providing this flag, users can choose to use the currently-shimmed Ev2
@@ -839,6 +855,12 @@ if test "$svn_lib_kwallet" = "yes"; then
   INSTALL_STATIC_RULES="$INSTALL_STATIC_RULES install-kwallet-lib"
 fi

+if test "$enable_gtest" = "yes"; then
+  BUILD_RULES="$BUILD_RULES libgtest"
+  INSTALL_RULES="`echo $INSTALL_RULES | $SED 's/install-lib/install-lib install-gtest/'`"
+  INSTALL_STATIC_RULES="$INSTALL_STATIC_RULES install-gtest"
+fi
+
 if test "$found_gnome_keyring" = "yes"; then
   BUILD_RULES="$BUILD_RULES gnome-keyring-lib"
   INSTALL_RULES="`echo $INSTALL_RULES | $SED 's/install-lib/install-lib install-gnome-keyring-lib/'`"
Index: gen-make.py
===================================================================
--- gen-make.py (revision 1442814)
+++ gen-make.py (working copy)
@@ -213,6 +213,8 @@ def _usage_exit(err=None):
   print("")
   print("  --with-apr_memcache=DIR")
   print("           the apr_memcache sources are in DIR")
+  print("  --with-gtest")
+  print("           enable Gtest")
   sys.exit(1)


@@ -261,7 +263,7 @@ if __name__ == '__main__':
                             'disable-shared',
                             'installed-libs=',
                             'vsnet-version=',
-
+                            'with-gtest',
                             # Keep distributions that help by adding a path
                             # working. On unix this would be filtered by
                             # configure, but on Windows gen-make.py is used
Index: get-deps.sh
===================================================================
--- get-deps.sh (revision 1442814)
+++ get-deps.sh (working copy)
@@ -115,7 +115,11 @@ get_gtest() {

     unzip -q $TEMPDIR/$GTEST.zip

-    mv $GTEST gtest
+    mv $GTEST libgtest
+    echo "Gtest has been installed, please note:"
+    echo "autogen.sh will issue spurious header warnings."
+    echo "./configure --enable-gtest will issue repeated spurious warnings that"
+    echo "the option --enable-gtest is not recognsed."
 }

 # main()
Index: Makefile.in
===================================================================
--- Makefile.in (revision 1442814)
+++ Makefile.in (working copy)
@@ -135,6 +135,8 @@ APACHE_INCLUDES = @APACHE_INCLUDES@
 APACHE_LIBEXECDIR = $(DESTDIR)@APACHE_LIBEXECDIR@
 APACHE_LDFLAGS = @APACHE_LDFLAGS@

+GTEST_INCLUDES = -Ilibgtest -Ilibgtest/include/ -Ilibgtest/include/gtest/internal -Ilibgtest/include/gtest
+
 SWIG = @SWIG@
 SWIG_PY_INCLUDES = @SWIG_PY_INCLUDES@ -I$(SWIG_SRC_DIR)/python/libsvn_swig_py
 SWIG_PY_COMPILE = @SWIG_PY_COMPILE@
@@ -183,9 +185,10 @@ SWIG_LDFLAGS = @SWIG_LDFLAGS@ $(EXTRA_SWIG_LDFLAGS

 COMPILE = $(CC) $(CMODEFLAGS) $(CPPFLAGS) $(CMAINTAINERFLAGS) $(CFLAGS) $(INCLUDES)
 COMPILE_CXX = $(CXX) $(CXXMODEFLAGS) $(CPPFLAGS) $(CXXMAINTAINERFLAGS) $(CXXFLAGS) $(INCLUDES)
+COMPILE_GTEST_CXX = $(COMPILE_CXX) $(GTEST_INCLUDES) -o $@ -c
 LT_COMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) $(LT_CFLAGS)
 LT_COMPILE_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=compile $(COMPILE_CXX) $(LT_CFLAGS)
-
+LT_COMPILE_GTEST_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=compile $(COMPILE_CXX) $(LT_FLAGS) $(GTEST_INCLUDES) -o $@ -c
 # Execute a command that loads libraries from the build dir
 LT_EXECUTE = $(LIBTOOL) $(LTFLAGS) --mode=execute `for f in $(abs_builddir)/subversion/*/*.la; do echo -dlopen $$f; done`

@@ -209,6 +212,8 @@ LINK = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(L
 LINK_LIB = $(LINK) $(LT_SO_VERSION)
 LINK_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=link $(CXX) $(LT_LDFLAGS) $(CXXFLAGS) $(LDFLAGS) -rpath $(libdir)
 LINK_CXX_LIB = $(LINK_CXX) $(LT_SO_VERSION)
+## LINK_GTEST_CXX = ar -rv libgtest.a src/gtest-all.lo
+LINK_GTEST_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=link $(CXX) $(LT_LDFLAGS) $(CXXFLAGS) $(LDFLAGS) -rpath $(libdir)

 # special link rule for mod_dav_svn
 LINK_APACHE_MOD = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LT_LDFLAGS) $(CFLAGS) $(LDFLAGS) -rpath $(APACHE_LIBEXECDIR) -avoid-version -module $(APACHE_LDFLAGS)
Index: build.conf
===================================================================
--- build.conf  (revision 1442814)
+++ build.conf  (working copy)
 # ----------------------------------------------------------------------------
 #
 # TARGETS FOR I18N SUPPORT
@@ -652,8 +652,26 @@ install = tests
 compile-cmd = $(COMPILE_CXXHL_CXX)
 link-cmd = $(LINK_CXX)

+
 # ----------------------------------------------------------------------------
 #
+# Gtest targets
+#
+
+# renamed from gtest to libgtest because libtool couldn't output
+# a library that didn't have the prefix 'lib'
+[libgtest]
+description = Gtest Test Suite
+type = lib
+path = libgtest
+headers = include/gtest
+sources = src/gtest-all.cc
+install = libgtest-install
+compile-cmd = $(LT_COMPILE_GTEST_CXX)
+link-cmd = $(LINK_CXX)
+
+# ----------------------------------------------------------------------------
+#
 # TESTING TARGETS
 #

Build System Walkthrough Patches (last edited 2013-02-09 23:21:59 by GabrielaGibson)