From 7002ffd415284175140868acaa8286ef029e2c51 Mon Sep 17 00:00:00 2001 From: Isabel Paredes Date: Tue, 4 Jun 2024 18:48:38 +0200 Subject: [PATCH] Add config patch --- recipes/recipes_emscripten/r-base/build.sh | 13 +- .../patches/00_emscripten_configure.patch | 163 ++++++++++++++++++ .../r-base/patches/zlib_config.patch | 15 -- recipes/recipes_emscripten/r-base/recipe.yaml | 4 + 4 files changed, 178 insertions(+), 17 deletions(-) create mode 100644 recipes/recipes_emscripten/r-base/patches/00_emscripten_configure.patch diff --git a/recipes/recipes_emscripten/r-base/build.sh b/recipes/recipes_emscripten/r-base/build.sh index 777bc26cc..7f542d2df 100644 --- a/recipes/recipes_emscripten/r-base/build.sh +++ b/recipes/recipes_emscripten/r-base/build.sh @@ -16,10 +16,19 @@ export FPICFLAGS="-fPIC" export r_cv_header_zlib_h=yes export r_cv_have_bzlib=yes + +# export LDFLAGS=${LDFLAGS//$PREFIX/$BUILD_PREFIX} +# export CPPFLAGS=${CPPFLAGS//$PREFIX/$BUILD_PREFIX} +# export NM=$($CC_FOR_BUILD -print-prog-name=nm) +# export PKG_CONFIG_PATH=${BUILD_PREFIX}/lib/pkgconfig +# export HOST=$BUILD_PREFIX +# export IS_MINIMAL_R_BUILD=1 + +# TODO: may need to compile twice, 1. regular, 2. cross-compile + emconfigure ./configure \ --prefix=$PREFIX \ - --build=$BUILD \ - --host=$HOST \ + --host=$ARCH \ --with-lapack=no \ --with-blas=no \ --with-readline=no \ diff --git a/recipes/recipes_emscripten/r-base/patches/00_emscripten_configure.patch b/recipes/recipes_emscripten/r-base/patches/00_emscripten_configure.patch new file mode 100644 index 000000000..d9c843fda --- /dev/null +++ b/recipes/recipes_emscripten/r-base/patches/00_emscripten_configure.patch @@ -0,0 +1,163 @@ +diff --git a/configure b/configure +index ea413eb..66308ed 100755 +--- a/configure ++++ b/configure +@@ -4305,7 +4305,7 @@ R_OS="${host_os}" + + + case "${host_os}" in +- mingw*|windows*|winnt|msys) ++ mingw*|windows*|winnt|msys|emscripten*) + + printf "%s\n" "#define Win32 1" >>confdefs.h + +@@ -11123,7 +11123,7 @@ irix5* | irix6* | nonstopux*) + ;; + + # This must be glibc/ELF. +-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) ++linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | emscripten*) + lt_cv_deplibs_check_method=pass_all + ;; + +@@ -14878,7 +14878,7 @@ _LT_EOF + archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + +- gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) ++ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu | emscripten*) + tmp_diet=no + if test linux-dietlibc = "$host_os"; then + case $cc_basename in +@@ -15645,7 +15645,7 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } + link_all_deplibs=yes + ;; + +- linux*) ++ linux* | emscripten*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler +@@ -16702,7 +16702,7 @@ linux*android*) + ;; + + # This must be glibc/ELF. +-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) ++linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | emscripten*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no +@@ -18794,7 +18794,7 @@ fi + inherit_rpath_CXX=yes + ;; + +- linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) ++ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | emscripten*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler +@@ -20679,7 +20679,7 @@ linux*android*) + ;; + + # This must be glibc/ELF. +-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) ++linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | emscripten*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no +@@ -22199,7 +22199,7 @@ _LT_EOF + archive_expsym_cmds_FC='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + +- gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) ++ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu | emscripten*) + tmp_diet=no + if test linux-dietlibc = "$host_os"; then + case $cc_basename in +@@ -22915,7 +22915,7 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } + link_all_deplibs_FC=yes + ;; + +- linux*) ++ linux* | emscripten*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler +@@ -23800,7 +23800,7 @@ linux*android*) + ;; + + # This must be glibc/ELF. +-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) ++linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | emscripten*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no +@@ -24256,7 +24256,7 @@ case "${host_os}" in + darwin*) + Rshlibpath_var=DYLD_FALLBACK_LIBRARY_PATH + ;; +- cygwin*|mingw*|windows*|winnt|msys) ++ cygwin*|mingw*|windows*|winnt|msys|emscripten*) + Rshlibpath_var=PATH + ;; + *) +@@ -25653,7 +25653,7 @@ done + fi + + case "${host_os}" in +- cygwin*|mingw*|windows*|winnt|msys) ++ cygwin*|mingw*|windows*|winnt|msys|emscripten*) + r_cv_type_socklen=int + ;; + esac +@@ -42681,7 +42681,7 @@ fi + ## flags to all (C, C++ and Fortran) compiler flags. + + case "${host_os}" in +- mingw*|windows*|winnt|msys) ++ mingw*|windows*|winnt|msys|emscripten*) + ;; + *) + r_save_CFLAGS=${CFLAGS} +@@ -43630,7 +43630,7 @@ fi + done + + case "${host_os}" in +- mingw*|windows*|winnt|msys) ++ mingw*|windows*|winnt|msys|emscripten*) + ;; + *) + if test "${ac_cv_have_decl_select}" = "no"; then +@@ -50606,7 +50606,7 @@ then : + printf %s "(cached) " >&6 + else $as_nop + case "${host_os}" in +- cygwin*|mingw*|windows*|winnt|msys) ++ cygwin*|mingw*|windows*|winnt|msys|emscripten*) + r_cv_bsd_networking=yes + ;; + esac +@@ -51491,6 +51491,12 @@ fi + + ## libcurl + ++case $host_os in ++ emscripten*) ++ have_libcurl=no ++ ;; ++ *) ++ + # Extract the first word of "curl-config", so it can be a program name with args. + set dummy curl-config; ac_word=$2 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +@@ -51678,6 +51684,10 @@ else + as_fn_error $? "libcurl >= 7.28.0 library and headers are required with support for https" "$LINENO" 5 + fi + ++;; ++ ++esac ++ + + + ## Bitmap headers and libraries. diff --git a/recipes/recipes_emscripten/r-base/patches/zlib_config.patch b/recipes/recipes_emscripten/r-base/patches/zlib_config.patch index 7a93047b2..e69de29bb 100644 --- a/recipes/recipes_emscripten/r-base/patches/zlib_config.patch +++ b/recipes/recipes_emscripten/r-base/patches/zlib_config.patch @@ -1,15 +0,0 @@ -diff --git a/configure b/configure -index ea413eb..d712ee3 100755 ---- a/configure -+++ b/configure -@@ -50802,8 +50802,9 @@ printf "%s\n" "$r_cv_header_zlib_h" >&6; } - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether zlib support suffices" >&5 - printf %s "checking whether zlib support suffices... " >&6; } -+have_zlib=yes - if test "${have_zlib}" != yes; then -- as_fn_error $? "zlib library and headers are required" "$LINENO" 5 -+ as_fn_error $? "zlib WTF library and headers are required" "$LINENO" 5 - else - LIBS="-lz ${LIBS}" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 diff --git a/recipes/recipes_emscripten/r-base/recipe.yaml b/recipes/recipes_emscripten/r-base/recipe.yaml index dda4532b9..304f3d344 100644 --- a/recipes/recipes_emscripten/r-base/recipe.yaml +++ b/recipes/recipes_emscripten/r-base/recipe.yaml @@ -27,10 +27,14 @@ requirements: - readline - zlib - bzip2 + - libdeflate + - xz host: - zlib + - bzip2 run: - zlib + - bzip2 about: