[source] tar = "https://ftp.gnu.org/gnu/m4/m4-1.14.21.tar.xz" patches = ["redox.patch"] [build] template = "custom" script = """ DYNAMIC_INIT # Add relibc system headers to the include path. # The cookbook sets CPPFLAGS="-I${COOKBOOK_SYSROOT}/include" but the recipe # sysroot is empty for packages with no header-providing deps. The relibc # headers are at prefix/${TARGET}/relibc-install/${TARGET}/include/ — not in # the compiler's default search path. Without this, gnulib's #include_next # can't find the system headers and every wrapper fails. RELIBC_INCLUDE="${COOKBOOK_ROOT}/prefix/${TARGET}/relibc-install/${TARGET}/include" export CPPFLAGS="${CPPFLAGS} -isystem ${RELIBC_INCLUDE}" # relibc's float.h is missing LDBL_DIG (and possibly other LDBL_* macros). # For x86_64 80-bit extended precision: LDBL_DIG = floor(63 * log10(2)) = 18 export CPPFLAGS="${CPPFLAGS} -DLDBL_DIG=18" # The redoxer toolchain has a stale libc without __fseterr/__freadahead. # Add the relibc library path so the linker finds the updated library. RELIBC_LIB="${COOKBOOK_ROOT}/prefix/${TARGET}/relibc-install/${TARGET}/lib" export LDFLAGS="${LDFLAGS} -L${RELIBC_LIB}" # Gnulib cross-compilation: relibc provides standard POSIX headers and types # but gnulib's configure can't run test programs during cross-compilation. export ac_cv_header_stdio_h=yes export ac_cv_header_stdlib_h=yes export ac_cv_header_string_h=yes export ac_cv_header_strings_h=yes export ac_cv_header_inttypes_h=yes export ac_cv_header_stdint_h=yes export ac_cv_header_unistd_h=yes export ac_cv_header_sys_types_h=yes export ac_cv_header_sys_stat_h=yes export ac_cv_header_time_h=yes export ac_cv_header_sys_time_h=yes export ac_cv_header_sys_select_h=yes export ac_cv_header_wchar_h=yes export ac_cv_header_wctype_h=yes export ac_cv_header_signal_h=yes export ac_cv_header_dirent_h=yes export ac_cv_header_fcntl_h=yes export ac_cv_header_locale_h=yes export ac_cv_header_errno_h=yes export ac_cv_header_ctype_h=yes export ac_cv_header_limits_h=yes export ac_cv_header_stdarg_h=yes export ac_cv_header_stddef_h=yes export ac_cv_header_spawn_h=yes # Standard types export ac_cv_type_intmax_t=yes export ac_cv_type_uintmax_t=yes export ac_cv_type_gid_t=yes export ac_cv_type_uid_t=yes export ac_cv_type_pid_t=yes export ac_cv_type_mode_t=yes export ac_cv_type_off_t=yes export ac_cv_type_size_t=yes export ac_cv_type_ssize_t=yes export ac_cv_type_ptrdiff_t=yes export ac_cv_type_nlink_t=yes export ac_cv_type_mbstate_t=yes export ac_cv_type_sigset_t=yes export ac_cv_type_posix_spawnattr_t=yes export ac_cv_type_posix_spawn_file_actions_t=yes export gl_cv_type_intmax_t=yes export gl_cv_type_ptrdiff_t_signed=yes export gl_cv_header_inttypes_h=yes export gl_cv_header_stdint_h=yes export gl_cv_header_inttypes_h_with_uintmax=yes export ac_cv_have_inttypes_h_with_uintmax=yes # m4-specific gnulib function checks export ac_cv_func___freadahead=yes export ac_cv_have_decl___freadahead=yes export gl_cv_header_wchar_h_correct_inline=yes export gl_cv_func_btowc_nul=yes export gl_cv_func_btowc_consistent=yes export gl_cv_onwards_func___freadahead=yes export gl_cv_socklen_t_equiv=socklen_t export ac_cv_func_getpagesize=yes export ac_cv_func_memcmp_working=yes # Tell gnulib these wide-char functions exist and work export ac_cv_func_btowc=yes export ac_cv_func_mbrtowc=yes export ac_cv_func_mbsinit=yes export ac_cv_func_wcrtomb=yes export ac_cv_func_wctob=yes export ac_cv_func_mbsrtowcs=yes export ac_cv_func_wcswidth=yes export ac_cv_func_wcwidth=yes export gl_cv_func_btowc=yes export gl_cv_func_mbrtowc=yes export gl_cv_func_mbsinit=yes export gl_cv_func_wcrtomb=yes export gl_cv_func_wctob=yes export gl_cv_func_wcwidth=yes export gl_cv_func_wcswidth=yes # Functions that relibc provides but gnulib can't detect during cross-compilation export ac_cv_func___fseterr=yes export ac_cv_func_getlocalename_l=yes COOKBOOK_CONFIGURE_FLAGS+=( --disable-nls ) "${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}" # Fix gnulib cross-compilation misdetections in config.h "${COOKBOOK_ROOT}/local/scripts/gnulib-cross-fix.sh" "${COOKBOOK_BUILD}/lib/config.h" # Prevent man page regeneration (help2man not available in cross-env) touch "${COOKBOOK_SOURCE}/doc/m4.1" "${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" HELP2MAN=true "${COOKBOOK_MAKE}" install DESTDIR="${COOKBOOK_STAGE}" HELP2MAN=true """ [package] description = "GNU M4 macro processor"