[R-pkg-devel] windows and configure scripts

Timothy Keitt tke|tt @end|ng |rom gm@||@com
Sun Aug 8 19:47:14 CEST 2021


Thanks. Just me trying to be minimalist and see if I could achieve the aim
without extra files, etc. All I need to do is see if the CXX17 config
option is empty and modify PKG_CPPFLAGS and CXX_STD appropriately. That
means calling R and and implementing an if-else in the Makevars file
outside of any make target (or that's my assumption). Searching how to do
that inevitably leads to 100's of GNU make examples using GNU extensions,
which are not portable across all R platforms and so are useless. (Thanks
for the link to the official non-extended make syntax.)

In the end, it was easier just to have a config and config.win as per
Dirk's suggestion.

THK

On Sat, Aug 7, 2021 at 4:51 PM Kevin Ushey <kevinushey using gmail.com> wrote:

> On Fri, Aug 6, 2021 at 3:47 PM Tim Keitt <tkeitt using gmail.com> wrote:
> >
> > As configure is not run on windows, but according to the writing
> extensions
> > docs you can run commands in Makevars, is that not preferable for simple
> > cases?
>
> IMHO it's ultimately up to you. Do what makes your life easier as a
> package maintainer. If your package can be successfully configured
> using only Makevars, then that's probably simplest. If Windows needs
> special help, then it might be reasonable to have a separate
> Makevars.win file. If you need to perform some extra introspection
> about the user's machine, then you probably want a pair of configure
> and configure.win scripts.
>
> > What shell is active in Makevars? Is it "/bin/sh" or is make the
> > interpreter here?
>
> Since Makevars is just a Makefile, it is processed by make. Executed
> shell commands then depend on what shell make has been configured to
> use. That defaults to /bin/sh, but R installations might be configured
> to use a different shell instead. If you look within $(R
> RHOME)/etc/Makeconf you'll probably see something like:
>
>     SHELL = /bin/sh
>
> But that might differ on different platforms. (I don't immediately
> recall how this is handled on Windows)
>
> I don't quite understand your question re: "is make the interpreter
> here?" -- make interprets Makefiles, which, while looking similar to
> shell scripts, are their own thing. Recipes are effectively just
> specially adorned shell commands, so while they are still interpreted
> by make per-se, it does so by sending those commands to a shell for
> execution. See
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html
> for the nitty gritty details.
>
> > Can we use $(shell ...cmd...) in Makevars on windows? I'm not sure where
> to
> > look for what syntax is in-play in the Makevars file during package
> > building other than trial-and-error.
>
> I think you would have to consult with the CRAN maintainers to be sure
> (assuming your question is whether CRAN would accept packages using
> GNU extensions only on Windows). While the toolchain on Windows is
> GNU-based and so GNU extensions are supported by the toolchain, it is
> theoretically possible (although, to me, very unlikely) this could
> change in the future.
>
> > THK
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-package-devel using r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list