On Fri, Nov 2, 2012 at 10:40 PM, Ivan Zhakov <i...@visualsvn.com> wrote:
> On Fri, Nov 2, 2012 at 9:04 PM, Branko Čibej <br...@wandisco.com> wrote:
>>
>> On 02.11.2012 17:30, Ivan Zhakov wrote:
>> > On Fri, Nov 2, 2012 at 5:12 PM, Branko Čibej <br...@wandisco.com> wrote:
>> >> On 02.11.2012 12:36, Ivan Zhakov wrote:
>> >>> On Wed, Oct 31, 2012 at 2:04 AM, Branko Čibej <br...@wandisco.com> wrote:
>> >>> [..]
>> >>>> The sysinfo bits have static (build-time) info and dynamic (runtime)
>> >>>> info. Presumably the only difference will be noticing when you're
>> >>>> running the program on a different "size" of OS, e.g., running 32-bit
>> >>>> code on a 64-bit OS (hopefully in some compatibility mode).
>> >>>>
>> >>>> For the purpose of user agent strings, the host triplet exposed in the
>> >>>> #define in svn_private_config.h should be more than good enough.
>> >>>>
>> >>> I agree that using autoconf to collect OS type is much better. But I
>> >>> think we should use $target, instead of $host for user-agent to
>> >>> support cross compile scenarios. Also I've checked $target_os for our
>> >>> build bots and their values are:
>> >>> * OpenBSD:  'i386-unknown-openbsd5.0' ($target_os = 'openbsd5.0',
>> >>> $target_vendor='unknown')
>> >>> * Centos: 'x86_64-redhat-linux-gnu' ($target_os='linux-gnu';
>> >>> $target_vendor='redhat')
>> >>> * Ubuntu: ''x86_64-unknown-linux-gnu'' ($target_os=''linux-gnu'';
>> >>> $target_vendor='unknown')
>> >>>
>> >>> I've also googled for different autoconf outputs:
>> >>> * MacOS: 'x86_64-apple-darwin11.2.0'
>> >>> * cygwin: 'i686-pc-cygwin'
>> >>> * mingw: 'i686-pc-mingw32'
>> >>>
>> >>> We can use all $target triplet in user-agent or just $target_os. I
>> >>> have no opinion on this matter. Any thoughts?
>> >> I considered that, but our build scripts very definitely do not support
>> >> cross-compiling. So anyone who tries that and succeeds can easily add
>> >> another line to the already-huge patch that made cross-compiling possible.
>> >>
>> > Well, it seems our scripts actually supports cross compiling :) On
>> > Windows: you can build x86 binaries on x64 platform or vice versa.
>>
>> Yes, but I hardly think that has anything to do with autoconf and
>> config.guess ... :)
>>
> Anyway I'm going to add SVN_BUILD_TARGET to both autoconf and Windows
> build stuff and use it user-string.
>
Here is updated patch:
[[[
Add target platform information to user agent string.

* subversion/libsvn_ra_serf/ra_serf.h
  (USER_AGENT): Add target platform information.
* subversion/libsvn_ra_serf/ra_svn.h
  (SVN_RA_SVN__DEFAULT_USERAGENT): Add target platform information.
* configure.ac
  (SVN_BUILD_TARGET): Define to ${target}.
* subversion/svn_private_config.hw
  (SVN_BUILD_TARGET): Define.
]]]

NOTE: I tested it only on Windows platform.

-- 
Ivan Zhakov
Index: configure.ac
===================================================================
--- configure.ac        (revision 1405031)
+++ configure.ac        (working copy)
@@ -1393,6 +1393,10 @@
 AC_DEFINE_UNQUOTED([SVN_BUILD_HOST], "${host}",
                    [Defined to the config.guess name of the build system])
 
+dnl Provide ${target} for use in compiled code (for user-agent string)
+AC_DEFINE_UNQUOTED([SVN_BUILD_TARGET], "${target}",
+                   [Defined to the config.guess name of the build target])
+
 AC_OUTPUT
 
 # ==== Print final messages to user ==========================================
Index: subversion/libsvn_ra_serf/ra_serf.h
===================================================================
--- subversion/libsvn_ra_serf/ra_serf.h (revision 1405031)
+++ subversion/libsvn_ra_serf/ra_serf.h (working copy)
@@ -56,8 +56,9 @@
 /** Use this to silence compiler warnings about unused parameters. */
 #define UNUSED_CTX(x) ((void)(x))
 
-/** Our User-Agent string. */
-#define USER_AGENT "SVN/" SVN_VER_NUMBER " serf/" \
+    /** Our User-Agent string. */
+#define USER_AGENT "SVN/" SVN_VER_NUMBER " (" SVN_BUILD_TARGET ")" \
+                   " serf/" \
                    APR_STRINGIFY(SERF_MAJOR_VERSION) "." \
                    APR_STRINGIFY(SERF_MINOR_VERSION) "." \
                    APR_STRINGIFY(SERF_PATCH_VERSION)
Index: subversion/libsvn_ra_svn/ra_svn.h
===================================================================
--- subversion/libsvn_ra_svn/ra_svn.h   (revision 1405031)
+++ subversion/libsvn_ra_svn/ra_svn.h   (working copy)
@@ -57,7 +57,8 @@
                                                void *baton);
 
 /* The default "user agent". */
-#define SVN_RA_SVN__DEFAULT_USERAGENT  "SVN/" SVN_VER_NUMBER
+#define SVN_RA_SVN__DEFAULT_USERAGENT  "SVN/" SVN_VER_NUMBER\
+                                       " (" SVN_BUILD_TARGET ")"
 
 /* The size of our per-connection read and write buffers. */
 #define SVN_RA_SVN__PAGE_SIZE 4096
Index: subversion/svn_private_config.hw
===================================================================
--- subversion/svn_private_config.hw    (revision 1405034)
+++ subversion/svn_private_config.hw    (working copy)
@@ -33,6 +33,12 @@
 /* Define to a Windows-specific equivalent of config.guess output */
 #define SVN_BUILD_HOST "x86-microsoft-windows"
 
+#ifdef _WIN64
+#define SVN_BUILD_TARGET "x86-microsoft-windows"
+#else
+#define SVN_BUILD_TARGET "x64-microsoft-windows"
+#endif
+
 /* The minimal version of Berkeley DB we want */
 #define SVN_FS_WANT_DB_MAJOR    4
 #define SVN_FS_WANT_DB_MINOR    0

Reply via email to