[Rd] building windows packages under wine/linux and cross-compiling.
Hin-Tak Leung
hin-tak.leung at cimr.cam.ac.uk
Tue Aug 1 13:22:20 CEST 2006
Prof Brian Ripley wrote:
> On Mon, 31 Jul 2006, Hin-Tak Leung wrote:
>
>> Had some fun today, and thought it might be a good idea to share
>> and possibly for inclusion to R/src/gnuwin32/README.packages .
>
> [...]
>
>> Cross-compiling: The instruction in R/src/gnuwin32/README.packages
>> essentially works, with one missing detail: "R_EXE=/usr/bin/R" is also
>> needed. Thus it should be:
>>
>> make R_EXE=/usr/bin/R PKGDIR=/mysources RLIB=/R/win/library \
>> pkg-mypkg
>> make P_EXE=/usr/bin/R KGDIR=/mysources RLIB=/R/win/library \
>> pkgcheck-mypkg
>
> The instructions do work for those who actually follow them! That file
> says
>
> Edit MkRules to set BUILD=CROSS and the appropriate paths (including
> HEADER) as needed.
Apologies... but in fact I did *not* edit HEADER, and essentially did
not understand the 2nd part of the above sentence, either.
Would it be better phrased as '...BUILD=CROSS near the top, and HEADER,
R_EXE, etc in the "cross-compilation settings" section in the middle
of the file' ? Better still, have it in MkRules itself:
# Alternatives MINGW (mingw), CROSS (Linux)
# - if you change BUILD, remember to edit and adjust the relevant
# native/cross cofiguration section further down
BUILD=MINGW
This is all about user-friendliness/useability...
> ## =================== cross-compilation settings =================
>
> ifeq ($(strip $(BUILD)),CROSS)
> # Next might be mingw32- or i386-mingw32msvc- or i586-
> # depending on the cross-compiler.
> BINPREF=i586-mingw32-
> # Set this to where the mingw32 include files are. It must be accurate.
> HEADER=/users/ripley/R/cross-tools5/i586-mingw32/include
> endif
> # path (possibly full path) to same version of R on the host system
> # R_EXE=R
>
> and please do note the last two lines.
I did not modify the HEADER line - and it wasn't necessary -
I guess mingw32 either knows the header files is right next to the
compiler, picked up enough from linux glibc's headers, or what not.
On a different note, I am rather uncomfortable doing *both*
makefile editing and setting options on the comand lines
"make option1=value1 option2=vaule2 ...". Surely it is possible
to do it entirely one way, e.g.
make CROSS_ON_LINUX=1 <rest_of_options>
or have the switching inside the makefile itself? e.g. (probably
wrong syntax - and depends on cygwin uname which isn't in Rtools)
ifeq ($(uname -a),Linux)
BUILD=CROSS
else
BUILD=MINGW
endif
Hin-Tak Leung
More information about the R-devel
mailing list