The R Project SVN R

Rev

Rev 78954 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 78954 Rev 83796
Line 18... Line 18...
18
2) Everything else, where the primary Makefile is MkRules which is
18
2) Everything else, where the primary Makefile is MkRules which is
19
where all the customization is done.  This is included by all
19
where all the customization is done.  This is included by all
20
Makefile.win files in directories above this one and
20
Makefile.win files in directories above this one and
21
 
21
 
22
./Makefile
22
./Makefile
23
./cran/Makefile
-
 
24
./fixed/Makefile
23
./fixed/Makefile
25
./front-ends/Makefile
24
./front-ends/Makefile
26
./getline/Makefile
25
./getline/Makefile
27
./installer/Makefile
26
./installer/Makefile
28
 
27
 
Line 40... Line 39...
40
front-ends/Makefile:
39
front-ends/Makefile:
41
 
40
 
42
- A resource compiler is used to compile in version information, an
41
- A resource compiler is used to compile in version information, an
43
  icon and a manifest.  Also done for version information in all the
42
  icon and a manifest.  Also done for version information in all the
44
  other DLLs under bin and modules (R.dll Rblas.dll Rgraphapp.dll
43
  other DLLs under bin and modules (R.dll Rblas.dll Rgraphapp.dll
45
  Riconv.dll Rlapack.dll internet.dll lapack.dll).
44
  Riconv.dll Rlapack.dll lapack.dll).
46
 
45
 
47
- LINKFLAGS includes flags for the stack size and to allow addressing
46
- LINKFLAGS includes flags for the stack size.
48
  over 2GB for 32-bit executables.
-
 
49
 
47
 
50
A resource compiler is used to add version information to the DLLs
48
A resource compiler is used to add version information to the DLLs
51
under directories bin and modules.
49
under directories bin and modules.
52
 
50
 
53
The default is to compile without debug info: this can be enabled by
51
The default is to compile without debug info: this can be enabled by
Line 73... Line 71...
73
 
71
 
74
 
72
 
75
Cross-compilation
73
Cross-compilation
76
=================
74
=================
77
 
75
 
78
Linux distributions including Fedora, Debian and Ubuntu provide
76
Versions of R prior to 4.2.0 could be cross-compiled using the tools
79
cross-compilers and many cross-compiled libraries for both 32- and
77
provided by Linux distributions including Fedora, Debian and Ubuntu.
80
64-bit Windows.  For example, on Fedora 32 for a 64-bit build one
78
However, these do not (at the time of writing) support UCRT-based builds.
81
might install the RPMs
-
 
82
 
79
 
83
mingw64-binutils
-
 
84
mingw64-bzip2
-
 
85
mingw64-cairo
-
 
86
mingw64-cpp
-
 
87
mingw64-crt
-
 
88
mingw64-filesystem
80
https://cran.r-project.org/bin/windows/base/howto-R-devel.html
89
mingw64-gcc
-
 
90
mingw64-gcc-c++ (not needed for R, but needed for cairo, icu and libtiff)
81
describes how to obtain a suitable cross-compilation toolchain for
91
mingw64-gcc-gfortran
82
x86_64 Linux (based on glibc).  Look at the section entitled something
92
mingw64-headers
-
 
93
mingw64-libgomp
83
like
94
mingw64-libpng
84
 
95
mingw64-libjpeg-turbo
85
'Setting up MXE build from pre-built tarballs',
96
mingw64-libtiff
-
 
97
mingw64-pcre2
86
 
98
mingw64-pkg-config
87
and follow the instructions, which install the toolchain under a place
99
mingw64-readline
88
it (and we) call MXE_ROOT.  (To build R only the
100
mingw64-tcl
-
 
101
mingw64-termcap
-
 
102
mingw64-tk
-
 
103
mingw64-winpthreads
89
'rtools43-toolchain-libs-base' version is required.)
104
mingw64-xz-libs
-
 
105
mingw64-zlib
-
 
106
 
90
 
107
or install the mingw32- variants for a 32-bit build.  At the time of
91
You will also need to fetch the pre-built Tcl/Tk as described in the
-
 
92
section 'Building R from source using a toolchain tarball'.  The default
108
writing this used GCC 9.2.1.
93
location for the latter is R_HOME/Tcl.
109
 
94
 
110
To build all the compiled code, set BINPREF in MkRules.local, e.g. to
95
To build all the compiled code, edit MkRules.local to something like
111
 
96
 
112
WIN = 64
-
 
-
 
97
MXE_ROOT = wherever you put it, or /usr/lib/mxe (which was set as a symlink)
113
BINPREF64 = /usr/bin/x86_64-w64-mingw32-
98
BINPREF64 = $(MXE_ROOT)/usr/bin/x86_64-w64-mingw32.static.posix-
114
 
-
 
115
or
-
 
116
 
-
 
