[Flightgear-devel] Add optional build dependency: libsvn

2008-10-19 Thread Alex Perry
This patch changes terrasync so it links against the subversion
library if you have it installed.  It supports people who build binary
releases for use by non-developers by removing the runtime external
dependency on having command line svn or rsync available.  Since the
patch changes autoconf to detect libsvn,  I'd appreciate it if people
who release binaries could verify that the detection scripting works
for their platform.

Developer warning:  If you do have libsvn developer libraries
installed, terrasync changes its default option from -R to -S to
remove the command line dependency.  However, Martin has not yet
uploaded world scenery into the subversion repository so it won't be
useful to fly against and you may want to specify -R on the command
line in the short term.  Or run both.
? src/ATCDCL/.deps
? src/ATCDCL/Makefile
? src/ATCDCL/Makefile.in
? utils/Modeller/photomodel
? utils/TerraSync/*.h
? utils/TerraSync/terrasyncdir
Index: configure.ac
===
RCS file: /var/cvs/FlightGear-0.9/source/configure.ac,v
retrieving revision 1.138
diff -u -r1.138 configure.ac
--- configure.ac	28 Aug 2008 21:19:38 -	1.138
+++ configure.ac	19 Oct 2008 07:59:14 -
@@ -597,7 +597,27 @@
 echo
 fi
 
-
+dnl Check for Subversion library support
+save_LIBS=$LIBS
+save_CPPFLAGS=$CPPFLAGS
+LIBS=
+CPPFLAGS=-I/usr/include/subversion-1 -I/usr/include/apr-1.0
+AC_CHECK_LIB(svn_client-1, svn_client_checkout3)
+AC_CHECK_HEADERS([svn_client.h])
+if test x$ac_cv_header_svn_client_h != xyes; then
+  echo TerraSync will shell out for command line subversion
+  svn_LIBS=
+  svn_CPPFLAGS=
+else
+  echo TerraSync will use integrated subversion library
+  AC_SEARCH_LIBS(svn_client_checkout, svn_client-1)
+  svn_LIBS=$LIBS
+  svn_CPPFLAGS=$CPPFLAGS
+  AC_SUBST(svn_LIBS)
+  AC_SUBST(svn_CPPFLAGS)
+fi
+LIBS=$save_LIBS
+CPPFLAGS=$save_CPPFLAGS
 
 dnl Checks for header files.
 AC_HEADER_STDC
Index: utils/TerraSync/Makefile.am
===
RCS file: /var/cvs/FlightGear-0.9/source/utils/TerraSync/Makefile.am,v
retrieving revision 1.4
diff -u -r1.4 Makefile.am
--- utils/TerraSync/Makefile.am	12 Oct 2008 09:56:18 -	1.4
+++ utils/TerraSync/Makefile.am	19 Oct 2008 07:59:15 -
@@ -4,4 +4,6 @@
 
 terrasync_SOURCES = terrasync.cxx
 
-terrasync_LDADD = -lplibnet -lplibul -lsgmisc -lsgdebug $(network_LIBS)
+AM_CPPFLAGS = $(svn_CPPFLAGS)
+
+terrasync_LDADD = -lplibnet -lplibul -lsgmisc -lsgdebug $(network_LIBS) $(svn_LIBS)
Index: utils/TerraSync/terrasync.cxx
===
RCS file: /var/cvs/FlightGear-0.9/source/utils/TerraSync/terrasync.cxx,v
retrieving revision 1.14
diff -u -r1.14 terrasync.cxx
--- utils/TerraSync/terrasync.cxx	12 Oct 2008 07:55:09 -	1.14
+++ utils/TerraSync/terrasync.cxx	19 Oct 2008 07:59:16 -
@@ -43,29 +43,186 @@
 #include simgear/bucket/newbucket.hxx
 #include simgear/misc/sg_path.hxx
 
+#ifdef HAVE_SVN_CLIENT_H
+#  ifdef HAVE_LIBSVN_CLIENT_1
+#include svn_auth.h
+#include svn_client.h
+#include svn_cmdline.h
+#include svn_pools.h
+#  else
+#undef HAVE_SVN_CLIENT_H
+#  endif
+#endif
+
 using std::string;
 using std::cout;
 using std::endl;
 
+const char* source_base = NULL;
 const char* svn_base =
   http://terrascenery.googlecode.com/svn/trunk/data/Scenery;;
 const char* rsync_base = scenery.flightgear.org::Scenery;
-const char* source_base = NULL;
 const char* dest_base = terrasyncdir;
-bool use_svn = false;
-
-const char* svn_cmd = svn checkout;
 const char* rsync_cmd = 
 rsync --verbose --archive --delete --perms --owner --group;
 
+#ifdef HAVE_SVN_CLIENT_H
+bool use_svn = true;
+#else
+bool use_svn = false;
+const char* svn_cmd = svn checkout;
+#endif
 
 // display usage
 static void usage( const string prog ) {
 cout  Usage:   endl
   prog   -p port 
-	  [ -R ] [ -s rsync_source ] -d dest  endl
+	  -R [ -s rsync_source ] -d dest  endl
   prog   -p port 
--S   [ -s svn_source ] -d dest  endl;
+  -S [ -s svn_source ] -d dest  endl;
+#ifdef HAVE_SVN_CLIENT_H
+cout  (defaults to the built in subversion)  endl;
+#else
+cout  (defaults to rsync, using external commands)  endl;
+#endif
+}
+
+#ifdef HAVE_SVN_CLIENT_H
+
+// Things we need for doing subversion checkout - often
+apr_pool_t *mysvn_pool = NULL;
+svn_client_ctx_t *mysvn_ctx = NULL;
+svn_opt_revision_t *mysvn_rev = NULL;
+
+static const svn_version_checklist_t mysvn_checklist[] = {
+{ svn_subr,   svn_subr_version },
+{ svn_client, svn_client_version },
+{ svn_wc, svn_wc_version },
+{ svn_ra, svn_ra_version },
+{ svn_delta,  svn_delta_version },
+{ svn_diff,   svn_diff_version },
+{ NULL, NULL }
+};
+
+// Configure our subversion session
+int mysvn_setup(void) {
+// Are we already prepared?
+if (mysvn_pool) return EXIT_SUCCESS;
+// No, so initialize svn 

Re: [Flightgear-devel] Add optional build dependency: libsvn

2008-10-19 Thread Martin Spott
Hi Alex,

Alex Perry wrote:

 [...] However, Martin has not yet
 uploaded world scenery into the subversion repository so it won't be
 useful to fly against [...]

The Terrain upload is already running, but, I suspect, it will take a
few days until it's finished. Nevertheless, it would be nice being able
to distribute 'standalone' binaries for different platforms by then.

Many thanks for pursuing this progress,

Martin.
-- 
 Unix _IS_ user friendly - it's just selective about who its friends are !
--

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Add optional build dependency: libsvn

2008-10-19 Thread James Turner

On 19 Oct 2008, at 09:13, Alex Perry wrote:

 This patch changes terrasync so it links against the subversion
 library if you have it installed.  It supports people who build binary
 releases for use by non-developers by removing the runtime external
 dependency on having command line svn or rsync available.  Since the
 patch changes autoconf to detect libsvn,  I'd appreciate it if people
 who release binaries could verify that the detection scripting works
 for their platform.

Out of curiosity, does installing 'svn' mean I have libsvn installed  
automatically? Or does that depend on how my svn was built?

Anyway, seems like a good change.

James


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Add optional build dependency: libsvn

2008-10-19 Thread Matthew Tippett
The package needed would be libsvn-dev or similar.  This is unlikely
to be installed as part of the installation of svn, however libsvn
(the runtime library) will be.  And the dev package is usually just a
suffix.

Regards... Matthew


On 10/19/08, James Turner [EMAIL PROTECTED] wrote:

 On 19 Oct 2008, at 09:13, Alex Perry wrote:

 This patch changes terrasync so it links against the subversion
 library if you have it installed.  It supports people who build binary
 releases for use by non-developers by removing the runtime external
 dependency on having command line svn or rsync available.  Since the
 patch changes autoconf to detect libsvn,  I'd appreciate it if people
 who release binaries could verify that the detection scripting works
 for their platform.

 Out of curiosity, does installing 'svn' mean I have libsvn installed
 automatically? Or does that depend on how my svn was built?

 Anyway, seems like a good change.

 James


 -
 This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
 Build the coolest Linux based applications with Moblin SDK  win great
 prizes
 Grand prize is a trip for two to an Open Source event anywhere in the world
 http://moblin-contest.org/redirect.php?banner_id=100url=/
 ___
 Flightgear-devel mailing list
 Flightgear-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/flightgear-devel


-- 
Sent from my mobile device

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Add optional build dependency: libsvn

2008-10-19 Thread Frederic Bouvier
Hi Alex,

Alex Perry a écrit :
 This patch changes terrasync so it links against the subversion
 library if you have it installed.  It supports people who build binary
 releases for use by non-developers by removing the runtime external
 dependency on having command line svn or rsync available.  Since the
 patch changes autoconf to detect libsvn,  I'd appreciate it if people
 who release binaries could verify that the detection scripting works
 for their platform.

 Developer warning:  If you do have libsvn developer libraries
 installed, terrasync changes its default option from -R to -S to
 remove the command line dependency.  However, Martin has not yet
 uploaded world scenery into the subversion repository so it won't be
 useful to fly against and you may want to specify -R on the command
 line in the short term.  Or run both.
   

I will commit your patch as soon as I manage to run it correctly under
Windows. It builds but I currently experience a segfault
that I need to investigate.

-Fred

-- 
Frédéric Bouvier
http://my.fotolia.com/frfoto/   Photo gallery
http://fgsd.sourceforge.net/FlightGear Scenery Designer


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel