1 Cloning the R sources
1.1 Fetch R from a git clone
R is hosted on the Subversion (SVN) version control system. In the age of github and gitlab, this can be a hindrance for most new developers who are only familiar with git workflows. Fortunately, it is easy to work on R from a git clone of the SVN repository. Since SVN does not have a concept of pull requests, contributions are communicated via ordinary patches which are easy to create from git commits and git branches.
Start by cloning R from Winston Chang’s git mirror of the Subversion repository:
git clone https://github.com/wch/r-source.git
1.2 Tweak the repository
Next we need to import a few files that will make it easier to build R from the git clone.
1.2.1 Script for
As of revision 62183, R must either be built from an SVN checkout or from the tarball generated by
make dist. This is because R needs to create a file called
SVN-REVISION that contains information about the last update to the sources. To work around this, we need to augment the build system with:
GNUmakefileintercepts the logic that checks for an SVN checkout.
The following commands download the files into a
mkdir r-source/build cd r-source/build wget https://raw.githubusercontent.com/lionel-/contributing/master/inst/GNUmakefile wget https://raw.githubusercontent.com/lionel-/contributing/master/inst/make-svn-revision chmod +x make-svn-revision
Finally, we need to git-ignore a few files that are generated as part of the build process. The following
.gitignore file should get you covered:
.gitignore build/ src/library/Recommended/*gz
This file ignores itself, anything that is in the
build directory, and the tarballs of the recommended packages.