-
 
99
EXT_LIBS = $(MXE_ROOT)/usr/x86_64-w64-mingw32.static.posix
117
WIN = 32
100
#CURL_CA_BUNDLE = /etc/pki/tls/certs/ca-bundle.crt
118
BINPREF = /usr/bin/i686-w64-mingw32-
101
TEXI2ANY=/usr/bin/texi2any
119
 
102
 
120
Setting LTO is supported.
103
Setting LTO is supported.
121
 
104
 
122
Then in this directory
105
Then in this directory
123
 
106
 
124
make MkRules rbuild rpackages-cross
107
make MkRules rbuild rpackages-cross cairodevices
125
 
-
 
126
To make the cairo devices, set something like
-
 
127
 
-
 
128
USE_CAIRO = TRUE
-
 
129
CAIRO_CPPFLAGS = -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/cairo
-
 
130
CAIRO_LIBS = "-lcairo -lpixman-1 -lpng -lz -lgdi32 -lmsimg32"
-
 
131
 
-
 
132
in MkRules.local and run
-
 
133
 
-
 
134
make cairodevices
-
 
135
 
-
 
136
 
-
 
137
This will link to the DLLs of external software and for libgomp and
-
 
138
pthreads (for OpenMP).
-
 
139
 
-
 
140
For a more static build, install
-
 
141
 
-
 
142
mingw64-bzip2-static
-
 
143
mingw64-libpng-static
-
 
144
mingw64-libjpeg-turbo-static
-
 
145
mingw64-libtiff-static
-
 
146
mingw64-pcre2-static
-
 
147
mingw64-winpthreads-static
-
 
148
mingw64-xz-libs-static
-
 
149
mingw64-zlib-static
-
 
150
 
-
 
151
and remove the corresponding libfoo.dll.a files from
-
 
152
/usr/x86_64-w64-mingw32/sys-root/mingw/lib, and libgomp.dll.a.  (The
-
 
153
build still uses DLLs for libgcc_s_seh and Tcl/Tk).  For a static
-
 
154
build of the Cairo devices one would need other RPMs like
-
 
155
 
-
 
156
mingw64-cairo-static
-
 
157
mingw64-fontconfig-static
-
 
158
mingw64-freetype-static
-
 
159
mingw64-pixman-static
-
 
160
 
-
 
161
Rather than remove the .dll.a files, one could experiment with -Wl,-Bstatic.
-
 
162
 
-
 
163
There are curl and ICU libraries for optional features.  Settings for
-
 
164
Fedora's libs (DLL versions):
-
 
165
 
-
 
166
USE_LIBCURL = YES
-
 
167
CURL_LIBS = -lcurl
-
 
168
 
-
 
169
USE_ICU = YES
-
 
170
ICU_LIBS = -licuuc -licui18n -licudata
-
 
171
 
-
 
172
There is a static version for curl but not ICU.
-
 
173
 
108
 
174
 
109
 
175
Cross-building packages
110
Cross-building packages
176
=======================
111
=======================
177
 
112
 
178
There is experimental minimal support for cross-building packages.
113
There is experimental minimal support for cross-building packages.
179
 
114
 
180
Copy {bin,etc}/{i386,x64} from this build to a standard Linux build.
115
Copy {bin,etc}/x64 from this build to a standard Linux build of R.
181
 
116
 
182
Edit the copy of etc/*/Makeconf to have
117
Edit the copy of etc/x64/Makeconf to have
183
 
118
 
184
R_WIN = /path/to/top/directory/of/this/build
119
R_WIN = /path/to/top/directory/of/this/build
185
R_XTRA_CPPFLAGS = -I"$(R_WIN)/include" -DNDEBUG
120
R_XTRA_CPPFLAGS = -I"$(R_WIN)/include" -DNDEBUG
186
 
121
 
187
Set the environment variable R_CROSS_BUILD to i386 or x64.
122
Set the environment variable R_CROSS_BUILD to x64.
188
 
123
 
189
Use R CMD INSTALL as usual. (This does not do a staged install nor
124
Use R CMD INSTALL as usual. (This does not do a staged install nor
190
test loading.)  --use-LTO is supported if LTO_OPT was set.
125
test loading.)  --use-LTO is supported if LTO_OPT was set.  Use a
-
 
126
separate library tree (-l) as these are Windows and not Linux
-
 
127
binaries.
191
 
128
 
192
R CMD INSTALL --build will produce a zipped installation.
129
R CMD INSTALL --build will produce a zipped installation.
193
 
130
 
194
Should a package require external libraries, these can be placed under
131
Should a package require external libraries, these can be placed under
195
LOCAL_SOFT as defined in etc/*/Makeconf in the copy.
132
LOCAL_SOFT as defined in etc/x64/Makeconf in the copy.
196
 
133
 
197
 
134
 
198
 
135