From bill at insightful.com  Sat Apr 19 19:41:38 2008
From: bill at insightful.com (Bill Dunlap)
Date: Sat, 19 Apr 2008 10:41:38 -0700 (PDT)
Subject: [Rd] nondigits in R_FILEVERSION mess up Windows build
In-Reply-To: <Pine.GSO.4.56.0804182152300.29645@devsun3201.insightful.com>
References: <Pine.GSO.4.56.0804182152300.29645@devsun3201.insightful.com>
Message-ID: <Pine.GSO.4.56.0804191007190.12957@devsun3201.insightful.com>

On Fri, 18 Apr 2008, Bill Dunlap wrote:

> I tried for the first time to build R from source on Windows, where I
> got the source code via svn.  Per the Installation and Administration
> manual, I altered src\gnuwin32\MkRules so it had the the locally
> correct paths to HTML Help Workshop and Inno Setup 5.  I also set
> USE_SVNVERSION=yes, as suggested in MkRules itself.  Then, while in
> the directory src/gnuwin32 I ran 'make all recommended' and got an
> error from windres very early in the build:
>  ...
> Line 9 of src\gnuwin32\front-ends\rcico.rc is
>   FILEVERSION R_FILEVERSION
> The problem was that my change to MkRules caused 'svnversion' to put an
> 'M' (modified) on the end of the svn version it reports.  This svn
> version number is used in the R_FILEVERSION macro, which is used in in
> the *.rc files.  The resource file compiler, windres, appears to choke on
> non-digits in R_FILEVERSION.  (A comment in tools\GETVERSION indicates
> it might choke on leading 0's as well.)
>
> After the following change, to remove the trailing M or S from the
> svn version number, the build worked.  In R itself, the svn version
> contains the trailing 'M' to show it came from modified source.
> In the long run it might be nice to alter MkRules so it can read
> a LocalMkRules file which is not under svn control, so trivial path
> changes in MkRules don't make it look like the build is from modified
> source code.  I don't think the M-less svn version in R_FILEVERSION
> will cause any confusion.

I ran into another problem with the trailing 'M' from svnversion
when doing 'make rinstaller' in R_HOME/src/gnuwin32:
   E:\R\R-svn\r-devel\src\gnuwin32\installer>type R-2.8.0dev.log
   Inno Setup 5 Command-Line Compiler
   ...
   Compiler engine version: Inno Setup 5.2.3 (ISPP 5.2.3.0)
   ...
   [ISPP] Preprocessing.
   ...
   [ISPP] Preprocessed.
   Parsing [Setup] section, line 10
   ...
   Parsing [Setup] section, line 20
   Error on line 12 in e:\R\R-svn\r-devel\src\gnuwin32\installer\R.iss: Value of [Setup] section directive "VersionInfoVersion" is invalid.
   Compile aborted.
The offending line 12 in R.iss is
    12  VersionInfoVersion=2.8.0.45381M
and it is put there by src/gnuwin32/installer/JRins.pl.
The following patch removes possible the trailing M or S
from the svn version number when making the Windows installer.
With that change 'make installer' completes without error
and I can run the installer (and uninstaller) successfully
with a locally modified svn tree.

It is nice to be able have the svn version available in R
and the 'M' (modified) tag is useful information.  It would
be more useful if we also stored the output of 'svn diff'
in the binary distribution, so we could tell exactly what was done.

Index: JRins.pl
===================================================================
--- JRins.pl	(revision 45381)
+++ JRins.pl	(working copy)
@@ -44,6 +44,7 @@
 $SVN = <ver>;
 close ver;
 $SVN =~s/Revision: //;
+$SVN =~s/[MS]* *$//;
 $RVER0 .= "." . $SVN;

 open insfile, "> R.iss" || die "Cannot open R.iss\n";



[Rd] nondigits in R_FILEVERSION mess up Windows build
Bill Dunlap