diff --git a/recipes/recipes_emscripten/r-fastmatch/patches/0001-Remove-dummy.c.patch b/recipes/recipes_emscripten/r-fastmatch/patches/0001-Remove-dummy.c.patch new file mode 100644 index 00000000000..88dd7f29d78 --- /dev/null +++ b/recipes/recipes_emscripten/r-fastmatch/patches/0001-Remove-dummy.c.patch @@ -0,0 +1,31 @@ +From ae8423bb3477b25b3d668a1e4c4b3e84b0129bd8 Mon Sep 17 00:00:00 2001 +From: Raniere Gaia Costa da Silva +Date: Thu, 29 Jan 2026 10:36:27 +0100 +Subject: [PATCH] Remove dummy.c + +As recommended in https://github.com/s-u/fastmatch/issues/13 +--- + src/dummy.c | 11 ----------- + 1 file changed, 11 deletions(-) + delete mode 100644 src/dummy.c + +diff --git a/src/dummy.c b/src/dummy.c +deleted file mode 100644 +index 5bddef9..0000000 +--- a/src/dummy.c ++++ /dev/null +@@ -1,11 +0,0 @@ +-/* dummy symbols to keep superfluous CRAN checks happy +- (this package uses NAMESPACE C-level symbol registration +- but the checks don't get that) */ +- +-extern void R_registerRoutines(void); +-extern void R_useDynamicSymbols(void); +- +-void dummy(void) { +- R_registerRoutines(); +- R_useDynamicSymbols(); +-} +-- +2.52.0 + diff --git a/recipes/recipes_emscripten/r-fastmatch/recipe.yaml b/recipes/recipes_emscripten/r-fastmatch/recipe.yaml new file mode 100644 index 00000000000..71ae864df05 --- /dev/null +++ b/recipes/recipes_emscripten/r-fastmatch/recipe.yaml @@ -0,0 +1,53 @@ +context: + name: r-fastmatch + version: 1.1-8 + +package: + name: ${{ name }} + version: ${{ version|replace("-", "_") }} + +source: + url: + - https://cran.r-project.org/src/contrib/${{ name[2:] }}_${{ version }}.tar.gz + - https://cloud.r-project.org/src/contrib/${{ name[2:] }}_${{ version }}.tar.gz + sha256: 2661c01bdc2383f4a30bf940e6bc3b68f1329db5f0e837df8160eb893f748d54 + patches: + - patches/0001-Remove-dummy.c.patch + +build: + number: 0 + script: $R CMD INSTALL $R_ARGS . + +requirements: + build: + - ${{ compiler('c') }} + - cross-r-base_${{ target_platform }} ==${{ r_base }} + host: + - r-base ==${{ r_base }} + run: + +tests: +- package_contents: + lib: + - R/library/${{ name[2:] }}/libs/${{ name[2:] }}.so +- script: run_r_test test-r-fastmatch.R + files: + recipe: + - test-r-fastmatch.R + requirements: + build: + - r-wasm-tester + +about: + homepage: https://www.rforge.net/fastmatch + license: GPL-2.0-only + summary: Package providing a fast match() replacement for cases that require repeated look-ups. + It is slightly faster that R's built-in match() function on first match against + a table, but extremely fast on any subsequent lookup as it keeps the hash table + in memory. + license_family: GPL2 + license_file: ${{ PREFIX }}/lib/R/share/licenses/GPL-2 + +extra: + recipe-maintainers: + - rgaiacs \ No newline at end of file diff --git a/recipes/recipes_emscripten/r-fastmatch/test-r-fastmatch.R b/recipes/recipes_emscripten/r-fastmatch/test-r-fastmatch.R new file mode 100644 index 00000000000..5cb61e57683 --- /dev/null +++ b/recipes/recipes_emscripten/r-fastmatch/test-r-fastmatch.R @@ -0,0 +1,17 @@ +library(fastmatch) + +stopifnot(is.function(coalesce)) +stopifnot(is.function(ctapply)) +stopifnot(is.function(fmatch)) + +# Example from fastmatch documentation +i = rnorm(2e6) +names(i) = as.integer(rnorm(2e6)) +coalesce(names(i)) + +i = i[order(names(i))] +ctapply(i, names(i), sum) + +x = as.integer(rnorm(1e6) * 1000000) +s = 1:100 +fmatch(s,x) \ No newline at end of file