The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
A package created with use_rzig() contains a copy of the
rzig framework (src/rzig/framework) and build files made
from rzig’s templates (configure,
src/Makevars.in, src/entry.c,
src/rzig/build.zig and others). The framework and the R
side of rzig must come from the same version, because the generated
bindings rely on both. After an update of rzig,
update_rzig() brings the package to the installed version.
Every step of this vignette is plain R and needs no Zig compiler.
path <- file.path(tempdir(), "updatedpkg")
create_rzig_package(path, tests = FALSE)
#> Created package updatedpkg at /private/var/folders/vh/njwnyy0141n0zbrgjw2vbz800000gn/T/RtmppmxRLi/updatedpkg
#> Write Zig functions in src/rzig/src/main.zig, then run rzig::document(path) and rzig::build_zig(path)update_rzig() replaces the framework sources, replaces
each build file that is identical to a template of some rzig version
(the package author has not changed it), adds missing files and
regenerates the bindings. The package author’s Zig sources in
src/rzig/src, the list of C libraries
src/rzig/c_libraries.zon and every file rzig does not know
stay as they are. On a package that is current, the result lists no
file:
A build file that the package author changed is kept, because the
change may matter, and listed, so that it can be compared with the new
template. Here src/Makevars.in gets an extra comment:
makevars <- file.path(path, "src", "Makevars.in")
cat("# Built with a custom flag.\n", file = makevars, append = TRUE)
result <- update_rzig(path)
#> Generated RZig bindings for updatedpkg: 1 exported function
#> Updated RZig in package updatedpkg to rzig 1.0.0
result
#> RZig update of package updatedpkg
#> customized build files kept (compare with the templates of rzig) (1):
#> src/Makevars.inrzig_status() notes the difference without failing,
because a customized build file is allowed:
status <- rzig_status(path)
status[status$step == "Scaffold", ]
#> RZig status of package updatedpkg
#> [ok] Scaffold build files and framework sources present
#> differs from the rzig template: src/Makevars.inWith force = TRUE, update_rzig() replaces
customized build files with the templates as well:
When the framework files differ from those of the installed rzig, for
example after install.packages("rzig") in a project that
was not updated, rzig_status() fails the scaffold step and
names update_rzig(). A changed framework file shows the
check:
framework_file <- file.path(path, "src", "rzig", "framework", "rzig.zig")
cat("// local change\n", file = framework_file, append = TRUE)
status <- rzig_status(path)
status[status$step == "Scaffold", ]
#> RZig status of package updatedpkg
#> [--] Scaffold 1 framework file differs from rzig 1.0.0
#> (framework/rzig.zig); run update_rzig(path), which keeps
#> src/rzig/src and customized build files
#> 1 of 1 checks failed: Scaffold
result <- update_rzig(path)
#> Generated RZig bindings for updatedpkg: 1 exported function
#> Updated RZig in package updatedpkg to rzig 1.0.0
result
#> RZig update of package updatedpkg
#> framework sources refreshed (1):
#> src/rzig/framework/rzig.zigAfter updating rzig: run update_rzig(path), read the
list of kept files, run rzig_status(path), rebuild with
build_zig(path) and run the tests of the package. The NEWS
file of rzig lists the changes of each version that affect packages.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.