Re: [R-pkg-devel] Alternative to ifeq for Makevars
В Fri, 8 Nov 2024 11:44:15 -0800 Josiah Parry пишет: > Do you know of any good documentation on the use of Makevars.in with > configure? A configure script for an R package could be any POSIX-compatible shell script, including a hand-written one that substitutes strings using sed [*], or even one that delegates to R [**]. If you do want to use GNU Autoconf, the relevant sections of the manual are 4.8 and 7.2: https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/html_node/Makefile-Substitutions.html https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/html_node/Setting-Output-Variables.html -- Best regards, Ivan [*] https://github.com/jeroen/V8/blob/master/configure [**] https://github.com/kevinushey/configure __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] Alternative to ifeq for Makevars
Thanks, Ivan! I've been able to get quite far based on the code in data.table* which uses sed to generate the Makevars from the Makevars.in file. The new challenge is that the Makevars file needs to be deleted after building. The approach I have now is a cleanup script with only rm -rf src/Makevars. This works *only* when --preclean or --clean is called. SO I'm not sure if it is a permanent solution. For example devtools::document() doesn't run the clean step nor does pkgbuild::compile_dll(). I may keep banging my head against the keyboard on this... * https://github.com/Rdatatable/data.table/blob/08e94b7f4af3fc4403959282bf81c490ebdf9e72/src/Makevars.in#L7 On Fri, Nov 8, 2024 at 12:04 PM Ivan Krylov wrote: > В Fri, 8 Nov 2024 11:44:15 -0800 > Josiah Parry пишет: > > > Do you know of any good documentation on the use of Makevars.in with > > configure? > > A configure script for an R package could be any POSIX-compatible shell > script, including a hand-written one that substitutes strings using sed > [*], or even one that delegates to R [**]. If you do want to use GNU > Autoconf, the relevant sections of the manual are 4.8 and 7.2: > > https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/html_node/Makefile-Substitutions.html > > https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/html_node/Setting-Output-Variables.html > > -- > Best regards, > Ivan > > [*] https://github.com/jeroen/V8/blob/master/configure > [**] https://github.com/kevinushey/configure > [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
[R-pkg-devel] Alternative to ifeq for Makevars
I am working on refactoring some Makevars files and I am quite stuck. I want to conditionally set the value of CRAN_FLAGS like so in my Makevars files ifeq ($(NOT_CRAN), false) CRAN_FLAGS = -j 2 --offline else CRAN_FLAGS = endif Using ifeq appears to be the only way to get the value of CRAN_FLAGS to persist within the $(STATILIB) portion of the Makevars file. However, this results in a Warning checking for GNU extensions in Makefiles ... WARNING Found the following file(s) containing GNU extensions: src/Makevars Portable Makefiles do not use GNU extensions such as +=, :=, $(shell), $(wildcard), ifeq ... endif, .NOTPARALLEL See section ‘Writing portable packages’ in the ‘Writing R Extensions’ manual. How do other people address this? [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] Alternative to ifeq for Makevars
В Fri, 8 Nov 2024 11:21:16 -0800 Josiah Parry пишет: > I want to conditionally set the value of CRAN_FLAGS like so in my > Makevars files > > ifeq ($(NOT_CRAN), false) > CRAN_FLAGS = -j 2 --offline > else > CRAN_FLAGS = > endif Unless a better approach surfaces (detect the environment variable in the configure script and generate src/Makevars from src/Makevars.in?), you may be interested in the following movfuscator-like POSIX-compatible trick: https://nullprogram.com/blog/2016/04/30/ EXTRA_FLAGS_true = EXTRA_FLAGS_ = -j 2 --offline EXTRA_FLAGS = $(EXTRA_FLAGS_$(NOT_CRAN)) (This one is untested, sorry.) -- Best regards, Ivan __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] Alternative to ifeq for Makevars
Thanks, Ivan! Do you know of any good documentation on the use of Makevars.in with configure? The @VARNAME@ syntax is quite confusing and isn't explained in WRE from what I can tell. On Fri, Nov 8, 2024 at 11:33 AM Ivan Krylov wrote: > В Fri, 8 Nov 2024 11:21:16 -0800 > Josiah Parry пишет: > > > I want to conditionally set the value of CRAN_FLAGS like so in my > > Makevars files > > > > ifeq ($(NOT_CRAN), false) > > CRAN_FLAGS = -j 2 --offline > > else > > CRAN_FLAGS = > > endif > > Unless a better approach surfaces (detect the environment variable in > the configure script and generate src/Makevars from src/Makevars.in?), > you may be interested in the following movfuscator-like > POSIX-compatible trick: https://nullprogram.com/blog/2016/04/30/ > > EXTRA_FLAGS_true = > EXTRA_FLAGS_ = -j 2 --offline > EXTRA_FLAGS = $(EXTRA_FLAGS_$(NOT_CRAN)) > > (This one is untested, sorry.) > > -- > Best regards, > Ivan > [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
[R-pkg-devel] Why is Rf_Seql hidden?
Hi everyone, Checking if 2 strings are equal, when these strings might be of different encoding, whilst still maintaining good performance, can be quite difficult. But R seems to manage reasonably well. It appears that R uses Rf_seql() to check if 2 strings are equal. But Rf_seql is not public in R's C API; it is hidden. So I have 2 questions: 1) Why is Rf_Seql() hidden? (what would be the problem if it were made public?) 2) What would be an alternative way to re-create Rf_Seql (a way that is relatively stable)? (An example C function that re-creates Rf_seql() using R's public C Api would be really nice.) Kind regards, Tony. [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] Alternative to ifeq for Makevars
On 2024-11-08 4:55 p.m., Josiah Parry wrote: Thanks, Ivan! I've been able to get quite far based on the code in data.table* which uses sed to generate the Makevars from the Makevars.in file. The new challenge is that the Makevars file needs to be deleted after building. I am pretty sure it does not need to be deleted. Just ignore it in the build (i.e. list it in .Rbuildignore, so it doesn't end up in the tarball, and each system installing the package recreates it). Duncan Murdoch The approach I have now is a cleanup script with only rm -rf src/Makevars. This works *only* when --preclean or --clean is called. SO I'm not sure if it is a permanent solution. For example devtools::document() doesn't run the clean step nor does pkgbuild::compile_dll(). I may keep banging my head against the keyboard on this... * https://github.com/Rdatatable/data.table/blob/08e94b7f4af3fc4403959282bf81c490ebdf9e72/src/Makevars.in#L7 On Fri, Nov 8, 2024 at 12:04 PM Ivan Krylov wrote: В Fri, 8 Nov 2024 11:44:15 -0800 Josiah Parry пишет: Do you know of any good documentation on the use of Makevars.in with configure? A configure script for an R package could be any POSIX-compatible shell script, including a hand-written one that substitutes strings using sed [*], or even one that delegates to R [**]. If you do want to use GNU Autoconf, the relevant sections of the manual are 4.8 and 7.2: https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/html_node/Makefile-Substitutions.html https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/html_node/Setting-Output-Variables.html -- Best regards, Ivan [*] https://github.com/jeroen/V8/blob/master/configure [**] https://github.com/kevinushey/configure [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel