commit aac5d72fe45c302942303d6b4331aaaba19626d5 Author: SFG545 Date: Tue May 26 02:08:47 2026 -0500 initial commit diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..1da1df0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "cmake.ignoreCMakeListsMissing": true, + "git.ignoreLimitWarning": true +} \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..1f9c14c --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,11 @@ +## Agent Instructions + +- When asked to make patches for a codebase, ensure that the user provides a link or location of a tarball or git repository. If not, request the user to provide it. +- Extract tarball using bsdtar to a temporary directory in /tmp to use diff for generating patches based on your modifications. +- When generating patches, ensure that the output is in the correct format (e.g., unified diff format) and includes the necessary context for understanding the changes. +- Make sure patches use the a/ and b/ prefixes to indicate the original and modified files, respectively. +- if asked to 'posixify' a source, replace all /bin/bash with /bin/sh and ensure that the script is compatible with POSIX standards. (use dash to verify if available, otherwise use sh) +- if just given a link, download to /tmp and then extract to a temporary directory for processing. +- if asked to 'ungnuify' a source, look for hardcoded deps such as -lgcc and -lstdc++ and change the source to query the compiler (eg. compiler-rt from clang) for the correct flags to link against. +- if it is a git repo, then use git diff to generate the patch +- make sure you place it into the proper directory (eg. util-linux patches should be placed in the util-linux directory) \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f577ef2 --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# Vertex Linux Patches + +This directory is a working collection of old and current patch sets used for Vertex Linux packaging. + +It spans two broad eras of the distro: + +- The older `musl + mimalloc + LibreSSL` era. +- The current `glibc + x86_64-v3` era. + +Some patches are clearly tied to one period, while others are carry patches that remained useful across both. + +## What This Tree Contains + +The patches here are not a pristine historical archive of a single release. They are a maintained patch bucket for packages Vertex Linux has needed to adjust over time, including: + +- libc and toolchain integration fixes +- `clang` and `compiler-rt` compatibility work +- `x86_64-v3` policy and platform-specific changes +- `LibreSSL` compatibility patches from the older stack +- POSIX and `/bin/sh` cleanups for build scripts +- packaging, portability, and local distro behavior changes + +## Era Notes + +### Older Era: `musl + mimalloc + LibreSSL + LLVM/Clang` + +This was the earlier Vertex Linux direction. Patches from that period generally reflect: + +- `musl`-oriented portability work +- `LibreSSL` compatibility, especially for older Qt and network/crypto consumers +- runtime and allocator decisions that matched the `mimalloc` period +- build-system cleanup for a smaller, less GNU-specific base + +### Current Era: `glibc + x86_64-v3 + LLVM/Clang` + +This is the current Vertex Linux direction. Patches from this period generally reflect: + +- `glibc`-based userland assumptions +- `x86_64-v3` baseline policy +- modern `LLVM/Clang`, `lld`, `compiler-rt`, and `libc++` integration +- removing hardcoded GNU toolchain assumptions where they break modern Clang-based builds + +Examples in this tree include the kernel-side `x86_64-v3` enforcement patch in [linux/0001-x86-setup-enforce-x86_64-v3.patch](linux/0001-x86-setup-enforce-x86_64-v3.patch) and newer `glibc`/`valgrind` compiler-runtime fixes such as [glibc/glibc-2.43-use-compiler-reported-libgcc.patch](glibc/glibc-2.43-use-compiler-reported-libgcc.patch) and [valgrind/valgrind-3.26.0-ungnuify.patch](valgrind/valgrind-3.26.0-ungnuify.patch). + +## Reading The Layout + +Directories are package-oriented. In general, each subdirectory holds local patches for one upstream project, for example: + +- [glibc patches](glibc) +- [qt5 patches](qt5) +- [util-linux](util-linux) +- [valgrind](valgrind) + +## Practical Note + +Not every patch maps cleanly to exactly one era. This tree should be read as "Vertex Linux patches that accumulated through the older `musl/mimalloc/LibreSSL` period and into the current `glibc/x86_64-v3` period", not as a strict release-by-release archive. + +## PS: +And yes I used ai for these, not because I don't know how to write patches/code, but because I PROMISE I dont have the time to do all of this by hand. I have to maintain the distro, do the packaging, code a bunch of more stuff, and also write the documentation. The patches are just a small part of the work, and using ai helps me get them done faster so I can focus on the other important tasks. \ No newline at end of file diff --git a/abseil/abseil-cpp-20260107.1-symbolize-proc-maps-fallback.patch b/abseil/abseil-cpp-20260107.1-symbolize-proc-maps-fallback.patch new file mode 100644 index 0000000..deb2140 --- /dev/null +++ b/abseil/abseil-cpp-20260107.1-symbolize-proc-maps-fallback.patch @@ -0,0 +1,34 @@ +diff --git a/absl/debugging/symbolize_elf.inc b/absl/debugging/symbolize_elf.inc +index 0317bbc..e4a5060 100644 +--- a/absl/debugging/symbolize_elf.inc ++++ b/absl/debugging/symbolize_elf.inc +@@ -1086,17 +1086,24 @@ static ABSL_ATTRIBUTE_NOINLINE bool ReadAddrMap( + void *arg, void *tmp_buf, size_t tmp_buf_size) { + // Use /proc/self/task//maps instead of /proc/self/maps. The latter + // requires kernel to stop all threads, and is significantly slower when there +- // are 1000s of threads. ++ // are 1000s of threads. Some container procfs implementations do not expose ++ // per-thread maps files, so fall back to /proc/self/maps when needed. + char maps_path[80]; + snprintf(maps_path, sizeof(maps_path), "/proc/self/task/%d/maps", getpid()); + + int maps_fd; + NO_INTR(maps_fd = OpenReadOnlyWithHighFD(maps_path)); +- FileDescriptor wrapped_maps_fd(maps_fd); +- if (wrapped_maps_fd.get() < 0) { +- ABSL_RAW_LOG(WARNING, "%s: errno=%d", maps_path, errno); +- return false; ++ if (maps_fd < 0) { ++ const int task_maps_errno = errno; ++ NO_INTR(maps_fd = OpenReadOnlyWithHighFD("/proc/self/maps")); ++ if (maps_fd < 0) { ++ const int self_maps_errno = errno; ++ ABSL_RAW_LOG(WARNING, "%s: errno=%d; /proc/self/maps: errno=%d", ++ maps_path, task_maps_errno, self_maps_errno); ++ return false; ++ } + } ++ FileDescriptor wrapped_maps_fd(maps_fd); + + // Iterate over maps and look for the map containing the pc. Then + // look into the symbol tables inside. diff --git a/autoconf-archive/autoconf-archive-2024.10.16-fix-config-status.patch b/autoconf-archive/autoconf-archive-2024.10.16-fix-config-status.patch new file mode 100644 index 0000000..d1b82b6 --- /dev/null +++ b/autoconf-archive/autoconf-archive-2024.10.16-fix-config-status.patch @@ -0,0 +1,77 @@ +diff --git a/configure b/configure +index 5b97f4c..8f6be19 100755 +--- a/configure ++++ b/configure +@@ -612,8 +612,6 @@ PACKAGE_URL='https://www.gnu.org/software/autoconf-archive/' + ac_unique_file="doc/autoconf-archive.texi" + ac_subst_vars='LTLIBOBJS + LIBOBJS +-TEXIFILES +-M4FILES + SED + AM_BACKSLASH + AM_DEFAULT_VERBOSITY +@@ -2567,10 +2565,8 @@ printf "%s\n" "$ac_cv_path_SED" >&6; } + rm -f conftest.sed + + +-M4FILES="m4/ax_absolute_header.m4 m4/ax_ac_append_to_file.m4 m4/ax_ac_print_to_file.m4 m4/ax_add_am_macro.m4 m4/ax_add_am_macro_static.m4 m4/ax_add_am_trilinos_makefile_export.m4 m4/ax_add_fortify_source.m4 m4/ax_add_recursive_am_macro.m4 m4/ax_add_recursive_am_macro_static.m4 m4/ax_afs.m4 m4/ax_am_jobserver.m4 m4/ax_am_macros.m4 m4/ax_am_macros_static.m4 m4/ax_am_override_var.m4 m4/ax_append_compile_flags.m4 m4/ax_append_flag.m4 m4/ax_append_link_flags.m4 m4/ax_append_to_file.m4 m4/ax_arg_with_path_style.m4 m4/ax_asm_inline.m4 m4/ax_at_check_pattern.m4 m4/ax_auto_include_headers.m4 m4/ax_berkeley_db.m4 m4/ax_berkeley_db_cxx.m4 m4/ax_blas.m4 m4/ax_blas_f77_func.m4 m4/ax_boost_asio.m4 m4/ax_boost_atomic.m4 m4/ax_boost_base.m4 m4/ax_boost_chrono.m4 m4/ax_boost_context.m4 m4/ax_boost_coroutine.m4 m4/ax_boost_date_time.m4 m4/ax_boost_filesystem.m4 m4/ax_boost_iostreams.m4 m4/ax_boost_json.m4 m4/ax_boost_locale.m4 m4/ax_boost_log.m4 m4/ax_boost_log_setup.m4 m4/ax_boost_process.m4 m4/ax_boost_program_options.m4 m4/ax_boost_python.m4 m4/ax_boost_random.m4 m4/ax_boost_regex.m4 m4/ax_boost_serialization.m4 m4/ax_boost_signals.m4 m4/ax_boost_system.m4 m4/ax_boost_test_exec_monitor.m4 m4/ax_boost_thread.m4 m4/ax_boost_unit_test_framework.m4 m4/ax_boost_wave.m4 m4/ax_boost_wserialization.m4 m4/ax_build_date_epoch.m4 m4/ax_c99_inline.m4 m4/ax_c___attribute__.m4 m4/ax_c_arithmetic_rshift.m4 m4/ax_c_compile_value.m4 m4/ax_c_declare_block.m4 m4/ax_c_float_words_bigendian.m4 m4/ax_c_long_long.m4 m4/ax_c_referenceable_passed_va_list.m4 m4/ax_c_restrict.m4 m4/ax_c_var_func.m4 m4/ax_cache_size.m4 m4/ax_caolan_check_package.m4 m4/ax_caolan_search_package.m4 m4/ax_cc_attrcommon.m4 m4/ax_cc_for_build.m4 m4/ax_cc_maxopt.m4 m4/ax_cc_tentdef.m4 m4/ax_cf_ebcdic.m4 m4/ax_cflags_aix_option.m4 m4/ax_cflags_force_c89.m4 m4/ax_cflags_hpux_option.m4 m4/ax_cflags_irix_option.m4 m4/ax_cflags_no_writable_strings.m4 m4/ax_cflags_strict_prototypes.m4 m4/ax_cflags_sun_option.m4 m4/ax_cflags_warn_all.m4 m4/ax_check_aligned_access_required.m4 m4/ax_check_allocated_ctime.m4 m4/ax_check_awk__v.m4 m4/ax_check_awk__x_escapes.m4 m4/ax_check_awk_and.m4 m4/ax_check_awk_argind.m4 m4/ax_check_awk_array_delete.m4 m4/ax_check_awk_array_delete_elem.m4 m4/ax_check_awk_array_in.m4 m4/ax_check_awk_asort.m4 m4/ax_check_awk_asorti.m4 m4/ax_check_awk_associative_array.m4 m4/ax_check_awk_atan2.m4 m4/ax_check_awk_compl.m4 m4/ax_check_awk_conditional_expression.m4 m4/ax_check_awk_cos.m4 m4/ax_check_awk_environ.m4 m4/ax_check_awk_errno.m4 m4/ax_check_awk_exit.m4 m4/ax_check_awk_exp.m4 m4/ax_check_awk_gensub.m4 m4/ax_check_awk_getline.m4 m4/ax_check_awk_gsub.m4 m4/ax_check_awk_ignorecase.m4 m4/ax_check_awk_index.m4 m4/ax_check_awk_int.m4 m4/ax_check_awk_length.m4 m4/ax_check_awk_log.m4 m4/ax_check_awk_lshift.m4 m4/ax_check_awk_match_2parms.m4 m4/ax_check_awk_match_3parms.m4 m4/ax_check_awk_operator_multiply_multiply.m4 m4/ax_check_awk_operator_square.m4 m4/ax_check_awk_or.m4 m4/ax_check_awk_printf.m4 m4/ax_check_awk_rand.m4 m4/ax_check_awk_rshift.m4 m4/ax_check_awk_sin.m4 m4/ax_check_awk_split.m4 m4/ax_check_awk_sprintf.m4 m4/ax_check_awk_sqrt.m4 m4/ax_check_awk_srand.m4 m4/ax_check_awk_strftime.m4 m4/ax_check_awk_strtonum.m4 m4/ax_check_awk_sub.m4 m4/ax_check_awk_substr.m4 m4/ax_check_awk_system.m4 m4/ax_check_awk_systime.m4 m4/ax_check_awk_tolower.m4 m4/ax_check_awk_toupper.m4 m4/ax_check_awk_user_defined_functions.m4 m4/ax_check_awk_var_regexp.m4 m4/ax_check_awk_variable_value_pairs.m4 m4/ax_check_awk_xor.m4 m4/ax_check_class.m4 m4/ax_check_classpath.m4 m4/ax_check_compile_flag.m4 m4/ax_check_define.m4 m4/ax_check_docbook_dtd.m4 m4/ax_check_docbook_xslt.m4 m4/ax_check_docbook_xslt_min.m4 m4/ax_check_dos_filesys.m4 m4/ax_check_enable_debug.m4 m4/ax_check_func_in.m4 m4/ax_check_gd.m4 m4/ax_check_gir_symbols_gjs.m4 m4/ax_check_girs_gjs.m4 m4/ax_check_gl.m4 m4/ax_check_glu.m4 m4/ax_check_glut.m4 m4/ax_check_glx.m4 m4/ax_check_gnu_make.m4 m4/ax_check_icu.m4 m4/ax_check_java_home.m4 m4/ax_check_java_plugin.m4 m4/ax_check_junit.m4 m4/ax_check_library.m4 m4/ax_check_link_flag.m4 m4/ax_check_mysql.m4 m4/ax_check_mysql_db.m4 m4/ax_check_mysqlr.m4 m4/ax_check_off64_t.m4 m4/ax_check_openssl.m4 m4/ax_check_page_aligned_malloc.m4 m4/ax_check_pathfind.m4 m4/ax_check_pathname_style.m4 m4/ax_check_pcre2.m4 m4/ax_check_pgsql_db.m4 m4/ax_check_posix_regcomp.m4 m4/ax_check_posix_sysinfo.m4 m4/ax_check_postgres_db.m4 m4/ax_check_preproc_flag.m4 m4/ax_check_rqrd_class.m4 m4/ax_check_sign.m4 m4/ax_check_strcspn.m4 m4/ax_check_strftime.m4 m4/ax_check_struct_for.m4 m4/ax_check_symbol.m4 m4/ax_check_sys_siglist.m4 m4/ax_check_typedef.m4 m4/ax_check_uname_syscall.m4 m4/ax_check_user.m4 m4/ax_check_vscript.m4 m4/ax_check_x86_features.m4 m4/ax_check_zlib.m4 m4/ax_code_coverage.m4 m4/ax_compare_version.m4 m4/ax_compile_check_sizeof.m4 m4/ax_compiler_flags.m4 m4/ax_compiler_flags_cflags.m4 m4/ax_compiler_flags_cxxflags.m4 m4/ax_compiler_flags_gir.m4 m4/ax_compiler_flags_ldflags.m4 m4/ax_compiler_vendor.m4 m4/ax_compiler_version.m4 m4/ax_compute_relative_paths.m4 m4/ax_compute_standard_relative_paths.m4 m4/ax_cond_with_level.m4 m4/ax_config_feature.m4 m4/ax_configure_args.m4 m4/ax_count_cpus.m4 m4/ax_cpu_freq.m4 m4/ax_cpu_vendor.m4 m4/ax_create_generic_config.m4 m4/ax_create_pkgconfig_info.m4 m4/ax_create_stdint_h.m4 m4/ax_create_target_h.m4 m4/ax_cvs.m4 m4/ax_cxx_bool.m4 m4/ax_cxx_compile_stdcxx.m4 m4/ax_cxx_compile_stdcxx_0x.m4 m4/ax_cxx_compile_stdcxx_11.m4 m4/ax_cxx_compile_stdcxx_14.m4 m4/ax_cxx_compile_stdcxx_17.m4 m4/ax_cxx_complex_math_in_namespace_std.m4 m4/ax_cxx_const_cast.m4 m4/ax_cxx_cppflags_std_lang.m4 m4/ax_cxx_cxxflags_std_lang.m4 m4/ax_cxx_default_template_parameters.m4 m4/ax_cxx_delete_method.m4 m4/ax_cxx_dtor_after_atexit.m4 m4/ax_cxx_dynamic_cast.m4 m4/ax_cxx_enum_computations.m4 m4/ax_cxx_enum_computations_with_cast.m4 m4/ax_cxx_erase_iterator_type.m4 m4/ax_cxx_exceptions.m4 m4/ax_cxx_explicit.m4 m4/ax_cxx_explicit_instantiations.m4 m4/ax_cxx_explicit_template_function_qualification.m4 m4/ax_cxx_extern_template.m4 m4/ax_cxx_full_specialization_syntax.m4 m4/ax_cxx_function_nontype_parameters.m4 m4/ax_cxx_function_try_blocks.m4 m4/ax_cxx_gcc_abi_demangle.m4 m4/ax_cxx_gnucxx_hashmap.m4 m4/ax_cxx_have_bad_function_call.m4 m4/ax_cxx_have_bind.m4 m4/ax_cxx_have_bit_and.m4 m4/ax_cxx_have_bit_or.m4 m4/ax_cxx_have_bit_xor.m4 m4/ax_cxx_have_complex.m4 m4/ax_cxx_have_complex_math1.m4 m4/ax_cxx_have_complex_math2.m4 m4/ax_cxx_have_cref.m4 m4/ax_cxx_have_empty_iostream.m4 m4/ax_cxx_have_ext_hash_map.m4 m4/ax_cxx_have_ext_hash_set.m4 m4/ax_cxx_have_ext_slist.m4 m4/ax_cxx_have_freeze_sstream.m4 m4/ax_cxx_have_function.m4 m4/ax_cxx_have_hash.m4 m4/ax_cxx_have_ieee_math.m4 m4/ax_cxx_have_is_bind_expression.m4 m4/ax_cxx_have_is_placeholder.m4 m4/ax_cxx_have_koenig_lookup.m4 m4/ax_cxx_have_long_long_for_iostream.m4 m4/ax_cxx_have_mem_fn.m4 m4/ax_cxx_have_numeric_limits.m4 m4/ax_cxx_have_placeholders.m4 m4/ax_cxx_have_ref.m4 m4/ax_cxx_have_reference_wrapper.m4 m4/ax_cxx_have_sstream.m4 m4/ax_cxx_have_std.m4 m4/ax_cxx_have_stl.m4 m4/ax_cxx_have_string_push_back.m4 m4/ax_cxx_have_system_v_math.m4 m4/ax_cxx_have_valarray.m4 m4/ax_cxx_have_vector_at.m4 m4/ax_cxx_header_pre_stdcxx.m4 m4/ax_cxx_header_stdcxx_0x.m4 m4/ax_cxx_header_stdcxx_98.m4 m4/ax_cxx_header_stdcxx_tr1.m4 m4/ax_cxx_header_tr1_unordered_map.m4 m4/ax_cxx_header_tr1_unordered_set.m4 m4/ax_cxx_header_unordered_map.m4 m4/ax_cxx_header_unordered_set.m4 m4/ax_cxx_ldflags_std_lang.m4 m4/ax_cxx_member_constants.m4 m4/ax_cxx_member_templates.m4 m4/ax_cxx_member_templates_outside_class.m4 m4/ax_cxx_mutable.m4 m4/ax_cxx_namespace_std.m4 m4/ax_cxx_namespaces.m4 m4/ax_cxx_new_for_scoping.m4 m4/ax_cxx_old_for_scoping.m4 m4/ax_cxx_partial_ordering.m4 m4/ax_cxx_partial_specialization.m4 m4/ax_cxx_reinterpret_cast.m4 m4/ax_cxx_restrict_this.m4 m4/ax_cxx_rtti.m4 m4/ax_cxx_rvalue_references.m4 m4/ax_cxx_static_cast.m4 m4/ax_cxx_stlport_hashmap.m4 m4/ax_cxx_template_keyword_qualifier.m4 m4/ax_cxx_template_qualified_base_class.m4 m4/ax_cxx_template_qualified_return_type.m4 m4/ax_cxx_template_scoped_argument_matching.m4 m4/ax_cxx_templates.m4 m4/ax_cxx_templates_as_template_arguments.m4 m4/ax_cxx_typename.m4 m4/ax_cxx_use_numtrait.m4 m4/ax_cxx_var_prettyfunc.m4 m4/ax_cxx_verbose_terminate_handler.m4 m4/ax_czmq.m4 m4/ax_decl_wchar_max.m4 m4/ax_define_integer_bits.m4 m4/ax_define_sub_path.m4 m4/ax_dirname.m4 m4/ax_dist_msi.m4 m4/ax_dist_rpm.m4 m4/ax_dll_string.m4 m4/ax_elisp.m4 m4/ax_enable_builddir.m4 m4/ax_execinfo.m4 m4/ax_expand_prefix.m4 m4/ax_ext.m4 m4/ax_ext_check_header.m4 m4/ax_ext_have_lib.m4 m4/ax_extend_srcdir.m4 m4/ax_extra_dist.m4 m4/ax_f77_cmain_fflags.m4 m4/ax_f90_header.m4 m4/ax_f90_internal_headmod.m4 m4/ax_f90_library.m4 m4/ax_f90_library_setup.m4 m4/ax_f90_module.m4 m4/ax_f90_module_extension.m4 m4/ax_f90_module_flag.m4 m4/ax_fc_check_define.m4 m4/ax_file_escapes.m4 m4/ax_find_hamcrest.m4 m4/ax_find_junit.m4 m4/ax_find_scala_stdlib.m4 m4/ax_forceinline.m4 m4/ax_func_accept_argtypes.m4 m4/ax_func_getopt_long.m4 m4/ax_func_memmove.m4 m4/ax_func_mkdir.m4 m4/ax_func_posix_memalign.m4 m4/ax_func_snprintf.m4 m4/ax_func_which_gethostbyaddr_r.m4 m4/ax_func_which_gethostbyname_r.m4 m4/ax_func_which_gethostent_r.m4 m4/ax_func_which_getservbyname_r.m4 m4/ax_gcc_archflag.m4 m4/ax_gcc_builtin.m4 m4/ax_gcc_const_call.m4 m4/ax_gcc_func_attribute.m4 m4/ax_gcc_lib.m4 m4/ax_gcc_libgcc_eh.m4 m4/ax_gcc_libsupcxx.m4 m4/ax_gcc_malloc_call.m4 m4/ax_gcc_var_attribute.m4 m4/ax_gcc_warn_unused_result.m4 m4/ax_gcc_x86_avx_xgetbv.m4 m4/ax_gcc_x86_cpu_supports.m4 m4/ax_gcc_x86_cpuid.m4 m4/ax_generate_changelog.m4 m4/ax_gnu_autotest.m4 m4/ax_have_adns.m4 m4/ax_have_epoll.m4 m4/ax_have_poll.m4 m4/ax_have_qt.m4 m4/ax_have_select.m4 m4/ax_include_strcasecmp.m4 m4/ax_install_files.m4 m4/ax_int128.m4 m4/ax_is_release.m4 m4/ax_java_check_class.m4 m4/ax_java_options.m4 m4/ax_jni_include_dir.m4 m4/ax_lapack.m4 m4/ax_lib_beecrypt.m4 m4/ax_lib_cgal_core.m4 m4/ax_lib_crypto.m4 m4/ax_lib_curl.m4 m4/ax_lib_ev.m4 m4/ax_lib_expat.m4 m4/ax_lib_firebird.m4 m4/ax_lib_gcrypt.m4 m4/ax_lib_gdal.m4 m4/ax_lib_hdf5.m4 m4/ax_lib_id3.m4 m4/ax_lib_libkml.m4 m4/ax_lib_metis.m4 m4/ax_lib_mysql.m4 m4/ax_lib_mysqlcppconn.m4 m4/ax_lib_netcdf4.m4 m4/ax_lib_nettle.m4 m4/ax_lib_nokalva.m4 m4/ax_lib_oracle_occi.m4 m4/ax_lib_oracle_oci.m4 m4/ax_lib_orbit2.m4 m4/ax_lib_postgresql.m4 m4/ax_lib_readline.m4 m4/ax_lib_samtools.m4 m4/ax_lib_socket_nsl.m4 m4/ax_lib_sqlite3.m4 m4/ax_lib_tabix.m4 m4/ax_lib_taglib.m4 m4/ax_lib_trace.m4 m4/ax_lib_upnp.m4 m4/ax_lib_wad.m4 m4/ax_lib_xalan.m4 m4/ax_lib_xerces.m4 m4/ax_lib_xml_security.m4 m4/ax_libgcj_jar.m4 m4/ax_libtoolize_cflags.m4 m4/ax_llvm.m4 m4/ax_lua.m4 m4/ax_luarocks_rock.m4 m4/ax_maintainer_mode_auto_silent.m4 m4/ax_missing_prog.m4 m4/ax_mpi.m4 m4/ax_mpip.m4 m4/ax_ms_cpprest.m4 m4/ax_need_awk.m4 m4/ax_normalize_path.m4 m4/ax_not_enable_frame_pointer.m4 m4/ax_numeric_namedlevel.m4 m4/ax_open62541_check_h.m4 m4/ax_open62541_check_lib.m4 m4/ax_open62541_path.m4 m4/ax_openmp.m4 m4/ax_patch_libtool_changing_cmds_ifs.m4 m4/ax_path_bdb.m4 m4/ax_path_generic.m4 m4/ax_path_lib_pcre.m4 m4/ax_path_milter.m4 m4/ax_path_missing.m4 m4/ax_perl_ext.m4 m4/ax_perl_ext_flags.m4 m4/ax_perl_module_version.m4 m4/ax_pgsql_priv_root.m4 m4/ax_pkg_check_modules.m4 m4/ax_pkg_mico.m4 m4/ax_pkg_swig.m4 m4/ax_prefix_config_h.m4 m4/ax_prepend_flag.m4 m4/ax_print_to_file.m4 m4/ax_printf_size_t.m4 m4/ax_prog_apache.m4 m4/ax_prog_bison.m4 m4/ax_prog_bison_version.m4 m4/ax_prog_cc_char_subscripts.m4 m4/ax_prog_cc_for_build.m4 m4/ax_prog_cc_mpi.m4 m4/ax_prog_cp_s.m4 m4/ax_prog_crontab.m4 m4/ax_prog_cxx_for_build.m4 m4/ax_prog_cxx_mpi.m4 m4/ax_prog_date.m4 m4/ax_prog_dotnetcore_version.m4 m4/ax_prog_doxygen.m4 m4/ax_prog_emacs.m4 m4/ax_prog_f77_mpi.m4 m4/ax_prog_fasm.m4 m4/ax_prog_fasm_opt.m4 m4/ax_prog_fc_mpi.m4 m4/ax_prog_fig2dev.m4 m4/ax_prog_flex.m4 m4/ax_prog_flex_version.m4 m4/ax_prog_gjs.m4 m4/ax_prog_guile_version.m4 m4/ax_prog_haxe_version.m4 m4/ax_prog_help2man.m4 m4/ax_prog_hla.m4 m4/ax_prog_hla_opt.m4 m4/ax_prog_httpd.m4 m4/ax_prog_jar.m4 m4/ax_prog_java.m4 m4/ax_prog_java_cc.m4 m4/ax_prog_java_works.m4 m4/ax_prog_javac.m4 m4/ax_prog_javac_works.m4 m4/ax_prog_javadoc.m4 m4/ax_prog_javah.m4 m4/ax_prog_masm.m4 m4/ax_prog_masm_opt.m4 m4/ax_prog_md5sum.m4 m4/ax_prog_modprobe.m4 m4/ax_prog_mysql.m4 m4/ax_prog_mysqladmin.m4 m4/ax_prog_mysqld.m4 m4/ax_prog_mysqlimport.m4 m4/ax_prog_mysqlshow.m4 m4/ax_prog_nasm.m4 m4/ax_prog_nasm_opt.m4 m4/ax_prog_perl_modules.m4 m4/ax_prog_perl_version.m4 m4/ax_prog_pgclient.m4 m4/ax_prog_python_version.m4 m4/ax_prog_robot.m4 m4/ax_prog_ruby_version.m4 m4/ax_prog_scala.m4 m4/ax_prog_scalac.m4 m4/ax_prog_scp.m4 m4/ax_prog_splint.m4 m4/ax_prog_ssh.m4 m4/ax_prog_tasm.m4 m4/ax_prog_tasm_opt.m4 m4/ax_prog_tcl.m4 m4/ax_prog_xsltproc.m4 m4/ax_prog_yasm.m4 m4/ax_prog_yasm_opt.m4 m4/ax_prototype.m4 m4/ax_prototype_accept.m4 m4/ax_prototype_getsockname.m4 m4/ax_prototype_setsockopt.m4 m4/ax_pthread.m4 m4/ax_python.m4 m4/ax_python_config_var.m4 m4/ax_python_devel.m4 m4/ax_python_embed.m4 m4/ax_python_module.m4 m4/ax_python_module_version.m4 m4/ax_r_package.m4 m4/ax_recursive_eval.m4 m4/ax_require_defined.m4 m4/ax_require_one_func.m4 m4/ax_restore_flags.m4 m4/ax_restore_flags_with_prefix.m4 m4/ax_rpm_init.m4 m4/ax_ruby_devel.m4 m4/ax_ruby_ext.m4 m4/ax_save_flags.m4 m4/ax_save_flags_with_prefix.m4 m4/ax_set_default_paths_system.m4 m4/ax_short_sleep.m4 m4/ax_silent_mode.m4 m4/ax_sip_devel.m4 m4/ax_spec_file.m4 m4/ax_spec_package_version.m4 m4/ax_split_version.m4 m4/ax_string_strcasecmp.m4 m4/ax_strings_strcasecmp.m4 m4/ax_struct_semun.m4 m4/ax_subdir_files.m4 m4/ax_subdirs_configure.m4 m4/ax_subst_with.m4 m4/ax_swig_enable_cxx.m4 m4/ax_swig_multi_module_support.m4 m4/ax_swig_python.m4 m4/ax_switch_flags.m4 m4/ax_sys_dev_poll.m4 m4/ax_sys_largefile_sensitive.m4 m4/ax_sys_perlsharpbang.m4 m4/ax_sys_weak_alias.m4 m4/ax_sysv_ipc.m4 m4/ax_tls.m4 m4/ax_trilinos_amesos.m4 m4/ax_trilinos_base.m4 m4/ax_trilinos_epetra.m4 m4/ax_trilinos_epetraext.m4 m4/ax_trilinos_epetraext_hdf5.m4 m4/ax_trilinos_rtop.m4 m4/ax_trilinos_rythmos.m4 m4/ax_trilinos_teuchos.m4 m4/ax_trilinos_thyra.m4 m4/ax_trilinos_thyra_epetra.m4 m4/ax_trilinos_thyra_epetraext.m4 m4/ax_try_awk_anyout.m4 m4/ax_try_awk_expout.m4 m4/ax_try_compile_java.m4 m4/ax_try_run_java.m4 m4/ax_type_socklen_t.m4 m4/ax_upload.m4 m4/ax_valgrind_check.m4 m4/ax_var_pop.m4 m4/ax_var_push.m4 m4/ax_var_timezone_externals.m4 m4/ax_very_nice.m4 m4/ax_warning_default_aclocaldir.m4 m4/ax_warning_default_pkgconfig.m4 m4/ax_wint_t.m4 m4/ax_with_apxs.m4 m4/ax_with_build_path.m4 m4/ax_with_curses.m4 m4/ax_with_curses_extra.m4 m4/ax_with_dmalloc.m4 m4/ax_with_mpatrol.m4 m4/ax_with_prog.m4 m4/ax_xercesc.m4 m4/ax_xsdcxx.m4 m4/ax_xtra_classpath.m4 m4/ax_zmq.m4 m4/ax_zoneinfo.m4" + + +-TEXIFILES="ax_absolute_header.texi ax_ac_append_to_file.texi ax_ac_print_to_file.texi ax_add_am_macro.texi ax_add_am_macro_static.texi ax_add_am_trilinos_makefile_export.texi ax_add_fortify_source.texi ax_add_recursive_am_macro.texi ax_add_recursive_am_macro_static.texi ax_afs.texi ax_am_jobserver.texi ax_am_macros.texi ax_am_macros_static.texi ax_am_override_var.texi ax_append_compile_flags.texi ax_append_flag.texi ax_append_link_flags.texi ax_append_to_file.texi ax_arg_with_path_style.texi ax_asm_inline.texi ax_at_check_pattern.texi ax_auto_include_headers.texi ax_berkeley_db.texi ax_berkeley_db_cxx.texi ax_blas.texi ax_blas_f77_func.texi ax_boost_asio.texi ax_boost_atomic.texi ax_boost_base.texi ax_boost_chrono.texi ax_boost_context.texi ax_boost_coroutine.texi ax_boost_date_time.texi ax_boost_filesystem.texi ax_boost_iostreams.texi ax_boost_json.texi ax_boost_locale.texi ax_boost_log.texi ax_boost_log_setup.texi ax_boost_process.texi ax_boost_program_options.texi ax_boost_python.texi ax_boost_random.texi ax_boost_regex.texi ax_boost_serialization.texi ax_boost_signals.texi ax_boost_system.texi ax_boost_test_exec_monitor.texi ax_boost_thread.texi ax_boost_unit_test_framework.texi ax_boost_wave.texi ax_boost_wserialization.texi ax_build_date_epoch.texi ax_c99_inline.texi ax_c___attribute__.texi ax_c_arithmetic_rshift.texi ax_c_compile_value.texi ax_c_declare_block.texi ax_c_float_words_bigendian.texi ax_c_long_long.texi ax_c_referenceable_passed_va_list.texi ax_c_restrict.texi ax_c_var_func.texi ax_cache_size.texi ax_caolan_check_package.texi ax_caolan_search_package.texi ax_cc_attrcommon.texi ax_cc_for_build.texi ax_cc_maxopt.texi ax_cc_tentdef.texi ax_cf_ebcdic.texi ax_cflags_aix_option.texi ax_cflags_force_c89.texi ax_cflags_hpux_option.texi ax_cflags_irix_option.texi ax_cflags_no_writable_strings.texi ax_cflags_strict_prototypes.texi ax_cflags_sun_option.texi ax_cflags_warn_all.texi ax_check_aligned_access_required.texi ax_check_allocated_ctime.texi ax_check_awk__v.texi ax_check_awk__x_escapes.texi ax_check_awk_and.texi ax_check_awk_argind.texi ax_check_awk_array_delete.texi ax_check_awk_array_delete_elem.texi ax_check_awk_array_in.texi ax_check_awk_asort.texi ax_check_awk_asorti.texi ax_check_awk_associative_array.texi ax_check_awk_atan2.texi ax_check_awk_compl.texi ax_check_awk_conditional_expression.texi ax_check_awk_cos.texi ax_check_awk_environ.texi ax_check_awk_errno.texi ax_check_awk_exit.texi ax_check_awk_exp.texi ax_check_awk_gensub.texi ax_check_awk_getline.texi ax_check_awk_gsub.texi ax_check_awk_ignorecase.texi ax_check_awk_index.texi ax_check_awk_int.texi ax_check_awk_length.texi ax_check_awk_log.texi ax_check_awk_lshift.texi ax_check_awk_match_2parms.texi ax_check_awk_match_3parms.texi ax_check_awk_operator_multiply_multiply.texi ax_check_awk_operator_square.texi ax_check_awk_or.texi ax_check_awk_printf.texi ax_check_awk_rand.texi ax_check_awk_rshift.texi ax_check_awk_sin.texi ax_check_awk_split.texi ax_check_awk_sprintf.texi ax_check_awk_sqrt.texi ax_check_awk_srand.texi ax_check_awk_strftime.texi ax_check_awk_strtonum.texi ax_check_awk_sub.texi ax_check_awk_substr.texi ax_check_awk_system.texi ax_check_awk_systime.texi ax_check_awk_tolower.texi ax_check_awk_toupper.texi ax_check_awk_user_defined_functions.texi ax_check_awk_var_regexp.texi ax_check_awk_variable_value_pairs.texi ax_check_awk_xor.texi ax_check_class.texi ax_check_classpath.texi ax_check_compile_flag.texi ax_check_define.texi ax_check_docbook_dtd.texi ax_check_docbook_xslt.texi ax_check_docbook_xslt_min.texi ax_check_dos_filesys.texi ax_check_enable_debug.texi ax_check_func_in.texi ax_check_gd.texi ax_check_gir_symbols_gjs.texi ax_check_girs_gjs.texi ax_check_gl.texi ax_check_glu.texi ax_check_glut.texi ax_check_glx.texi ax_check_gnu_make.texi ax_check_icu.texi ax_check_java_home.texi ax_check_java_plugin.texi ax_check_junit.texi ax_check_library.texi ax_check_link_flag.texi ax_check_mysql.texi ax_check_mysql_db.texi ax_check_mysqlr.texi ax_check_off64_t.texi ax_check_openssl.texi ax_check_page_aligned_malloc.texi ax_check_pathfind.texi ax_check_pathname_style.texi ax_check_pcre2.texi ax_check_pgsql_db.texi ax_check_posix_regcomp.texi ax_check_posix_sysinfo.texi ax_check_postgres_db.texi ax_check_preproc_flag.texi ax_check_rqrd_class.texi ax_check_sign.texi ax_check_strcspn.texi ax_check_strftime.texi ax_check_struct_for.texi ax_check_symbol.texi ax_check_sys_siglist.texi ax_check_typedef.texi ax_check_uname_syscall.texi ax_check_user.texi ax_check_vscript.texi ax_check_x86_features.texi ax_check_zlib.texi ax_code_coverage.texi ax_compare_version.texi ax_compile_check_sizeof.texi ax_compiler_flags.texi ax_compiler_flags_cflags.texi ax_compiler_flags_cxxflags.texi ax_compiler_flags_gir.texi ax_compiler_flags_ldflags.texi ax_compiler_vendor.texi ax_compiler_version.texi ax_compute_relative_paths.texi ax_compute_standard_relative_paths.texi ax_cond_with_level.texi ax_config_feature.texi ax_configure_args.texi ax_count_cpus.texi ax_cpu_freq.texi ax_cpu_vendor.texi ax_create_generic_config.texi ax_create_pkgconfig_info.texi ax_create_stdint_h.texi ax_create_target_h.texi ax_cvs.texi ax_cxx_bool.texi ax_cxx_compile_stdcxx.texi ax_cxx_compile_stdcxx_0x.texi ax_cxx_compile_stdcxx_11.texi ax_cxx_compile_stdcxx_14.texi ax_cxx_compile_stdcxx_17.texi ax_cxx_complex_math_in_namespace_std.texi ax_cxx_const_cast.texi ax_cxx_cppflags_std_lang.texi ax_cxx_cxxflags_std_lang.texi ax_cxx_default_template_parameters.texi ax_cxx_delete_method.texi ax_cxx_dtor_after_atexit.texi ax_cxx_dynamic_cast.texi ax_cxx_enum_computations.texi ax_cxx_enum_computations_with_cast.texi ax_cxx_erase_iterator_type.texi ax_cxx_exceptions.texi ax_cxx_explicit.texi ax_cxx_explicit_instantiations.texi ax_cxx_explicit_template_function_qualification.texi ax_cxx_extern_template.texi ax_cxx_full_specialization_syntax.texi ax_cxx_function_nontype_parameters.texi ax_cxx_function_try_blocks.texi ax_cxx_gcc_abi_demangle.texi ax_cxx_gnucxx_hashmap.texi ax_cxx_have_bad_function_call.texi ax_cxx_have_bind.texi ax_cxx_have_bit_and.texi ax_cxx_have_bit_or.texi ax_cxx_have_bit_xor.texi ax_cxx_have_complex.texi ax_cxx_have_complex_math1.texi ax_cxx_have_complex_math2.texi ax_cxx_have_cref.texi ax_cxx_have_empty_iostream.texi ax_cxx_have_ext_hash_map.texi ax_cxx_have_ext_hash_set.texi ax_cxx_have_ext_slist.texi ax_cxx_have_freeze_sstream.texi ax_cxx_have_function.texi ax_cxx_have_hash.texi ax_cxx_have_ieee_math.texi ax_cxx_have_is_bind_expression.texi ax_cxx_have_is_placeholder.texi ax_cxx_have_koenig_lookup.texi ax_cxx_have_long_long_for_iostream.texi ax_cxx_have_mem_fn.texi ax_cxx_have_numeric_limits.texi ax_cxx_have_placeholders.texi ax_cxx_have_ref.texi ax_cxx_have_reference_wrapper.texi ax_cxx_have_sstream.texi ax_cxx_have_std.texi ax_cxx_have_stl.texi ax_cxx_have_string_push_back.texi ax_cxx_have_system_v_math.texi ax_cxx_have_valarray.texi ax_cxx_have_vector_at.texi ax_cxx_header_pre_stdcxx.texi ax_cxx_header_stdcxx_0x.texi ax_cxx_header_stdcxx_98.texi ax_cxx_header_stdcxx_tr1.texi ax_cxx_header_tr1_unordered_map.texi ax_cxx_header_tr1_unordered_set.texi ax_cxx_header_unordered_map.texi ax_cxx_header_unordered_set.texi ax_cxx_ldflags_std_lang.texi ax_cxx_member_constants.texi ax_cxx_member_templates.texi ax_cxx_member_templates_outside_class.texi ax_cxx_mutable.texi ax_cxx_namespace_std.texi ax_cxx_namespaces.texi ax_cxx_new_for_scoping.texi ax_cxx_old_for_scoping.texi ax_cxx_partial_ordering.texi ax_cxx_partial_specialization.texi ax_cxx_reinterpret_cast.texi ax_cxx_restrict_this.texi ax_cxx_rtti.texi ax_cxx_rvalue_references.texi ax_cxx_static_cast.texi ax_cxx_stlport_hashmap.texi ax_cxx_template_keyword_qualifier.texi ax_cxx_template_qualified_base_class.texi ax_cxx_template_qualified_return_type.texi ax_cxx_template_scoped_argument_matching.texi ax_cxx_templates.texi ax_cxx_templates_as_template_arguments.texi ax_cxx_typename.texi ax_cxx_use_numtrait.texi ax_cxx_var_prettyfunc.texi ax_cxx_verbose_terminate_handler.texi ax_czmq.texi ax_decl_wchar_max.texi ax_define_integer_bits.texi ax_define_sub_path.texi ax_dirname.texi ax_dist_msi.texi ax_dist_rpm.texi ax_dll_string.texi ax_elisp.texi ax_enable_builddir.texi ax_execinfo.texi ax_expand_prefix.texi ax_ext.texi ax_ext_check_header.texi ax_ext_have_lib.texi ax_extend_srcdir.texi ax_extra_dist.texi ax_f77_cmain_fflags.texi ax_f90_header.texi ax_f90_internal_headmod.texi ax_f90_library.texi ax_f90_library_setup.texi ax_f90_module.texi ax_f90_module_extension.texi ax_f90_module_flag.texi ax_fc_check_define.texi ax_file_escapes.texi ax_find_hamcrest.texi ax_find_junit.texi ax_find_scala_stdlib.texi ax_forceinline.texi ax_func_accept_argtypes.texi ax_func_getopt_long.texi ax_func_memmove.texi ax_func_mkdir.texi ax_func_posix_memalign.texi ax_func_snprintf.texi ax_func_which_gethostbyaddr_r.texi ax_func_which_gethostbyname_r.texi ax_func_which_gethostent_r.texi ax_func_which_getservbyname_r.texi ax_gcc_archflag.texi ax_gcc_builtin.texi ax_gcc_const_call.texi ax_gcc_func_attribute.texi ax_gcc_lib.texi ax_gcc_libgcc_eh.texi ax_gcc_libsupcxx.texi ax_gcc_malloc_call.texi ax_gcc_var_attribute.texi ax_gcc_warn_unused_result.texi ax_gcc_x86_avx_xgetbv.texi ax_gcc_x86_cpu_supports.texi ax_gcc_x86_cpuid.texi ax_generate_changelog.texi ax_gnu_autotest.texi ax_have_adns.texi ax_have_epoll.texi ax_have_poll.texi ax_have_qt.texi ax_have_select.texi ax_include_strcasecmp.texi ax_install_files.texi ax_int128.texi ax_is_release.texi ax_java_check_class.texi ax_java_options.texi ax_jni_include_dir.texi ax_lapack.texi ax_lib_beecrypt.texi ax_lib_cgal_core.texi ax_lib_crypto.texi ax_lib_curl.texi ax_lib_ev.texi ax_lib_expat.texi ax_lib_firebird.texi ax_lib_gcrypt.texi ax_lib_gdal.texi ax_lib_hdf5.texi ax_lib_id3.texi ax_lib_libkml.texi ax_lib_metis.texi ax_lib_mysql.texi ax_lib_mysqlcppconn.texi ax_lib_netcdf4.texi ax_lib_nettle.texi ax_lib_nokalva.texi ax_lib_oracle_occi.texi ax_lib_oracle_oci.texi ax_lib_orbit2.texi ax_lib_postgresql.texi ax_lib_readline.texi ax_lib_samtools.texi ax_lib_socket_nsl.texi ax_lib_sqlite3.texi ax_lib_tabix.texi ax_lib_taglib.texi ax_lib_trace.texi ax_lib_upnp.texi ax_lib_wad.texi ax_lib_xalan.texi ax_lib_xerces.texi ax_lib_xml_security.texi ax_libgcj_jar.texi ax_libtoolize_cflags.texi ax_llvm.texi ax_lua.texi ax_luarocks_rock.texi ax_maintainer_mode_auto_silent.texi ax_missing_prog.texi ax_mpi.texi ax_mpip.texi ax_ms_cpprest.texi ax_need_awk.texi ax_normalize_path.texi ax_not_enable_frame_pointer.texi ax_numeric_namedlevel.texi ax_open62541_check_h.texi ax_open62541_check_lib.texi ax_open62541_path.texi ax_openmp.texi ax_patch_libtool_changing_cmds_ifs.texi ax_path_bdb.texi ax_path_generic.texi ax_path_lib_pcre.texi ax_path_milter.texi ax_path_missing.texi ax_perl_ext.texi ax_perl_ext_flags.texi ax_perl_module_version.texi ax_pgsql_priv_root.texi ax_pkg_check_modules.texi ax_pkg_mico.texi ax_pkg_swig.texi ax_prefix_config_h.texi ax_prepend_flag.texi ax_print_to_file.texi ax_printf_size_t.texi ax_prog_apache.texi ax_prog_bison.texi ax_prog_bison_version.texi ax_prog_cc_char_subscripts.texi ax_prog_cc_for_build.texi ax_prog_cc_mpi.texi ax_prog_cp_s.texi ax_prog_crontab.texi ax_prog_cxx_for_build.texi ax_prog_cxx_mpi.texi ax_prog_date.texi ax_prog_dotnetcore_version.texi ax_prog_doxygen.texi ax_prog_emacs.texi ax_prog_f77_mpi.texi ax_prog_fasm.texi ax_prog_fasm_opt.texi ax_prog_fc_mpi.texi ax_prog_fig2dev.texi ax_prog_flex.texi ax_prog_flex_version.texi ax_prog_gjs.texi ax_prog_guile_version.texi ax_prog_haxe_version.texi ax_prog_help2man.texi ax_prog_hla.texi ax_prog_hla_opt.texi ax_prog_httpd.texi ax_prog_jar.texi ax_prog_java.texi ax_prog_java_cc.texi ax_prog_java_works.texi ax_prog_javac.texi ax_prog_javac_works.texi ax_prog_javadoc.texi ax_prog_javah.texi ax_prog_masm.texi ax_prog_masm_opt.texi ax_prog_md5sum.texi ax_prog_modprobe.texi ax_prog_mysql.texi ax_prog_mysqladmin.texi ax_prog_mysqld.texi ax_prog_mysqlimport.texi ax_prog_mysqlshow.texi ax_prog_nasm.texi ax_prog_nasm_opt.texi ax_prog_perl_modules.texi ax_prog_perl_version.texi ax_prog_pgclient.texi ax_prog_python_version.texi ax_prog_robot.texi ax_prog_ruby_version.texi ax_prog_scala.texi ax_prog_scalac.texi ax_prog_scp.texi ax_prog_splint.texi ax_prog_ssh.texi ax_prog_tasm.texi ax_prog_tasm_opt.texi ax_prog_tcl.texi ax_prog_xsltproc.texi ax_prog_yasm.texi ax_prog_yasm_opt.texi ax_prototype.texi ax_prototype_accept.texi ax_prototype_getsockname.texi ax_prototype_setsockopt.texi ax_pthread.texi ax_python.texi ax_python_config_var.texi ax_python_devel.texi ax_python_embed.texi ax_python_module.texi ax_python_module_version.texi ax_r_package.texi ax_recursive_eval.texi ax_require_defined.texi ax_require_one_func.texi ax_restore_flags.texi ax_restore_flags_with_prefix.texi ax_rpm_init.texi ax_ruby_devel.texi ax_ruby_ext.texi ax_save_flags.texi ax_save_flags_with_prefix.texi ax_set_default_paths_system.texi ax_short_sleep.texi ax_silent_mode.texi ax_sip_devel.texi ax_spec_file.texi ax_spec_package_version.texi ax_split_version.texi ax_string_strcasecmp.texi ax_strings_strcasecmp.texi ax_struct_semun.texi ax_subdir_files.texi ax_subdirs_configure.texi ax_subst_with.texi ax_swig_enable_cxx.texi ax_swig_multi_module_support.texi ax_swig_python.texi ax_switch_flags.texi ax_sys_dev_poll.texi ax_sys_largefile_sensitive.texi ax_sys_perlsharpbang.texi ax_sys_weak_alias.texi ax_sysv_ipc.texi ax_tls.texi ax_trilinos_amesos.texi ax_trilinos_base.texi ax_trilinos_epetra.texi ax_trilinos_epetraext.texi ax_trilinos_epetraext_hdf5.texi ax_trilinos_rtop.texi ax_trilinos_rythmos.texi ax_trilinos_teuchos.texi ax_trilinos_thyra.texi ax_trilinos_thyra_epetra.texi ax_trilinos_thyra_epetraext.texi ax_try_awk_anyout.texi ax_try_awk_expout.texi ax_try_compile_java.texi ax_try_run_java.texi ax_type_socklen_t.texi ax_upload.texi ax_valgrind_check.texi ax_var_pop.texi ax_var_push.texi ax_var_timezone_externals.texi ax_very_nice.texi ax_warning_default_aclocaldir.texi ax_warning_default_pkgconfig.texi ax_wint_t.texi ax_with_apxs.texi ax_with_build_path.texi ax_with_curses.texi ax_with_curses_extra.texi ax_with_dmalloc.texi ax_with_mpatrol.texi ax_with_prog.texi ax_xercesc.texi ax_xsdcxx.texi ax_xtra_classpath.texi ax_zmq.texi ax_zoneinfo.texi" + + + ac_config_files="$ac_config_files Makefile doc/Makefile" +diff --git a/Makefile.in b/Makefile.in +index be03111..d6c0d7e 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -269,7 +269,6 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ + LIBOBJS = @LIBOBJS@ + LIBS = @LIBS@ + LTLIBOBJS = @LTLIBOBJS@ +-M4FILES = @M4FILES@ + MAKEINFO = @MAKEINFO@ + MKDIR_P = @MKDIR_P@ + PACKAGE = @PACKAGE@ +@@ -329,7 +328,7 @@ top_srcdir = @top_srcdir@ + SUBDIRS = doc + dist_doc_DATA = AUTHORS COPYING COPYING.EXCEPTION README + aclocaldir = $(datadir)/aclocal +-dist_aclocal_DATA = $(M4FILES) ++dist_aclocal_DATA = $(sort $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/m4/*.m4))) + EXTRA_DIST = build-aux/git-version-gen build-aux/gitlog-to-changelog + all: all-recursive + +diff --git a/doc/Makefile.in b/doc/Makefile.in +index a0abe08..783e554 100644 +--- a/doc/Makefile.in ++++ b/doc/Makefile.in +@@ -227,7 +227,6 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ + LIBOBJS = @LIBOBJS@ + LIBS = @LIBS@ + LTLIBOBJS = @LTLIBOBJS@ +-M4FILES = @M4FILES@ + MAKEINFO = @MAKEINFO@ + MKDIR_P = @MKDIR_P@ + PACKAGE = @PACKAGE@ +@@ -242,7 +241,6 @@ SED = @SED@ + SET_MAKE = @SET_MAKE@ + SHELL = @SHELL@ + STRIP = @STRIP@ +-TEXIFILES = @TEXIFILES@ + VERSION = @VERSION@ + abs_builddir = @abs_builddir@ + abs_srcdir = @abs_srcdir@ +@@ -285,6 +283,11 @@ top_build_prefix = @top_build_prefix@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + CHAPTERS = introduction.texi downloads.texi contribute.texi fdl-1.3.texi ++TEXIFILES = $(sort $(patsubst $(srcdir)/%,%, \ ++ $(filter-out $(srcdir)/autoconf-archive.texi \ ++ $(srcdir)/all-macros.texi \ ++ $(addprefix $(srcdir)/,$(CHAPTERS)), \ ++ $(wildcard $(srcdir)/*.texi)))) + info_TEXINFOS = autoconf-archive.texi + EXTRA_DIST = $(TEXIFILES) $(CHAPTERS) all-macros.texi + all: all-am diff --git a/bsdsed/bsdsed-0.99.2-glibc-headers.patch b/bsdsed/bsdsed-0.99.2-glibc-headers.patch new file mode 100644 index 0000000..ded123d --- /dev/null +++ b/bsdsed/bsdsed-0.99.2-glibc-headers.patch @@ -0,0 +1,49 @@ +diff -Naur orig/bsdsed-0.99.2/Makefile mod/bsdsed-0.99.2/Makefile +--- a/Makefile 2021-06-27 13:43:27.000000000 -0500 ++++ b/Makefile 2026-05-26 02:06:54.688173361 -0500 +@@ -4,7 +4,7 @@ + BINDIR ?= $(PREFIX)/bin + DATADIR ?= $(PREFIX)/share + MANDIR ?= $(DATADIR)/man/man1 +-EXTRA_CFLAGS = -Wall -Wextra -I. -Dlint ++EXTRA_CFLAGS = -Wall -Wextra -I. -Dlint -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE + + OBJS = compile.o main.o misc.o process.o errc.o + +diff -Naur orig/bsdsed-0.99.2/sys/cdefs.h mod/bsdsed-0.99.2/sys/cdefs.h +--- a/sys/cdefs.h 2021-06-27 13:43:27.000000000 -0500 ++++ b/sys/cdefs.h 2026-05-26 02:06:33.401607906 -0500 +@@ -1,17 +1,33 @@ + #ifndef CDEFS_H + #define CDEFS_H + ++#if defined(__has_include_next) ++#if __has_include_next() ++#include_next ++#endif ++#elif defined(__GNUC__) ++#include_next ++#endif ++ + #define __FBSDID(x) + + /* other compat bits */ + ++#ifndef DEFFILEMODE + #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) ++#endif ++#ifndef ALLPERMS + #define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) ++#endif + + extern char *__progname; + ++#ifndef __unreachable + #define __unreachable() ++#endif ++#ifndef getprogname + #define getprogname() __progname ++#endif + + void errc(int status, int code, const char *format, ...); + diff --git a/bzip2/make.patch b/bzip2/make.patch new file mode 100644 index 0000000..1ac6e54 --- /dev/null +++ b/bzip2/make.patch @@ -0,0 +1,133 @@ +diff --git a/Makefile b/Makefile +index f8a1772..b3a442c 100644 +--- a/Makefile ++++ b/Makefile +@@ -15,13 +15,13 @@ + SHELL=/bin/sh + + # To assist in cross-compiling +-CC=gcc +-AR=ar +-RANLIB=ranlib ++CC ?= gcc ++AR ?= ar ++RANLIB ?= ranlib + LDFLAGS= + + BIGFILES=-D_FILE_OFFSET_BITS=64 +-CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) ++CFLAGS += -Wall -Winline -O2 $(BIGFILES) + + # Where you want it installed when you do 'make install' + PREFIX=/usr/local +@@ -70,43 +70,43 @@ test: bzip2 + @cat words3 + + install: bzip2 bzip2recover +- if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi +- if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi +- if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi +- if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi +- if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi +- cp -f bzip2 $(PREFIX)/bin/bzip2 +- cp -f bzip2 $(PREFIX)/bin/bunzip2 +- cp -f bzip2 $(PREFIX)/bin/bzcat +- cp -f bzip2recover $(PREFIX)/bin/bzip2recover +- chmod a+x $(PREFIX)/bin/bzip2 +- chmod a+x $(PREFIX)/bin/bunzip2 +- chmod a+x $(PREFIX)/bin/bzcat +- chmod a+x $(PREFIX)/bin/bzip2recover +- cp -f bzip2.1 $(PREFIX)/man/man1 +- chmod a+r $(PREFIX)/man/man1/bzip2.1 +- cp -f bzlib.h $(PREFIX)/include +- chmod a+r $(PREFIX)/include/bzlib.h +- cp -f libbz2.a $(PREFIX)/lib +- chmod a+r $(PREFIX)/lib/libbz2.a +- cp -f bzgrep $(PREFIX)/bin/bzgrep +- ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep +- ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep +- chmod a+x $(PREFIX)/bin/bzgrep +- cp -f bzmore $(PREFIX)/bin/bzmore +- ln -s -f $(PREFIX)/bin/bzmore $(PREFIX)/bin/bzless +- chmod a+x $(PREFIX)/bin/bzmore +- cp -f bzdiff $(PREFIX)/bin/bzdiff +- ln -s -f $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp +- chmod a+x $(PREFIX)/bin/bzdiff +- cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1 +- chmod a+r $(PREFIX)/man/man1/bzgrep.1 +- chmod a+r $(PREFIX)/man/man1/bzmore.1 +- chmod a+r $(PREFIX)/man/man1/bzdiff.1 +- echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzegrep.1 +- echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzfgrep.1 +- echo ".so man1/bzmore.1" > $(PREFIX)/man/man1/bzless.1 +- echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1 ++ if ( test ! -d $(DESTDIR)$(PREFIX)/bin ) ; then mkdir -p $(DESTDIR)$(PREFIX)/bin ; fi ++ if ( test ! -d $(DESTDIR)$(PREFIX)/lib ) ; then mkdir -p $(DESTDIR)$(PREFIX)/lib ; fi ++ if ( test ! -d $(DESTDIR)$(PREFIX)/man ) ; then mkdir -p $(DESTDIR)$(PREFIX)/man ; fi ++ if ( test ! -d $(DESTDIR)$(PREFIX)/man/man1 ) ; then mkdir -p $(DESTDIR)$(PREFIX)/man/man1 ; fi ++ if ( test ! -d $(DESTDIR)$(PREFIX)/include ) ; then mkdir -p $(DESTDIR)$(PREFIX)/include ; fi ++ cp -f bzip2 $(DESTDIR)$(PREFIX)/bin/bzip2 ++ cp -f bzip2 $(DESTDIR)$(PREFIX)/bin/bunzip2 ++ cp -f bzip2 $(DESTDIR)$(PREFIX)/bin/bzcat ++ cp -f bzip2recover $(DESTDIR)$(PREFIX)/bin/bzip2recover ++ chmod a+x $(DESTDIR)$(PREFIX)/bin/bzip2 ++ chmod a+x $(DESTDIR)$(PREFIX)/bin/bunzip2 ++ chmod a+x $(DESTDIR)$(PREFIX)/bin/bzcat ++ chmod a+x $(DESTDIR)$(PREFIX)/bin/bzip2recover ++ cp -f bzip2.1 $(DESTDIR)$(PREFIX)/man/man1 ++ chmod a+r $(DESTDIR)$(PREFIX)/man/man1/bzip2.1 ++ cp -f bzlib.h $(DESTDIR)$(PREFIX)/include ++ chmod a+r $(DESTDIR)$(PREFIX)/include/bzlib.h ++ cp -f libbz2.a $(DESTDIR)$(PREFIX)/lib ++ chmod a+r $(DESTDIR)$(PREFIX)/lib/libbz2.a ++ cp -f bzgrep $(DESTDIR)$(PREFIX)/bin/bzgrep ++ ln -s -f $(PREFIX)/bin/bzgrep $(DESTDIR)$(PREFIX)/bin/bzegrep ++ ln -s -f $(PREFIX)/bin/bzgrep $(DESTDIR)$(PREFIX)/bin/bzfgrep ++ chmod a+x $(DESTDIR)$(PREFIX)/bin/bzgrep ++ cp -f bzmore $(DESTDIR)$(PREFIX)/bin/bzmore ++ ln -s -f $(PREFIX)/bin/bzmore $(DESTDIR)$(PREFIX)/bin/bzless ++ chmod a+x $(DESTDIR)$(PREFIX)/bin/bzmore ++ cp -f bzdiff $(DESTDIR)$(PREFIX)/bin/bzdiff ++ ln -s -f $(PREFIX)/bin/bzdiff $(DESTDIR)$(PREFIX)/bin/bzcmp ++ chmod a+x $(DESTDIR)$(PREFIX)/bin/bzdiff ++ cp -f bzgrep.1 bzmore.1 bzdiff.1 $(DESTDIR)$(PREFIX)/man/man1 ++ chmod a+r $(DESTDIR)$(PREFIX)/man/man1/bzgrep.1 ++ chmod a+r $(DESTDIR)$(PREFIX)/man/man1/bzmore.1 ++ chmod a+r $(DESTDIR)$(PREFIX)/man/man1/bzdiff.1 ++ echo ".so man1/bzgrep.1" > $(DESTDIR)$(PREFIX)/man/man1/bzegrep.1 ++ echo ".so man1/bzgrep.1" > $(DESTDIR)$(PREFIX)/man/man1/bzfgrep.1 ++ echo ".so man1/bzmore.1" > $(DESTDIR)$(PREFIX)/man/man1/bzless.1 ++ echo ".so man1/bzdiff.1" > $(DESTDIR)$(PREFIX)/man/man1/bzcmp.1 + + clean: + rm -f *.o libbz2.a bzip2 bzip2recover \ +diff --git a/Makefile-libbz2_so b/Makefile-libbz2_so +index fb0f230..1b3a94d 100644 +--- a/Makefile-libbz2_so ++++ b/Makefile-libbz2_so +@@ -22,9 +22,9 @@ + + + SHELL=/bin/sh +-CC=gcc ++CC ?= gcc + BIGFILES=-D_FILE_OFFSET_BITS=64 +-CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES) ++CFLAGS += -fpic -fPIC -Wall -Winline $(BIGFILES) + + OBJS= blocksort.o \ + huffman.o \ +@@ -35,10 +35,11 @@ OBJS= blocksort.o \ + bzlib.o + + all: $(OBJS) +- $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.8 $(OBJS) +- $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.8 ++ $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname -Wl,libbz2.so.1 -o libbz2.so.1.0.8 $(OBJS) ++ $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.8 + rm -f libbz2.so.1.0 + ln -s libbz2.so.1.0.8 libbz2.so.1.0 ++ ln -s libbz2.so.1.0.8 libbz2.so.1 + + clean: + rm -f $(OBJS) bzip2.o libbz2.so.1.0.8 libbz2.so.1.0 bzip2-shared diff --git a/colord/colord-1.4.8-libudev-zero.patch b/colord/colord-1.4.8-libudev-zero.patch new file mode 100644 index 0000000..2dd9d4a --- /dev/null +++ b/colord/colord-1.4.8-libudev-zero.patch @@ -0,0 +1,46 @@ +diff --git a/meson.build b/meson.build +index 966a9ba..cc9d8c2 100644 +--- a/meson.build ++++ b/meson.build +@@ -121,9 +121,17 @@ gusb = dependency('gusb', version : '>= 0.2.7') + gudev = dependency('gudev-1.0') + libm = cc.find_library('m', required: false) + libudev = dependency('libudev') ++udev_rules_dir = '' + + if get_option('udev_rules') +- udev = dependency('udev') ++ udev = dependency('udev', required : false) ++ if udev.found() ++ udev_rules_dir = join_paths(udev.get_pkgconfig_variable('udevdir'), 'rules.d') ++ elif get_option('udev_rules_dir') != '' ++ udev_rules_dir = get_option('udev_rules_dir') ++ else ++ udev_rules_dir = join_paths(libudev.get_pkgconfig_variable('libdir'), 'udev', 'rules.d') ++ endif + endif + + if get_option('systemd') +diff --git a/meson_options.txt b/meson_options.txt +index 88d0b7b..b1cfe42 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -2,6 +2,7 @@ option('daemon', type : 'boolean', value : true, description : 'build the daemon + option('session_example', type : 'boolean', value : false, description : 'Enable session example') + option('bash_completion', type : 'boolean', value : true, description : 'Enable bash completion') + option('udev_rules', type: 'boolean', value: true, description: 'Install udev rules') ++option('udev_rules_dir', type : 'string', value : '', description : 'Directory to install udev rules into when udev.pc is unavailable') + option('systemd', type : 'boolean', value : true, description : 'Enable systemd integration') + option('systemd_root_prefix', type: 'string', value: '', description: 'Directory to base systemd’s installation directories on') + option('libcolordcompat', type : 'boolean', value : false, description : 'Enable libcolordcompat.so which is used by ArgyllCMS') +diff --git a/rules/meson.build b/rules/meson.build +index 7985e1d..4f328c9 100644 +--- a/rules/meson.build ++++ b/rules/meson.build +@@ -9,5 +9,5 @@ install_data([ + sensor_rules_in, + '95-cd-devices.rules', + ], +- install_dir : join_paths(udev.get_pkgconfig_variable('udevdir'), 'rules.d') ++ install_dir : udev_rules_dir + ) diff --git a/db5.3/db-5.3.28-libcxx12.patch b/db5.3/db-5.3.28-libcxx12.patch new file mode 100644 index 0000000..6982033 --- /dev/null +++ b/db5.3/db-5.3.28-libcxx12.patch @@ -0,0 +1,105 @@ +--- a/src/dbinc/db_cxx.in ++++ b/src/dbinc/db_cxx.in +@@ -50,6 +50,23 @@ + + #include + ++/* ++ * Berkeley DB's C API exposes atomic_init and store as macros, which ++ * collides with libc++ declarations when db.h is already included. ++ * Hide the macros while pulling in the C++ standard headers, then ++ * restore them for the Berkeley DB interfaces below. ++ */ ++#ifdef atomic_init ++#pragma push_macro("atomic_init") ++#undef atomic_init ++#define DB_CXX_RESTORE_ATOMIC_INIT ++#endif ++#ifdef store ++#pragma push_macro("store") ++#undef store ++#define DB_CXX_RESTORE_STORE ++#endif ++ + @cxx_have_stdheaders@ + #ifdef HAVE_CXX_STDHEADERS + #include +@@ -61,6 +78,15 @@ + #define __DB_STD(x) x + #endif + ++#ifdef DB_CXX_RESTORE_STORE ++#pragma pop_macro("store") ++#undef DB_CXX_RESTORE_STORE ++#endif ++#ifdef DB_CXX_RESTORE_ATOMIC_INIT ++#pragma pop_macro("atomic_init") ++#undef DB_CXX_RESTORE_ATOMIC_INIT ++#endif ++ + #include "db.h" + + class Db; // forward +--- a/lang/cxx/stl/dbstl_exception.h ++++ b/lang/cxx/stl/dbstl_exception.h +@@ -13,9 +13,29 @@ + #include + #include + ++#ifdef atomic_init ++#pragma push_macro("atomic_init") ++#undef atomic_init ++#define DB_STL_RESTORE_ATOMIC_INIT ++#endif ++#ifdef store ++#pragma push_macro("store") ++#undef store ++#define DB_STL_RESTORE_STORE ++#endif ++ + #include + #include + ++#ifdef DB_STL_RESTORE_STORE ++#pragma pop_macro("store") ++#undef DB_STL_RESTORE_STORE ++#endif ++#ifdef DB_STL_RESTORE_ATOMIC_INIT ++#pragma pop_macro("atomic_init") ++#undef DB_STL_RESTORE_ATOMIC_INIT ++#endif ++ + #include "dbstl_common.h" + + START_NS(dbstl) +--- a/lang/cxx/stl/dbstl_element_ref.h ++++ b/lang/cxx/stl/dbstl_element_ref.h +@@ -9,8 +9,28 @@ + #ifndef _DB_STL_KDPAIR_H + #define _DB_STL_KDPAIR_H + ++#ifdef atomic_init ++#pragma push_macro("atomic_init") ++#undef atomic_init ++#define DB_STL_RESTORE_ATOMIC_INIT ++#endif ++#ifdef store ++#pragma push_macro("store") ++#undef store ++#define DB_STL_RESTORE_STORE ++#endif ++ + #include + ++#ifdef DB_STL_RESTORE_STORE ++#pragma pop_macro("store") ++#undef DB_STL_RESTORE_STORE ++#endif ++#ifdef DB_STL_RESTORE_ATOMIC_INIT ++#pragma pop_macro("atomic_init") ++#undef DB_STL_RESTORE_ATOMIC_INIT ++#endif ++ + #include "dbstl_common.h" + #include "dbstl_dbt.h" + #include "dbstl_exception.h" diff --git a/efivar/efivar-39-posixify-build.patch b/efivar/efivar-39-posixify-build.patch new file mode 100644 index 0000000..e3fa329 --- /dev/null +++ b/efivar/efivar-39-posixify-build.patch @@ -0,0 +1,125 @@ +diff --git a/Makefile b/Makefile +index 5f1dc88..1ef6fcd 100644 +--- a/Makefile ++++ b/Makefile +@@ -35,12 +35,12 @@ brick : all + done + + a : +- @if [ $${EUID} != 0 ]; then \ ++ @if [ "$$(id -u)" != 0 ]; then \ + echo no 1>&2 ; \ + exit 1 ; \ + fi + +-GITTAG = $(shell bash -c "echo $$(($(VERSION) + 1))") ++GITTAG = $(shell printf '%s\n' $$(( $(VERSION) + 1 ))) + + efivar.spec : | Makefile src/include/version.mk + +diff --git a/src/include/defaults.mk b/src/include/defaults.mk +index 4da0cde..40f4d51 100644 +--- a/src/include/defaults.mk ++++ b/src/include/defaults.mk +@@ -11,13 +11,15 @@ PKGS ?= + + CROSS_COMPILE ?= + COMPILER ?= gcc +-ifeq ($(origin CC),command line) +-override COMPILER := $(CC) +-override CC := $(CROSS_COMPILE)$(COMPILER) +-endif ++ ++tool-if-exists = $(strip $(shell command -v $(1) >/dev/null 2>&1 && printf '%s' '$(1)')) ++cc-command = $(firstword $(filter-out ccache sccache distcc,$(foreach word,$(1),$(notdir $(word))))) ++cc-name = $(patsubst $(CROSS_COMPILE)%,%,$(call cc-command,$(1))) ++ + $(call set-if-undefined,CC,$(CROSS_COMPILE)$(COMPILER)) ++override COMPILER := $(or $(call cc-name,$(CC)),$(COMPILER)) + $(call set-if-undefined,CCLD,$(CC)) +-$(call set-if-undefined,HOSTCC,$(COMPILER)) ++$(call set-if-undefined,HOSTCC,$(call cc-name,$(CC))) + $(call set-if-undefined,HOSTCCLD,$(HOSTCC)) + + # temporary, see https://sourceware.org/bugzilla/show_bug.cgi?id=28264 +@@ -107,11 +109,11 @@ override HOST_LDFLAGS = $(HOST_CFLAGS) -L. \ + $(call pkg-config-ccldflags) + override HOST_CCLDFLAGS = $(HOST_LDFLAGS) + +-PKG_CONFIG ?= $(shell if [ -e "$$(env $(CROSS_COMPILE)pkg-config 2>&1)" ]; then echo $(CROSS_COMPILE)pkg-config ; else echo pkg-config ; fi) ++PKG_CONFIG ?= $(or $(call tool-if-exists,$(CROSS_COMPILE)pkg-config),pkg-config) + INSTALL ?= install +-AR := $(CROSS_COMPILE)$(COMPILER)-ar +-NM := $(CROSS_COMPILE)$(COMPILER)-nm +-RANLIB := $(CROSS_COMPILE)$(COMPILER)-ranlib ++$(call set-if-undefined,AR,$(or $(call tool-if-exists,$(CROSS_COMPILE)$(call cc-name,$(CC))-ar),$(if $(findstring clang,$(call cc-name,$(CC))),$(call tool-if-exists,$(CROSS_COMPILE)llvm-ar),$(call tool-if-exists,$(CROSS_COMPILE)gcc-ar)),$(call tool-if-exists,$(CROSS_COMPILE)ar),ar)) ++$(call set-if-undefined,NM,$(or $(call tool-if-exists,$(CROSS_COMPILE)$(call cc-name,$(CC))-nm),$(if $(findstring clang,$(call cc-name,$(CC))),$(call tool-if-exists,$(CROSS_COMPILE)llvm-nm),$(call tool-if-exists,$(CROSS_COMPILE)gcc-nm)),$(call tool-if-exists,$(CROSS_COMPILE)nm),nm)) ++$(call set-if-undefined,RANLIB,$(or $(call tool-if-exists,$(CROSS_COMPILE)$(call cc-name,$(CC))-ranlib),$(if $(findstring clang,$(call cc-name,$(CC))),$(call tool-if-exists,$(CROSS_COMPILE)llvm-ranlib),$(call tool-if-exists,$(CROSS_COMPILE)gcc-ranlib)),$(call tool-if-exists,$(CROSS_COMPILE)ranlib),ranlib)) + ABIDW := abidw + ABIDIFF := abidiff + MANDOC := mandoc +diff --git a/src/include/coverity.mk b/src/include/coverity.mk +index 2e7024b..f852097 100644 +--- a/src/include/coverity.mk ++++ b/src/include/coverity.mk +@@ -4,11 +4,11 @@ COV_URL=$(call get-config,coverity.url) + COV_FILE=$(NAME)-coverity-$(VERSION)-$(COMMIT_ID).tar.bz2 + + cov-int : clean +- cov-build --dir cov-int make all ++ cov-build --dir cov-int $(MAKE) all + + cov-clean : + @rm -vf $(NAME)-coverity-*.tar.* +- @if [[ -d cov-int ]]; then rm -rf cov-int && echo "removed 'cov-int'"; fi ++ @if [ -d cov-int ]; then rm -rf cov-int && echo "removed 'cov-int'"; fi + + cov-file : | $(COV_FILE) + +@@ -16,9 +16,9 @@ $(COV_FILE) : cov-int + tar caf $@ cov-int + + cov-upload : +- @if [[ -n "$(COV_URL)" ]] && \ +- [[ -n "$(COV_TOKEN)" ]] && \ +- [[ -n "$(COV_EMAIL)" ]] ; \ ++ @if [ -n "$(COV_URL)" ] && \ ++ [ -n "$(COV_TOKEN)" ] && \ ++ [ -n "$(COV_EMAIL)" ] ; \ + then \ + echo curl --form token=$(COV_TOKEN) --form email="$(COV_EMAIL)" --form file=@"$(COV_FILE)" --form version=$(VERSION).1 --form description="$(COMMIT_ID)" "$(COV_URL)" ; \ + curl --form token=$(COV_TOKEN) --form email="$(COV_EMAIL)" --form file=@"$(COV_FILE)" --form version=$(VERSION).1 --form description="$(COMMIT_ID)" "$(COV_URL)" ; \ +@@ -31,7 +31,7 @@ coverity : cov-file cov-upload + + clean : | cov-clean + +-COV_BUILD ?= $(shell x=$$(which --skip-alias --skip-functions cov-build 2>/dev/null) ; [ -n "$$x" ] && echo 1) ++COV_BUILD ?= $(shell command -v cov-build >/dev/null 2>&1 && printf '%s' 1) + ifeq ($(COV_BUILD),) + COV_BUILD_ERROR = $(error cov-build not found) + endif +diff --git a/src/include/scan-build.mk b/src/include/scan-build.mk +index 19da90c..125c85c 100644 +--- a/src/include/scan-build.mk ++++ b/src/include/scan-build.mk +@@ -1,4 +1,4 @@ +-SCAN_BUILD ?= $(shell x=$$(which --skip-alias --skip-functions scan-build 2>/dev/null) ; [ -n "$$x" ] && echo 1) ++SCAN_BUILD ?= $(shell command -v scan-build >/dev/null 2>&1 && printf '%s' 1) + ifeq ($(SCAN_BUILD),) + SCAN_BUILD_ERROR = $(error scan-build not found) + endif +@@ -6,12 +6,12 @@ endif + scan-test : ; $(SCAN_BUILD_ERROR) + + scan-clean : clean +- @if [[ -d scan-results ]]; then rm -rf scan-results && echo "removed 'scan-results'"; fi ++ @if [ -d scan-results ]; then rm -rf scan-results && echo "removed 'scan-results'"; fi + + scan-build : | scan-test + scan-build : clean + $(MAKE) -C src makeguids +- scan-build -o scan-results make $(DASHJ) CC=clang all ++ scan-build -o scan-results $(MAKE) $(DASHJ) CC=clang all + + scan-build-all: | scan-build + scan : | scan-build diff --git a/elogind/elogind-255.22-clang-const-fixes.patch b/elogind/elogind-255.22-clang-const-fixes.patch new file mode 100644 index 0000000..3e35eb2 --- /dev/null +++ b/elogind/elogind-255.22-clang-const-fixes.patch @@ -0,0 +1,171 @@ +diff -urN a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c +--- a/src/basic/mountpoint-util.c 2025-11-18 01:14:12.000000000 -0600 ++++ b/src/basic/mountpoint-util.c 2026-03-29 15:01:10.720866440 -0500 +@@ -127,7 +127,7 @@ + if (r < 0) + return r; + +- p = find_line_startswith(fdinfo, "mnt_id:"); ++ p = (char*) find_line_startswith(fdinfo, "mnt_id:"); + if (!p) /* The mnt_id field is a relatively new addition */ + return -EOPNOTSUPP; + +@@ -554,7 +554,7 @@ + int dev_is_devtmpfs(void) { + _cleanup_fclose_ FILE *proc_self_mountinfo = NULL; + int mount_id, r; +- char *e; ++ const char *e; + + r = path_get_mnt_id("/dev", &mount_id); + if (r < 0) +diff -urN a/src/basic/process-util.c b/src/basic/process-util.c +--- a/src/basic/process-util.c 2025-11-18 01:14:12.000000000 -0600 ++++ b/src/basic/process-util.c 2026-03-29 15:01:10.721866471 -0500 +@@ -1793,7 +1793,7 @@ + if (r < 0) + return r; + +- p = find_line_startswith(fdinfo, "Pid:"); ++ p = (char*) find_line_startswith(fdinfo, "Pid:"); + if (!p) + return -ENOTTY; /* not a pidfd? */ + +diff -urN a/src/basic/string-util.c b/src/basic/string-util.c +--- a/src/basic/string-util.c 2025-11-18 01:14:12.000000000 -0600 ++++ b/src/basic/string-util.c 2026-03-29 15:01:10.720866440 -0500 +@@ -1409,8 +1409,8 @@ + return strndup(a, strcspn(a, reject)); + } + +-char *find_line_startswith(const char *haystack, const char *needle) { +- char *p; ++const char *find_line_startswith(const char *haystack, const char *needle) { ++ const char *p; + + assert(haystack); + assert(needle); +diff -urN a/src/basic/string-util.h b/src/basic/string-util.h +--- a/src/basic/string-util.h 2025-11-18 01:14:12.000000000 -0600 ++++ b/src/basic/string-util.h 2026-03-29 15:01:10.720866440 -0500 +@@ -26,14 +26,14 @@ + #define URI_UNRESERVED ALPHANUMERICAL "-._~" /* [RFC3986] */ + #define URI_VALID URI_RESERVED URI_UNRESERVED /* [RFC3986] */ + +-static inline char* strstr_ptr(const char *haystack, const char *needle) { ++static inline const char* strstr_ptr(const char *haystack, const char *needle) { + if (!haystack || !needle) + return NULL; + return strstr(haystack, needle); + } + +-static inline char *strstrafter(const char *haystack, const char *needle) { +- char *p; ++static inline const char *strstrafter(const char *haystack, const char *needle) { ++ const char *p; + + /* Returns NULL if not found, or pointer to first character after needle if found */ + +@@ -308,7 +308,7 @@ + #endif // 0 + char *strdupcspn(const char *a, const char *reject); + +-char *find_line_startswith(const char *haystack, const char *needle); ++const char *find_line_startswith(const char *haystack, const char *needle); + + char *startswith_strv(const char *string, char **strv); + +diff -urN a/src/libelogind/sd-bus/sd-bus.c b/src/libelogind/sd-bus/sd-bus.c +--- a/src/libelogind/sd-bus/sd-bus.c 2025-11-18 01:14:12.000000000 -0600 ++++ b/src/libelogind/sd-bus/sd-bus.c 2026-03-29 14:55:42.302578511 -0500 +@@ -1407,7 +1407,8 @@ + + int bus_set_address_system_remote(sd_bus *b, const char *host) { + _cleanup_free_ char *e = NULL; +- char *m = NULL, *c = NULL, *a, *rbracket = NULL, *p = NULL; ++ const char *m = NULL, *at = NULL, *rbracket = NULL, *p = NULL; ++ char *a = NULL, *c = NULL; + + assert(b); + assert(host); +@@ -1423,29 +1424,29 @@ + e = bus_address_escape(t); + if (!e) + return -ENOMEM; +- } else if ((a = strchr(host, '@'))) { +- if (*(a + 1) == '[') { ++ } else if ((at = strchr(host, '@'))) { ++ if (*(at + 1) == '[') { + _cleanup_free_ char *t = NULL; + +- rbracket = strchr(a + 1, ']'); ++ rbracket = strchr(at + 1, ']'); + if (!rbracket) + return -EINVAL; + t = new0(char, strlen(host)); + if (!t) + return -ENOMEM; +- strncat(t, host, a - host + 1); +- strncat(t, a + 2, rbracket - a - 2); ++ strncat(t, host, at - host + 1); ++ strncat(t, at + 2, rbracket - at - 2); + e = bus_address_escape(t); + if (!e) + return -ENOMEM; +- } else if (*(a + 1) == '\0' || strchr(a + 1, '@')) ++ } else if (*(at + 1) == '\0' || strchr(at + 1, '@')) + return -EINVAL; + } + + /* Let's see if a port was given */ + m = strchr(rbracket ? rbracket + 1 : host, ':'); + if (m) { +- char *t; ++ const char *t; + bool got_forward_slash = false; + + p = m + 1; +diff -urN a/src/test/test-id128.c b/src/test/test-id128.c +--- a/src/test/test-id128.c 2025-11-18 01:14:12.000000000 -0600 ++++ b/src/test/test-id128.c 2026-03-29 15:05:01.649650821 -0500 +@@ -22,6 +22,18 @@ + #define UUID_WALDI "01020304-0506-0708-090a-0b0c0d0e0f10" + #define STR_NULL "00000000000000000000000000000000" + ++static bool id128_in_0(sd_id128_t id) { ++ return false; ++} ++ ++static bool id128_in_1(sd_id128_t id, sd_id128_t a) { ++ return sd_id128_equal(id, a); ++} ++ ++static bool id128_in_2(sd_id128_t id, sd_id128_t a, sd_id128_t b) { ++ return sd_id128_equal(id, a) || sd_id128_equal(id, b); ++} ++ + TEST(id128) { + sd_id128_t id, id2; + char t[SD_ID128_STRING_MAX], q[SD_ID128_UUID_STRING_MAX]; +@@ -33,13 +45,14 @@ + + assert_se(sd_id128_from_string(t, &id2) == 0); + assert_se(sd_id128_equal(id, id2)); +- assert_se(sd_id128_in_set(id, id)); +- assert_se(sd_id128_in_set(id, id2)); +- assert_se(sd_id128_in_set(id, id2, id)); +- assert_se(sd_id128_in_set(id, ID128_WALDI, id)); +- assert_se(!sd_id128_in_set(id)); +- assert_se(!sd_id128_in_set(id, ID128_WALDI)); +- assert_se(!sd_id128_in_set(id, ID128_WALDI, ID128_WALDI)); ++ /* Work around a Clang 22 frontend crash on sd_id128_in_set() with union varargs in this test. */ ++ assert_se(id128_in_1(id, id)); ++ assert_se(id128_in_1(id, id2)); ++ assert_se(id128_in_2(id, id2, id)); ++ assert_se(id128_in_2(id, ID128_WALDI, id)); ++ assert_se(!id128_in_0(id)); ++ assert_se(!id128_in_1(id, ID128_WALDI)); ++ assert_se(!id128_in_2(id, ID128_WALDI, ID128_WALDI)); + + if (sd_booted() > 0 && sd_id128_get_machine(NULL) >= 0) { + assert_se(sd_id128_get_machine(&id) == 0); diff --git a/elogind/elogind-255.22-libexecdir-equals-libdir.patch b/elogind/elogind-255.22-libexecdir-equals-libdir.patch new file mode 100644 index 0000000..636431e --- /dev/null +++ b/elogind/elogind-255.22-libexecdir-equals-libdir.patch @@ -0,0 +1,15 @@ +--- a/meson.build 2025-11-18 01:14:12.000000000 -0600 ++++ b/meson.build 2026-03-29 15:09:28.505104620 -0500 +@@ -158,6 +158,12 @@ + #endif // 0 + pkglibdir = libdir / 'elogind' + ++# If libexecdir collapses to libdir, keep private executables under pkglibdir ++# so they don't collide with the private library directory itself. ++if libexecdir == libdir ++ libexecdir = pkglibdir ++endif ++ + #if 0 /// UNNEEDED by elogind + # install_sysconfdir = get_option('install-sysconfdir') != 'false' + #endif // 0 diff --git a/elogind/elogind-255.22-posixify.patch b/elogind/elogind-255.22-posixify.patch new file mode 100644 index 0000000..02308a0 --- /dev/null +++ b/elogind/elogind-255.22-posixify.patch @@ -0,0 +1,311 @@ +diff -urN a/configure b/configure +--- a/configure 2025-11-18 01:14:12.000000000 -0600 ++++ b/configure 2026-03-29 14:49:52.741863535 -0500 +@@ -1,10 +1,12 @@ +-#!/usr/bin/env bash ++#!/bin/sh + # SPDX-License-Identifier: LGPL-2.1-or-later + set -e + + cflags="CFLAGS=${CFLAGS-}" + cxxflags="CXXFLAGS=${CXXFLAGS-}" +-args=() ++args_file="${TMPDIR:-/tmp}/elogind-configure-args.$$" ++trap 'rm -f "$args_file"' EXIT HUP INT TERM ++: >"$args_file" + + for arg in "$@"; do + case "$arg" in +@@ -15,10 +17,15 @@ + cxxflags="$arg" + ;; + *) +- args+=("$arg") ++ printf '%s\n' "$arg" >>"$args_file" + esac + done + ++set -- ++while IFS= read -r arg; do ++ set -- "$@" "$arg" ++done <"$args_file" ++ + export "${cflags?}" "${cxxflags?}" + set -x +-exec meson setup build "${args[@]}" ++exec meson setup build "$@" +diff -urN a/meson_options.txt b/meson_options.txt +--- a/meson_options.txt 2025-11-18 01:14:12.000000000 -0600 ++++ b/meson_options.txt 2026-03-29 14:50:19.141523091 -0500 +@@ -297,7 +297,7 @@ + # option('clock-valid-range-usec-max', type : 'integer', value : 473364000000000, # 15 years + # description : 'maximum value in microseconds for the difference between RTC and epoch, exceeding which is considered an RTC error ["0" disables]') + #endif // 0 +-option('default-user-shell', type : 'string', value : '/bin/bash', ++option('default-user-shell', type : 'string', value : '/bin/sh', + description : 'default interactive shell') + + option('system-alloc-uid-min', type : 'integer', value : 0, +diff -urN a/src/basic/generate-cap-list.sh b/src/basic/generate-cap-list.sh +--- a/src/basic/generate-cap-list.sh 2025-11-18 01:14:12.000000000 -0600 ++++ b/src/basic/generate-cap-list.sh 2026-03-29 14:51:05.674685004 -0500 +@@ -1,8 +1,19 @@ +-#!/usr/bin/env bash ++#!/bin/sh + # SPDX-License-Identifier: LGPL-2.1-or-later + set -eu +-set -o pipefail + +-${1:?} -dM -include linux/capability.h -include "${2:?}" -include "${3:?}" - "$tmp" ++ ++awk ' ++ /^#define[ \t]+CAP_[A-Z_]+[ \t]+/ && $2 != "CAP_LAST_CAP" { ++ print $2 ++ } ++' "$tmp" +diff -urN a/src/basic/generate-errno-list.sh b/src/basic/generate-errno-list.sh +--- a/src/basic/generate-errno-list.sh 2025-11-18 01:14:12.000000000 -0600 ++++ b/src/basic/generate-errno-list.sh 2026-03-29 14:50:58.129496657 -0500 +@@ -1,11 +1,20 @@ +-#!/usr/bin/env bash ++#!/bin/sh + # SPDX-License-Identifier: LGPL-2.1-or-later + set -eu +-set -o pipefail + + # In kernel's arch/parisc/include/uapi/asm/errno.h, ECANCELLED and EREFUSED are defined as aliases of + # ECANCELED and ECONNREFUSED, respectively. Let's drop them. + +-${1:?} -dM -include errno.h - "$tmp" ++ ++awk ' ++ !/^#define[[:space:]]+(ECANCELLED|EREFUSED)/ && ++ /^#define[ \t]+E[^ _]+[ \t]+/ { ++ print $2 ++ } ++' "$tmp" +diff -urN a/src/basic/user-util.c b/src/basic/user-util.c +--- a/src/basic/user-util.c 2025-11-18 01:14:12.000000000 -0600 ++++ b/src/basic/user-util.c 2026-03-29 14:50:19.142523116 -0500 +@@ -160,7 +160,7 @@ + + const char* default_root_shell_at(int rfd) { + /* We want to use the preferred shell, i.e. DEFAULT_USER_SHELL, which usually +- * will be /bin/bash. Fall back to /bin/sh if DEFAULT_USER_SHELL is not found, ++ * will be /bin/sh. Fall back to /bin/sh if DEFAULT_USER_SHELL is not found, + * or any access errors. */ + + assert(rfd >= 0 || rfd == AT_FDCWD); +diff -urN a/tools/check-api-docs.sh b/tools/check-api-docs.sh +--- a/tools/check-api-docs.sh 2025-11-18 01:14:12.000000000 -0600 ++++ b/tools/check-api-docs.sh 2026-03-29 14:50:58.129496657 -0500 +@@ -1,44 +1,42 @@ +-#!/usr/bin/env bash ++#!/bin/sh + # SPDX-License-Identifier: LGPL-2.1-or-later + set -eu +-set -o pipefail + + sd_good=0 + sd_total=0 + udev_good=0 + udev_total=0 ++nm_file="${TMPDIR:-/tmp}/check-api-docs.nm.$$" ++symbols_file="${TMPDIR:-/tmp}/check-api-docs.symbols.$$" ++trap 'rm -f "$nm_file" "$symbols_file"' EXIT HUP INT TERM + +-deprecated=( +- -e sd_bus_try_close +- -e sd_bus_process_priority +- -e sd_bus_message_get_priority +- -e sd_bus_message_set_priority +- -e sd_seat_can_multi_session +- -e sd_journal_open_container +-) ++nm -g --defined-only "$@" >"$nm_file" ++awk '/ T / { print $3; }' "$nm_file" | \ ++ grep -E -v '^(sd_bus_try_close|sd_bus_process_priority|sd_bus_message_get_priority|sd_bus_message_set_priority|sd_seat_can_multi_session|sd_journal_open_container)$' | \ ++ sort -u >"$symbols_file" + +-for symbol in $(nm -g --defined-only "$@" | grep " T " | cut -d" " -f3 | grep -wv "${deprecated[@]}" | sort -u); do ++while IFS= read -r symbol; do + if test -f "${MESON_BUILD_ROOT:?}/man/$symbol.3"; then + echo "✓ Symbol $symbol() is documented." + good=1 + else +- echo -e " \x1b[1;31mSymbol $symbol() lacks documentation.\x1b[0m" ++ printf ' \033[1;31mSymbol %s() lacks documentation.\033[0m\n' "$symbol" + good=0 + fi + + case "$symbol" in + sd_*) +- ((sd_good+=good)) +- ((sd_total+=1)) ++ sd_good=$((sd_good + good)) ++ sd_total=$((sd_total + 1)) + ;; + udev_*) +- ((udev_good+=good)) +- ((udev_total+=1)) ++ udev_good=$((udev_good + good)) ++ udev_total=$((udev_total + 1)) + ;; + *) + echo 'unknown symbol prefix' + exit 1 + esac +-done ++done <"$symbols_file" + + echo "libsystemd: $sd_good/$sd_total libudev: $udev_good/$udev_total" +diff -urN a/tools/check-help.sh b/tools/check-help.sh +--- a/tools/check-help.sh 2025-11-18 01:14:12.000000000 -0600 ++++ b/tools/check-help.sh 2026-03-29 14:49:52.742863560 -0500 +@@ -1,7 +1,6 @@ +-#!/usr/bin/env bash ++#!/bin/sh + # SPDX-License-Identifier: LGPL-2.1-or-later + set -eu +-set -o pipefail + + # Note: 'grep ... >/dev/null' instead of just 'grep -q' is used intentionally + # here, since 'grep -q' exits on the first match causing SIGPIPE being +@@ -9,39 +8,48 @@ + + BINARY="${1:?}" + export SYSTEMD_LOG_LEVEL=info ++help_out="${TMPDIR:-/tmp}/check-help.out.$$" ++help_err="${TMPDIR:-/tmp}/check-help.err.$$" ++short_out="${TMPDIR:-/tmp}/check-help-short.out.$$" ++bad_err="${TMPDIR:-/tmp}/check-help-bad.err.$$" ++trap 'rm -f "$help_out" "$help_err" "$short_out" "$bad_err"' EXIT HUP INT TERM + +-if [[ ! -x "$BINARY" ]]; then ++if [ ! -x "$BINARY" ]; then + echo "$BINARY is not an executable" + exit 1 + fi + ++"$BINARY" --help >"$help_out" 2>"$help_err" ++ + # output width +-if "$BINARY" --help | grep -v 'default:' | grep -E '.{80}.' >/dev/null; then ++if grep -v 'default:' "$help_out" | grep -E '.{80}.' >/dev/null; then + echo "$(basename "$BINARY") --help output is too wide:" +- "$BINARY" --help | awk 'length > 80' | grep -E --color=yes '.{80}' ++ awk 'length > 80' "$help_out" | grep -E --color=yes '.{80}' + exit 1 + fi + + # --help prints something. Also catches case where args are ignored. +-if ! "$BINARY" --help | grep . >/dev/null; then ++if ! grep . "$help_out" >/dev/null; then + echo "$(basename "$BINARY") --help output is empty" + exit 2 + fi + + # no --help output to stderr +-if "$BINARY" --help 2>&1 1>/dev/null | grep .; then ++if grep . "$help_err" >/dev/null; then + echo "$(basename "$BINARY") --help prints to stderr" + exit 3 + fi + + # error output to stderr +-if ! ("$BINARY" --no-such-parameter 2>&1 1>/dev/null || :) | grep . >/dev/null; then ++("$BINARY" --no-such-parameter >/dev/null 2>"$bad_err" || :) ++if ! grep . "$bad_err" >/dev/null; then + echo "$(basename "$BINARY") with an unknown parameter does not print to stderr" + exit 4 + fi + + # --help and -h are equivalent +-if ! diff <("$BINARY" -h) <("$BINARY" --help); then ++"$BINARY" -h >"$short_out" 2>/dev/null ++if ! diff "$short_out" "$help_out"; then + echo "$(basename "$BINARY") --help and -h are not identical" + exit 5 + fi +diff -urN a/tools/check-version.sh b/tools/check-version.sh +--- a/tools/check-version.sh 2025-11-18 01:14:12.000000000 -0600 ++++ b/tools/check-version.sh 2026-03-29 14:49:52.742863560 -0500 +@@ -1,7 +1,6 @@ +-#!/usr/bin/env bash ++#!/bin/sh + # SPDX-License-Identifier: LGPL-2.1-or-later + set -eu +-set -o pipefail + + # Note: 'grep ... >/dev/null' instead of just 'grep -q' is used intentionally + # here, since 'grep -q' exits on the first match causing SIGPIPE being +@@ -10,27 +9,32 @@ + BINARY="${1:?}" + VERSION="${2:?}" + export SYSTEMD_LOG_LEVEL=info ++version_out="${TMPDIR:-/tmp}/check-version.out.$$" ++version_err="${TMPDIR:-/tmp}/check-version.err.$$" ++trap 'rm -f "$version_out" "$version_err"' EXIT HUP INT TERM + +-if [[ ! -x "$BINARY" ]]; then ++if [ ! -x "$BINARY" ]; then + echo "$BINARY is not an executable" + exit 1 + fi + ++"$BINARY" --version >"$version_out" 2>"$version_err" ++ + # --version prints something. Also catches case where args are ignored. +-if ! "$BINARY" --version | grep . >/dev/null; then ++if ! grep . "$version_out" >/dev/null; then + echo "$(basename "$BINARY") --version output is empty" + exit 2 + fi + + # no --version output to stderr +-if "$BINARY" --version 2>&1 1>/dev/null | grep .; then ++if grep . "$version_err" >/dev/null; then + echo "$(basename "$BINARY") --version prints to stderr" + exit 3 + fi + + # project version appears in version output +-out="$("$BINARY" --version)" +-if ! grep -F "$VERSION" >/dev/null <<<"$out"; then ++out=$(cat "$version_out") ++if ! grep -F "$VERSION" "$version_out" >/dev/null; then + echo "$(basename "$BINARY") --version output does not match '$VERSION': $out" + exit 4 + fi +diff -urN a/tools/meson-vcs-tag.sh b/tools/meson-vcs-tag.sh +--- a/tools/meson-vcs-tag.sh 2025-11-18 01:14:12.000000000 -0600 ++++ b/tools/meson-vcs-tag.sh 2026-03-29 14:49:52.742863560 -0500 +@@ -1,8 +1,7 @@ +-#!/usr/bin/env bash ++#!/bin/sh + # SPDX-License-Identifier: LGPL-2.1-or-later + + set -u +-set -o pipefail + + dir="${1:?}" + fallback="${2:?}" diff --git a/fakeroot/fakeroot-1.37.2-no-doc-man-install.patch b/fakeroot/fakeroot-1.37.2-no-doc-man-install.patch new file mode 100644 index 0000000..cceb6cc --- /dev/null +++ b/fakeroot/fakeroot-1.37.2-no-doc-man-install.patch @@ -0,0 +1,10 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -1,6 +1,6 @@ + AUTOMAKE_OPTIONS=foreign + ACLOCAL_AMFLAGS = -I build-aux +-SUBDIRS=doc scripts test ++SUBDIRS=scripts test + + noinst_LTLIBRARIES = libcommunicate.la libmacosx.la libfakeroot_time64.la + libcommunicate_la_SOURCES = communicate.c diff --git a/fastfetch/fastfetch-2.59.0-vertex-depot.patch b/fastfetch/fastfetch-2.59.0-vertex-depot.patch new file mode 100644 index 0000000..e2016a6 --- /dev/null +++ b/fastfetch/fastfetch-2.59.0-vertex-depot.patch @@ -0,0 +1,136 @@ +diff -ruN a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2026-02-13 10:15:11.000000000 -0600 ++++ b/CMakeLists.txt 2026-02-28 14:34:36.533430812 -0600 +@@ -120,7 +120,7 @@ + message(FATAL_ERROR "BINARY_LINK_TYPE must be one of ${BINARY_LINK_TYPE_OPTIONS}") + endif() + +-set(PACKAGE_MANAGERS AM APK BREW CHOCO DPKG EMERGE EOPKG FLATPAK GUIX LINGLONG LPKG LPKGBUILD MACPORTS NIX OPKG PACMAN PACSTALL PALUDIS PISI PKG PKGTOOL RPM SCOOP SNAP SOAR SORCERY WINGET XBPS) ++set(PACKAGE_MANAGERS AM APK BREW CHOCO DEPOT DPKG EMERGE EOPKG FLATPAK GUIX LINGLONG LPKG LPKGBUILD MACPORTS NIX OPKG PACMAN PACSTALL PALUDIS PISI PKG PKGTOOL RPM SCOOP SNAP SOAR SORCERY WINGET XBPS) + foreach(package_manager ${PACKAGE_MANAGERS}) + if(package_manager STREQUAL "WINGET") + option(PACKAGES_DISABLE_${package_manager} "Disable ${package_manager} package manager detection by default" ON) +diff -ruN a/src/detection/packages/packages.h b/src/detection/packages/packages.h +--- a/src/detection/packages/packages.h 2026-02-13 10:15:11.000000000 -0600 ++++ b/src/detection/packages/packages.h 2026-02-28 14:34:43.270607662 -0600 +@@ -11,6 +11,7 @@ + uint32_t brew; + uint32_t brewCask; + uint32_t choco; ++ uint32_t depot; + uint32_t dpkg; + uint32_t emerge; + uint32_t eopkg; +diff -ruN a/src/detection/packages/packages_linux.c b/src/detection/packages/packages_linux.c +--- a/src/detection/packages/packages_linux.c 2026-02-13 10:15:11.000000000 -0600 ++++ b/src/detection/packages/packages_linux.c 2026-02-28 14:34:54.446900065 -0600 +@@ -455,6 +455,7 @@ + { + if (!(options->disabled & FF_PACKAGES_FLAG_APK_BIT)) packageCounts->apk += getNumStrings(baseDir, "/lib/apk/db/installed", "C:Q", "apk"); + if (!(options->disabled & FF_PACKAGES_FLAG_DPKG_BIT)) packageCounts->dpkg += getNumStrings(baseDir, "/var/lib/dpkg/status", "Status: install ok installed", "dpkg"); ++ if (!(options->disabled & FF_PACKAGES_FLAG_DEPOT_BIT)) packageCounts->depot += getSQLite3Int(baseDir, "/var/lib/depot/packages.db", "SELECT COUNT(*) FROM packages", "depot-system"); + if (!(options->disabled & FF_PACKAGES_FLAG_LPKG_BIT)) packageCounts->lpkg += getNumStrings(baseDir, "/opt/Loc-OS-LPKG/installed-lpkg/Listinstalled-lpkg.list", "\n", "lpkg"); + if (!(options->disabled & FF_PACKAGES_FLAG_EMERGE_BIT)) packageCounts->emerge += countFilesRecursive(baseDir, "/var/db/pkg", "SIZE"); + if (!(options->disabled & FF_PACKAGES_FLAG_EOPKG_BIT)) packageCounts->eopkg += getNumElements(baseDir, "/var/lib/eopkg/package", true); +@@ -559,6 +560,9 @@ + #endif + + ffStrbufSet(&baseDir, &instance.state.platform.homeDir); ++ if (!(options->disabled & FF_PACKAGES_FLAG_DEPOT_BIT)) ++ result->depot += getSQLite3Int(&baseDir, ".local/share/depot/packages.db", "SELECT COUNT(*) FROM packages", "depot-user"); ++ + if (!(options->disabled & FF_PACKAGES_FLAG_NIX_BIT)) + { + // Count packages from $HOME/.nix-profile +diff -ruN a/src/logo/ascii/vertex.txt b/src/logo/ascii/vertex.txt +--- a/src/logo/ascii/vertex.txt 1969-12-31 18:00:00.000000000 -0600 ++++ b/src/logo/ascii/vertex.txt 2026-02-28 14:34:29.816254040 -0600 +@@ -0,0 +1,6 @@ ++____ ____ __ ++\ \ / /____________/ |_ ____ ___ ___ ++ \ Y // __ \_ __ \ __\/ __ \\ \/ / ++ \ /\ ___/| | \/| | \ ___/ > < ++ \___/ \___ >__| |__| \___ >__/\_ \ ++ \/ \/ \/ +diff -ruN a/src/logo/builtin.c b/src/logo/builtin.c +--- a/src/logo/builtin.c 2026-02-13 10:15:11.000000000 -0600 ++++ b/src/logo/builtin.c 2026-02-28 14:35:07.169231466 -0600 +@@ -5274,6 +5274,16 @@ + FF_COLOR_FG_BLUE, + }, + }, ++ // Vertex Linux ++ { ++ .names = {"Vertex Linux", "Vertex", "vertex"}, ++ .lines = FASTFETCH_DATATEXT_LOGO_VERTEX, ++ .colors = { ++ FF_COLOR_FG_LIGHT_MAGENTA, ++ }, ++ .colorKeys = FF_COLOR_FG_LIGHT_MAGENTA, ++ .colorTitle = FF_COLOR_FG_LIGHT_MAGENTA, ++ }, + // VincentOS + { + .names = {"VincentOS"}, +diff -ruN a/src/modules/packages/option.h b/src/modules/packages/option.h +--- a/src/modules/packages/option.h 2026-02-13 10:15:11.000000000 -0600 ++++ b/src/modules/packages/option.h 2026-02-28 14:34:47.202710674 -0600 +@@ -37,6 +37,7 @@ + FF_PACKAGES_FLAG_PISI_BIT = 1ULL << 29, + FF_PACKAGES_FLAG_SOAR_BIT = 1ULL << 30, + FF_PACKAGES_FLAG_KISS_BIT = 1ULL << 31, ++ FF_PACKAGES_FLAG_DEPOT_BIT = 1ULL << 32, + FF_PACKAGES_FLAG_FORCE_UNSIGNED = UINT64_MAX, + } FFPackagesFlags; + static_assert(sizeof(FFPackagesFlags) == sizeof(uint64_t), ""); +diff -ruN a/src/modules/packages/packages.c b/src/modules/packages/packages.c +--- a/src/modules/packages/packages.c 2026-02-13 10:15:11.000000000 -0600 ++++ b/src/modules/packages/packages.c 2026-02-28 14:35:01.426082052 -0600 +@@ -58,6 +58,7 @@ + if((all -= counts.pacman) > 0) + printf(", "); + }; ++ FF_PRINT_PACKAGE(depot) + FF_PRINT_PACKAGE(dpkg) + FF_PRINT_PACKAGE(rpm) + FF_PRINT_PACKAGE(emerge) +@@ -156,6 +157,7 @@ + FF_FORMAT_ARG(counts.all, "all"), + FF_FORMAT_ARG(counts.pacman, "pacman"), + FF_FORMAT_ARG(counts.pacmanBranch, "pacman-branch"), ++ FF_FORMAT_ARG(counts.depot, "depot"), + FF_FORMAT_ARG(counts.dpkg, "dpkg"), + FF_FORMAT_ARG(counts.rpm, "rpm"), + FF_FORMAT_ARG(counts.emerge, "emerge"), +@@ -255,6 +257,7 @@ + FF_TEST_PACKAGE_NAME(CHOCO) + break; + case 'D': if (false); ++ FF_TEST_PACKAGE_NAME(DEPOT) + FF_TEST_PACKAGE_NAME(DPKG) + break; + case 'E': if (false); +@@ -345,6 +348,7 @@ + FF_TEST_PACKAGE_NAME(APK) + FF_TEST_PACKAGE_NAME(BREW) + FF_TEST_PACKAGE_NAME(CHOCO) ++ FF_TEST_PACKAGE_NAME(DEPOT) + FF_TEST_PACKAGE_NAME(DPKG) + FF_TEST_PACKAGE_NAME(EMERGE) + FF_TEST_PACKAGE_NAME(EOPKG) +@@ -402,6 +406,7 @@ + FF_APPEND_PACKAGE_COUNT(brew) + FF_APPEND_PACKAGE_COUNT(brewCask) + FF_APPEND_PACKAGE_COUNT(choco) ++ FF_APPEND_PACKAGE_COUNT(depot) + FF_APPEND_PACKAGE_COUNT(dpkg) + FF_APPEND_PACKAGE_COUNT(emerge) + FF_APPEND_PACKAGE_COUNT(eopkg) +@@ -466,6 +471,7 @@ + {"Number of all packages", "all"}, + {"Number of pacman packages", "pacman"}, + {"Pacman branch on manjaro", "pacman-branch"}, ++ {"Number of depot packages", "depot"}, + {"Number of dpkg packages", "dpkg"}, + {"Number of rpm packages", "rpm"}, + {"Number of emerge packages", "emerge"}, diff --git a/ffmpeg/ffmpeg-8.1-ungnuify.patch b/ffmpeg/ffmpeg-8.1-ungnuify.patch new file mode 100644 index 0000000..c734199 --- /dev/null +++ b/ffmpeg/ffmpeg-8.1-ungnuify.patch @@ -0,0 +1,149 @@ +--- a/configure ++++ b/configure +@@ -1289,12 +1289,27 @@ + log test_ld "$@" + type=$1 + shift 1 ++ linker=$ld ++ linkerflags=$LDFLAGS ++ use_cxx_linker=false ++ test "$type" = cxx && use_cxx_linker=true ++ for opt; do ++ test "$opt" = "$cxx_linker_flag" && use_cxx_linker=true ++ done + flags=$(filter_out '-l*|*.so' $@) + libs=$(filter '-l*|*.so' $@) ++ flags=$(filter_out "$cxx_linker_flag" $flags) ++ libs=$(filter_out "$cxx_linker_flag" $libs) + test_$type $($cflags_filter $flags) || return + flags=$($ldflags_filter $flags) + libs=$($ldflags_filter $libs) +- test_cmd $ld $LDFLAGS $LDEXEFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs ++ if $use_cxx_linker; then ++ linker=$cxx ++ linkerflags="$CXXFLAGS $LDFLAGS" ++ test_cmd $linker $linkerflags $LDEXEFLAGS $flags $(cxx_o $TMPE) $TMPO $libs $extralibs ++ else ++ test_cmd $linker $linkerflags $LDEXEFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs ++ fi + } + + check_ld(){ +@@ -1647,11 +1662,11 @@ + pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg) + pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg) + pkg_incdir=$($pkg_config --variable=includedir $pkg_config_flags $pkg) +- check_class_headers_cxx "$headers" "$classes" $pkg_cflags $pkg_libs "-lstdc++" "$@" && ++ check_class_headers_cxx "$headers" "$classes" $pkg_cflags $pkg_libs "$cxx_linker_flag" "$@" && + enable $name && + set_sanitized "${name}_cflags" $pkg_cflags && + set_sanitized "${name}_incdir" $pkg_incdir && +- set_sanitized "${name}_extralibs" $pkg_libs "-lstdc++" ++ set_sanitized "${name}_extralibs" $pkg_libs "$cxx_linker_flag" + } + + check_pkg_config(){ +@@ -3531,7 +3546,7 @@ + + ddagrab_filter_deps="d3d11va IDXGIOutput1 DXGI_OUTDUPL_FRAME_INFO" + gfxcapture_filter_deps="cxx17 threads d3d11va IGraphicsCaptureItemInterop __x_ABI_CWindows_CGraphics_CCapture_CIGraphicsCaptureSession3" +-gfxcapture_filter_extralibs="-lstdc++" ++gfxcapture_filter_extralibs="$cxx_linker_flag" + scale_d3d11_filter_deps="d3d11va" + scale_d3d12_filter_deps="d3d12va ID3D12VideoProcessor" + deinterlace_d3d12_filter_deps="d3d12va ID3D12VideoProcessor" +@@ -3971,11 +3986,11 @@ + caca_outdev_deps="libcaca" + decklink_deps_any="libdl LoadLibrary" + decklink_indev_deps="decklink threads" +-decklink_indev_extralibs="-lstdc++" ++decklink_indev_extralibs="$cxx_linker_flag" + decklink_indev_suggest="libzvbi" + decklink_outdev_deps="decklink threads" + decklink_outdev_suggest="libklvanc" +-decklink_outdev_extralibs="-lstdc++" ++decklink_outdev_extralibs="$cxx_linker_flag" + dshow_indev_deps="IBaseFilter" + dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi" + fbdev_indev_deps="linux_fb_h" +@@ -4464,6 +4479,9 @@ + host_extralibs='-lm' + host_cflags_filter=echo + host_ldflags_filter=echo ++# Internal marker for configure tests and generated makefiles to use CXX ++# as the linker driver without hardcoding a specific C++ runtime library. ++cxx_linker_flag='--ffmpeg-cxx-linker' + + target_path='$(CURDIR)' + +@@ -7269,13 +7287,13 @@ + require_headers "glslang/build_info.h" && { test_cpp_condition glslang/build_info.h "GLSLANG_VERSION_MAJOR >= 16" && spvremap="" ; } + check_lib spirv_library glslang/Include/glslang_c_interface.h glslang_initialize_process \ + -lglslang -lMachineIndependent -lGenericCodeGen \ +- ${spvremap} -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lstdc++ $libm_extralibs $pthreads_extralibs || ++ ${spvremap} -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools $cxx_linker_flag $libm_extralibs $pthreads_extralibs || + require spirv_library glslang/Include/glslang_c_interface.h glslang_initialize_process \ + -lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \ +- ${spvremap} -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lstdc++ $libm_extralibs $pthreads_extralibs ; ++ ${spvremap} -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools $cxx_linker_flag $libm_extralibs $pthreads_extralibs ; + fi + enabled libgme && { check_pkg_config libgme libgme gme/gme.h gme_new_emu || +- require libgme gme/gme.h gme_new_emu -lgme -lstdc++; } ++ require libgme gme/gme.h gme_new_emu -lgme $cxx_linker_flag; } + enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do + check_lib libgsm "${gsm_hdr}" gsm_create -lgsm && break; + done || die "ERROR: libgsm not found"; } +@@ -7343,7 +7361,7 @@ + enabled libopenh264 && require_pkg_config libopenh264 "openh264 >= 1.3.0" wels/codec_api.h WelsGetCodecVersion + enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version || + { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } } +-enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++" ++enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create $cxx_linker_flag && append libopenmpt_extralibs "$cxx_linker_flag" + enabled libopenvino && { { check_pkg_config libopenvino openvino openvino/c/openvino.h ov_core_create && enable openvino2; } || + { check_pkg_config libopenvino openvino c_api/ie_c_api.h ie_c_api_version || + require libopenvino c_api/ie_c_api.h ie_c_api_version -linference_engine_c_api; } } +@@ -7364,12 +7382,12 @@ + enabled librist && require_pkg_config librist "librist >= 0.2.7" librist/librist.h rist_receiver_create + enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_new_from_data + enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket +-enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++" ++enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new $cxx_linker_flag && append librubberband_extralibs "$cxx_linker_flag" + enabled libshaderc && require_pkg_config spirv_library "shaderc >= 2019.1" shaderc/shaderc.h shaderc_compiler_initialize + enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer + enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init || + require libsmbclient libsmbclient.h smbc_init -lsmbclient; } +-enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++ ++enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy $cxx_linker_flag + enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr + enabled libssh && require_pkg_config libssh "libssh >= 0.6.0" libssh/sftp.h sftp_init + enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init +@@ -7381,7 +7399,7 @@ + enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg + enabled libtls && require_pkg_config libtls libtls tls.h tls_configure && + { enabled gpl && ! enabled nonfree && die "ERROR: LibreSSL is incompatible with the gpl"; } +-enabled libtorch && check_cxxflags -std=c++17 && require_cxx libtorch torch/torch.h "torch::Tensor" -ltorch -lc10 -ltorch_cpu -lstdc++ -lpthread ++enabled libtorch && check_cxxflags -std=c++17 && require_cxx libtorch torch/torch.h "torch::Tensor" -ltorch -lc10 -ltorch_cpu $cxx_linker_flag -lpthread + enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame && + { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame || + die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; } +@@ -8588,6 +8606,7 @@ + CC_O=$CC_O + CXX_C=$CXX_C + CXX_O=$CXX_O ++CXXLINKERFLAG=$cxx_linker_flag + GLSLC_O=$GLSLC_O + NVCC_C=$NVCC_C + NVCC_O=$NVCC_O +--- a/ffbuild/common.mak ++++ b/ffbuild/common.mak +@@ -17,7 +17,9 @@ + ifeq ($(LD),$(CC)) + ifneq ($(CXX),) + LDXX := $(CXX) +-LINK = $(if $(filter -lstdc++,$(1)),$(LDXX) $(filter-out -lstdc++,$(1)),$(LD) $(1)) ++# Link C++-dependent targets with the C++ driver so it can select the ++# appropriate runtime library for the active toolchain. ++LINK = $(if $(filter $(CXXLINKERFLAG),$(1)),$(LDXX) $(filter-out $(CXXLINKERFLAG),$(1)),$(LD) $(1)) + endif + endif + diff --git a/fish/fish-4.5.0-depot-command-not-found.patch b/fish/fish-4.5.0-depot-command-not-found.patch new file mode 100644 index 0000000..08fb4cf --- /dev/null +++ b/fish/fish-4.5.0-depot-command-not-found.patch @@ -0,0 +1,47 @@ +--- a/share/functions/fish_command_not_found.fish ++++ b/share/functions/fish_command_not_found.fish +@@ -49,6 +49,44 @@ + function fish_command_not_found + command-not-found -- $argv[1] + end ++ # depot can query binary repo metadata for path ownership, which lets us ++ # suggest packages for missing commands in a pkgfile-like format. ++else if type -q depot ++ function fish_command_not_found ++ set -l __depot_seen_dirs ++ set -l __depot_paths ++ set -l __depot_packages ++ ++ for __dir in $PATH ++ string match -q '/*' -- $__dir; or continue ++ contains -- $__dir $__depot_seen_dirs; and continue ++ set -a __depot_seen_dirs $__dir ++ set -a __depot_paths $__dir/$argv[1] ++ end ++ ++ if test (count $__depot_paths) -eq 0 ++ set __depot_paths /usr/bin/$argv[1] /bin/$argv[1] ++ end ++ ++ for __path in $__depot_paths ++ set -l __hits ( ++ depot repo owns $__path 2>/dev/null | ++ string match -r '^\[INFO\] [^ ]+ \[binary:[^]]+\] [^ ]+ size=[^ ]+ owns=.*$' | ++ string replace -r '^\[INFO\] ([^ ]+) \[binary:([^]]+)\] ([^ ]+) size=[^ ]+ owns=(.+)$' '$2/$1 $3\t$4' ++ ) ++ ++ for __hit in $__hits ++ contains -- $__hit $__depot_packages; or set -a __depot_packages $__hit ++ end ++ end ++ ++ if test (count $__depot_packages) -gt 0 ++ printf "%s may be found in the following packages:\n" "$argv[1]" ++ printf " %s\n" $__depot_packages ++ else ++ __fish_default_command_not_found_handler $argv[1] ++ end ++ end + # pkgfile is an optional, but official, package on Arch Linux + # it ships with example handlers for bash and zsh, so we'll follow that format + else if type -q pkgfile diff --git a/fontconfig/fontconfig-2.17.1-posixify.patch b/fontconfig/fontconfig-2.17.1-posixify.patch new file mode 100644 index 0000000..2b8cb38 --- /dev/null +++ b/fontconfig/fontconfig-2.17.1-posixify.patch @@ -0,0 +1,84 @@ +diff --git a/test/run-test.sh b/test/run-test.sh +index 9b3c91c..73c0d3e 100644 +--- a/test/run-test.sh ++++ b/test/run-test.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # fontconfig/test/run-test.sh + # + # Copyright © 2000 Keith Packard +@@ -84,11 +84,11 @@ fstat() { + ret=$(stat -c "$fmt" "$fn") + else + # BSD +- if [ "x$fmt" == "x%Y" ]; then ++ if [ "x$fmt" = "x%Y" ]; then + ret=$(stat -f "%m" "$fn") +- elif [ "x$fmt" == "x%y" ]; then ++ elif [ "x$fmt" = "x%y" ]; then + ret=$(stat -f "%Sm" -t "%F %T %z" "$fn") +- elif [ "x$fmt" == "x%n %s %y %z" ]; then ++ elif [ "x$fmt" = "x%n %s %y %z" ]; then + ret=$(stat -f "%SN %z %Sm %Sc" -t "%F %T %z" "$fn") + else + echo "E: Unknown format" +diff --git a/test/run-test-map.sh b/test/run-test-map.sh +index 869d7b2..c634bb8 100755 +--- a/test/run-test-map.sh ++++ b/test/run-test-map.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # fontconfig/test/run-test-cache-map.sh + # + # Copyright © 2018 Keith Packard +@@ -41,9 +41,8 @@ EXPECTED="out-map.expected" + FCLIST=../fc-list/fc-list$EXEEXT + FCCACHE=../fc-cache/fc-cache$EXEEXT + +-which bwrap > /dev/null 2>&1 +-if [ $? -eq 0 ]; then +- BWRAP=`which bwrap` ++if command -v bwrap > /dev/null 2>&1; then ++ BWRAP=$(command -v bwrap) + fi + + FONT1=$TESTDIR/4x6.pcf +diff --git a/test/wrapper-script.sh b/test/wrapper-script.sh +index 94dcb85..ae68c6d 100755 +--- a/test/wrapper-script.sh ++++ b/test/wrapper-script.sh +@@ -1,20 +1,24 @@ +-#! /bin/bash ++#! /bin/sh + + CC=${CC:-gcc} + + case "$1" in + *.exe) + export WINEPATH=$(${CC} -print-sysroot)/mingw/bin +- fccwd=`pwd` +- cd $(IFS=:;for i in $PATH; do echo $i|grep mingw> /dev/null; [ $? -eq 0 ] && echo $i; done) +- if [ "x$(dirname $@)" = "x." ]; then +- /usr/bin/env wine $fccwd/$@ ++ fccwd=$(pwd) ++ mingw_path=$(IFS=:; for i in $PATH; do ++ case "$i" in ++ *mingw*) printf '%s\n' "$i"; break ;; ++ esac ++ done) ++ cd "$mingw_path" || exit 1 ++ if [ "$(dirname -- "$1")" = "." ]; then ++ /usr/bin/env wine "$fccwd/$1" + else +- /usr/bin/env wine $@ ++ /usr/bin/env wine "$@" + fi + ;; + *) +- $@ ++ "$@" + ;; + esac +- diff --git a/gettext-tiny/gettext-tiny-0.3.3-bmake.patch b/gettext-tiny/gettext-tiny-0.3.3-bmake.patch new file mode 100644 index 0000000..2b62ee3 --- /dev/null +++ b/gettext-tiny/gettext-tiny-0.3.3-bmake.patch @@ -0,0 +1,178 @@ +--- a/Makefile ++++ b/Makefile +@@ -1,93 +1,103 @@ + prefix=/usr/local +-bindir=$(prefix)/bin +-includedir=$(prefix)/include +-libdir=$(prefix)/lib +-sysconfdir=$(prefix)/etc +-datarootdir=$(prefix)/share +-datadir=$(datarootdir)/gettext-tiny +-acdir=$(datarootdir)/aclocal +- +-ifeq ($(LIBINTL), MUSL) +- LIBSRC = libintl/libintl-musl.c +- HEADERS = +-else ifeq ($(LIBINTL), NONE) +- LIBSRC = +- HEADERS = +-else +- LIBSRC = libintl/libintl.c +- HEADERS = libintl.h +-endif +-PROGSRC = $(sort $(wildcard src/*.c)) +- +-PARSEROBJS = src/poparser.o src/poparser_sysdep.o src/StringEscape.o +-PROGOBJS = $(PROGSRC:.c=.o) +-LIBOBJS = $(LIBSRC:.c=.o) +-OBJS = $(PROGOBJS) $(LIBOBJS) ++bindir=${prefix}/bin ++includedir=${prefix}/include ++libdir=${prefix}/lib ++sysconfdir=${prefix}/etc ++datarootdir=${prefix}/share ++datadir=${datarootdir}/gettext-tiny ++acdir=${datarootdir}/aclocal ++ ++LIBINTL ?= default ++LIBINTL_MODE=${LIBINTL:tl} ++ ++.if ${LIBINTL_MODE} == "musl" ++LIBSRC=libintl/libintl-musl.c ++HEADERS= ++.elif ${LIBINTL_MODE} == "none" ++LIBSRC= ++HEADERS= ++.else ++LIBSRC=libintl/libintl.c ++HEADERS=libintl.h ++.endif ++ ++PARSEROBJS=src/poparser.o src/poparser_sysdep.o src/StringEscape.o ++PROGOBJS=src/msgfmt.o src/msgmerge.o src/poparser.o src/poparser_sysdep.o src/StringEscape.o ++LIBOBJS=${LIBSRC:.c=.o} ++OBJS=${PROGOBJS} ${LIBOBJS} + +-ALL_INCLUDES = $(HEADERS) +-ifneq ($(LIBINTL), NONE) ++ALL_INCLUDES=${HEADERS} ++.if ${LIBINTL_MODE} != "none" + ALL_LIBS=libintl.a +-endif ++.else ++ALL_LIBS= ++.endif + ALL_TOOLS=msgfmt msgmerge xgettext autopoint +-ALL_M4S=$(sort $(wildcard m4/*.m4)) +-ALL_DATA=$(sort $(wildcard data/*)) ++AC_DATADIR_REL=${datadir:S,${datarootdir}/,,} + + CFLAGS ?= -O0 -fPIC + +-AR ?= $(CROSS_COMPILE)ar +-RANLIB ?= $(CROSS_COMPILE)ranlib +-CC ?= $(CROSS_COMPILE)cc ++AR ?= ${CROSS_COMPILE}ar ++RANLIB ?= ${CROSS_COMPILE}ranlib ++CC ?= ${CROSS_COMPILE}cc + + INSTALL ?= ./install.sh + +--include config.mak +- +-LDLIBS:=$(shell echo "int main(){}" | $(CC) $(CFLAGS) $(LDFLAGS) -liconv -x c - >/dev/null 2>&1 && printf %s -liconv) +- +-BUILDCFLAGS=$(CFLAGS) +- +-all: $(ALL_LIBS) $(ALL_TOOLS) +- +-install: $(ALL_LIBS:lib%=$(DESTDIR)$(libdir)/lib%) $(ALL_INCLUDES:%=$(DESTDIR)$(includedir)/%) $(ALL_TOOLS:%=$(DESTDIR)$(bindir)/%) $(ALL_M4S:%=$(DESTDIR)$(datadir)/%) $(ALL_M4S:%=$(DESTDIR)$(acdir)/%) $(ALL_DATA:%=$(DESTDIR)$(datadir)/%) ++.if exists(config.mak) ++.include "config.mak" ++.endif ++ ++LDLIBS!=echo 'int main(){}' | ${CC} ${CFLAGS} ${LDFLAGS} -liconv -x c - >/dev/null 2>&1 && printf '%s' -liconv || true ++ ++BUILDCFLAGS=${CFLAGS} ++ ++all: ${ALL_LIBS} ${ALL_TOOLS} ++ ++install: ${ALL_LIBS} ${ALL_TOOLS} ++.for lib in ${ALL_LIBS} ++ ${INSTALL} -D -m 755 ${lib} ${DESTDIR}${libdir}/${lib} ++.endfor ++.for hdr in ${ALL_INCLUDES} ++ ${INSTALL} -D -m 644 include/${hdr} ${DESTDIR}${includedir}/${hdr} ++.endfor ++.for tool in ${ALL_TOOLS} ++ ${INSTALL} -D -m 755 ${tool} ${DESTDIR}${bindir}/${tool} ++.endfor ++ @set -e; \ ++ for m4f in m4/*.m4; do \ ++ [ -f "$$m4f" ] || continue; \ ++ ${INSTALL} -D -m 644 "$$m4f" "${DESTDIR}${datadir}/$${m4f##*/}"; \ ++ ${INSTALL} -D -l "../${AC_DATADIR_REL}/$${m4f##*/}" "${DESTDIR}${acdir}/$${m4f##*/}"; \ ++ done ++ @set -e; \ ++ for dataf in data/*; do \ ++ [ -f "$$dataf" ] || continue; \ ++ ${INSTALL} -D -m 644 "$$dataf" "${DESTDIR}${datadir}/$${dataf##*/}"; \ ++ done + + clean: +- rm -f $(ALL_LIBS) +- rm -f $(OBJS) +- rm -f $(ALL_TOOLS) +- +-%.o: %.c +- $(CC) $(BUILDCFLAGS) -c -o $@ $< +- +-libintl.a: $(LIBOBJS) +- rm -f $@ +- $(AR) rc $@ $(LIBOBJS) +- $(RANLIB) $@ ++ rm -f ${ALL_LIBS} ++ rm -f ${OBJS} ++ rm -f ${ALL_TOOLS} ++ ++.c.o: ++ ${CC} ${BUILDCFLAGS} -c -o ${.TARGET} ${.IMPSRC} ++ ++libintl.a: ${LIBOBJS} ++ rm -f ${.TARGET} ++ ${AR} rc ${.TARGET} ${LIBOBJS} ++ ${RANLIB} ${.TARGET} + +-msgmerge: $(OBJS) +- $(CC) -o $@ src/msgmerge.o $(PARSEROBJS) $(LDFLAGS) $(LDLIBS) ++msgmerge: ${OBJS} ++ ${CC} -o ${.TARGET} src/msgmerge.o ${PARSEROBJS} ${LDFLAGS} ${LDLIBS} + +-msgfmt: $(OBJS) +- $(CC) -o $@ src/msgfmt.o $(PARSEROBJS) $(LDFLAGS) $(LDLIBS) ++msgfmt: ${OBJS} ++ ${CC} -o ${.TARGET} src/msgfmt.o ${PARSEROBJS} ${LDFLAGS} ${LDLIBS} + + xgettext: + cp src/xgettext.sh ./xgettext + + autopoint: src/autopoint.in +- cat $< | sed 's,@datadir@,$(datadir),' > $@ +- +-$(DESTDIR)$(libdir)/%.a: %.a +- $(INSTALL) -D -m 755 $< $@ +- +-$(DESTDIR)$(includedir)/%.h: include/%.h +- $(INSTALL) -D -m 644 $< $@ +- +-$(DESTDIR)$(bindir)/%: % +- $(INSTALL) -D -m 755 $< $@ +- +-$(DESTDIR)$(datadir)/%: % +- $(INSTALL) -D -m 644 $< $@ +- +-$(DESTDIR)$(acdir)/%: % +- $(INSTALL) -D -l ../$(subst $(datarootdir)/,,$(datadir))/$< $(patsubst %m4/,%,$(dir $@))/$(notdir $@) ++ sed 's,@datadir@,${datadir},' < src/autopoint.in > ${.TARGET} + + .PHONY: all clean install diff --git a/glibc/glibc-2.43-clang-math-barriers.patch b/glibc/glibc-2.43-clang-math-barriers.patch new file mode 100644 index 0000000..88dac07 --- /dev/null +++ b/glibc/glibc-2.43-clang-math-barriers.patch @@ -0,0 +1,11 @@ +--- a/sysdeps/x86/fpu/math-barriers.h ++++ b/sysdeps/x86/fpu/math-barriers.h +@@ -19,7 +19,7 @@ + #ifndef X86_MATH_BARRIERS_H + #define X86_MATH_BARRIERS_H 1 + +-#ifdef __SSE2_MATH__ ++#if defined __SSE2_MATH__ && !defined __clang__ + # define math_opt_barrier(x) \ + ({ __typeof(x) __x; \ + if (sizeof (x) <= sizeof (double) \ diff --git a/glibc/glibc-2.43-use-compiler-reported-libgcc.patch b/glibc/glibc-2.43-use-compiler-reported-libgcc.patch new file mode 100644 index 0000000..d3d89f1 --- /dev/null +++ b/glibc/glibc-2.43-use-compiler-reported-libgcc.patch @@ -0,0 +1,315 @@ +diff -ruN a/Makeconfig b/Makeconfig +--- a/Makeconfig 2026-01-23 14:54:00.000000000 -0600 ++++ b/Makeconfig 2026-03-15 19:54:42.332792487 -0500 +@@ -714,33 +714,109 @@ + else + libunwind = -lunwind + endif +-libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed ++# Preserve the configured target selection when asking the compiler for ++# support libraries and CRT objects. For Clang, prefer ++# compiler-rt builtins if available because libgcc lookups may resolve to a ++# host archive. ++cc-runtime-flags := $(filter-out -I%,$(CFLAGS)) $(sysdep-LDFLAGS) $(LDFLAGS) ++cc-runtime-target := $(shell $(CC) $(cc-runtime-flags) -print-target-triple 2>/dev/null) ++cc-clang-resource-dir := $(shell $(CC) $(cc-runtime-flags) --print-resource-dir 2>/dev/null) ++cc-clang-rtlib-flags := $(shell \ ++ if test "$(have-test-clang)" = yes; then \ ++ for candidate in i686-linux-gnu i686-unknown-linux-gnu i386-unknown-linux-gnu "$(cc-runtime-target)"; do \ ++ if test -n "$$candidate"; then \ ++ rtlib=$$($(CC) $(cc-runtime-flags) --target=$$candidate \ ++ --rtlib=compiler-rt --print-libgcc-file-name 2>/dev/null); \ ++ if test "x$$rtlib" != x && test "x$$rtlib" != xlibgcc.a && test -r "$$rtlib"; then \ ++ printf '%s' "--target=$$candidate --rtlib=compiler-rt"; \ ++ exit 0; \ ++ fi; \ ++ fi; \ ++ done; \ ++ fi) ++cc-clang-crtbegin := $(shell \ ++ if test "$(have-test-clang)" = yes; then \ ++ for path in \ ++ "$(cc-clang-resource-dir)/lib/i686-linux-gnu/clang_rt.crtbegin-i386.o" \ ++ "$(cc-clang-resource-dir)/lib/i686-unknown-linux-gnu/clang_rt.crtbegin-i386.o" \ ++ "$(cc-clang-resource-dir)/lib/i386-unknown-linux-gnu/clang_rt.crtbegin-i386.o" \ ++ "$(cc-clang-resource-dir)/lib/$(cc-runtime-target)/clang_rt.crtbegin-i386.o" \ ++ "$(cc-clang-resource-dir)/lib/linux/clang_rt.crtbegin-i386.o"; do \ ++ if test -r "$$path"; then \ ++ printf '%s' "$$path"; \ ++ exit 0; \ ++ fi; \ ++ done; \ ++ fi) ++cc-clang-crtend := $(shell \ ++ if test "$(have-test-clang)" = yes; then \ ++ for path in \ ++ "$(cc-clang-resource-dir)/lib/i686-linux-gnu/clang_rt.crtend-i386.o" \ ++ "$(cc-clang-resource-dir)/lib/i686-unknown-linux-gnu/clang_rt.crtend-i386.o" \ ++ "$(cc-clang-resource-dir)/lib/i386-unknown-linux-gnu/clang_rt.crtend-i386.o" \ ++ "$(cc-clang-resource-dir)/lib/$(cc-runtime-target)/clang_rt.crtend-i386.o" \ ++ "$(cc-clang-resource-dir)/lib/linux/clang_rt.crtend-i386.o"; do \ ++ if test -r "$$path"; then \ ++ printf '%s' "$$path"; \ ++ exit 0; \ ++ fi; \ ++ done; \ ++ fi) ++libgcc := $(shell \ ++ lib=$$($(CC) $(cc-runtime-flags) --print-libgcc-file-name 2>/dev/null); \ ++ if test "$(have-test-clang)" = yes; then \ ++ rtlib=$$($(CC) $(cc-runtime-flags) $(cc-clang-rtlib-flags) \ ++ --print-libgcc-file-name 2>/dev/null); \ ++ if test "x$$rtlib" != x && test "x$$rtlib" != xlibgcc.a && test -r "$$rtlib"; then \ ++ lib=$$rtlib; \ ++ else \ ++ for path in \ ++ "$(cc-clang-resource-dir)/lib/i686-linux-gnu/libclang_rt.builtins.a" \ ++ "$(cc-clang-resource-dir)/lib/i686-unknown-linux-gnu/libclang_rt.builtins.a" \ ++ "$(cc-clang-resource-dir)/lib/i386-unknown-linux-gnu/libclang_rt.builtins.a" \ ++ "$(cc-clang-resource-dir)/lib/$(cc-runtime-target)/libclang_rt.builtins.a" \ ++ "$(cc-clang-resource-dir)/lib/linux/libclang_rt.builtins-i386.a"; do \ ++ if test -r "$$path"; then \ ++ lib=$$path; \ ++ break; \ ++ fi; \ ++ done; \ ++ fi; \ ++ fi; \ ++ printf '%s' "$$lib") ++# Do not mix Clang's compiler-rt builtins with GCC crtbegin/crtend ++# objects. If compiler-rt CRT objects are unavailable, leave these ++# empty and let the link proceed without the GCC startup fragments. ++cc-clang-use-rt := $(and $(filter yes,$(have-test-clang)),$(cc-clang-rtlib-flags)) ++libgcc_eh_archive := $(shell $(CC) $(cc-runtime-flags) --print-file-name=libgcc_eh.a) ++libgcc_s := $(shell $(CC) $(cc-runtime-flags) --print-file-name=libgcc_s.so$(libgcc_s.so-version)) ++libgcc_eh := -Wl,--as-needed $(libgcc_s) $(libunwind) -Wl,--no-as-needed + gnulib-arch = +-gnulib = -lgcc $(gnulib-arch) +-gnulib-tests := -lgcc $(libgcc_eh) +-gnulib-extralibdir = $(dir $(shell $(CC) -print-file-name=libgcc_s.so$(libgcc_s.so-version))) ++gnulib = $(libgcc) $(gnulib-arch) ++gnulib-tests := $(libgcc) $(libgcc_eh) ++gnulib-extralibdir = $(patsubst ./,,$(dir $(libgcc_s))) + static-gnulib-arch = + # By default, elf/static-stubs.o, instead of -lgcc_eh, is used to + # statically link programs. When --disable-shared is used, we use + # -lgcc_eh since elf/static-stubs.o isn't sufficient. + ifeq (yes,$(build-shared)) +-static-gnulib = -lgcc $(static-gnulib-arch) ++static-gnulib = $(libgcc) $(static-gnulib-arch) + else +-static-gnulib = -lgcc -lgcc_eh $(static-gnulib-arch) ++static-gnulib = $(libgcc) $(libgcc_eh_archive) $(static-gnulib-arch) + endif +-static-gnulib-tests := -lgcc -lgcc_eh $(libunwind) +-libc.so-gnulib := -lgcc ++static-gnulib-tests := $(libgcc) $(libgcc_eh_archive) $(libunwind) ++libc.so-gnulib := $(libgcc) + endif + +preinit = $(addprefix $(csu-objpfx),crti.o) + +postinit = $(addprefix $(csu-objpfx),crtn.o) +-+prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o` +-+postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o` +++prector = $(if $(cc-clang-use-rt),$(cc-clang-crtbegin),`$(CC) $(cc-runtime-flags) --print-file-name=crtbegin.o`) +++postctor = $(if $(cc-clang-use-rt),$(cc-clang-crtend),`$(CC) $(cc-runtime-flags) --print-file-name=crtend.o`) + # Variants of the two previous definitions for linking PIE programs. +-+prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o` +-+postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o` +++prectorS = $(if $(cc-clang-use-rt),$(cc-clang-crtbegin),`$(CC) $(cc-runtime-flags) --print-file-name=crtbeginS.o`) +++postctorS = $(if $(cc-clang-use-rt),$(cc-clang-crtend),`$(CC) $(cc-runtime-flags) --print-file-name=crtendS.o`) + # Variants of the two previous definitions for statically linking programs. +-static-prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o` +-static-postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o` ++static-prector = $(if $(cc-clang-use-rt),$(cc-clang-crtbegin),`$(CC) $(cc-runtime-flags) --print-file-name=crtbeginT.o`) ++static-postctor = $(if $(cc-clang-use-rt),$(cc-clang-crtend),`$(CC) $(cc-runtime-flags) --print-file-name=crtend.o`) + ifeq (yes,$(enable-static-pie)) + # Static PIE must use PIE variants. + +prectorT = $(if $($(@F)-no-pie),$(static-prector),$(+prectorS)) +diff -ruN a/Makerules b/Makerules +--- a/Makerules 2026-01-23 14:54:00.000000000 -0600 ++++ b/Makerules 2026-03-15 19:54:16.435354197 -0500 +@@ -543,7 +543,7 @@ + $(call after-link,$@) + + define build-shlib-helper +-$(LINK.o) -shared -static-libgcc -Wl,-O1 $(sysdep-LDFLAGS) \ ++$(LINK.o) -shared $(if $(and $(filter yes,$(have-test-clang)),$(cc-clang-rtlib-flags)),-nostartfiles $(cc-clang-rtlib-flags),-static-libgcc) -Wl,-O1 $(sysdep-LDFLAGS) \ + $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) $(rtld-LDFLAGS) \ + $(if $($(@F)-no-dt-relr),$(no-dt-relr-ldflag),$(dt-relr-ldflag)) \ + $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \ +@@ -555,11 +555,13 @@ + + define build-shlib + $(build-shlib-helper) -o $@ \ +- $(csu-objpfx)abi-note.o $(build-shlib-objlist) ++ $(if $(and $(filter yes,$(have-test-clang)),$(cc-clang-crtbegin)),$(if $(filter c.so,$(@F)),,$(+preinit)) $(+prectorS)) \ ++ $(csu-objpfx)abi-note.o $(build-shlib-objlist) \ ++ $(if $(and $(filter yes,$(have-test-clang)),$(cc-clang-crtend)),$(+postctorS) $(if $(filter c.so,$(@F)),,$(+postinit))) + endef + + define build-module-helper +-$(LINK.o) -shared -static-libgcc $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \ ++$(LINK.o) -shared $(if $(and $(filter yes,$(have-test-clang)),$(cc-clang-rtlib-flags)),-nostartfiles $(cc-clang-rtlib-flags),-static-libgcc) $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \ + $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) \ + $(if $($(@F)-no-dt-relr),$(no-dt-relr-ldflag),$(dt-relr-ldflag)) \ + -B$(csu-objpfx) $(load-map-file) \ +@@ -574,14 +576,18 @@ + # not for shared objects + define build-module + $(build-module-helper) -o $@ \ +- $(csu-objpfx)abi-note.o $(build-module-objlist) $(link-libc-args) ++ $(if $(and $(filter yes,$(have-test-clang)),$(cc-clang-crtbegin)),$(+preinit) $(+prectorS)) \ ++ $(csu-objpfx)abi-note.o $(build-module-objlist) $(link-libc-args) \ ++ $(if $(and $(filter yes,$(have-test-clang)),$(cc-clang-crtend)),$(+postctorS) $(+postinit)) + $(call after-link,$@) + endef + define build-module-asneeded + $(build-module-helper) -o $@ \ ++ $(if $(and $(filter yes,$(have-test-clang)),$(cc-clang-crtbegin)),$(+preinit) $(+prectorS)) \ + $(csu-objpfx)abi-note.o \ + -Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed \ +- $(link-libc-args) ++ $(link-libc-args) \ ++ $(if $(and $(filter yes,$(have-test-clang)),$(cc-clang-crtend)),$(+postctorS) $(+postinit)) + $(call after-link,$@) + endef + +diff -ruN a/configure b/configure +--- a/configure 2026-01-23 14:54:00.000000000 -0600 ++++ b/configure 2026-03-15 19:54:16.436079577 -0500 +@@ -9328,18 +9328,28 @@ + config_vars="$config_vars + enable-static-pie = $libc_cv_static_pie" + +-# Check if we can link support functionality against libgcc_s. ++# Check if the compiler reports usable support functionality from libgcc_s. + # Must not be used for linking installed binaries, to produce the + # same binaries for bootstrapped and bootstrapping builds (the latter + # with a GCC that does not build libgcc_s). +-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC can link against -lgcc_s" >&5 +-printf %s "checking whether $CC can link against -lgcc_s... " >&6; } ++# ++# The compiler-reported runtime may be an absolute path rather than a bare ++# library name, for example when using llvm-libgcc. Include the configured ++# target-selection flags so multilib and compiler-rt builds query the ++# matching runtime. ++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC reports a usable libgcc_s" >&5 ++printf %s "checking whether $CC reports a usable libgcc_s... " >&6; } + if test ${libc_cv_have_libgcc_s+y} + then : + printf %s "(cached) " >&6 + else case e in #( + e) old_LIBS="$LIBS" +- LIBS="$LIBS -lgcc_s" ++ libc_cv_libgcc_s=`$CC $CFLAGS $LDFLAGS -print-file-name=libgcc_s.so 2>/dev/null` ++ if test "x$libc_cv_libgcc_s" = "xlibgcc_s.so" ++ then : ++ libc_cv_have_libgcc_s=no ++ else case e in #( ++ e) LIBS="$LIBS $libc_cv_libgcc_s" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + +@@ -9360,6 +9370,9 @@ + fi + rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext ++ ;; ++esac ++ fi + LIBS="$old_LIBS" ;; + esac + fi +@@ -11002,5 +11015,3 @@ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 + printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + fi +- +- +diff -ruN a/configure.ac b/configure.ac +--- a/configure.ac 2026-01-23 14:54:00.000000000 -0600 ++++ b/configure.ac 2026-03-15 19:54:16.436525491 -0500 +@@ -2122,15 +2122,24 @@ + fi + LIBC_CONFIG_VAR([enable-static-pie], [$libc_cv_static_pie]) + +-# Check if we can link support functionality against libgcc_s. ++# Check if the compiler reports usable support functionality from libgcc_s. + # Must not be used for linking installed binaries, to produce the + # same binaries for bootstrapped and bootstrapping builds (the latter + # with a GCC that does not build libgcc_s). +-AC_CACHE_CHECK([whether $CC can link against -lgcc_s], libc_cv_have_libgcc_s, [dnl ++# The compiler-reported runtime may be an absolute path rather than a bare ++# library name, for example when using llvm-libgcc. Include the configured ++# target-selection flags so multilib and compiler-rt builds query the ++# matching runtime. ++AC_CACHE_CHECK([whether $CC reports a usable libgcc_s], libc_cv_have_libgcc_s, [dnl + old_LIBS="$LIBS" +- LIBS="$LIBS -lgcc_s" +- AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], +- [libc_cv_have_libgcc_s=yes], [libc_cv_have_libgcc_s=no]) ++ libc_cv_libgcc_s=`$CC $CFLAGS $LDFLAGS -print-file-name=libgcc_s.so 2>/dev/null` ++ if test "x$libc_cv_libgcc_s" = "xlibgcc_s.so"; then ++ libc_cv_have_libgcc_s=no ++ else ++ LIBS="$LIBS $libc_cv_libgcc_s" ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], ++ [libc_cv_have_libgcc_s=yes], [libc_cv_have_libgcc_s=no]) ++ fi + LIBS="$old_LIBS"]) + LIBC_CONFIG_VAR([have-libgcc_s], [$libc_cv_have_libgcc_s]) + +diff -ruN a/dlfcn/Makefile b/dlfcn/Makefile +--- a/dlfcn/Makefile 2026-01-23 14:54:00.000000000 -0600 ++++ b/dlfcn/Makefile 2026-03-15 19:54:16.436660818 -0500 +@@ -187,7 +187,7 @@ + $(objpfx)bug-atexit2.out: $(objpfx)bug-atexit2-lib.so + + ifneq (,$(CXX)) +-LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh ++LDLIBS-bug-atexit3-lib.so = -lstdc++ $(libgcc_eh_archive) + $(objpfx)bug-atexit3-lib.so: $(libsupport) + $(objpfx)bug-atexit3.out: $(objpfx)bug-atexit3-lib.so + endif +diff -ruN a/elf/Makefile b/elf/Makefile +--- a/elf/Makefile 2026-01-23 14:54:00.000000000 -0600 ++++ b/elf/Makefile 2026-03-15 19:54:16.436784483 -0500 +@@ -1514,7 +1514,7 @@ + echo ".globl $$symbol"; \ + echo "$$symbol:"; \ + done | $(CC) -o $@T.o $(ASFLAGS) -c -x assembler - +- $(reloc-link) -o $@.o $@T.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T ++ $(reloc-link) -o $@.o $@T.o '-Wl,-(' $^ $(libgcc) '-Wl,-)' -Wl,-Map,$@T + rm -f %@T.o $@.o + mv -f $@T $@ + +@@ -1544,7 +1544,7 @@ + $(MAKE) -f $< -f rtld-Rules + + $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a +- $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \ ++ $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ $(libgcc) '-Wl,-)' \ + -Wl,-Map,$@.map + + generated += librtld.map librtld.mk rtld-libc.a librtld.os.map +diff -ruN a/support/Makefile b/support/Makefile +--- a/support/Makefile 2026-01-23 14:54:00.000000000 -0600 ++++ b/support/Makefile 2026-03-15 19:54:16.436940579 -0500 +@@ -284,14 +284,14 @@ + + ifeq (,$(CXX)) + LINKS_DSO_PROGRAM = links-dso-program-c +-LDLIBS-links-dso-program-c = -lgcc ++LDLIBS-links-dso-program-c = $(libgcc) + ifeq ($(have-libgcc_s),yes) + CFLAGS-links-dso-program-c.c += -fexceptions +-LDLIBS-links-dso-program-c += -lgcc_s $(libunwind) ++LDLIBS-links-dso-program-c += $(libgcc_s) $(libunwind) + endif + else + LINKS_DSO_PROGRAM = links-dso-program +-LDLIBS-links-dso-program = -lstdc++ -lgcc -lgcc_s $(libunwind) ++LDLIBS-links-dso-program = -lstdc++ $(libgcc) $(libgcc_s) $(libunwind) + endif + + ifeq (yes,$(have-selinux)) diff --git a/glibc/glibc-longjmp-ssp-fix.patch b/glibc/glibc-longjmp-ssp-fix.patch new file mode 100644 index 0000000..5d9ef9c --- /dev/null +++ b/glibc/glibc-longjmp-ssp-fix.patch @@ -0,0 +1,15 @@ +--- a/sysdeps/unix/sysv/linux/x86/longjmp.c ++++ b/sysdeps/unix/sysv/linux/x86/longjmp.c +@@ -29,6 +29,7 @@ + + /* Assert that the priv field in struct pthread_unwind_buf has space + to store shadow stack pointer. */ ++#if defined SHADOW_STACK_POINTER_OFFSET && SHADOW_STACK_POINTER_OFFSET > 0 + _Static_assert ((offsetof (struct pthread_unwind_buf, priv) + <= SHADOW_STACK_POINTER_OFFSET) + && ((offsetof (struct pthread_unwind_buf, priv) +@@ -37,3 +38,4 @@ + + SHADOW_STACK_POINTER_SIZE)), + "Shadow stack pointer is not within private storage " + "of pthread_unwind_buf."); ++#endif diff --git a/glibc/glibc-sfp-handle-exceptions-fix.patch b/glibc/glibc-sfp-handle-exceptions-fix.patch new file mode 100644 index 0000000..293064b --- /dev/null +++ b/glibc/glibc-sfp-handle-exceptions-fix.patch @@ -0,0 +1,154 @@ +--- a/sysdeps/x86/fpu/sfp-machine.h ++++ b/sysdeps/x86/fpu/sfp-machine.h +@@ -2,6 +2,7 @@ + libgcc, with soft-float and other irrelevant parts removed. */ + + #include ++#include + + #if HAVE_X86_LIBGCC_CMP_RETURN_ATTR + /* The type of the result of a floating point comparison. This must +@@ -65,76 +66,82 @@ + # define _FP_WS_TYPE signed long int + # define _FP_I_TYPE long int + ++# ifdef __clang__ ++# define __SFP_REG(x) (x) ++# else ++# define __SFP_REG(x) ((USItype) (x)) ++# endif ++ + # define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \ + __asm__ ("add{l} {%11,%3|%3,%11}\n\t" \ + "adc{l} {%9,%2|%2,%9}\n\t" \ + "adc{l} {%7,%1|%1,%7}\n\t" \ + "adc{l} {%5,%0|%0,%5}" \ +- : "=r" ((USItype) (r3)), \ +- "=&r" ((USItype) (r2)), \ +- "=&r" ((USItype) (r1)), \ +- "=&r" ((USItype) (r0)) \ +- : "%0" ((USItype) (x3)), \ +- "g" ((USItype) (y3)), \ +- "%1" ((USItype) (x2)), \ +- "g" ((USItype) (y2)), \ +- "%2" ((USItype) (x1)), \ +- "g" ((USItype) (y1)), \ +- "%3" ((USItype) (x0)), \ +- "g" ((USItype) (y0))) ++ : "=r" (__SFP_REG (r3)), \ ++ "=&r" (__SFP_REG (r2)), \ ++ "=&r" (__SFP_REG (r1)), \ ++ "=&r" (__SFP_REG (r0)) \ ++ : "%0" (__SFP_REG (x3)), \ ++ "g" (__SFP_REG (y3)), \ ++ "%1" (__SFP_REG (x2)), \ ++ "g" (__SFP_REG (y2)), \ ++ "%2" (__SFP_REG (x1)), \ ++ "g" (__SFP_REG (y1)), \ ++ "%3" (__SFP_REG (x0)), \ ++ "g" (__SFP_REG (y0))) + # define __FP_FRAC_ADD_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \ + __asm__ ("add{l} {%8,%2|%2,%8}\n\t" \ + "adc{l} {%6,%1|%1,%6}\n\t" \ + "adc{l} {%4,%0|%0,%4}" \ +- : "=r" ((USItype) (r2)), \ +- "=&r" ((USItype) (r1)), \ +- "=&r" ((USItype) (r0)) \ +- : "%0" ((USItype) (x2)), \ +- "g" ((USItype) (y2)), \ +- "%1" ((USItype) (x1)), \ +- "g" ((USItype) (y1)), \ +- "%2" ((USItype) (x0)), \ +- "g" ((USItype) (y0))) ++ : "=r" (__SFP_REG (r2)), \ ++ "=&r" (__SFP_REG (r1)), \ ++ "=&r" (__SFP_REG (r0)) \ ++ : "%0" (__SFP_REG (x2)), \ ++ "g" (__SFP_REG (y2)), \ ++ "%1" (__SFP_REG (x1)), \ ++ "g" (__SFP_REG (y1)), \ ++ "%2" (__SFP_REG (x0)), \ ++ "g" (__SFP_REG (y0))) + # define __FP_FRAC_SUB_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \ + __asm__ ("sub{l} {%11,%3|%3,%11}\n\t" \ + "sbb{l} {%9,%2|%2,%9}\n\t" \ + "sbb{l} {%7,%1|%1,%7}\n\t" \ + "sbb{l} {%5,%0|%0,%5}" \ +- : "=r" ((USItype) (r3)), \ +- "=&r" ((USItype) (r2)), \ +- "=&r" ((USItype) (r1)), \ +- "=&r" ((USItype) (r0)) \ +- : "0" ((USItype) (x3)), \ +- "g" ((USItype) (y3)), \ +- "1" ((USItype) (x2)), \ +- "g" ((USItype) (y2)), \ +- "2" ((USItype) (x1)), \ +- "g" ((USItype) (y1)), \ +- "3" ((USItype) (x0)), \ +- "g" ((USItype) (y0))) ++ : "=r" (__SFP_REG (r3)), \ ++ "=&r" (__SFP_REG (r2)), \ ++ "=&r" (__SFP_REG (r1)), \ ++ "=&r" (__SFP_REG (r0)) \ ++ : "0" (__SFP_REG (x3)), \ ++ "g" (__SFP_REG (y3)), \ ++ "1" (__SFP_REG (x2)), \ ++ "g" (__SFP_REG (y2)), \ ++ "2" (__SFP_REG (x1)), \ ++ "g" (__SFP_REG (y1)), \ ++ "3" (__SFP_REG (x0)), \ ++ "g" (__SFP_REG (y0))) + # define __FP_FRAC_SUB_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \ + __asm__ ("sub{l} {%8,%2|%2,%8}\n\t" \ + "sbb{l} {%6,%1|%1,%6}\n\t" \ + "sbb{l} {%4,%0|%0,%4}" \ +- : "=r" ((USItype) (r2)), \ +- "=&r" ((USItype) (r1)), \ +- "=&r" ((USItype) (r0)) \ +- : "0" ((USItype) (x2)), \ +- "g" ((USItype) (y2)), \ +- "1" ((USItype) (x1)), \ +- "g" ((USItype) (y1)), \ +- "2" ((USItype) (x0)), \ +- "g" ((USItype) (y0))) ++ : "=r" (__SFP_REG (r2)), \ ++ "=&r" (__SFP_REG (r1)), \ ++ "=&r" (__SFP_REG (r0)) \ ++ : "0" (__SFP_REG (x2)), \ ++ "g" (__SFP_REG (y2)), \ ++ "1" (__SFP_REG (x1)), \ ++ "g" (__SFP_REG (y1)), \ ++ "2" (__SFP_REG (x0)), \ ++ "g" (__SFP_REG (y0))) + # define __FP_FRAC_ADDI_4(x3,x2,x1,x0,i) \ + __asm__ ("add{l} {%4,%3|%3,%4}\n\t" \ + "adc{l} {$0,%2|%2,0}\n\t" \ + "adc{l} {$0,%1|%1,0}\n\t" \ + "adc{l} {$0,%0|%0,0}" \ +- : "+r" ((USItype) (x3)), \ +- "+&r" ((USItype) (x2)), \ +- "+&r" ((USItype) (x1)), \ +- "+&r" ((USItype) (x0)) \ +- : "g" ((USItype) (i))) ++ : "+r" (__SFP_REG (x3)), \ ++ "+&r" (__SFP_REG (x2)), \ ++ "+&r" (__SFP_REG (x1)), \ ++ "+&r" (__SFP_REG (x0)) \ ++ : "g" (__SFP_REG (i))) + + + # define _FP_MUL_MEAT_S(R,X,Y) \ +@@ -210,12 +217,10 @@ + (FP_EX_INVALID | FP_EX_DENORM | FP_EX_DIVZERO | FP_EX_OVERFLOW \ + | FP_EX_UNDERFLOW | FP_EX_INEXACT) + +-void __sfp_handle_exceptions (int); +- + #define FP_HANDLE_EXCEPTIONS \ + do { \ + if (__builtin_expect (_fex, 0)) \ +- __sfp_handle_exceptions (_fex); \ ++ __feraiseexcept (_fex & FE_ALL_EXCEPT); \ + } while (0); + + #define FP_TRAPPING_EXCEPTIONS ((~_fcw >> FP_EX_SHIFT) & FP_EX_ALL) diff --git a/gnutls/gnutls-3.8.12-nettle-4.0-compat.patch b/gnutls/gnutls-3.8.12-nettle-4.0-compat.patch new file mode 100644 index 0000000..18e9084 --- /dev/null +++ b/gnutls/gnutls-3.8.12-nettle-4.0-compat.patch @@ -0,0 +1,1952 @@ +diff -urN a/lib/accelerated/aarch64/aarch64-common.c b/lib/accelerated/aarch64/aarch64-common.c +--- a/lib/accelerated/aarch64/aarch64-common.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/accelerated/aarch64/aarch64-common.c 2026-03-12 01:40:56.320678036 -0500 +@@ -141,11 +141,13 @@ + gnutls_assert(); + } + ++#if defined(HAVE_LIBNETTLE) && defined(HMAC_SET_KEY) + ret = gnutls_crypto_single_mac_register( + GNUTLS_MAC_SHA1, 80, &_gnutls_hmac_sha_aarch64, 0); + if (ret < 0) { + gnutls_assert(); + } ++#endif + } + + if (_gnutls_arm_cpuid_s & ARMV8_SHA256) { +@@ -157,11 +159,13 @@ + gnutls_assert(); + } + ++#if defined(HAVE_LIBNETTLE) && defined(HMAC_SET_KEY) + ret = gnutls_crypto_single_mac_register( + GNUTLS_MAC_SHA224, 80, &_gnutls_hmac_sha_aarch64, 0); + if (ret < 0) { + gnutls_assert(); + } ++#endif + + ret = gnutls_crypto_single_digest_register( + GNUTLS_DIG_SHA256, 80, &_gnutls_sha_aarch64, 0); +@@ -169,11 +173,13 @@ + gnutls_assert(); + } + ++#if defined(HAVE_LIBNETTLE) && defined(HMAC_SET_KEY) + ret = gnutls_crypto_single_mac_register( + GNUTLS_MAC_SHA256, 80, &_gnutls_hmac_sha_aarch64, 0); + if (ret < 0) { + gnutls_assert(); + } ++#endif + + ret = gnutls_crypto_single_digest_register( + GNUTLS_DIG_SHA384, 80, &_gnutls_sha_aarch64, 0); +@@ -181,11 +187,13 @@ + gnutls_assert(); + } + ++#if defined(HAVE_LIBNETTLE) && defined(HMAC_SET_KEY) + ret = gnutls_crypto_single_mac_register( + GNUTLS_MAC_SHA384, 80, &_gnutls_hmac_sha_aarch64, 0); + if (ret < 0) { + gnutls_assert(); + } ++#endif + + ret = gnutls_crypto_single_digest_register( + GNUTLS_DIG_SHA512, 80, &_gnutls_sha_aarch64, 0); +@@ -193,11 +201,13 @@ + gnutls_assert(); + } + ++#if defined(HAVE_LIBNETTLE) && defined(HMAC_SET_KEY) + ret = gnutls_crypto_single_mac_register( + GNUTLS_MAC_SHA512, 80, &_gnutls_hmac_sha_aarch64, 0); + if (ret < 0) { + gnutls_assert(); + } ++#endif + } + + if (_gnutls_arm_cpuid_s & ARMV8_AES) { +diff -urN a/lib/accelerated/aarch64/aarch64-common.h b/lib/accelerated/aarch64/aarch64-common.h +--- a/lib/accelerated/aarch64/aarch64-common.h 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/accelerated/aarch64/aarch64-common.h 2026-03-12 01:30:12.287575932 -0500 +@@ -28,7 +28,7 @@ + { #name, \ + sizeof(struct name##_ctx), \ + NAME##_DIGEST_SIZE, \ +- NAME##_DATA_SIZE, \ ++ NAME##_BLOCK_SIZE, \ + (nettle_hash_init_func *)name##_init, \ + (nettle_hash_update_func *)update_func, \ + (nettle_hash_digest_func *)digest_func } +diff -urN a/lib/accelerated/aarch64/hmac-sha-aarch64.c b/lib/accelerated/aarch64/hmac-sha-aarch64.c +--- a/lib/accelerated/aarch64/hmac-sha-aarch64.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/accelerated/aarch64/hmac-sha-aarch64.c 2026-03-12 01:15:30.775902876 -0500 +@@ -28,13 +28,14 @@ + #include "gnutls_int.h" + #include "hash_int.h" + #include "errors.h" +-#include ++#include ++#include + #include + #include + #include "sha-aarch64.h" + #include "algorithms.h" + +-#ifdef HAVE_LIBNETTLE ++#if defined(HAVE_LIBNETTLE) && defined(HMAC_SET_KEY) + + typedef void (*update_func)(void *, size_t, const uint8_t *); + typedef void (*digest_func)(void *, size_t, uint8_t *); +@@ -300,4 +301,4 @@ + .fast = wrap_aarch64_hmac_fast, + }; + +-#endif /* HAVE_LIBNETTLE */ ++#endif /* HAVE_LIBNETTLE && HMAC_SET_KEY */ +diff -urN a/lib/accelerated/aarch64/sha-aarch64.c b/lib/accelerated/aarch64/sha-aarch64.c +--- a/lib/accelerated/aarch64/sha-aarch64.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/accelerated/aarch64/sha-aarch64.c 2026-03-12 01:18:00.090725040 -0500 +@@ -25,9 +25,11 @@ + #include "gnutls_int.h" + #include + #include "errors.h" +-#include ++#include ++#include + #include + #include ++#include + #include "sha-aarch64.h" + #include "aarch64-common.h" + +@@ -35,10 +37,7 @@ + void sha256_block_data_order(void *c, const void *p, size_t len); + void sha512_block_data_order(void *c, const void *p, size_t len); + +-typedef void (*update_func)(void *, size_t, const uint8_t *); +-typedef void (*digest_func)(void *, size_t, uint8_t *); + typedef void (*set_key_func)(void *, size_t, const uint8_t *); +-typedef void (*init_func)(void *); + + struct aarch64_hash_ctx { + union { +@@ -51,9 +50,9 @@ + void *ctx_ptr; + gnutls_digest_algorithm_t algo; + size_t length; +- update_func update; +- digest_func digest; +- init_func init; ++ nettle_hash_update_func *update; ++ nettle_hash_digest_func *digest; ++ nettle_hash_init_func *init; + }; + + static int wrap_aarch64_hash_update(void *_ctx, const void *text, +@@ -84,7 +83,7 @@ + unsigned t2, i; + + if ((res = ctx->index)) { +- res = SHA1_DATA_SIZE - res; ++ res = SHA1_BLOCK_SIZE - res; + if (length < res) + res = length; + sha1_update(ctx, res, data); +@@ -98,14 +97,14 @@ + octx.h3 = ctx->state[3]; + octx.h4 = ctx->state[4]; + +- memcpy(octx.data, ctx->block, SHA1_DATA_SIZE); ++ memcpy(octx.data, ctx->block, SHA1_BLOCK_SIZE); + octx.num = ctx->index; + +- res = length % SHA1_DATA_SIZE; ++ res = length % SHA1_BLOCK_SIZE; + length -= res; + + if (length > 0) { +- t2 = length / SHA1_DATA_SIZE; ++ t2 = length / SHA1_BLOCK_SIZE; + + sha1_block_data_order(&octx, data, t2); + +@@ -142,7 +141,7 @@ + unsigned t2, i; + + if ((res = ctx->index)) { +- res = SHA256_DATA_SIZE - res; ++ res = SHA256_BLOCK_SIZE - res; + if (length < res) + res = length; + sha256_update(ctx, res, data); +@@ -151,14 +150,14 @@ + } + + memcpy(octx.h, ctx->state, sizeof(octx.h)); +- memcpy(octx.data, ctx->block, SHA256_DATA_SIZE); ++ memcpy(octx.data, ctx->block, SHA256_BLOCK_SIZE); + octx.num = ctx->index; + +- res = length % SHA256_DATA_SIZE; ++ res = length % SHA256_BLOCK_SIZE; + length -= res; + + if (length > 0) { +- t2 = length / SHA1_DATA_SIZE; ++ t2 = length / SHA1_BLOCK_SIZE; + sha256_block_data_order(&octx, data, t2); + + for (i = 0; i < t2; i++) +@@ -193,7 +192,7 @@ + unsigned t2, i; + + if ((res = ctx->index)) { +- res = SHA512_DATA_SIZE - res; ++ res = SHA512_BLOCK_SIZE - res; + if (length < res) + res = length; + sha512_update(ctx, res, data); +@@ -202,14 +201,14 @@ + } + + memcpy(octx.h, ctx->state, sizeof(octx.h)); +- memcpy(octx.u.p, ctx->block, SHA512_DATA_SIZE); ++ memcpy(octx.u.p, ctx->block, SHA512_BLOCK_SIZE); + octx.num = ctx->index; + +- res = length % SHA512_DATA_SIZE; ++ res = length % SHA512_BLOCK_SIZE; + length -= res; + + if (length > 0) { +- t2 = length / SHA512_DATA_SIZE; ++ t2 = length / SHA512_BLOCK_SIZE; + sha512_block_data_order(&octx, data, t2); + + for (i = 0; i < t2; i++) +@@ -233,41 +232,41 @@ + switch (algo) { + case GNUTLS_DIG_SHA1: + sha1_init(&ctx->ctx.sha1); +- ctx->update = (update_func)aarch64_sha1_update; +- ctx->digest = (digest_func)sha1_digest; +- ctx->init = (init_func)sha1_init; ++ ctx->update = (nettle_hash_update_func *)aarch64_sha1_update; ++ ctx->digest = (nettle_hash_digest_func *)sha1_digest; ++ ctx->init = (nettle_hash_init_func *)sha1_init; + ctx->ctx_ptr = &ctx->ctx.sha1; + ctx->length = SHA1_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA224: + sha224_init(&ctx->ctx.sha224); +- ctx->update = (update_func)aarch64_sha256_update; +- ctx->digest = (digest_func)sha224_digest; +- ctx->init = (init_func)sha224_init; ++ ctx->update = (nettle_hash_update_func *)aarch64_sha256_update; ++ ctx->digest = (nettle_hash_digest_func *)sha224_digest; ++ ctx->init = (nettle_hash_init_func *)sha224_init; + ctx->ctx_ptr = &ctx->ctx.sha224; + ctx->length = SHA224_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA256: + sha256_init(&ctx->ctx.sha256); +- ctx->update = (update_func)aarch64_sha256_update; +- ctx->digest = (digest_func)sha256_digest; +- ctx->init = (init_func)sha256_init; ++ ctx->update = (nettle_hash_update_func *)aarch64_sha256_update; ++ ctx->digest = (nettle_hash_digest_func *)sha256_digest; ++ ctx->init = (nettle_hash_init_func *)sha256_init; + ctx->ctx_ptr = &ctx->ctx.sha256; + ctx->length = SHA256_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA384: + sha384_init(&ctx->ctx.sha384); +- ctx->update = (update_func)aarch64_sha512_update; +- ctx->digest = (digest_func)sha384_digest; +- ctx->init = (init_func)sha384_init; ++ ctx->update = (nettle_hash_update_func *)aarch64_sha512_update; ++ ctx->digest = (nettle_hash_digest_func *)sha384_digest; ++ ctx->init = (nettle_hash_init_func *)sha384_init; + ctx->ctx_ptr = &ctx->ctx.sha384; + ctx->length = SHA384_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA512: + sha512_init(&ctx->ctx.sha512); +- ctx->update = (update_func)aarch64_sha512_update; +- ctx->digest = (digest_func)sha512_digest; +- ctx->init = (init_func)sha512_init; ++ ctx->update = (nettle_hash_update_func *)aarch64_sha512_update; ++ ctx->digest = (nettle_hash_digest_func *)sha512_digest; ++ ctx->init = (nettle_hash_init_func *)sha512_init; + ctx->ctx_ptr = &ctx->ctx.sha512; + ctx->length = SHA512_DIGEST_SIZE; + break; +@@ -335,7 +334,15 @@ + if (digestsize < ctx->length) + return gnutls_assert_val(GNUTLS_E_SHORT_MEMORY_BUFFER); + ++#if NETTLE_VERSION_MAJOR >= 4 ++ if (digestsize != ctx->length) { ++ gnutls_assert(); ++ return GNUTLS_E_INVALID_REQUEST; ++ } ++ ctx->digest(ctx->ctx_ptr, digest); ++#else + ctx->digest(ctx->ctx_ptr, digestsize, digest); ++#endif + + return 0; + } +@@ -352,8 +359,12 @@ + return gnutls_assert_val(ret); + + ctx.update(&ctx, text_size, text); ++#if NETTLE_VERSION_MAJOR >= 4 ++ ctx.digest(&ctx, digest); ++#else + ctx.digest(&ctx, ctx.length, digest); +- ++#endif ++ zeroize_key(&ctx, sizeof(ctx)); + return 0; + } + +diff -urN a/lib/accelerated/aarch64/sha-aarch64.h b/lib/accelerated/aarch64/sha-aarch64.h +--- a/lib/accelerated/aarch64/sha-aarch64.h 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/accelerated/aarch64/sha-aarch64.h 2026-03-12 01:15:30.775902876 -0500 +@@ -1,7 +1,8 @@ + #ifndef GNUTLS_LIB_ACCELERATED_AARCH64_SHA_AARCH64_H + #define GNUTLS_LIB_ACCELERATED_AARCH64_SHA_AARCH64_H + +-#include ++#include ++#include + + extern const struct nettle_hash aarch64_sha1; + extern const struct nettle_hash aarch64_sha224; +diff -urN a/lib/accelerated/x86/aes-gcm-padlock.c b/lib/accelerated/x86/aes-gcm-padlock.c +--- a/lib/accelerated/x86/aes-gcm-padlock.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/accelerated/x86/aes-gcm-padlock.c 2026-03-12 01:15:30.776902925 -0500 +@@ -35,6 +35,7 @@ + #include "x86-common.h" + #include + #include ++#include + #include "aes-padlock.h" + + #define GCM_BLOCK_SIZE 16 +@@ -176,8 +177,14 @@ + static void aes_gcm_tag(void *_ctx, void *tag, size_t tagsize) + { + struct gcm_padlock_aes_ctx *ctx = _ctx; ++ uint8_t buffer[GCM_DIGEST_SIZE]; + +- GCM_DIGEST(&ctx->inner, padlock_aes_encrypt, tagsize, tag); ++#if NETTLE_VERSION_MAJOR >= 4 ++ GCM_DIGEST(&ctx->inner, padlock_aes_encrypt, buffer); ++#else ++ GCM_DIGEST(&ctx->inner, padlock_aes_encrypt, sizeof(buffer), buffer); ++#endif ++ memcpy(tag, buffer, tagsize); + } + + #include "aes-gcm-aead.h" +diff -urN a/lib/accelerated/x86/aes-gcm-x86-aesni.c b/lib/accelerated/x86/aes-gcm-x86-aesni.c +--- a/lib/accelerated/x86/aes-gcm-x86-aesni.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/accelerated/x86/aes-gcm-x86-aesni.c 2026-03-12 01:15:30.775902876 -0500 +@@ -36,6 +36,7 @@ + #include "x86-common.h" + #include + #include ++#include + + /* GCM mode + * It is used when the CPU doesn't include the PCLMUL instructions. +@@ -168,8 +169,14 @@ + static void aes_gcm_tag(void *_ctx, void *tag, size_t tagsize) + { + struct gcm_x86_aes_ctx *ctx = _ctx; ++ uint8_t buffer[GCM_DIGEST_SIZE]; + +- GCM_DIGEST(&ctx->inner, x86_aes_encrypt, tagsize, tag); ++#if NETTLE_VERSION_MAJOR >= 4 ++ GCM_DIGEST(&ctx->inner, x86_aes_encrypt, buffer); ++#else ++ GCM_DIGEST(&ctx->inner, x86_aes_encrypt, tagsize, buffer); ++#endif ++ memcpy(tag, buffer, tagsize); + } + + static void aes_gcm_deinit(void *_ctx) +diff -urN a/lib/accelerated/x86/aes-gcm-x86-ssse3.c b/lib/accelerated/x86/aes-gcm-x86-ssse3.c +--- a/lib/accelerated/x86/aes-gcm-x86-ssse3.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/accelerated/x86/aes-gcm-x86-ssse3.c 2026-03-12 01:15:30.775902876 -0500 +@@ -36,6 +36,7 @@ + #include "x86-common.h" + #include + #include ++#include + #include + + /* GCM mode +@@ -177,8 +178,14 @@ + static void aes_gcm_tag(void *_ctx, void *tag, size_t tagsize) + { + struct gcm_x86_aes_ctx *ctx = _ctx; ++ uint8_t buffer[GCM_DIGEST_SIZE]; + +- GCM_DIGEST(&ctx->inner, x86_aes_encrypt, tagsize, tag); ++#if NETTLE_VERSION_MAJOR >= 4 ++ GCM_DIGEST(&ctx->inner, x86_aes_encrypt, buffer); ++#else ++ GCM_DIGEST(&ctx->inner, x86_aes_encrypt, tagsize, buffer); ++#endif ++ memcpy(tag, buffer, tagsize); + } + + static void aes_gcm_deinit(void *_ctx) +diff -urN a/lib/accelerated/x86/hmac-padlock.c b/lib/accelerated/x86/hmac-padlock.c +--- a/lib/accelerated/x86/hmac-padlock.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/accelerated/x86/hmac-padlock.c 2026-03-12 01:15:30.775902876 -0500 +@@ -27,7 +27,8 @@ + #include "gnutls_int.h" + #include "hash_int.h" + #include "errors.h" +-#include ++#include ++#include + #include + #include + #include +@@ -35,7 +36,7 @@ + #include "sha-padlock.h" + #include "algorithms.h" + +-#ifdef HAVE_LIBNETTLE ++#if defined(HAVE_LIBNETTLE) && defined(HMAC_SET_KEY) + + #define IPAD 0x36 + #define OPAD 0x5c +@@ -280,39 +281,39 @@ + { + if (algo == GNUTLS_MAC_SHA1 || algo == GNUTLS_MAC_SHA256) { + unsigned char *pad; +- unsigned char pad2[SHA1_DATA_SIZE + MAX_SHA_DIGEST_SIZE]; ++ unsigned char pad2[SHA1_BLOCK_SIZE + MAX_SHA_DIGEST_SIZE]; + unsigned char hkey[MAX_SHA_DIGEST_SIZE]; + unsigned int digest_size = + _gnutls_mac_get_algo_len(mac_to_entry(algo)); + +- if (key_size > SHA1_DATA_SIZE) { ++ if (key_size > SHA1_BLOCK_SIZE) { + wrap_padlock_hash_fast((gnutls_digest_algorithm_t)algo, + key, key_size, hkey); + key = hkey; + key_size = digest_size; + } + +- pad = gnutls_malloc(text_size + SHA1_DATA_SIZE); ++ pad = gnutls_malloc(text_size + SHA1_BLOCK_SIZE); + if (pad == NULL) + return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR); + +- memset(pad, IPAD, SHA1_DATA_SIZE); ++ memset(pad, IPAD, SHA1_BLOCK_SIZE); + memxor(pad, key, key_size); + +- memcpy(&pad[SHA1_DATA_SIZE], text, text_size); ++ memcpy(&pad[SHA1_BLOCK_SIZE], text, text_size); + + wrap_padlock_hash_fast((gnutls_digest_algorithm_t)algo, pad, +- text_size + SHA1_DATA_SIZE, +- &pad2[SHA1_DATA_SIZE]); ++ text_size + SHA1_BLOCK_SIZE, ++ &pad2[SHA1_BLOCK_SIZE]); + +- zeroize_key(pad, text_size + SHA1_DATA_SIZE); ++ zeroize_key(pad, text_size + SHA1_BLOCK_SIZE); + gnutls_free(pad); + +- memset(pad2, OPAD, SHA1_DATA_SIZE); ++ memset(pad2, OPAD, SHA1_BLOCK_SIZE); + memxor(pad2, key, key_size); + + wrap_padlock_hash_fast((gnutls_digest_algorithm_t)algo, pad2, +- digest_size + SHA1_DATA_SIZE, digest); ++ digest_size + SHA1_BLOCK_SIZE, digest); + + zeroize_key(pad2, sizeof(pad2)); + zeroize_key(hkey, sizeof(hkey)); +@@ -358,4 +359,4 @@ + .fast = wrap_padlock_hmac_fast, + }; + +-#endif /* HAVE_LIBNETTLE */ ++#endif /* HAVE_LIBNETTLE && HMAC_SET_KEY */ +diff -urN a/lib/accelerated/x86/hmac-x86-ssse3.c b/lib/accelerated/x86/hmac-x86-ssse3.c +--- a/lib/accelerated/x86/hmac-x86-ssse3.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/accelerated/x86/hmac-x86-ssse3.c 2026-03-12 01:15:30.775902876 -0500 +@@ -27,14 +27,15 @@ + #include "gnutls_int.h" + #include "hash_int.h" + #include "errors.h" +-#include ++#include ++#include + #include + #include + #include "aes-x86.h" + #include "sha-x86.h" + #include "algorithms.h" + +-#ifdef HAVE_LIBNETTLE ++#if defined(HAVE_LIBNETTLE) && defined(HMAC_SET_KEY) + + typedef void (*update_func)(void *, size_t, const uint8_t *); + typedef void (*digest_func)(void *, size_t, uint8_t *); +@@ -296,4 +297,4 @@ + .fast = wrap_x86_hmac_fast, + }; + +-#endif /* HAVE_LIBNETTLE */ ++#endif /* HAVE_LIBNETTLE && HMAC_SET_KEY */ +diff -urN a/lib/accelerated/x86/sha-padlock.c b/lib/accelerated/x86/sha-padlock.c +--- a/lib/accelerated/x86/sha-padlock.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/accelerated/x86/sha-padlock.c 2026-03-12 01:18:00.090725040 -0500 +@@ -24,9 +24,11 @@ + #include "gnutls_int.h" + #include "hash_int.h" + #include "errors.h" +-#include ++#include ++#include + #include + #include ++#include + #include "aes-padlock.h" + #include + #include "sha-padlock.h" +@@ -34,10 +36,7 @@ + + #ifdef HAVE_LIBNETTLE + +-typedef void (*update_func)(void *, size_t, const uint8_t *); +-typedef void (*digest_func)(void *, size_t, uint8_t *); + typedef void (*set_key_func)(void *, size_t, const uint8_t *); +-typedef void (*init_func)(void *); + + struct padlock_hash_ctx { + union { +@@ -50,9 +49,9 @@ + void *ctx_ptr; + gnutls_digest_algorithm_t algo; + size_t length; +- update_func update; +- digest_func digest; +- init_func init; ++ nettle_hash_update_func *update; ++ nettle_hash_digest_func *digest; ++ nettle_hash_init_func *init; + }; + + static int wrap_padlock_hash_update(void *_ctx, const void *text, +@@ -129,8 +128,8 @@ + } + } + +-static void padlock_sha1_digest(struct sha1_ctx *ctx, size_t length, +- uint8_t *digest) ++static void _padlock_sha1_digest(struct sha1_ctx *ctx, size_t length, ++ uint8_t *digest) + { + uint64_t bit_count; + +@@ -148,8 +147,8 @@ + _nettle_write_be32(length, digest, ctx->state); + } + +-static void padlock_sha256_digest(struct sha256_ctx *ctx, size_t length, +- uint8_t *digest) ++static void _padlock_sha256_digest(struct sha256_ctx *ctx, size_t length, ++ uint8_t *digest) + { + uint64_t bit_count; + +@@ -169,8 +168,8 @@ + _nettle_write_be32(length, digest, ctx->state); + } + +-static void padlock_sha512_digest(struct sha512_ctx *ctx, size_t length, +- uint8_t *digest) ++static void _padlock_sha512_digest(struct sha512_ctx *ctx, size_t length, ++ uint8_t *digest) + { + uint64_t high, low; + +@@ -189,8 +188,8 @@ + /* This is slightly inefficient, as the numbers are converted to + big-endian format, and will be converted back by the compression + function. It's probably not worth the effort to fix this. */ +- WRITE_UINT64(ctx->block + (SHA512_DATA_SIZE - 16), high); +- WRITE_UINT64(ctx->block + (SHA512_DATA_SIZE - 8), low); ++ WRITE_UINT64(ctx->block + (SHA512_BLOCK_SIZE - 16), high); ++ WRITE_UINT64(ctx->block + (SHA512_BLOCK_SIZE - 8), low); + SHA512_COMPRESS(ctx, ctx->block); + + words = length / 8; +@@ -210,47 +209,66 @@ + } + } + ++#if NETTLE_VERSION_MAJOR >= 4 ++static void padlock_sha1_digest(struct sha1_ctx *ctx, uint8_t *digest) ++{ ++ _padlock_sha1_digest(ctx, SHA1_DIGEST_SIZE, digest); ++} ++static void padlock_sha256_digest(struct sha256_ctx *ctx, uint8_t *digest) ++{ ++ _padlock_sha256_digest(ctx, SHA256_DIGEST_SIZE, digest); ++} ++static void padlock_sha512_digest(struct sha512_ctx *ctx, uint8_t *digest) ++{ ++ _padlock_sha512_digest(ctx, SHA512_DIGEST_SIZE, digest); ++} ++#else ++#define padlock_sha1_digest _padlock_sha1_digest ++#define padlock_sha256_digest _padlock_sha256_digest ++#define padlock_sha512_digest _padlock_sha512_digest ++#endif ++ + static int _ctx_init(gnutls_digest_algorithm_t algo, + struct padlock_hash_ctx *ctx) + { + switch (algo) { + case GNUTLS_DIG_SHA1: + sha1_init(&ctx->ctx.sha1); +- ctx->update = (update_func)padlock_sha1_update; +- ctx->digest = (digest_func)padlock_sha1_digest; +- ctx->init = (init_func)sha1_init; ++ ctx->update = (nettle_hash_update_func *)padlock_sha1_update; ++ ctx->digest = (nettle_hash_digest_func *)padlock_sha1_digest; ++ ctx->init = (nettle_hash_init_func *)sha1_init; + ctx->ctx_ptr = &ctx->ctx.sha1; + ctx->length = SHA1_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA224: + sha224_init(&ctx->ctx.sha224); +- ctx->update = (update_func)padlock_sha256_update; +- ctx->digest = (digest_func)padlock_sha256_digest; +- ctx->init = (init_func)sha224_init; ++ ctx->update = (nettle_hash_update_func *)padlock_sha256_update; ++ ctx->digest = (nettle_hash_digest_func *)padlock_sha256_digest; ++ ctx->init = (nettle_hash_init_func *)sha224_init; + ctx->ctx_ptr = &ctx->ctx.sha224; + ctx->length = SHA224_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA256: + sha256_init(&ctx->ctx.sha256); +- ctx->update = (update_func)padlock_sha256_update; +- ctx->digest = (digest_func)padlock_sha256_digest; +- ctx->init = (init_func)sha256_init; ++ ctx->update = (nettle_hash_update_func *)padlock_sha256_update; ++ ctx->digest = (nettle_hash_digest_func *)padlock_sha256_digest; ++ ctx->init = (nettle_hash_init_func *)sha256_init; + ctx->ctx_ptr = &ctx->ctx.sha256; + ctx->length = SHA256_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA384: + sha384_init(&ctx->ctx.sha384); +- ctx->update = (update_func)padlock_sha512_update; +- ctx->digest = (digest_func)padlock_sha512_digest; +- ctx->init = (init_func)sha384_init; ++ ctx->update = (nettle_hash_update_func *)padlock_sha512_update; ++ ctx->digest = (nettle_hash_digest_func *)padlock_sha512_digest; ++ ctx->init = (nettle_hash_init_func *)sha384_init; + ctx->ctx_ptr = &ctx->ctx.sha384; + ctx->length = SHA384_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA512: + sha512_init(&ctx->ctx.sha512); +- ctx->update = (update_func)padlock_sha512_update; +- ctx->digest = (digest_func)padlock_sha512_digest; +- ctx->init = (init_func)sha512_init; ++ ctx->update = (nettle_hash_update_func *)padlock_sha512_update; ++ ctx->digest = (nettle_hash_digest_func *)padlock_sha512_digest; ++ ctx->init = (nettle_hash_init_func *)sha512_init; + ctx->ctx_ptr = &ctx->ctx.sha512; + ctx->length = SHA512_DIGEST_SIZE; + break; +@@ -318,7 +336,15 @@ + if (digestsize < ctx->length) + return gnutls_assert_val(GNUTLS_E_SHORT_MEMORY_BUFFER); + ++#if NETTLE_VERSION_MAJOR >= 4 ++ if (digestsize != ctx->length) { ++ gnutls_assert(); ++ return GNUTLS_E_INVALID_REQUEST; ++ } ++ ctx->digest(ctx->ctx_ptr, digest); ++#else + ctx->digest(ctx->ctx_ptr, digestsize, digest); ++#endif + + ctx->init(ctx->ctx_ptr); + +diff -urN a/lib/accelerated/x86/sha-padlock.h b/lib/accelerated/x86/sha-padlock.h +--- a/lib/accelerated/x86/sha-padlock.h 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/accelerated/x86/sha-padlock.h 2026-03-12 01:15:30.775902876 -0500 +@@ -1,7 +1,8 @@ + #ifndef GNUTLS_LIB_ACCELERATED_X86_SHA_PADLOCK_H + #define GNUTLS_LIB_ACCELERATED_X86_SHA_PADLOCK_H + +-#include ++#include ++#include + + void padlock_sha1_oneshot(void *ctx, const void *inp, size_t len); + void padlock_sha256_oneshot(void *ctx, const void *inp, size_t len); +diff -urN a/lib/accelerated/x86/sha-x86-ssse3.c b/lib/accelerated/x86/sha-x86-ssse3.c +--- a/lib/accelerated/x86/sha-x86-ssse3.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/accelerated/x86/sha-x86-ssse3.c 2026-03-12 01:18:00.090725040 -0500 +@@ -25,9 +25,11 @@ + #include + #include "errors.h" + #include "aes-x86.h" +-#include ++#include ++#include + #include + #include ++#include + #include "sha-x86.h" + #include "x86-common.h" + +@@ -35,10 +37,7 @@ + void sha256_block_data_order(void *c, const void *p, size_t len); + void sha512_block_data_order(void *c, const void *p, size_t len); + +-typedef void (*update_func)(void *, size_t, const uint8_t *); +-typedef void (*digest_func)(void *, size_t, uint8_t *); + typedef void (*set_key_func)(void *, size_t, const uint8_t *); +-typedef void (*init_func)(void *); + + struct x86_hash_ctx { + union { +@@ -51,9 +50,9 @@ + void *ctx_ptr; + gnutls_digest_algorithm_t algo; + size_t length; +- update_func update; +- digest_func digest; +- init_func init; ++ nettle_hash_update_func *update; ++ nettle_hash_digest_func *digest; ++ nettle_hash_init_func *init; + }; + + static int wrap_x86_hash_update(void *_ctx, const void *text, size_t textsize) +@@ -82,7 +81,7 @@ + unsigned t2, i; + + if ((res = ctx->index)) { +- res = SHA1_DATA_SIZE - res; ++ res = SHA1_BLOCK_SIZE - res; + if (length < res) + res = length; + sha1_update(ctx, res, data); +@@ -96,14 +95,14 @@ + octx.h3 = ctx->state[3]; + octx.h4 = ctx->state[4]; + +- memcpy(octx.data, ctx->block, SHA1_DATA_SIZE); ++ memcpy(octx.data, ctx->block, SHA1_BLOCK_SIZE); + octx.num = ctx->index; + +- res = length % SHA1_DATA_SIZE; ++ res = length % SHA1_BLOCK_SIZE; + length -= res; + + if (length > 0) { +- t2 = length / SHA1_DATA_SIZE; ++ t2 = length / SHA1_BLOCK_SIZE; + + sha1_block_data_order(&octx, data, t2); + +@@ -140,7 +139,7 @@ + unsigned t2, i; + + if ((res = ctx->index)) { +- res = SHA256_DATA_SIZE - res; ++ res = SHA256_BLOCK_SIZE - res; + if (length < res) + res = length; + sha256_update(ctx, res, data); +@@ -149,14 +148,14 @@ + } + + memcpy(octx.h, ctx->state, sizeof(octx.h)); +- memcpy(octx.data, ctx->block, SHA256_DATA_SIZE); ++ memcpy(octx.data, ctx->block, SHA256_BLOCK_SIZE); + octx.num = ctx->index; + +- res = length % SHA256_DATA_SIZE; ++ res = length % SHA256_BLOCK_SIZE; + length -= res; + + if (length > 0) { +- t2 = length / SHA1_DATA_SIZE; ++ t2 = length / SHA1_BLOCK_SIZE; + sha256_block_data_order(&octx, data, t2); + + for (i = 0; i < t2; i++) +@@ -191,7 +190,7 @@ + unsigned t2, i; + + if ((res = ctx->index)) { +- res = SHA512_DATA_SIZE - res; ++ res = SHA512_BLOCK_SIZE - res; + if (length < res) + res = length; + sha512_update(ctx, res, data); +@@ -200,14 +199,14 @@ + } + + memcpy(octx.h, ctx->state, sizeof(octx.h)); +- memcpy(octx.u.p, ctx->block, SHA512_DATA_SIZE); ++ memcpy(octx.u.p, ctx->block, SHA512_BLOCK_SIZE); + octx.num = ctx->index; + +- res = length % SHA512_DATA_SIZE; ++ res = length % SHA512_BLOCK_SIZE; + length -= res; + + if (length > 0) { +- t2 = length / SHA512_DATA_SIZE; ++ t2 = length / SHA512_BLOCK_SIZE; + sha512_block_data_order(&octx, data, t2); + + for (i = 0; i < t2; i++) +@@ -230,41 +229,41 @@ + switch (algo) { + case GNUTLS_DIG_SHA1: + sha1_init(&ctx->ctx.sha1); +- ctx->update = (update_func)x86_sha1_update; +- ctx->digest = (digest_func)sha1_digest; +- ctx->init = (init_func)sha1_init; ++ ctx->update = (nettle_hash_update_func *)x86_sha1_update; ++ ctx->digest = (nettle_hash_digest_func *)sha1_digest; ++ ctx->init = (nettle_hash_init_func *)sha1_init; + ctx->ctx_ptr = &ctx->ctx.sha1; + ctx->length = SHA1_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA224: + sha224_init(&ctx->ctx.sha224); +- ctx->update = (update_func)x86_sha256_update; +- ctx->digest = (digest_func)sha224_digest; +- ctx->init = (init_func)sha224_init; ++ ctx->update = (nettle_hash_update_func *)x86_sha256_update; ++ ctx->digest = (nettle_hash_digest_func *)sha224_digest; ++ ctx->init = (nettle_hash_init_func *)sha224_init; + ctx->ctx_ptr = &ctx->ctx.sha224; + ctx->length = SHA224_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA256: + sha256_init(&ctx->ctx.sha256); +- ctx->update = (update_func)x86_sha256_update; +- ctx->digest = (digest_func)sha256_digest; +- ctx->init = (init_func)sha256_init; ++ ctx->update = (nettle_hash_update_func *)x86_sha256_update; ++ ctx->digest = (nettle_hash_digest_func *)sha256_digest; ++ ctx->init = (nettle_hash_init_func *)sha256_init; + ctx->ctx_ptr = &ctx->ctx.sha256; + ctx->length = SHA256_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA384: + sha384_init(&ctx->ctx.sha384); +- ctx->update = (update_func)x86_sha512_update; +- ctx->digest = (digest_func)sha384_digest; +- ctx->init = (init_func)sha384_init; ++ ctx->update = (nettle_hash_update_func *)x86_sha512_update; ++ ctx->digest = (nettle_hash_digest_func *)sha384_digest; ++ ctx->init = (nettle_hash_init_func *)sha384_init; + ctx->ctx_ptr = &ctx->ctx.sha384; + ctx->length = SHA384_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA512: + sha512_init(&ctx->ctx.sha512); +- ctx->update = (update_func)x86_sha512_update; +- ctx->digest = (digest_func)sha512_digest; +- ctx->init = (init_func)sha512_init; ++ ctx->update = (nettle_hash_update_func *)x86_sha512_update; ++ ctx->digest = (nettle_hash_digest_func *)sha512_digest; ++ ctx->init = (nettle_hash_init_func *)sha512_init; + ctx->ctx_ptr = &ctx->ctx.sha512; + ctx->length = SHA512_DIGEST_SIZE; + break; +@@ -331,7 +330,15 @@ + if (digestsize < ctx->length) + return gnutls_assert_val(GNUTLS_E_SHORT_MEMORY_BUFFER); + ++#if NETTLE_VERSION_MAJOR >= 4 ++ if (digestsize != ctx->length) { ++ gnutls_assert(); ++ return GNUTLS_E_INVALID_REQUEST; ++ } ++ ctx->digest(ctx->ctx_ptr, digest); ++#else + ctx->digest(ctx->ctx_ptr, digestsize, digest); ++#endif + + return 0; + } +@@ -347,8 +354,12 @@ + return gnutls_assert_val(ret); + + ctx.update(&ctx, text_size, text); ++#if NETTLE_VERSION_MAJOR >= 4 ++ ctx.digest(&ctx, digest); ++#else + ctx.digest(&ctx, ctx.length, digest); +- ++#endif ++ zeroize_key(&ctx, sizeof(ctx)); + return 0; + } + +diff -urN a/lib/accelerated/x86/sha-x86.h b/lib/accelerated/x86/sha-x86.h +--- a/lib/accelerated/x86/sha-x86.h 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/accelerated/x86/sha-x86.h 2026-03-12 01:15:30.775902876 -0500 +@@ -1,7 +1,8 @@ + #ifndef GNUTLS_LIB_ACCELERATED_X86_SHA_X86_H + #define GNUTLS_LIB_ACCELERATED_X86_SHA_X86_H + +-#include ++#include ++#include + + extern const struct nettle_hash x86_sha1; + extern const struct nettle_hash x86_sha224; +diff -urN a/lib/accelerated/x86/x86-common.c b/lib/accelerated/x86/x86-common.c +--- a/lib/accelerated/x86/x86-common.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/accelerated/x86/x86-common.c 2026-03-12 01:40:56.319678011 -0500 +@@ -35,6 +35,7 @@ + #include "x86-common.h" + #ifdef HAVE_LIBNETTLE + #include /* for key generation in 192 and 256 bits */ ++#include /* to check if custom hmac is supported */ + #include "sha-padlock.h" + #endif + #include "aes-padlock.h" +@@ -459,6 +460,7 @@ + gnutls_assert(); + } + ++#if defined(HAVE_LIBNETTLE) && defined(HMAC_SET_KEY) + ret = gnutls_crypto_single_mac_register( + GNUTLS_MAC_SHA1, 80, &_gnutls_hmac_sha_x86_ssse3, 0); + if (ret < 0) +@@ -473,6 +475,7 @@ + GNUTLS_MAC_SHA256, 80, &_gnutls_hmac_sha_x86_ssse3, 0); + if (ret < 0) + gnutls_assert(); ++#endif + + ret = gnutls_crypto_single_digest_register( + GNUTLS_DIG_SHA384, 80, &_gnutls_sha_x86_ssse3, 0); +@@ -483,6 +486,7 @@ + GNUTLS_DIG_SHA512, 80, &_gnutls_sha_x86_ssse3, 0); + if (ret < 0) + gnutls_assert(); ++#if defined(HAVE_LIBNETTLE) && defined(HMAC_SET_KEY) + ret = gnutls_crypto_single_mac_register( + GNUTLS_MAC_SHA384, 80, &_gnutls_hmac_sha_x86_ssse3, 0); + if (ret < 0) +@@ -492,6 +496,7 @@ + GNUTLS_MAC_SHA512, 80, &_gnutls_hmac_sha_x86_ssse3, 0); + if (ret < 0) + gnutls_assert(); ++#endif + } + + if (check_optimized_aes()) { +@@ -692,6 +697,7 @@ + gnutls_assert(); + } + ++#if defined(HAVE_LIBNETTLE) && defined(HMAC_SET_KEY) + ret = gnutls_crypto_single_mac_register( + GNUTLS_MAC_SHA384, 80, + &_gnutls_hmac_sha_padlock, 0); +@@ -705,6 +711,7 @@ + if (ret < 0) { + gnutls_assert(); + } ++#endif + } + + ret = gnutls_crypto_single_digest_register( +@@ -725,6 +732,7 @@ + gnutls_assert(); + } + ++#if defined(HAVE_LIBNETTLE) && defined(HMAC_SET_KEY) + ret = gnutls_crypto_single_mac_register( + GNUTLS_MAC_SHA1, 90, &_gnutls_hmac_sha_padlock, 0); + if (ret < 0) { +@@ -738,6 +746,7 @@ + if (ret < 0) { + gnutls_assert(); + } ++#endif + } else if (phe) { + /* Original padlock PHE. Does not support incremental operations. + */ +@@ -755,6 +764,7 @@ + gnutls_assert(); + } + ++#if defined(HAVE_LIBNETTLE) && defined(HMAC_SET_KEY) + ret = gnutls_crypto_single_mac_register( + GNUTLS_MAC_SHA1, 90, &_gnutls_hmac_sha_padlock_oneshot, + 0); +@@ -768,6 +778,7 @@ + if (ret < 0) { + gnutls_assert(); + } ++#endif + } + #endif + +@@ -910,6 +921,7 @@ + gnutls_assert(); + } + ++#if defined(HAVE_LIBNETTLE) && defined(HMAC_SET_KEY) + ret = gnutls_crypto_single_mac_register( + GNUTLS_MAC_SHA1, 80, &_gnutls_hmac_sha_x86_ssse3, 0); + if (ret < 0) +@@ -924,6 +936,7 @@ + GNUTLS_MAC_SHA256, 80, &_gnutls_hmac_sha_x86_ssse3, 0); + if (ret < 0) + gnutls_assert(); ++#endif + + ret = gnutls_crypto_single_digest_register( + GNUTLS_DIG_SHA384, 80, &_gnutls_sha_x86_ssse3, 0); +@@ -934,6 +947,7 @@ + GNUTLS_DIG_SHA512, 80, &_gnutls_sha_x86_ssse3, 0); + if (ret < 0) + gnutls_assert(); ++#if defined(HAVE_LIBNETTLE) && defined(HMAC_SET_KEY) + ret = gnutls_crypto_single_mac_register( + GNUTLS_MAC_SHA384, 80, &_gnutls_hmac_sha_x86_ssse3, 0); + if (ret < 0) +@@ -943,6 +957,7 @@ + GNUTLS_MAC_SHA512, 80, &_gnutls_hmac_sha_x86_ssse3, 0); + if (ret < 0) + gnutls_assert(); ++#endif + } + + if (check_optimized_aes()) { +diff -urN a/lib/accelerated/x86/x86-common.h b/lib/accelerated/x86/x86-common.h +--- a/lib/accelerated/x86/x86-common.h 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/accelerated/x86/x86-common.h 2026-03-12 01:30:12.287575932 -0500 +@@ -39,7 +39,7 @@ + { #name, \ + sizeof(struct name##_ctx), \ + NAME##_DIGEST_SIZE, \ +- NAME##_DATA_SIZE, \ ++ NAME##_BLOCK_SIZE, \ + (nettle_hash_init_func *)name##_init, \ + (nettle_hash_update_func *)update_func, \ + (nettle_hash_digest_func *)digest_func } +diff -urN a/lib/nettle/cipher.c b/lib/nettle/cipher.c +--- a/lib/nettle/cipher.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/nettle/cipher.c 2026-03-12 01:33:08.686478097 -0500 +@@ -1370,7 +1370,7 @@ + break; + case GNUTLS_CIPHER_SALSA20_256: + case GNUTLS_CIPHER_ESTREAM_SALSA20_256: +- if (iv_size != SALSA20_IV_SIZE) ++ if (iv_size != SALSA20_NONCE_SIZE) + return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); + break; + default: +@@ -1477,8 +1477,12 @@ + + ctx->cipher->encrypt(ctx, plain_size, encr, plain); + ++#if NETTLE_VERSION_MAJOR >= 4 ++ ctx->cipher->tag(ctx->ctx_ptr, ((uint8_t *)encr) + plain_size); ++#else + ctx->cipher->tag(ctx->ctx_ptr, tag_size, + ((uint8_t *)encr) + plain_size); ++#endif + } else { + /* CCM-style cipher */ + +@@ -1557,7 +1561,11 @@ + + ctx->cipher->decrypt(ctx, encr_size, plain, encr); + ++#if NETTLE_VERSION_MAJOR >= 4 ++ ctx->cipher->tag(ctx->ctx_ptr, tag); ++#else + ctx->cipher->tag(ctx->ctx_ptr, tag_size, tag); ++#endif + + if (gnutls_memcmp(((uint8_t *)encr) + encr_size, tag, + tag_size) != 0) +@@ -1626,7 +1634,11 @@ + { + struct nettle_cipher_ctx *ctx = _ctx; + ++#if NETTLE_VERSION_MAJOR >= 4 ++ ctx->cipher->tag(ctx->ctx_ptr, tag); ++#else + ctx->cipher->tag(ctx->ctx_ptr, tag_size, tag); ++#endif + } + + static void wrap_nettle_cipher_close(void *_ctx) +diff -urN a/lib/nettle/gost/cmac-kuznyechik.c b/lib/nettle/gost/cmac-kuznyechik.c +--- a/lib/nettle/gost/cmac-kuznyechik.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/nettle/gost/cmac-kuznyechik.c 2026-03-12 01:16:48.450569253 -0500 +@@ -44,9 +44,16 @@ + CMAC128_UPDATE(ctx, kuznyechik_encrypt, length, data); + } + ++#if NETTLE_VERSION_MAJOR >= 4 ++void cmac_kuznyechik_digest(struct cmac_kuznyechik_ctx *ctx, uint8_t *digest) ++{ ++ CMAC128_DIGEST(ctx, kuznyechik_encrypt, digest); ++} ++#else + void cmac_kuznyechik_digest(struct cmac_kuznyechik_ctx *ctx, size_t length, + uint8_t *digest) + { + CMAC128_DIGEST(ctx, kuznyechik_encrypt, length, digest); + } + #endif ++#endif +diff -urN a/lib/nettle/gost/cmac-magma.c b/lib/nettle/gost/cmac-magma.c +--- a/lib/nettle/gost/cmac-magma.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/nettle/gost/cmac-magma.c 2026-03-12 01:16:48.450569253 -0500 +@@ -44,9 +44,16 @@ + CMAC64_UPDATE(ctx, magma_encrypt, length, data); + } + ++#if NETTLE_VERSION_MAJOR >= 4 ++void cmac_magma_digest(struct cmac_magma_ctx *ctx, uint8_t *digest) ++{ ++ CMAC64_DIGEST(ctx, magma_encrypt, digest); ++} ++#else + void cmac_magma_digest(struct cmac_magma_ctx *ctx, size_t length, + uint8_t *digest) + { + CMAC64_DIGEST(ctx, magma_encrypt, length, digest); + } + #endif ++#endif +diff -urN a/lib/nettle/gost/cmac.h b/lib/nettle/gost/cmac.h +--- a/lib/nettle/gost/cmac.h 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/nettle/gost/cmac.h 2026-03-12 01:16:48.450569253 -0500 +@@ -43,6 +43,8 @@ + #ifndef HAVE_NETTLE_CMAC_MAGMA_UPDATE + #include "magma.h" + ++#include ++ + #ifdef __cplusplus + extern "C" { + #endif +@@ -58,8 +60,12 @@ + void cmac_magma_update(struct cmac_magma_ctx *ctx, size_t length, + const uint8_t *data); + ++#if NETTLE_VERSION_MAJOR >= 4 ++void cmac_magma_digest(struct cmac_magma_ctx *ctx, uint8_t *digest); ++#else + void cmac_magma_digest(struct cmac_magma_ctx *ctx, size_t length, + uint8_t *digest); ++#endif + + #ifdef __cplusplus + } +@@ -83,8 +89,12 @@ + void cmac_kuznyechik_update(struct cmac_kuznyechik_ctx *ctx, size_t length, + const uint8_t *data); + ++#if NETTLE_VERSION_MAJOR >= 4 ++void cmac_kuznyechik_digest(struct cmac_kuznyechik_ctx *ctx, uint8_t *digest); ++#else + void cmac_kuznyechik_digest(struct cmac_kuznyechik_ctx *ctx, size_t length, + uint8_t *digest); ++#endif + + #ifdef __cplusplus + } +diff -urN a/lib/nettle/gost/gost-wrap.c b/lib/nettle/gost/gost-wrap.c +--- a/lib/nettle/gost/gost-wrap.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/nettle/gost/gost-wrap.c 2026-03-12 01:16:48.452569344 -0500 +@@ -92,7 +92,11 @@ + gost28147_imit_set_param(&ictx, param); + gost28147_imit_set_nonce(&ictx, ukm); + gost28147_imit_update(&ictx, GOST28147_KEY_SIZE, cek); ++#if NETTLE_VERSION_MAJOR >= 4 ++ gost28147_imit_digest(&ictx, imit); ++#else + gost28147_imit_digest(&ictx, GOST28147_IMIT_DIGEST_SIZE, imit); ++#endif + } + + int gost28147_key_unwrap_cryptopro(const struct gost28147_param *param, +@@ -116,7 +120,11 @@ + gost28147_imit_set_param(&ictx, param); + gost28147_imit_set_nonce(&ictx, ukm); + gost28147_imit_update(&ictx, GOST28147_KEY_SIZE, cek); ++#if NETTLE_VERSION_MAJOR >= 4 ++ gost28147_imit_digest(&ictx, mac); ++#else + gost28147_imit_digest(&ictx, GOST28147_IMIT_DIGEST_SIZE, mac); ++#endif + + return memeql_sec(mac, imit, GOST28147_IMIT_DIGEST_SIZE); + } +diff -urN a/lib/nettle/gost/gost28147.c b/lib/nettle/gost/gost28147.c +--- a/lib/nettle/gost/gost28147.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/nettle/gost/gost28147.c 2026-03-12 01:16:48.451569299 -0500 +@@ -8631,8 +8631,8 @@ + MD_UPDATE(ctx, length, data, gost28147_imit_compress, ctx->count++); + } + +-void gost28147_imit_digest(struct gost28147_imit_ctx *ctx, size_t length, +- uint8_t *digest) ++static void _gost28147_imit_digest(struct gost28147_imit_ctx *ctx, ++ size_t length, uint8_t *digest) + { + assert(length <= GOST28147_IMIT_DIGEST_SIZE); + const uint8_t zero[GOST28147_IMIT_BLOCK_SIZE] = { 0 }; +@@ -8650,4 +8650,17 @@ + _nettle_write_le32(length, digest, ctx->state); + _gost28147_imit_reinit(ctx); + } ++ ++#if NETTLE_VERSION_MAJOR >= 4 ++void gost28147_imit_digest(struct gost28147_imit_ctx *ctx, uint8_t *digest) ++{ ++ _gost28147_imit_digest(ctx, GOST28147_IMIT_DIGEST_SIZE, digest); ++} ++#else ++void gost28147_imit_digest(struct gost28147_imit_ctx *ctx, size_t length, ++ uint8_t *digest) ++{ ++ _gost28147_imit_digest(ctx, length, digest); ++} ++#endif + #endif +diff -urN a/lib/nettle/gost/gost28147.h b/lib/nettle/gost/gost28147.h +--- a/lib/nettle/gost/gost28147.h 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/nettle/gost/gost28147.h 2026-03-12 01:16:48.450569253 -0500 +@@ -40,6 +40,7 @@ + #ifndef HAVE_NETTLE_GOST28147_SET_KEY + + #include ++#include + + #ifdef __cplusplus + extern "C" { +@@ -174,8 +175,12 @@ + void gost28147_imit_update(struct gost28147_imit_ctx *ctx, size_t length, + const uint8_t *data); + ++#if NETTLE_VERSION_MAJOR >= 4 ++void gost28147_imit_digest(struct gost28147_imit_ctx *ctx, uint8_t *digest); ++#else + void gost28147_imit_digest(struct gost28147_imit_ctx *ctx, size_t length, + uint8_t *digest); ++#endif + + #ifdef __cplusplus + } +diff -urN a/lib/nettle/int/dsa-fips.h b/lib/nettle/int/dsa-fips.h +--- a/lib/nettle/int/dsa-fips.h 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/nettle/int/dsa-fips.h 2026-03-12 01:15:30.776902925 -0500 +@@ -25,6 +25,7 @@ + #include /* includes gmp.h */ + #include + #include ++#include + #include "fips.h" + + #define div_ceil(x, y) ((x + (y) - 1) / (y)) +@@ -100,7 +101,11 @@ + + sha384_init(&ctx); + sha384_update(&ctx, length, data); ++#if NETTLE_VERSION_MAJOR >= 4 ++ sha384_digest(&ctx, digest); ++#else + sha384_digest(&ctx, DIGEST_SIZE, digest); ++#endif + + return; + } +diff -urN a/lib/nettle/int/tls1-prf.c b/lib/nettle/int/tls1-prf.c +--- a/lib/nettle/int/tls1-prf.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/nettle/int/tls1-prf.c 2026-03-12 01:15:30.776902925 -0500 +@@ -38,6 +38,7 @@ + #include "int/tls1-prf.h" + #include + #include ++#include + + /* The RFC2246 P_hash() function. The mac_ctx is expected to + * be initialized and key set to be the secret key. +@@ -50,6 +51,7 @@ + uint8_t Atmp[MAX_HASH_SIZE]; + ssize_t left; + unsigned started = 0; ++ uint8_t tmp[MAX_HASH_SIZE]; + + /* round up */ + left = dst_length; +@@ -63,7 +65,11 @@ + } else { + update(mac_ctx, digest_size, Atmp); + } ++#if NETTLE_VERSION_MAJOR >= 4 ++ digest(mac_ctx, Atmp); /* store A(i) */ ++#else + digest(mac_ctx, digest_size, Atmp); /* store A(i) */ ++#endif + + update(mac_ctx, digest_size, Atmp); /* hash A(i) */ + update(mac_ctx, label_size, +@@ -73,7 +79,12 @@ + if (left < (ssize_t)digest_size) + digest_size = left; + +- digest(mac_ctx, digest_size, dst); ++#if NETTLE_VERSION_MAJOR >= 4 ++ digest(mac_ctx, tmp); ++#else ++ digest(mac_ctx, digest_size, tmp); ++#endif ++ memcpy(dst, tmp, digest_size); + + left -= digest_size; + dst += digest_size; +diff -urN a/lib/nettle/mac.c b/lib/nettle/mac.c +--- a/lib/nettle/mac.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/nettle/mac.c 2026-03-12 01:20:50.109508073 -0500 +@@ -29,7 +29,8 @@ + #include + #include + #include +-#include ++#include ++#include + #include + #ifndef HAVE_NETTLE_SHA3_128_SHAKE_OUTPUT + #include "int/sha3-shake.h" +@@ -47,12 +48,14 @@ + #include "gost/cmac.h" + #endif + #include ++#include ++ ++#if NETTLE_VERSION_MAJOR < 4 ++typedef void nettle_output_func(void *ctx, size_t length, uint8_t *dst); ++#endif + +-typedef void (*update_func)(void *, size_t, const uint8_t *); +-typedef void (*digest_func)(void *, size_t, uint8_t *); + typedef void (*set_key_func)(void *, size_t, const uint8_t *); + typedef void (*set_nonce_func)(void *, size_t, const uint8_t *); +-typedef void (*init_func)(void *); + typedef bool (*finished_func)(void *); + + static int wrap_nettle_hash_init(gnutls_digest_algorithm_t algo, void **_ctx); +@@ -100,9 +103,10 @@ + void *ctx_ptr; + gnutls_digest_algorithm_t algo; + size_t length; +- update_func update; +- digest_func digest; +- init_func init; ++ nettle_hash_update_func *update; ++ nettle_hash_digest_func *digest; ++ nettle_output_func *output; ++ nettle_hash_init_func *init; + finished_func finished; + }; + +@@ -152,8 +156,8 @@ + void *ctx_ptr; + gnutls_mac_algorithm_t algo; + size_t length; +- update_func update; +- digest_func digest; ++ nettle_hash_update_func *update; ++ nettle_hash_digest_func *digest; + set_key_func set_key; + set_nonce_func set_nonce; + }; +@@ -278,16 +282,30 @@ + ctx->pos = length; + } + ++#if NETTLE_VERSION_MAJOR >= 4 ++static void _wrap_gmac_digest(void *_ctx, uint8_t *digest) ++{ ++ struct gmac_ctx *ctx = _ctx; ++ ++ if (ctx->pos) ++ gcm_update(&ctx->ctx, &ctx->key, ctx->pos, ctx->buffer); ++ ++ gcm_digest(&ctx->ctx, &ctx->key, &ctx->cipher, ctx->encrypt, digest); ++ ctx->pos = 0; ++} ++#else + static void _wrap_gmac_digest(void *_ctx, size_t length, uint8_t *digest) + { + struct gmac_ctx *ctx = _ctx; + + if (ctx->pos) + gcm_update(&ctx->ctx, &ctx->key, ctx->pos, ctx->buffer); ++ + gcm_digest(&ctx->ctx, &ctx->key, &ctx->cipher, ctx->encrypt, length, + digest); + ctx->pos = 0; + } ++#endif + + static int _mac_ctx_init(gnutls_mac_algorithm_t algo, + struct nettle_mac_ctx *ctx) +@@ -298,117 +316,125 @@ + ctx->set_nonce = NULL; + switch (algo) { + case GNUTLS_MAC_MD5: +- ctx->update = (update_func)hmac_md5_update; +- ctx->digest = (digest_func)hmac_md5_digest; ++ ctx->update = (nettle_hash_update_func *)hmac_md5_update; ++ ctx->digest = (nettle_hash_digest_func *)hmac_md5_digest; + ctx->set_key = (set_key_func)hmac_md5_set_key; + ctx->ctx_ptr = &ctx->ctx.md5; + ctx->length = MD5_DIGEST_SIZE; + break; + case GNUTLS_MAC_SHA1: +- ctx->update = (update_func)hmac_sha1_update; +- ctx->digest = (digest_func)hmac_sha1_digest; ++ ctx->update = (nettle_hash_update_func *)hmac_sha1_update; ++ ctx->digest = (nettle_hash_digest_func *)hmac_sha1_digest; + ctx->set_key = (set_key_func)hmac_sha1_set_key; + ctx->ctx_ptr = &ctx->ctx.sha1; + ctx->length = SHA1_DIGEST_SIZE; + break; + case GNUTLS_MAC_SHA224: +- ctx->update = (update_func)hmac_sha224_update; +- ctx->digest = (digest_func)hmac_sha224_digest; ++ ctx->update = (nettle_hash_update_func *)hmac_sha224_update; ++ ctx->digest = (nettle_hash_digest_func *)hmac_sha224_digest; + ctx->set_key = (set_key_func)hmac_sha224_set_key; + ctx->ctx_ptr = &ctx->ctx.sha224; + ctx->length = SHA224_DIGEST_SIZE; + break; + case GNUTLS_MAC_SHA256: +- ctx->update = (update_func)hmac_sha256_update; +- ctx->digest = (digest_func)hmac_sha256_digest; ++ ctx->update = (nettle_hash_update_func *)hmac_sha256_update; ++ ctx->digest = (nettle_hash_digest_func *)hmac_sha256_digest; + ctx->set_key = (set_key_func)hmac_sha256_set_key; + ctx->ctx_ptr = &ctx->ctx.sha256; + ctx->length = SHA256_DIGEST_SIZE; + break; + case GNUTLS_MAC_SHA384: +- ctx->update = (update_func)hmac_sha384_update; +- ctx->digest = (digest_func)hmac_sha384_digest; ++ ctx->update = (nettle_hash_update_func *)hmac_sha384_update; ++ ctx->digest = (nettle_hash_digest_func *)hmac_sha384_digest; + ctx->set_key = (set_key_func)hmac_sha384_set_key; + ctx->ctx_ptr = &ctx->ctx.sha384; + ctx->length = SHA384_DIGEST_SIZE; + break; + case GNUTLS_MAC_SHA512: +- ctx->update = (update_func)hmac_sha512_update; +- ctx->digest = (digest_func)hmac_sha512_digest; ++ ctx->update = (nettle_hash_update_func *)hmac_sha512_update; ++ ctx->digest = (nettle_hash_digest_func *)hmac_sha512_digest; + ctx->set_key = (set_key_func)hmac_sha512_set_key; + ctx->ctx_ptr = &ctx->ctx.sha512; + ctx->length = SHA512_DIGEST_SIZE; + break; + #if ENABLE_GOST + case GNUTLS_MAC_GOSTR_94: +- ctx->update = (update_func)hmac_gosthash94cp_update; +- ctx->digest = (digest_func)hmac_gosthash94cp_digest; ++ ctx->update = ++ (nettle_hash_update_func *)hmac_gosthash94cp_update; ++ ctx->digest = ++ (nettle_hash_digest_func *)hmac_gosthash94cp_digest; + ctx->set_key = (set_key_func)hmac_gosthash94cp_set_key; + ctx->ctx_ptr = &ctx->ctx.gosthash94cp; + ctx->length = GOSTHASH94CP_DIGEST_SIZE; + break; + case GNUTLS_MAC_STREEBOG_256: +- ctx->update = (update_func)hmac_streebog256_update; +- ctx->digest = (digest_func)hmac_streebog256_digest; ++ ctx->update = ++ (nettle_hash_update_func *)hmac_streebog256_update; ++ ctx->digest = ++ (nettle_hash_digest_func *)hmac_streebog256_digest; + ctx->set_key = (set_key_func)hmac_streebog256_set_key; + ctx->ctx_ptr = &ctx->ctx.streebog256; + ctx->length = STREEBOG256_DIGEST_SIZE; + break; + case GNUTLS_MAC_STREEBOG_512: +- ctx->update = (update_func)hmac_streebog512_update; +- ctx->digest = (digest_func)hmac_streebog512_digest; ++ ctx->update = ++ (nettle_hash_update_func *)hmac_streebog512_update; ++ ctx->digest = ++ (nettle_hash_digest_func *)hmac_streebog512_digest; + ctx->set_key = (set_key_func)hmac_streebog512_set_key; + ctx->ctx_ptr = &ctx->ctx.streebog512; + ctx->length = STREEBOG512_DIGEST_SIZE; + break; + case GNUTLS_MAC_GOST28147_TC26Z_IMIT: +- ctx->update = (update_func)gost28147_imit_update; +- ctx->digest = (digest_func)gost28147_imit_digest; ++ ctx->update = (nettle_hash_update_func *)gost28147_imit_update; ++ ctx->digest = (nettle_hash_digest_func *)gost28147_imit_digest; + ctx->set_key = _wrap_gost28147_imit_set_key_tc26z; + ctx->ctx_ptr = &ctx->ctx.gost28147_imit; + ctx->length = GOST28147_IMIT_DIGEST_SIZE; + break; + case GNUTLS_MAC_MAGMA_OMAC: +- ctx->update = (update_func)cmac_magma_update; +- ctx->digest = (digest_func)cmac_magma_digest; ++ ctx->update = (nettle_hash_update_func *)cmac_magma_update; ++ ctx->digest = (nettle_hash_digest_func *)cmac_magma_digest; + ctx->set_key = _wrap_cmac_magma_set_key; + ctx->ctx_ptr = &ctx->ctx.magma; + ctx->length = CMAC64_DIGEST_SIZE; + break; + case GNUTLS_MAC_KUZNYECHIK_OMAC: +- ctx->update = (update_func)cmac_kuznyechik_update; +- ctx->digest = (digest_func)cmac_kuznyechik_digest; ++ ctx->update = ++ (nettle_hash_update_func *)cmac_kuznyechik_update; ++ ctx->digest = ++ (nettle_hash_digest_func *)cmac_kuznyechik_digest; + ctx->set_key = _wrap_cmac_kuznyechik_set_key; + ctx->ctx_ptr = &ctx->ctx.kuznyechik; + ctx->length = CMAC128_DIGEST_SIZE; + break; + #endif + case GNUTLS_MAC_UMAC_96: +- ctx->update = (update_func)umac96_update; +- ctx->digest = (digest_func)umac96_digest; ++ ctx->update = (nettle_hash_update_func *)umac96_update; ++ ctx->digest = (nettle_hash_digest_func *)umac96_digest; + ctx->set_key = _wrap_umac96_set_key; + ctx->set_nonce = (set_nonce_func)umac96_set_nonce; + ctx->ctx_ptr = &ctx->ctx.umac96; + ctx->length = 12; + break; + case GNUTLS_MAC_UMAC_128: +- ctx->update = (update_func)umac128_update; +- ctx->digest = (digest_func)umac128_digest; ++ ctx->update = (nettle_hash_update_func *)umac128_update; ++ ctx->digest = (nettle_hash_digest_func *)umac128_digest; + ctx->set_key = _wrap_umac128_set_key; + ctx->set_nonce = (set_nonce_func)umac128_set_nonce; + ctx->ctx_ptr = &ctx->ctx.umac128; + ctx->length = 16; + break; + case GNUTLS_MAC_AES_CMAC_128: +- ctx->update = (update_func)cmac_aes128_update; +- ctx->digest = (digest_func)cmac_aes128_digest; ++ ctx->update = (nettle_hash_update_func *)cmac_aes128_update; ++ ctx->digest = (nettle_hash_digest_func *)cmac_aes128_digest; + ctx->set_key = _wrap_cmac128_set_key; + ctx->ctx_ptr = &ctx->ctx.cmac128; + ctx->length = CMAC128_DIGEST_SIZE; + break; + case GNUTLS_MAC_AES_CMAC_256: +- ctx->update = (update_func)cmac_aes256_update; +- ctx->digest = (digest_func)cmac_aes256_digest; ++ ctx->update = (nettle_hash_update_func *)cmac_aes256_update; ++ ctx->digest = (nettle_hash_digest_func *)cmac_aes256_digest; + ctx->set_key = _wrap_cmac256_set_key; + ctx->ctx_ptr = &ctx->ctx.cmac256; + ctx->length = CMAC128_DIGEST_SIZE; +@@ -468,7 +494,11 @@ + ctx.set_nonce(&ctx, nonce_size, nonce); + } + ctx.update(&ctx, text_size, text); ++#if NETTLE_VERSION_MAJOR >= 4 ++ ctx.digest(&ctx, digest); ++#else + ctx.digest(&ctx, ctx.length, digest); ++#endif + + zeroize_key(&ctx, sizeof(ctx)); + +@@ -581,15 +611,22 @@ + static int wrap_nettle_mac_output(void *src_ctx, void *digest, + size_t digestsize) + { +- struct nettle_mac_ctx *ctx; +- ctx = src_ctx; ++ struct nettle_mac_ctx *ctx = src_ctx; + + if (digestsize < ctx->length) { + gnutls_assert(); + return GNUTLS_E_SHORT_MEMORY_BUFFER; + } + ++#if NETTLE_VERSION_MAJOR >= 4 ++ if (digestsize != ctx->length) { ++ gnutls_assert(); ++ return GNUTLS_E_INVALID_REQUEST; ++ } ++ ctx->digest(ctx->ctx_ptr, digest); ++#else + ctx->digest(ctx->ctx_ptr, digestsize, digest); ++#endif + + return 0; + } +@@ -665,17 +702,24 @@ + sha1_update(&ctx->sha1, len, data); + } + +-static void _md5_sha1_digest(void *_ctx, size_t len, uint8_t *digest) ++#if NETTLE_VERSION_MAJOR >= 4 ++static void _md5_sha1_digest(void *_ctx, uint8_t *digest) + { + struct md5_sha1_ctx *ctx = _ctx; + +- md5_digest(&ctx->md5, len <= MD5_DIGEST_SIZE ? len : MD5_DIGEST_SIZE, +- digest); ++ md5_digest(&ctx->md5, digest); ++ sha1_digest(&ctx->sha1, digest + MD5_DIGEST_SIZE); ++} ++#else ++static void _md5_sha1_digest(void *_ctx, size_t len, uint8_t *digest) ++{ ++ struct md5_sha1_ctx *ctx = _ctx; + +- if (len > MD5_DIGEST_SIZE) +- sha1_digest(&ctx->sha1, len - MD5_DIGEST_SIZE, +- digest + MD5_DIGEST_SIZE); ++ (void)len; ++ md5_digest(&ctx->md5, MD5_DIGEST_SIZE, digest); ++ sha1_digest(&ctx->sha1, SHA1_DIGEST_SIZE, digest + MD5_DIGEST_SIZE); + } ++#endif + + static void _md5_sha1_init(void *_ctx) + { +@@ -691,137 +735,140 @@ + /* Any FIPS140-2 related enforcement is performed on + * gnutls_hash_init() and gnutls_hmac_init() */ + ++ ctx->output = NULL; + ctx->finished = NULL; + switch (algo) { + case GNUTLS_DIG_MD5: +- ctx->init = (init_func)md5_init; +- ctx->update = (update_func)md5_update; +- ctx->digest = (digest_func)md5_digest; ++ ctx->init = (nettle_hash_init_func *)md5_init; ++ ctx->update = (nettle_hash_update_func *)md5_update; ++ ctx->digest = (nettle_hash_digest_func *)md5_digest; + ctx->ctx_ptr = &ctx->ctx.md5; + ctx->length = MD5_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA1: +- ctx->init = (init_func)sha1_init; +- ctx->update = (update_func)sha1_update; +- ctx->digest = (digest_func)sha1_digest; ++ ctx->init = (nettle_hash_init_func *)sha1_init; ++ ctx->update = (nettle_hash_update_func *)sha1_update; ++ ctx->digest = (nettle_hash_digest_func *)sha1_digest; + ctx->ctx_ptr = &ctx->ctx.sha1; + ctx->length = SHA1_DIGEST_SIZE; + break; + case GNUTLS_DIG_MD5_SHA1: +- ctx->init = (init_func)_md5_sha1_init; +- ctx->update = (update_func)_md5_sha1_update; +- ctx->digest = (digest_func)_md5_sha1_digest; ++ ctx->init = (nettle_hash_init_func *)_md5_sha1_init; ++ ctx->update = (nettle_hash_update_func *)_md5_sha1_update; ++ ctx->digest = (nettle_hash_digest_func *)_md5_sha1_digest; + ctx->ctx_ptr = &ctx->ctx.md5_sha1; + ctx->length = MD5_DIGEST_SIZE + SHA1_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA224: +- ctx->init = (init_func)sha224_init; +- ctx->update = (update_func)sha224_update; +- ctx->digest = (digest_func)sha224_digest; ++ ctx->init = (nettle_hash_init_func *)sha224_init; ++ ctx->update = (nettle_hash_update_func *)sha224_update; ++ ctx->digest = (nettle_hash_digest_func *)sha224_digest; + ctx->ctx_ptr = &ctx->ctx.sha224; + ctx->length = SHA224_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA256: +- ctx->init = (init_func)sha256_init; +- ctx->update = (update_func)sha256_update; +- ctx->digest = (digest_func)sha256_digest; ++ ctx->init = (nettle_hash_init_func *)sha256_init; ++ ctx->update = (nettle_hash_update_func *)sha256_update; ++ ctx->digest = (nettle_hash_digest_func *)sha256_digest; + ctx->ctx_ptr = &ctx->ctx.sha256; + ctx->length = SHA256_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA384: +- ctx->init = (init_func)sha384_init; +- ctx->update = (update_func)sha384_update; +- ctx->digest = (digest_func)sha384_digest; ++ ctx->init = (nettle_hash_init_func *)sha384_init; ++ ctx->update = (nettle_hash_update_func *)sha384_update; ++ ctx->digest = (nettle_hash_digest_func *)sha384_digest; + ctx->ctx_ptr = &ctx->ctx.sha384; + ctx->length = SHA384_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA512: +- ctx->init = (init_func)sha512_init; +- ctx->update = (update_func)sha512_update; +- ctx->digest = (digest_func)sha512_digest; ++ ctx->init = (nettle_hash_init_func *)sha512_init; ++ ctx->update = (nettle_hash_update_func *)sha512_update; ++ ctx->digest = (nettle_hash_digest_func *)sha512_digest; + ctx->ctx_ptr = &ctx->ctx.sha512; + ctx->length = SHA512_DIGEST_SIZE; + break; + #ifdef NETTLE_SHA3_FIPS202 + case GNUTLS_DIG_SHA3_224: +- ctx->init = (init_func)sha3_224_init; +- ctx->update = (update_func)sha3_224_update; +- ctx->digest = (digest_func)sha3_224_digest; ++ ctx->init = (nettle_hash_init_func *)sha3_224_init; ++ ctx->update = (nettle_hash_update_func *)sha3_224_update; ++ ctx->digest = (nettle_hash_digest_func *)sha3_224_digest; + ctx->ctx_ptr = &ctx->ctx.sha3_224; + ctx->length = SHA3_224_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA3_256: +- ctx->init = (init_func)sha3_256_init; +- ctx->update = (update_func)sha3_256_update; +- ctx->digest = (digest_func)sha3_256_digest; ++ ctx->init = (nettle_hash_init_func *)sha3_256_init; ++ ctx->update = (nettle_hash_update_func *)sha3_256_update; ++ ctx->digest = (nettle_hash_digest_func *)sha3_256_digest; + ctx->ctx_ptr = &ctx->ctx.sha3_256; + ctx->length = SHA3_256_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA3_384: +- ctx->init = (init_func)sha3_384_init; +- ctx->update = (update_func)sha3_384_update; +- ctx->digest = (digest_func)sha3_384_digest; ++ ctx->init = (nettle_hash_init_func *)sha3_384_init; ++ ctx->update = (nettle_hash_update_func *)sha3_384_update; ++ ctx->digest = (nettle_hash_digest_func *)sha3_384_digest; + ctx->ctx_ptr = &ctx->ctx.sha3_384; + ctx->length = SHA3_384_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHA3_512: +- ctx->init = (init_func)sha3_512_init; +- ctx->update = (update_func)sha3_512_update; +- ctx->digest = (digest_func)sha3_512_digest; ++ ctx->init = (nettle_hash_init_func *)sha3_512_init; ++ ctx->update = (nettle_hash_update_func *)sha3_512_update; ++ ctx->digest = (nettle_hash_digest_func *)sha3_512_digest; + ctx->ctx_ptr = &ctx->ctx.sha3_512; + ctx->length = SHA3_512_DIGEST_SIZE; + break; + case GNUTLS_DIG_SHAKE_128: +- ctx->init = (init_func)sha3_128_init; +- ctx->update = (update_func)sha3_128_update; +- ctx->digest = (digest_func)sha3_128_shake_output; ++ ctx->init = (nettle_hash_init_func *)sha3_128_init; ++ ctx->update = (nettle_hash_update_func *)sha3_128_update; ++ ctx->digest = NULL; ++ ctx->output = (nettle_output_func *)sha3_128_shake_output; + ctx->finished = _wrap_sha3_128_shake_finished; + ctx->ctx_ptr = &ctx->ctx.sha3_128; + ctx->length = 0; /* unused */ + break; + case GNUTLS_DIG_SHAKE_256: +- ctx->init = (init_func)sha3_256_init; +- ctx->update = (update_func)sha3_256_update; +- ctx->digest = (digest_func)sha3_256_shake_output; ++ ctx->init = (nettle_hash_init_func *)sha3_256_init; ++ ctx->update = (nettle_hash_update_func *)sha3_256_update; ++ ctx->digest = NULL; ++ ctx->output = (nettle_output_func *)sha3_256_shake_output; + ctx->finished = _wrap_sha3_256_shake_finished; + ctx->ctx_ptr = &ctx->ctx.sha3_256; + ctx->length = 0; /* unused */ + break; + #endif + case GNUTLS_DIG_MD2: +- ctx->init = (init_func)md2_init; +- ctx->update = (update_func)md2_update; +- ctx->digest = (digest_func)md2_digest; ++ ctx->init = (nettle_hash_init_func *)md2_init; ++ ctx->update = (nettle_hash_update_func *)md2_update; ++ ctx->digest = (nettle_hash_digest_func *)md2_digest; + ctx->ctx_ptr = &ctx->ctx.md2; + ctx->length = MD2_DIGEST_SIZE; + break; + + case GNUTLS_DIG_RMD160: +- ctx->init = (init_func)ripemd160_init; +- ctx->update = (update_func)ripemd160_update; +- ctx->digest = (digest_func)ripemd160_digest; ++ ctx->init = (nettle_hash_init_func *)ripemd160_init; ++ ctx->update = (nettle_hash_update_func *)ripemd160_update; ++ ctx->digest = (nettle_hash_digest_func *)ripemd160_digest; + ctx->ctx_ptr = &ctx->ctx.ripemd160; + ctx->length = RIPEMD160_DIGEST_SIZE; + break; + #if ENABLE_GOST + case GNUTLS_DIG_GOSTR_94: +- ctx->init = (init_func)gosthash94cp_init; +- ctx->update = (update_func)gosthash94cp_update; +- ctx->digest = (digest_func)gosthash94cp_digest; ++ ctx->init = (nettle_hash_init_func *)gosthash94cp_init; ++ ctx->update = (nettle_hash_update_func *)gosthash94cp_update; ++ ctx->digest = (nettle_hash_digest_func *)gosthash94cp_digest; + ctx->ctx_ptr = &ctx->ctx.gosthash94cp; + ctx->length = GOSTHASH94_DIGEST_SIZE; + break; + case GNUTLS_DIG_STREEBOG_256: +- ctx->init = (init_func)streebog256_init; +- ctx->update = (update_func)streebog256_update; +- ctx->digest = (digest_func)streebog256_digest; ++ ctx->init = (nettle_hash_init_func *)streebog256_init; ++ ctx->update = (nettle_hash_update_func *)streebog256_update; ++ ctx->digest = (nettle_hash_digest_func *)streebog256_digest; + ctx->ctx_ptr = &ctx->ctx.streebog256; + ctx->length = STREEBOG256_DIGEST_SIZE; + break; + case GNUTLS_DIG_STREEBOG_512: +- ctx->init = (init_func)streebog512_init; +- ctx->update = (update_func)streebog512_update; +- ctx->digest = (digest_func)streebog512_digest; ++ ctx->init = (nettle_hash_init_func *)streebog512_init; ++ ctx->update = (nettle_hash_update_func *)streebog512_update; ++ ctx->digest = (nettle_hash_digest_func *)streebog512_digest; + ctx->ctx_ptr = &ctx->ctx.streebog512; + ctx->length = STREEBOG512_DIGEST_SIZE; + break; +@@ -848,7 +895,13 @@ + if (text_size > 0) { + ctx.update(&ctx, text_size, text); + } ++#if NETTLE_VERSION_MAJOR >= 4 ++ if (!ctx.digest) ++ return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); ++ ctx.digest(&ctx, digest); ++#else + ctx.digest(&ctx, ctx.length, digest); ++#endif + zeroize_key(&ctx, sizeof(ctx)); + + return 0; +@@ -897,20 +950,32 @@ + static int wrap_nettle_hash_output(void *src_ctx, void *digest, + size_t digestsize) + { +- struct nettle_hash_ctx *ctx; +- ctx = src_ctx; ++ struct nettle_hash_ctx *ctx = src_ctx; + + if (digest == NULL) { + ctx->init(ctx->ctx_ptr); + return 0; + } + ++ if (ctx->output) { ++ ctx->output(ctx->ctx_ptr, digestsize, digest); ++ return 0; ++ } ++ + if (ctx->length > 0 && digestsize < ctx->length) { + gnutls_assert(); + return GNUTLS_E_SHORT_MEMORY_BUFFER; + } + ++#if NETTLE_VERSION_MAJOR >= 4 ++ if (digestsize != ctx->length) { ++ gnutls_assert(); ++ return GNUTLS_E_INVALID_REQUEST; ++ } ++ ctx->digest(ctx->ctx_ptr, digest); ++#else + ctx->digest(ctx->ctx_ptr, digestsize, digest); ++#endif + + return 0; + } +@@ -929,8 +994,12 @@ + return gnutls_assert_val(ret); + + ctx.set_key(&ctx, saltsize, salt); ++#if NETTLE_VERSION_MAJOR >= 4 ++ hkdf_extract(&ctx.ctx, ctx.update, ctx.digest, keysize, key, output); ++#else + hkdf_extract(&ctx.ctx, ctx.update, ctx.digest, ctx.length, keysize, key, + output); ++#endif + + zeroize_key(&ctx, sizeof(ctx)); + return 0; +diff -urN a/lib/nettle/rnd-fips.c b/lib/nettle/rnd-fips.c +--- a/lib/nettle/rnd-fips.c 2026-02-09 08:41:57.000000000 -0600 ++++ b/lib/nettle/rnd-fips.c 2026-03-12 01:15:30.776902925 -0500 +@@ -30,6 +30,7 @@ + #include + #include "atfork.h" + #include "rnd-common.h" ++#include + + /* The block size is chosen arbitrarily */ + #define ENTROPY_BLOCK_SIZE SHA256_DIGEST_SIZE +@@ -103,7 +104,11 @@ + + sha256_init(&ctx); + sha256_update(&ctx, sizeof(block), block); ++#if NETTLE_VERSION_MAJOR >= 4 ++ sha256_digest(&ctx, hash); ++#else + sha256_digest(&ctx, sizeof(hash), hash); ++#endif + + if (memcmp(hash, fctx->entropy_hash, sizeof(hash)) == 0) { + _gnutls_switch_fips_state(GNUTLS_FIPS140_OP_ERROR); +@@ -189,7 +194,11 @@ + sha256_init(&ctx); + sha256_update(&ctx, sizeof(block), block); + zeroize_key(block, sizeof(block)); ++#if NETTLE_VERSION_MAJOR >= 4 ++ sha256_digest(&ctx, fctx->entropy_hash); ++#else + sha256_digest(&ctx, sizeof(fctx->entropy_hash), fctx->entropy_hash); ++#endif + + /* normal */ + ret = drbg_init(fctx, &fctx->normal_context); diff --git a/googletest/googletest-1.17.0-fix-flaky-getthreadcount-test.patch b/googletest/googletest-1.17.0-fix-flaky-getthreadcount-test.patch new file mode 100644 index 0000000..f3abb52 --- /dev/null +++ b/googletest/googletest-1.17.0-fix-flaky-getthreadcount-test.patch @@ -0,0 +1,61 @@ +diff --git a/googletest/test/googletest-port-test.cc +index 9f05a01..9ee4061 100644 +--- a/googletest/test/googletest-port-test.cc ++++ b/googletest/test/googletest-port-test.cc +@@ -304,7 +304,12 @@ TEST(GetThreadCountTest, ReturnsCorrectValue) { + // some point. + for (int attempt = 0; attempt < 20; ++attempt) { + starting_count = GetThreadCount(); ++ if (starting_count == 0) { ++ GTEST_SKIP() << "GetThreadCount() is unavailable on this system."; ++ } ++ + pthread_t thread_id; ++ bool thread_count_matches = false; + + internal::Mutex mutex; + { +@@ -317,7 +322,22 @@ TEST(GetThreadCountTest, ReturnsCorrectValue) { + ASSERT_EQ(0, pthread_attr_destroy(&attr)); + ASSERT_EQ(0, status); + +- thread_count_after_create = GetThreadCount(); ++ // The OS may not immediately report the updated thread count after ++ // creating a thread, causing flakiness in this test. To counter that, ++ // wait for up to .5 seconds for the OS to report the correct value ++ // while keeping the worker thread blocked on the mutex. ++ for (int i = 0; i < 5; ++i) { ++ thread_count_after_create = GetThreadCount(); ++ if (thread_count_after_create == 0) { ++ GTEST_SKIP() << "GetThreadCount() is unavailable on this system."; ++ } ++ if (thread_count_after_create == starting_count + 1) { ++ thread_count_matches = true; ++ break; ++ } ++ ++ std::this_thread::sleep_for(std::chrono::milliseconds(100)); ++ } + } + + void* dummy; +@@ -325,14 +345,17 @@ TEST(GetThreadCountTest, ReturnsCorrectValue) { + + // Join before we decide whether we need to retry the test. Retry if an + // arbitrary other thread was created or destroyed in the meantime. +- if (thread_count_after_create != starting_count + 1) continue; ++ if (!thread_count_matches) continue; + + // The OS may not immediately report the updated thread count after + // joining a thread, causing flakiness in this test. To counter that, we + // wait for up to .5 seconds for the OS to report the correct value. +- bool thread_count_matches = false; ++ thread_count_matches = false; + for (int i = 0; i < 5; ++i) { + thread_count_after_join = GetThreadCount(); ++ if (thread_count_after_join == 0) { ++ GTEST_SKIP() << "GetThreadCount() is unavailable on this system."; ++ } + if (thread_count_after_join == starting_count) { + thread_count_matches = true; + break; diff --git a/icu/icu-78.2-fix-ssearch-fortify-overflow.patch b/icu/icu-78.2-fix-ssearch-fortify-overflow.patch new file mode 100644 index 0000000..638a2e4 --- /dev/null +++ b/icu/icu-78.2-fix-ssearch-fortify-overflow.patch @@ -0,0 +1,62 @@ +diff --git a/icu/source/test/intltest/ssearch.cpp b/icu/source/test/intltest/ssearch.cpp +index a13df7f..615ea53 100644 +--- a/icu/source/test/intltest/ssearch.cpp ++++ b/icu/source/test/intltest/ssearch.cpp +@@ -531,12 +531,26 @@ static char *printOffsets(char *buffer, size_t n, OrderList &list) + + for(int32_t i = 0; i < size; i += 1) { + const Order *order = list.get(i); ++ size_t remaining = n - static_cast(s - buffer); ++ ++ if (remaining == 0) { ++ break; ++ } + + if (i != 0) { +- s += snprintf(s, n, ", "); ++ int32_t written = snprintf(s, remaining, ", "); ++ if (written < 0 || static_cast(written) >= remaining) { ++ break; ++ } ++ s += written; ++ remaining -= written; + } + +- s += snprintf(s, n, "(%d, %d)", order->lowOffset, order->highOffset); ++ int32_t written = snprintf(s, remaining, "(%d, %d)", order->lowOffset, order->highOffset); ++ if (written < 0 || static_cast(written) >= remaining) { ++ break; ++ } ++ s += written; + } + + return buffer; +@@ -549,12 +563,26 @@ static char *printOrders(char *buffer, size_t n, OrderList &list) + + for(int32_t i = 0; i < size; i += 1) { + const Order *order = list.get(i); ++ size_t remaining = n - static_cast(s - buffer); ++ ++ if (remaining == 0) { ++ break; ++ } + + if (i != 0) { +- s += snprintf(s, n, ", "); ++ int32_t written = snprintf(s, remaining, ", "); ++ if (written < 0 || static_cast(written) >= remaining) { ++ break; ++ } ++ s += written; ++ remaining -= written; + } + +- s += snprintf(s, n, "%8.8X", order->order); ++ int32_t written = snprintf(s, remaining, "%8.8X", order->order); ++ if (written < 0 || static_cast(written) >= remaining) { ++ break; ++ } ++ s += written; + } + + return buffer; diff --git a/leancrypto/leancrypto-1.6.0-posixify.patch b/leancrypto/leancrypto-1.6.0-posixify.patch new file mode 100644 index 0000000..fae3d56 --- /dev/null +++ b/leancrypto/leancrypto-1.6.0-posixify.patch @@ -0,0 +1,288 @@ +diff --git a/addon/clang-format-helper.sh b/addon/clang-format-helper.sh +index 0f7c352..f2708f2 100755 +--- a/addon/clang-format-helper.sh ++++ b/addon/clang-format-helper.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # + # Helper script to invoke clang-format to re-format all files allowed to be +diff --git a/addon/fips_integrity_checker_elf_generator.sh b/addon/fips_integrity_checker_elf_generator.sh +index 10628f5..2529603 100755 +--- a/addon/fips_integrity_checker_elf_generator.sh ++++ b/addon/fips_integrity_checker_elf_generator.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + SOFILE="$1" + HASHER="$2" +@@ -15,13 +15,13 @@ CUT="cut" + + ################################################################################ + +-if [ -z "$SOFILE" -o ! -f "$SOFILE" ] ++if [ -z "$SOFILE" ] || [ ! -f "$SOFILE" ] + then + echo "ERROR: shared library file $SOFILE not found" + exit 1 + fi + +-if [ -z "$HASHER" -o ! -x "$HASHER" ] ++if [ -z "$HASHER" ] || [ ! -x "$HASHER" ] + then + echo "ERROR: hasher executable $HASHER not found" + exit 1 +diff --git a/addon/fips_integrity_digest.sh b/addon/fips_integrity_digest.sh +index c2a6475..b48f09b 100755 +--- a/addon/fips_integrity_digest.sh ++++ b/addon/fips_integrity_digest.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # + # Tool to extract the message digest of the FIPS library. This digest provides +@@ -22,7 +22,7 @@ XXD="xxd" + + ################################################################################ + +-if [ -z "$SOFILE" -o ! -f "$SOFILE" ] ++if [ -z "$SOFILE" ] || [ ! -f "$SOFILE" ] + then + echo "ERROR: shared library file $SOFILE not found" + exit 1 +diff --git a/addon/generate_header.sh b/addon/generate_header.sh +index c150391..9bb30b3 100755 +--- a/addon/generate_header.sh ++++ b/addon/generate_header.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + OUTFILE=$1 + shift +diff --git a/addon/sanity_checks.sh b/addon/sanity_checks.sh +index fc988b7..8595de7 100755 +--- a/addon/sanity_checks.sh ++++ b/addon/sanity_checks.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + CHANGESFILE="CHANGES.md" + +@@ -102,7 +102,14 @@ check_copyright_date() { + newyear="$year" + fi + +- sed -i "/Copyright/s/$searchyear/$newyear/" $file ++ tmpfile=$(mktemp "${TMPDIR:-/tmp}/leancrypto-copyright.XXXXXX") || exit 1 ++ if sed "/Copyright/s/$searchyear/$newyear/" "$file" > "$tmpfile" ++ then ++ mv "$tmpfile" "$file" ++ else ++ rm -f "$tmpfile" ++ exit 1 ++ fi + } + + # Cleanup code base +@@ -119,7 +126,7 @@ code_cleanup() { + + for j in $@ + do +- if (echo $i | grep -q $j) ++ if printf '%s\n' "$i" | grep -q -- "$j" + then + skip=1 + break +@@ -162,7 +169,7 @@ check_reposanity() { + + check_existence ${CHANGESFILE} + check_existence README.md +- if ! $(head -n1 ${CHANGESFILE} | grep -q "$version" ) ++ if ! head -n1 "${CHANGESFILE}" | grep -q -- "$version" + then + #git log --pretty=format"%h %an %s" ${OLDVER}..HEAD + echo "Forgot to add $version changes to ${CHANGESFILE}" >&2 +@@ -172,7 +179,7 @@ check_reposanity() { + + # Check whether we have a preliminary code drop + check_preliminary() { +- if $(head -n1 ${CHANGESFILE} | grep -q "prerelease" ) ++ if head -n1 "${CHANGESFILE}" | grep -q "prerelease" + then + echo "Preliminary release - skipping full release validation" >&2 + exit 0 +diff --git a/apps/tests/hasher-test.sh b/apps/tests/hasher-test.sh +index cae5be8..01f2f51 100755 +--- a/apps/tests/hasher-test.sh ++++ b/apps/tests/hasher-test.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # Copyright (C) 2017 - 2025, Stephan Mueller + # +@@ -106,7 +106,7 @@ then + echo_fail "Generation of checker file $CHKFILE with hasher $LC_HASHER failed" + fi + +-opensslcmd=$(type -p openssl) ++opensslcmd=$(command -v openssl 2>/dev/null) + + if [ -x "$opensslcmd" ] + then +diff --git a/apps/tests/leancrypto_check_with_ietf.sh b/apps/tests/leancrypto_check_with_ietf.sh +index 9e3f88a..b1c9ac6 100755 +--- a/apps/tests/leancrypto_check_with_ietf.sh ++++ b/apps/tests/leancrypto_check_with_ietf.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # Written by Stephan Mueller + # +@@ -52,8 +52,8 @@ trap "rm -rf $TMPDIR" 0 1 2 3 15 + color() + { + bg=0 +- echo -ne "\033[0m" +- while [[ $# -gt 0 ]]; do ++ printf '\033[0m' ++ while [ "$#" -gt 0 ]; do + code=0 + case $1 in + black) code=30 ;; +@@ -69,7 +69,10 @@ color() + reset|off|default) code=0 ;; + bold|bright) code=1 ;; + esac +- [[ $code == 0 ]] || echo -ne "\033[$(printf "%02d" $((code+bg)))m" ++ if [ "$code" -ne 0 ] ++ then ++ printf '\033[%02dm' "$((code + bg))" ++ fi + shift + done + } +diff --git a/apps/tests/libtest.sh b/apps/tests/libtest.sh +index 46f950b..ab7e36e 100644 +--- a/apps/tests/libtest.sh ++++ b/apps/tests/libtest.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # Copyright (C) 2017 - 2025, Stephan Mueller + # +@@ -34,8 +34,8 @@ KERNVER=$(uname -r) + color() + { + bg=0 +- echo -ne "\033[0m" +- while [[ $# -gt 0 ]]; do ++ printf '\033[0m' ++ while [ "$#" -gt 0 ]; do + code=0 + case $1 in + black) code=30 ;; +@@ -51,7 +51,10 @@ color() + reset|off|default) code=0 ;; + bold|bright) code=1 ;; + esac +- [[ $code == 0 ]] || echo -ne "\033[$(printf "%02d" $((code+bg)))m" ++ if [ "$code" -ne 0 ] ++ then ++ printf '\033[%02dm' "$((code + bg))" ++ fi + shift + done + } +diff --git a/asn1/tests/testcerts/lc_gen_4way_cert_chain.sh b/asn1/tests/testcerts/lc_gen_4way_cert_chain.sh +index d0f8a72..0a10677 100755 +--- a/asn1/tests/testcerts/lc_gen_4way_cert_chain.sh ++++ b/asn1/tests/testcerts/lc_gen_4way_cert_chain.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # Generate a 4-way certificate chain using leancrypto + # +diff --git a/build-scripts/aesgcm-only.sh b/build-scripts/aesgcm-only.sh +index 39bb0a3..739cf4f 100755 +--- a/build-scripts/aesgcm-only.sh ++++ b/build-scripts/aesgcm-only.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # + # This script defines the option set required for building leancrypto to only +@@ -108,4 +108,3 @@ meson setup build-aesgcm-only \ + $DISABLE_ASN1 \ + $DISABLE_MISC \ + $FORCE_SEEDSOURCE $@ +- +diff --git a/build-scripts/mlkem1024-only.sh b/build-scripts/mlkem1024-only.sh +index 1b2ff3e..e4ee316 100755 +--- a/build-scripts/mlkem1024-only.sh ++++ b/build-scripts/mlkem1024-only.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # + # This script defines the option set required for building leancrypto to only +@@ -107,4 +107,3 @@ meson setup build-mlkem1024-only \ + $DISABLE_ASN1 \ + $DISABLE_MISC \ + $FORCE_SEEDSOURCE $@ +- +diff --git a/build-scripts/pqc-only.sh b/build-scripts/pqc-only.sh +index e1b70da..10534d0 100755 +--- a/build-scripts/pqc-only.sh ++++ b/build-scripts/pqc-only.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # + # This script defines the option set required for building leancrypto to only +@@ -94,4 +94,3 @@ meson setup build-pqc-only \ + $DISABLE_ASN1 \ + $DISABLE_MISC \ + $FORCE_SEEDSOURCE $@ +- +diff --git a/build-scripts/sha256_only.sh b/build-scripts/sha256_only.sh +index fbe228a..6d43a4f 100755 +--- a/build-scripts/sha256_only.sh ++++ b/build-scripts/sha256_only.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # + # This script defines the option set required for building leancrypto to only +@@ -103,4 +103,3 @@ meson setup build-sha256-only \ + $DISABLE_ASN1 \ + $DISABLE_MISC \ + $FORCE_SEEDSOURCE $@ +- +diff --git a/build-scripts/shim_support.sh b/build-scripts/shim_support.sh +index c97a002..f127423 100755 +--- a/build-scripts/shim_support.sh ++++ b/build-scripts/shim_support.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # + # This script defines the option set required for building leancrypto to work +@@ -106,4 +106,3 @@ meson setup build-shim \ + $DISABLE_ASN1 \ + $DISABLE_MISC \ + $FORCE_SEEDSOURCE +- diff --git a/libcap/libcap-2.77-host-build-cc.patch b/libcap/libcap-2.77-host-build-cc.patch new file mode 100644 index 0000000..0e36fc3 --- /dev/null +++ b/libcap/libcap-2.77-host-build-cc.patch @@ -0,0 +1,11 @@ +--- a/Make.Rules 2025-10-26 13:29:03.000000000 -0500 ++++ b/Make.Rules 2026-03-15 23:30:24.030620424 -0500 +@@ -85,7 +85,7 @@ + CPPFLAGS += -Dlinux $(DEFINES) $(LIBCAP_INCLUDES) + LDFLAGS ?= # -g + +-BUILD_CC ?= $(CC) ++BUILD_CC ?= cc + BUILD_LD ?= $(BUILD_CC) -Wl,-x -shared + BUILD_COPTS ?= $(COPTS) + BUILD_CFLAGS ?= $(BUILD_COPTS) diff --git a/libffcall/libffcall-2.5-parallel-make-race.patch b/libffcall/libffcall-2.5-parallel-make-race.patch new file mode 100644 index 0000000..b3acf0d --- /dev/null +++ b/libffcall/libffcall-2.5-parallel-make-race.patch @@ -0,0 +1,25 @@ +diff --git a/Makefile.in b/Makefile.in +index 5f5b496..5865660 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -233,3 +233,7 @@ dist : force + + force : + ++# This Makefile contains rules which don't work with parallel make. ++# See . ++# So, turn off parallel execution in this Makefile. ++.NOTPARALLEL: +diff --git a/callback/Makefile.in b/callback/Makefile.in +index d453d6b..64908e8 100644 +--- a/callback/Makefile.in ++++ b/callback/Makefile.in +@@ -234,3 +234,8 @@ distdir : $(DISTFILES) + + + force : ++ ++# This Makefile contains rules which don't work with parallel make. ++# See . ++# So, turn off parallel execution in this Makefile. ++.NOTPARALLEL: diff --git a/libtpms/libtpms-0.10.2-const-plaintext-pointers.patch b/libtpms/libtpms-0.10.2-const-plaintext-pointers.patch new file mode 100644 index 0000000..9fb2c7d --- /dev/null +++ b/libtpms/libtpms-0.10.2-const-plaintext-pointers.patch @@ -0,0 +1,13 @@ +diff --git a/src/tpm_library.c b/src/tpm_library.c +index f48f4fd..7b2ea68 100644 +--- a/src/tpm_library.c ++++ b/src/tpm_library.c +@@ -435,7 +435,7 @@ static unsigned char *TPMLIB_GetPlaintext(const char *stream, + const char *endtag, + size_t *length) + { +- char *start, *end; ++ const char *start, *end; + unsigned char *plaintext = NULL; + + start = strstr(stream, starttag); diff --git a/libtpms/libtpms-0.10.2-posixify-tests.patch b/libtpms/libtpms-0.10.2-posixify-tests.patch new file mode 100644 index 0000000..05ebc6b --- /dev/null +++ b/libtpms/libtpms-0.10.2-posixify-tests.patch @@ -0,0 +1,325 @@ +diff --git a/tests/base64decode.sh b/tests/base64decode.sh +index eef96fe..a0c656c 100755 +--- a/tests/base64decode.sh ++++ b/tests/base64decode.sh +@@ -1,23 +1,26 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + input=$(mktemp) + binary=$(mktemp) + +-trap "rm -f $input $binary" EXIT ++trap 'rm -f "$input" "$binary"' 0 + +-function sseq() ++sseq() + { +- for ((i = $1; i < $2; i=i<<1)); do +- echo $i ++ i=$1 ++ limit=$2 ++ while [ "$i" -lt "$limit" ]; do ++ echo "$i" ++ i=$((i << 1)) + done + } + +-function do_base64() ++do_base64() + { +- if [ -n "$(type -p base64)" ]; then +- base64 $1 +- elif [ -n "$(type -p uuencode)" ]; then +- uuencode -m $1 data | sed 1d | sed '$d' ++ if command -v base64 >/dev/null 2>&1; then ++ base64 "$1" ++ elif command -v uuencode >/dev/null 2>&1; then ++ uuencode -m "$1" data | sed 1d | sed '$d' + else + echo "No tool found for base64 encoding." >&2 + exit 1 +@@ -26,13 +29,10 @@ function do_base64() + + for i in $(sseq 1 1024) 2048 10240; + do +- echo $i +- dd if=/dev/urandom of=$binary bs=1 count=$i &>/dev/null +- echo "-----BEGIN INITSTATE-----" > $input +- do_base64 $binary >> $input +- echo "-----END INITSTATE-----" >> $input +- ./base64decode $input $binary +- if [ $? -ne 0 ]; then +- exit 1 +- fi ++ echo "$i" ++ dd if=/dev/urandom of="$binary" bs=1 count="$i" >/dev/null 2>&1 ++ echo "-----BEGIN INITSTATE-----" > "$input" ++ do_base64 "$binary" >> "$input" ++ echo "-----END INITSTATE-----" >> "$input" ++ ./base64decode "$input" "$binary" || exit 1 + done +diff --git a/tests/common b/tests/common +index 11e2548..c03f822 100644 +--- a/tests/common ++++ b/tests/common +@@ -3,12 +3,15 @@ + # Get the size of a file in bytes + # + # @1: filename +-function get_filesize() ++get_filesize() + { +- if [[ "$(uname -s)" =~ (Linux|CYGWIN_NT-|GNU) ]]; then +- stat -c%s "$1" +- else +- # OpenBSD +- stat -f%z "$1" +- fi ++ case "$(uname -s)" in ++ Linux|CYGWIN_NT-*|GNU) ++ stat -c%s "$1" ++ ;; ++ *) ++ # OpenBSD ++ stat -f%z "$1" ++ ;; ++ esac + } +diff --git a/tests/fuzz.sh b/tests/fuzz.sh +index 5e21c37..ebe1b80 100755 +--- a/tests/fuzz.sh ++++ b/tests/fuzz.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + TESTDIR=${abs_top_testdir:-$(dirname "$0")} + DIR=${PWD} +@@ -12,8 +12,8 @@ while :; do + echo "Passing test cases $l to $((l + MAXLINES))" + tmp=$(echo "${corpus}" | sed -n "${l},$((l + MAXLINES))p") + [ -z "${tmp}" ] && exit 0 +- ${DIR}/fuzz ${tmp} ++ "${DIR}/fuzz" ${tmp} + rc=$? +- [ $rc -ne 0 ] && exit $rc ++ [ "$rc" -ne 0 ] && exit "$rc" + l=$((l + MAXLINES)) + done +diff --git a/tests/oss-fuzz.sh b/tests/oss-fuzz.sh +index ba65c8c..b00eed0 100755 +--- a/tests/oss-fuzz.sh ++++ b/tests/oss-fuzz.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + set -ex + +@@ -8,20 +8,21 @@ export WORK=${WORK:-$(pwd)} + export OUT=${OUT:-$(pwd)/out} + CFLAGS="${CFLAGS} -fno-sanitize=bounds" # due to casts to Crypt_Int* + +-mkdir -p $OUT ++mkdir -p "$OUT" + + build=$WORK/build +-rm -rf $build +-mkdir -p $build ++rm -rf "$build" ++mkdir -p "$build" + + export LIBTPMS=$(pwd) + autoreconf -vfi + +-cd $build +-$LIBTPMS/configure --disable-shared --enable-static --with-openssl --with-tpm2 +-make -j$(nproc) && make -C tests fuzz ++cd "$build" ++"$LIBTPMS"/configure --disable-shared --enable-static --with-openssl --with-tpm2 ++jobs=$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1) ++make -j"$jobs" && make -C tests fuzz + + zip -jqr $OUT/fuzz_seed_corpus.zip "$LIBTPMS/tests/corpus-execute-command" + +-find $build -type f -executable -name "fuzz*" -exec mv {} $OUT \; +-find $build -type f -name "*.options" -exec mv {} $OUT \; ++find "$build" -type f -executable -name "fuzz*" -exec mv {} "$OUT" \; ++find "$build" -type f -name "*.options" -exec mv {} "$OUT" \; +diff --git a/tests/run-fuzzer.sh b/tests/run-fuzzer.sh +index 0a86c63..2d47f46 100755 +--- a/tests/run-fuzzer.sh ++++ b/tests/run-fuzzer.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + # For the license, see the LICENSE file in the root directory. + +@@ -6,18 +6,19 @@ DIR=${PWD}/$(dirname "$0") + ROOT=${DIR}/.. + WORKDIR=$(mktemp -d) + +-function cleanup() ++cleanup() + { +- rm -rf ${WORKDIR} ++ rm -rf "${WORKDIR}" + } + +-trap "cleanup" QUIT EXIT ++trap 'cleanup' 0 3 + +-pushd $WORKDIR ++oldpwd=$(pwd) ++cd "$WORKDIR" || exit 1 + +-${DIR}/fuzz $@ ${DIR}/corpus-execute-command ++"${DIR}/fuzz" "$@" "${DIR}/corpus-execute-command" + rc=$? + +-popd ++cd "$oldpwd" || exit 1 + + exit $rc +diff --git a/tests/tpm2_createprimary.sh b/tests/tpm2_createprimary.sh +index 9b24848..7796d59 100755 +--- a/tests/tpm2_createprimary.sh ++++ b/tests/tpm2_createprimary.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + # For the license, see the LICENSE file in the root directory. + +diff --git a/tests/tpm2_cve-2023-1017.sh b/tests/tpm2_cve-2023-1017.sh +index 662b090..86dd001 100755 +--- a/tests/tpm2_cve-2023-1017.sh ++++ b/tests/tpm2_cve-2023-1017.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + # For the license, see the LICENSE file in the root directory. + +diff --git a/tests/tpm2_cve-2023-1018.sh b/tests/tpm2_cve-2023-1018.sh +index debe2e7..69abcfb 100755 +--- a/tests/tpm2_cve-2023-1018.sh ++++ b/tests/tpm2_cve-2023-1018.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + # For the license, see the LICENSE file in the root directory. + +diff --git a/tests/tpm2_pcr_read.sh b/tests/tpm2_pcr_read.sh +index fcd8858..24c9281 100755 +--- a/tests/tpm2_pcr_read.sh ++++ b/tests/tpm2_pcr_read.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + # For the license, see the LICENSE file in the root directory. + +diff --git a/tests/tpm2_run_test.sh b/tests/tpm2_run_test.sh +index 2f5437a..f0b3732 100755 +--- a/tests/tpm2_run_test.sh ++++ b/tests/tpm2_run_test.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + # For the license, see the LICENSE file in the root directory. + +@@ -10,20 +10,22 @@ WORKDIR=$(mktemp -d) + + . "${TESTDIR}/common" + +-function cleanup() ++cleanup() + { + rm -rf "${WORKDIR}" + } + +-trap "cleanup" QUIT EXIT ++trap 'cleanup' 0 3 + +-pushd "$WORKDIR" &>/dev/null || exit 1 ++oldpwd=$(pwd) ++cd "$WORKDIR" || exit 1 + + "${DIR}/${1}" + rc=$? + + if ! fs=$(get_filesize NVChip); then +- exit 1 ++ cd "$oldpwd" || exit 1 ++ exit 1 + fi + exp=176832 + if [ "$fs" -ne "$exp" ]; then +@@ -33,6 +35,6 @@ if [ "$fs" -ne "$exp" ]; then + rc=1 + fi + +-popd &>/dev/null || exit 1 ++cd "$oldpwd" || exit 1 + + exit $rc +diff --git a/tests/tpm2_selftest.sh b/tests/tpm2_selftest.sh +index d06e2ee..22504e5 100755 +--- a/tests/tpm2_selftest.sh ++++ b/tests/tpm2_selftest.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + # For the license, see the LICENSE file in the root directory. + +diff --git a/tests/tpm2_setprofile.sh b/tests/tpm2_setprofile.sh +index 88c6f52..8e77618 100755 +--- a/tests/tpm2_setprofile.sh ++++ b/tests/tpm2_setprofile.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + # For the license, see the LICENSE file in the root directory. + +@@ -10,20 +10,22 @@ WORKDIR=$(mktemp -d) + + . "${TESTDIR}/common" + +-function cleanup() ++cleanup() + { + rm -rf "${WORKDIR}" + } + +-trap "cleanup" QUIT EXIT ++trap 'cleanup' 0 3 + +-pushd "$WORKDIR" &>/dev/null || exit 1 ++oldpwd=$(pwd) ++cd "$WORKDIR" || exit 1 + + "${DIR}/tpm2_setprofile" + rc=$? + + if ! fs=$(get_filesize NVChip); then +- exit 1 ++ cd "$oldpwd" || exit 1 ++ exit 1 + fi + exp=176832 + if [ "$fs" -ne "$exp" ]; then +@@ -33,6 +35,6 @@ if [ "$fs" -ne "$exp" ]; then + rc=1 + fi + +-popd &>/dev/null || exit 1 ++cd "$oldpwd" || exit 1 + + exit "$rc" diff --git a/libyuv/libyuv-1864-posixify.patch b/libyuv/libyuv-1864-posixify.patch new file mode 100644 index 0000000..85c5d85 --- /dev/null +++ b/libyuv/libyuv-1864-posixify.patch @@ -0,0 +1,37 @@ +diff --git a/CM_linux_packages.cmake b/CM_linux_packages.cmake +index a073edfa..f047f048 100644 +--- a/CM_linux_packages.cmake ++++ b/CM_linux_packages.cmake +@@ -1,9 +1,8 @@ + # determine the version number from the #define in libyuv/version.h +-EXECUTE_PROCESS ( +- COMMAND grep --perl-regex --only-matching "(?<=LIBYUV_VERSION )[0-9]+" include/libyuv/version.h +- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} +- OUTPUT_VARIABLE YUV_VERSION_NUMBER +- OUTPUT_STRIP_TRAILING_WHITESPACE ) ++FILE(STRINGS "${PROJECT_SOURCE_DIR}/include/libyuv/version.h" YUV_VERSION_LINE ++ REGEX "^#define LIBYUV_VERSION [0-9]+$") ++STRING(REGEX REPLACE "^#define LIBYUV_VERSION ([0-9]+)$" "\\1" ++ YUV_VERSION_NUMBER "${YUV_VERSION_LINE}") + SET ( YUV_VER_MAJOR 0 ) + SET ( YUV_VER_MINOR 0 ) + SET ( YUV_VER_PATCH ${YUV_VERSION_NUMBER} ) +@@ -66,4 +65,3 @@ SET ( CPACK_GENERATOR "DEB;RPM" ) + + # create the .deb and .rpm files (you'll need build-essential and rpm tools) + INCLUDE( CPack ) +- +diff --git a/source/test.sh b/source/test.sh +index 7f12c3c1..95fcce3f 100755 +--- a/source/test.sh ++++ b/source/test.sh +@@ -1,7 +1,7 @@ +-#!/bin/bash ++#!/bin/sh + set -x + +-function runbenchmark1 { ++runbenchmark1() { + perf record /google/src/cloud/fbarchard/clean/google3/blaze-bin/third_party/libyuv/libyuv_test --gunit_filter=*$1 --libyuv_width=1280 --libyuv_height=720 --libyuv_repeat=1000 --libyuv_flags=-1 --libyuv_cpu_info=-1 + perf report | grep AVX + } diff --git a/linux-firmware/linux-firmware-20260309-portable-find-symlink-check.patch b/linux-firmware/linux-firmware-20260309-portable-find-symlink-check.patch new file mode 100644 index 0000000..9be39cd --- /dev/null +++ b/linux-firmware/linux-firmware-20260309-portable-find-symlink-check.patch @@ -0,0 +1,18 @@ +diff --git a/copy-firmware.sh b/copy-firmware.sh +index 6a32127..7c1821e 100755 +--- a/copy-firmware.sh ++++ b/copy-firmware.sh +@@ -164,9 +164,10 @@ if [ "$num_jobs" -gt 1 ]; then + parallel -j"$num_jobs" -a "$parallel_args_file" + fi + +-# Verify no broken symlinks +-if test "$(find "$destdir" -xtype l | wc -l)" -ne 0 ; then +- err "Broken symlinks found:\n$(find "$destdir" -xtype l)" ++# Verify no broken symlinks without relying on non-portable find -xtype. ++broken_links=$(find "$destdir" -type l ! -exec test -e {} \; -print) ++if test -n "$broken_links"; then ++ err "Broken symlinks found:\n$broken_links" + fi + + exit 0 diff --git a/linux/0001-x86-setup-enforce-x86_64-v3.patch b/linux/0001-x86-setup-enforce-x86_64-v3.patch new file mode 100644 index 0000000..1c90623 --- /dev/null +++ b/linux/0001-x86-setup-enforce-x86_64-v3.patch @@ -0,0 +1,41 @@ +--- a/arch/x86/kernel/setup.c ++++ b/arch/x86/kernel/setup.c +@@ -864,6 +864,27 @@ + } + } + ++#ifdef CONFIG_X86_64 ++static bool __init x86_has_x86_64_v3(void) ++{ ++ return boot_cpu_has(X86_FEATURE_CX16) && ++ boot_cpu_has(X86_FEATURE_LAHF_LM) && ++ boot_cpu_has(X86_FEATURE_POPCNT) && ++ boot_cpu_has(X86_FEATURE_XMM3) && ++ boot_cpu_has(X86_FEATURE_SSSE3) && ++ boot_cpu_has(X86_FEATURE_XMM4_1) && ++ boot_cpu_has(X86_FEATURE_XMM4_2) && ++ boot_cpu_has(X86_FEATURE_AVX) && ++ boot_cpu_has(X86_FEATURE_AVX2) && ++ boot_cpu_has(X86_FEATURE_BMI1) && ++ boot_cpu_has(X86_FEATURE_BMI2) && ++ boot_cpu_has(X86_FEATURE_F16C) && ++ boot_cpu_has(X86_FEATURE_FMA) && ++ boot_cpu_has(X86_FEATURE_MOVBE) && ++ boot_cpu_has(X86_FEATURE_ABM); ++} ++#endif ++ + /* + * Determine if we were loaded by an EFI loader. If so, then we have also been + * passed the efi memmap, systab, etc., so we should use these data structures +@@ -931,6 +952,10 @@ + + idt_setup_early_traps(); + early_cpu_init(); ++#ifdef CONFIG_X86_64 ++ if (!x86_has_x86_64_v3()) ++ panic("This kernel requires an x86_64-v3 CPU\n"); ++#endif + jump_label_init(); + static_call_init(); + early_ioremap_init(); diff --git a/llvm/llvm-project-22.1.1-compiler-rt-i386-tf-builtins.patch b/llvm/llvm-project-22.1.1-compiler-rt-i386-tf-builtins.patch new file mode 100644 index 0000000..2f74b12 --- /dev/null +++ b/llvm/llvm-project-22.1.1-compiler-rt-i386-tf-builtins.patch @@ -0,0 +1,63 @@ +--- a/compiler-rt/lib/builtins/CMakeLists.txt ++++ b/compiler-rt/lib/builtins/CMakeLists.txt +@@ -362,6 +362,7 @@ + + set(i386_SOURCES + ${GENERIC_SOURCES} ++ ${GENERIC_TF_SOURCES} + ${x86_ARCH_SOURCES} + i386/ashldi3.S + i386/ashrdi3.S +@@ -1012,9 +1013,9 @@ + list(APPEND BUILTIN_CFLAGS_${arch} -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET) + endif() + +- # For RISCV32 and 32-bit SPARC, we must force enable int128 for compiling long +- # double routines. +- if (COMPILER_RT_ENABLE_SOFTWARE_INT128 OR ("${arch}" MATCHES "riscv32|sparc$" ++ # For i386, RISCV32 and 32-bit SPARC, we must force enable int128 for ++ # compiling long double routines. ++ if (COMPILER_RT_ENABLE_SOFTWARE_INT128 OR ("${arch}" MATCHES "i386|riscv32|sparc$" + AND NOT CMAKE_COMPILER_IS_GNUCC)) + list(APPEND BUILTIN_CFLAGS_${arch} -fforce-enable-int128) + endif() + +--- a/compiler-rt/lib/builtins/extendxftf2.c ++++ b/compiler-rt/lib/builtins/extendxftf2.c +@@ -12,7 +12,8 @@ + #define QUAD_PRECISION + #include "fp_lib.h" + +-#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && defined(__x86_64__) ++#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && \ ++ (defined(__x86_64__) || defined(__i386__)) + #define SRC_80 + #define DST_QUAD + #include "fp_extend_impl.inc" + +--- a/compiler-rt/lib/builtins/trunctfxf2.c ++++ b/compiler-rt/lib/builtins/trunctfxf2.c +@@ -12,7 +12,8 @@ + #define QUAD_PRECISION + #include "fp_lib.h" + +-#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && defined(__x86_64__) ++#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && \ ++ (defined(__x86_64__) || defined(__i386__)) + + #define SRC_QUAD + #define DST_80 + +--- a/compiler-rt/lib/builtins/truncxfbf2.c ++++ b/compiler-rt/lib/builtins/truncxfbf2.c +@@ -6,7 +6,8 @@ + // + //===----------------------------------------------------------------------===// + +-#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && defined(__x86_64__) ++#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && \ ++ (defined(__x86_64__) || defined(__i386__)) + #define SRC_80 + #define DST_BFLOAT + #include "fp_trunc_impl.inc" + diff --git a/lua/lua-5.5.0-posixify.patch b/lua/lua-5.5.0-posixify.patch new file mode 100644 index 0000000..95d8d6e --- /dev/null +++ b/lua/lua-5.5.0-posixify.patch @@ -0,0 +1,186 @@ +diff -urN a/Makefile b/Makefile +--- a/Makefile 2025-06-26 08:04:37.000000000 -0500 ++++ b/Makefile 2026-03-23 21:17:07.502287273 -0500 +@@ -18,9 +18,9 @@ + INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V + INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V + +-# How to install. If your install program does not support "-p", then ++# How to install. If your install program does not preserve timestamps, then + # you may have to run ranlib on the installed liblua.a. +-INSTALL= install -p ++INSTALL?= install + INSTALL_EXEC= $(INSTALL) -m 0755 + INSTALL_DATA= $(INSTALL) -m 0644 + # +@@ -30,8 +30,8 @@ + # INSTALL_DATA= $(INSTALL) + + # Other utilities. +-MKDIR= mkdir -p +-RM= rm -f ++MKDIR?= mkdir -p ++RM?= rm -f + + # == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= + +@@ -52,7 +52,7 @@ + all: $(PLAT) + + $(PLATS) help test clean: +- @cd src && $(MAKE) $@ ++ @cd src && $(MAKE) $@ V=$(V) R=$(R) + + install: dummy + cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) +diff -urN a/src/Makefile b/src/Makefile +--- a/src/Makefile 2025-07-06 19:19:14.000000000 -0500 ++++ b/src/Makefile 2026-03-23 21:17:07.502287273 -0500 +@@ -6,15 +6,21 @@ + # Your platform. See PLATS for possible values. + PLAT= guess + +-CC= gcc -std=gnu99 +-CFLAGS= -O2 -Wall -Wextra $(SYSCFLAGS) $(MYCFLAGS) +-LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) +-LIBS= -lm $(SYSLIBS) $(MYLIBS) +- +-AR= ar rcu +-RANLIB= ranlib +-RM= rm -f +-UNAME= uname ++CC?= cc ++CXX?= c++ ++CCSTD?= -std=gnu99 ++CFLAGS?= $(CCSTD) -O2 -Wall -Wextra ++ALLCFLAGS= $(CFLAGS) $(SYSCFLAGS) $(MYCFLAGS) ++LDFLAGS?= ++ALLLDFLAGS= $(LDFLAGS) $(SYSLDFLAGS) $(MYLDFLAGS) ++LIBS?= -lm ++ALLLIBS= $(LIBS) $(SYSLIBS) $(MYLIBS) ++ ++AR?= ar ++ARFLAGS?= rcu ++RANLIB?= ranlib ++RM?= rm -f ++UNAME?= uname + + SYSCFLAGS= + SYSLDFLAGS= +@@ -28,11 +34,20 @@ + # Special flags for compiler modules; -Os reduces code size. + CMCFLAGS= + ++# Use C mode when a C++ driver is selected for compiling Lua's C sources. ++CCMODE= ++CCLINK= $(CC) ++ifneq ($(filter %++ c++,$(notdir $(firstword $(CC)))),) ++CCMODE= -x c ++endif ++CCCOMPILE= $(CC) $(CCMODE) ++ + # == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= + + PLATS= guess aix bsd c89 freebsd generic ios linux macosx mingw posix solaris + + LUA_A= liblua.a ++LUA_SO= liblua.so + CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o + LIB_O= lauxlib.o lbaselib.o lcorolib.o ldblib.o liolib.o lmathlib.o loadlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o linit.o + BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS) +@@ -44,7 +59,7 @@ + LUAC_O= luac.o + + ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) +-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) ++ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO) + ALL_A= $(LUA_A) + + # Targets start here. +@@ -57,14 +72,19 @@ + a: $(ALL_A) + + $(LUA_A): $(BASE_O) +- $(AR) $@ $(BASE_O) ++ $(AR) $(ARFLAGS) $@ $(BASE_O) + $(RANLIB) $@ + ++$(LUA_SO): $(CORE_O) $(LIB_O) ++ $(CCLINK) -shared $(ALLLDFLAGS) -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? $(ALLLIBS) ++ ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V) ++ ln -sf $(LUA_SO).$(R) $(LUA_SO) ++ + $(LUA_T): $(LUA_O) $(LUA_A) +- $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) ++ $(CCLINK) -o $@ $(ALLLDFLAGS) $(LUA_O) $(LUA_A) $(ALLLIBS) + + $(LUAC_T): $(LUAC_O) $(LUA_A) +- $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) ++ $(CCLINK) -o $@ $(ALLLDFLAGS) $(LUAC_O) $(LUA_A) $(ALLLIBS) + + test: + ./$(LUA_T) -v +@@ -73,15 +93,22 @@ + $(RM) $(ALL_T) $(ALL_O) + + depend: +- @$(CC) $(CFLAGS) -MM l*.c ++ @$(CCCOMPILE) $(ALLCFLAGS) -MM l*.c + + echo: + @echo "PLAT= $(PLAT)" + @echo "CC= $(CC)" ++ @echo "CXX= $(CXX)" ++ @echo "CCSTD= $(CCSTD)" ++ @echo "CCMODE= $(CCMODE)" + @echo "CFLAGS= $(CFLAGS)" ++ @echo "ALLCFLAGS= $(ALLCFLAGS)" + @echo "LDFLAGS= $(LDFLAGS)" ++ @echo "ALLLDFLAGS= $(ALLLDFLAGS)" + @echo "LIBS= $(LIBS)" ++ @echo "ALLLIBS= $(ALLLIBS)" + @echo "AR= $(AR)" ++ @echo "ARFLAGS= $(ARFLAGS)" + @echo "RANLIB= $(RANLIB)" + @echo "RM= $(RM)" + @echo "UNAME= $(UNAME)" +@@ -105,7 +132,7 @@ + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E" + + c89: +- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_C89" CC="gcc -std=c89" ++ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_C89" CCSTD="-std=c89" + @echo '' + @echo '*** C89 does not guarantee 64-bit integers for Lua.' + @echo '*** Make sure to compile all external Lua libraries' +@@ -113,7 +140,7 @@ + @echo '' + + FreeBSD NetBSD OpenBSD freebsd: +- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc" ++ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" + + generic: $(ALL) + +@@ -141,15 +168,18 @@ + # Targets that do not create files (not all makes understand .PHONY). + .PHONY: all $(PLATS) help test clean default o a depend echo + ++%.o: %.c ++ $(CCCOMPILE) $(ALLCFLAGS) -c -o $@ $< ++ + # Compiler modules may use special flags. + llex.o: +- $(CC) $(CFLAGS) $(CMCFLAGS) -c llex.c ++ $(CCCOMPILE) $(ALLCFLAGS) $(CMCFLAGS) -c -o $@ llex.c + + lparser.o: +- $(CC) $(CFLAGS) $(CMCFLAGS) -c lparser.c ++ $(CCCOMPILE) $(ALLCFLAGS) $(CMCFLAGS) -c -o $@ lparser.c + + lcode.o: +- $(CC) $(CFLAGS) $(CMCFLAGS) -c lcode.c ++ $(CCCOMPILE) $(ALLCFLAGS) $(CMCFLAGS) -c -o $@ lcode.c + + # DO NOT DELETE + diff --git a/mallard-ducktype/mallard-ducktype-1.0.2-posixify.patch b/mallard-ducktype/mallard-ducktype-1.0.2-posixify.patch new file mode 100644 index 0000000..7272461 --- /dev/null +++ b/mallard-ducktype/mallard-ducktype-1.0.2-posixify.patch @@ -0,0 +1,46 @@ +--- a/mallard-ducktype-1.0.2/tests/runtests ++++ b/mallard-ducktype-1.0.2/tests/runtests +@@ -8,19 +8,20 @@ + silent=0 + glob="" + +-for arg in $@; do +- if [ "x$arg" = "x-s" ]; then ++for arg do ++ if [ "$arg" = "-s" ]; then + silent=1 +- elif [ "x$arg" != "x" ]; then ++ elif [ -n "$arg" ]; then + glob="$arg" + fi + done + + for duck in *$glob*.duck; do ++ [ -f "$duck" ] || continue + count=$(( count + 1 )) +- out=$(echo $duck | sed -e 's/\.duck$/.out/') +- page=$(echo $duck | sed -e 's/\.duck$/.page/') +- error=$(echo $duck | sed -e 's/\.duck$/.error/') ++ out=${duck%.duck}.out ++ page=${duck%.duck}.page ++ error=${duck%.duck}.error + fail="" + if [ -f "$page" ]; then + python3 runtest.py "$duck" > "$out" || fail="exit status $?" +@@ -29,7 +30,6 @@ + diff -u "$out" "$page" >&2 || : + fi + elif [ -f "$error" ]; then +- status=0 + python3 runtest.py "$duck" > "$out" || : + if ! cmp "$out" "$error" >&2; then + fail="unexpected error message" +@@ -39,7 +39,7 @@ + fail="neither $page nor $error exists" + fi + if [ -z "$fail" ]; then +- if [ $silent = 0 ]; then ++ if [ "$silent" = 0 ]; then + echo "ok $count - $duck" + fi + else diff --git a/mono/mono-6.13.0.1279-posixify.patch b/mono/mono-6.13.0.1279-posixify.patch new file mode 100644 index 0000000..2e8a3b2 --- /dev/null +++ b/mono/mono-6.13.0.1279-posixify.patch @@ -0,0 +1,440 @@ +diff --git a/autogen.sh b/autogen.sh +index 3f0fcd4..5e586d7 100755 +--- a/autogen.sh ++++ b/autogen.sh +@@ -1,21 +1,21 @@ +-#!/usr/bin/env bash ++#!/bin/sh + # Run this to generate all the initial makefiles, etc. + # Ripped off from GNOME macros version + + DIE=0 + +-srcdir=`dirname $0` ++srcdir=`dirname "$0"` + test -z "$srcdir" && srcdir=. + + if [ -n "$MONO_PATH" ]; then + # from -> /mono/lib:/another/mono/lib + # to -> /mono /another/mono +- for i in `echo ${MONO_PATH} | tr ":" " "`; do +- i=`dirname ${i}` +- if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then ++ for i in `echo "${MONO_PATH}" | tr ":" " "`; do ++ i=`dirname "${i}"` ++ if [ -n "${i}" ] && [ -d "${i}/share/aclocal" ]; then + ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS" + fi +- if [ -n "{i}" -a -d "${i}/bin" ]; then ++ if [ -n "${i}" ] && [ -d "${i}/bin" ]; then + PATH="${i}/bin:$PATH" + fi + done +@@ -31,9 +31,9 @@ fi + } + + if [ -z "$LIBTOOLIZE" ]; then +- LIBTOOLIZE=`which glibtoolize 2>/dev/null` ++ LIBTOOLIZE=`command -v glibtoolize 2>/dev/null` + if [ ! -x "$LIBTOOLIZE" ]; then +- LIBTOOLIZE=`which libtoolize` ++ LIBTOOLIZE=`command -v libtoolize 2>/dev/null` + fi + fi + +@@ -109,24 +109,28 @@ has_ext_mod=false + ext_mod_args='' + has_disable_boehm=false + for PARAM; do +- if [[ $PARAM =~ "--enable-extension-module" ]] ; then +- has_ext_mod=true +- if [[ $PARAM =~ "=" ]] ; then +- ext_mod_args=`echo $PARAM | cut -d= -f2` +- fi +- fi +- if [[ $PARAM =~ "--disable-boehm" ]] ; then +- has_disable_boehm=true +- fi ++ case "$PARAM" in ++ --enable-extension-module) ++ has_ext_mod=true ++ ;; ++ --enable-extension-module=*) ++ has_ext_mod=true ++ ext_mod_args=${PARAM#*=} ++ ;; ++ --disable-boehm) ++ has_disable_boehm=true ++ ;; ++ esac + done + + # + # Plug in the extension module + # +-if test x$has_ext_mod = xtrue; then +- pushd $top_srcdir../mono-extensions/scripts +- sh ./prepare-repo.sh $ext_mod_args || exit 1 +- popd ++if test "x$has_ext_mod" = xtrue; then ++ ( ++ cd "$srcdir/../mono-extensions/scripts" && ++ sh ./prepare-repo.sh "$ext_mod_args" ++ ) || exit 1 + else + cat mono/mini/Makefile.am.in > mono/mini/Makefile.am + fi +@@ -156,12 +160,12 @@ autoconf || { echo "**Error**: autoconf failed."; exit 1; } + + # Update all submodules recursively to ensure everything is checked out + if test -e $srcdir/scripts/update_submodules.sh; then +- (cd $srcdir && scripts/update_submodules.sh) ++ (cd "$srcdir" && sh scripts/update_submodules.sh) + fi + +-if test x$has_disable_boehm = xfalse -a -d $srcdir/external/bdwgc; then ++if test "x$has_disable_boehm" = xfalse -a -d "$srcdir/external/bdwgc"; then + echo Running external/bdwgc/autogen.sh ... +- (cd $srcdir/external/bdwgc ; NOCONFIGURE=1 ./autogen.sh "$@") ++ (cd "$srcdir/external/bdwgc" ; NOCONFIGURE=1 ./autogen.sh "$@") + echo Done running external/bdwgc/autogen.sh ... + fi + +@@ -173,7 +177,15 @@ host_conf_flag= + build_uname_all=`(uname -a) 2>/dev/null` + case "$build_uname_all" in + CYGWIN*) +- if [[ "$@" != *"--host="* ]]; then ++ has_host_flag=false ++ for arg do ++ case "$arg" in ++ --host=*) ++ has_host_flag=true ++ ;; ++ esac ++ done ++ if test "$has_host_flag" != true; then + echo "Missing --host parameter, configure using ./configure --host=i686-w64-mingw32 or --host=x86_64-w64-mingw32" + echo "Falling back using --host=x86_64-w64-mingw32 as default." + host_conf_flag="--host=x86_64-w64-mingw32" +diff --git a/configure b/configure +index a465a2f..328ca8f 100755 +--- a/configure ++++ b/configure +@@ -18865,7 +18865,7 @@ fi + # end dolt + + +-export_ldflags=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh` ++export_ldflags=`eval echo \\$export_dynamic_flag_spec` + + + # Test whenever ld supports -version-script +diff --git a/configure.ac b/configure.ac +index ed6b6db..2629b10 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -678,7 +678,7 @@ AM_PROG_LIBTOOL + # Use dolt (http://dolt.freedesktop.org/) instead of libtool for building. + DOLT + +-export_ldflags=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh` ++export_ldflags=`eval echo \\$export_dynamic_flag_spec` + AC_SUBST(export_ldflags) + + # Test whenever ld supports -version-script +diff --git a/llvm/build_llvm_config.sh b/llvm/build_llvm_config.sh +index 7880d84..de1d368 100755 +--- a/llvm/build_llvm_config.sh ++++ b/llvm/build_llvm_config.sh +@@ -1,27 +1,38 @@ +-#!/bin/bash ++#!/bin/sh + + llvm_config=$1 + llvm_codegen_libs="$2" +-llvm_extra_libs="${@:3}" ++shift 2 ++llvm_extra_libs="$*" + + use_llvm_config=1 + llvm_host_win32=0 + llvm_host_win32_wsl=0 + llvm_host_win32_cygwin=0 + +-function win32_format_path { +- local formatted_path=$1 +- if [[ $llvm_host_win32_wsl = 1 ]] && [[ $1 != "/mnt/"* ]]; then +- # if path is not starting with /mnt under WSL it could be a windows path, convert using wslpath. +- formatted_path="$(wslpath -a "$1")" +- elif [[ $llvm_host_win32_cygwin = 1 ]] && [[ $1 != "/cygdrive/"* ]]; then +- # if path is not starting with /cygdrive under CygWin it could be a windows path, convert using cygpath. +- formatted_path="$(cygpath -a "$1")" +- fi ++win32_format_path() { ++ formatted_path=$1 ++ case "$llvm_host_win32_wsl:$1" in ++ 1:/mnt/*) ++ ;; ++ 1:*) ++ # If the path is not under /mnt on WSL it could already be a Windows path. ++ formatted_path="$(wslpath -a "$1")" ++ ;; ++ esac ++ case "$llvm_host_win32_cygwin:$formatted_path" in ++ 1:/cygdrive/*) ++ ;; ++ 1:*) ++ # If the path is not under /cygdrive on Cygwin it could already be a Windows path. ++ formatted_path="$(cygpath -a "$formatted_path")" ++ ;; ++ esac + echo "$formatted_path" + } + +-if [[ $llvm_config = *".exe" ]]; then ++case "$llvm_config" in ++*.exe) + llvm_host_win32=1 + # llvm-config is a windows binary. Check if we are running CygWin or WSL since then we might still be able to run llvm-config.exe + host_uname="$(uname -a)" +@@ -37,66 +48,67 @@ if [[ $llvm_config = *".exe" ]]; then + *) + use_llvm_config=0 + esac +-fi ++ ;; ++esac + +-if [[ $llvm_host_win32 = 1 ]]; then ++if [ "$llvm_host_win32" = 1 ]; then + llvm_config=$(win32_format_path "$llvm_config") + fi + +-if [[ $use_llvm_config = 1 ]]; then +- llvm_api_version=`$llvm_config --mono-api-version` || "0" +- with_llvm=`$llvm_config --prefix` +- llvm_config_cflags=`$llvm_config --cflags` +- llvm_system=`$llvm_config --system-libs` +- llvm_core_components=`$llvm_config --libs analysis core bitwriter` +- if [[ $llvm_api_version -lt 600 ]]; then +- llvm_old_jit=`$llvm_config --libs mcjit jit 2>>/dev/null` ++if [ "$use_llvm_config" = 1 ]; then ++ llvm_api_version=$("$llvm_config" --mono-api-version 2>/dev/null || printf '%s\n' 0) ++ with_llvm=$("$llvm_config" --prefix) ++ llvm_config_cflags=$("$llvm_config" --cflags) ++ llvm_system=$("$llvm_config" --system-libs) ++ llvm_core_components=$("$llvm_config" --libs analysis core bitwriter) ++ if [ "$llvm_api_version" -lt 600 ]; then ++ llvm_old_jit=$("$llvm_config" --libs mcjit jit 2>>/dev/null) + else +- llvm_old_jit=`$llvm_config --libs mcjit 2>>/dev/null` ++ llvm_old_jit=$("$llvm_config" --libs mcjit 2>>/dev/null) + fi +- llvm_new_jit=`$llvm_config --libs orcjit 2>>/dev/null` ++ llvm_new_jit=$("$llvm_config" --libs orcjit 2>>/dev/null) + +- if [[ ! -z $llvm_codegen_libs ]]; then +- llvm_extra=`$llvm_config --libs $llvm_codegen_libs` ++ if [ -n "$llvm_codegen_libs" ]; then ++ llvm_extra=$("$llvm_config" --libs "$llvm_codegen_libs") + fi + + # When building for Windows subsystem using WSL or CygWin the path returned from llvm-config.exe + # could be a Windows style path, make sure to format it into a path usable for WSL/CygWin. +- if [[ $llvm_host_win32 = 1 ]]; then ++ if [ "$llvm_host_win32" = 1 ]; then + with_llvm=$(win32_format_path "$with_llvm") + fi + fi + + # When cross compiling for Windows on system not capable of running Windows binaries, llvm-config.exe can't be used to query for + # LLVM parameters. In that scenario we will need to fallback to default values. +-if [[ $llvm_host_win32 = 1 ]] && [[ $use_llvm_config = 0 ]]; then ++if [ "$llvm_host_win32" = 1 ] && [ "$use_llvm_config" = 0 ]; then + # Assume we have llvm-config sitting in llvm-install-root/bin directory, get llvm-install-root directory. + with_llvm="$(dirname $llvm_config)" + with_llvm="$(dirname $with_llvm)" + llvm_config_path=$with_llvm/include/llvm/Config/llvm-config.h + + # llvm-config.exe --mono-api-version +- llvm_api_version=`awk '/MONO_API_VERSION/ { print $3 }' $llvm_config_path` ++ llvm_api_version=$(awk '/MONO_API_VERSION/ { print $3 }' "$llvm_config_path") + + # llvm-config.exe --cflags, returned information currently not used. + llvm_config_cflags= + + # llvm-config.exe --system-libs +- if [[ $llvm_api_version -lt 600 ]]; then ++ if [ "$llvm_api_version" -lt 600 ]; then + llvm_system="-limagehlp -lpsapi -lshell32" + else + llvm_system="-lpsapi -lshell32 -lole32 -luuid -ladvapi32" + fi + + # llvm-config.exe --libs analysis core bitwriter +- if [[ $llvm_api_version -lt 600 ]]; then ++ if [ "$llvm_api_version" -lt 600 ]; then + llvm_core_components="-lLLVMBitWriter -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport" + else + llvm_core_components="-lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle" + fi + + # llvm-config.exe --libs mcjit jit +- if [[ $llvm_api_version -lt 600 ]]; then ++ if [ "$llvm_api_version" -lt 600 ]; then + llvm_old_jit="-lLLVMJIT -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMMCJIT -lLLVMTarget -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMExecutionEngine -lLLVMMC -lLLVMCore -lLLVMSupport" + else + # Current build of LLVM 60 for cross Windows builds doesn't support LLVM JIT. +@@ -110,7 +122,7 @@ if [[ $llvm_host_win32 = 1 ]] && [[ $use_llvm_config = 0 ]]; then + case "$llvm_codegen_libs" in + *x86codegen*) + # llvm-config.exe --libs x86codegen +- if [[ $llvm_api_version -lt 600 ]]; then ++ if [ "$llvm_api_version" -lt 600 ]; then + llvm_extra="-lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMObject -lLLVMBitReader -lLLVMMCDisassembler -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport" + else + llvm_extra="-lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMX86Desc -lLLVMX86Info -lLLVMMCDisassembler -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle" +@@ -118,7 +130,7 @@ if [[ $llvm_host_win32 = 1 ]] && [[ $use_llvm_config = 0 ]]; then + ;; + *armcodegen*) + # llvm-config.exe --libs armcodegen +- if [[ $llvm_api_version -lt 600 ]]; then ++ if [ "$llvm_api_version" -lt 600 ]; then + llvm_extra="-lLLVMARMCodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMARMDesc -lLLVMMCDisassembler -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMMC -lLLVMSupport" + else + llvm_extra="-lLLVMARMCodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMARMDesc -lLLVMMCDisassembler -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMARMUtils -lLLVMMC -lLLVMSupport -lLLVMDemangle" +@@ -126,7 +138,7 @@ if [[ $llvm_host_win32 = 1 ]] && [[ $use_llvm_config = 0 ]]; then + ;; + *aarch64codegen*) + # llvm-config.exe --libs aarch64codegen +- if [[ $llvm_api_version -lt 600 ]]; then ++ if [ "$llvm_api_version" -lt 600 ]; then + llvm_extra="-lLLVMAArch64CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMMC -lLLVMAArch64Utils -lLLVMSupport" + else + llvm_extra="-lLLVMAArch64CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMMC -lLLVMAArch64Utils -lLLVMSupport -lLLVMDemangle" +@@ -137,15 +149,19 @@ if [[ $llvm_host_win32 = 1 ]] && [[ $use_llvm_config = 0 ]]; then + esac + fi + +-if [[ $llvm_config_cflags = *"stdlib=libc++"* ]]; then ++llvm_libc_link="" ++case "$llvm_config_cflags" in ++ *stdlib=libc++*) + llvm_libc_c="-stdlib=libc++" + # llvm_libc_link="-lc++" +-else ++ ;; ++*) + llvm_libc_c="" + # llvm_libc_link="-lstdc++" +-fi ++ ;; ++esac + +-if [[ $llvm_host_win32 = 1 ]]; then ++if [ "$llvm_host_win32" = 1 ]; then + host_cxxflag_additions="-std=gnu++11" + host_cflag_additions="-DNDEBUG" + else +@@ -153,7 +169,7 @@ else + host_cflag_additions="" + fi + +-if [[ ! -z $llvm_extra_libs ]]; then ++if [ -n "$llvm_extra_libs" ]; then + llvm_extra="$llvm_extra $llvm_extra_libs" + fi + +diff --git a/mcs/build/start-compiler-server.sh b/mcs/build/start-compiler-server.sh +index 8c74d4c..16bc874 100755 +--- a/mcs/build/start-compiler-server.sh ++++ b/mcs/build/start-compiler-server.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + # usage: start-compiler-server.sh + # ensure that VBCS_RUNTIME and VBCS_LOCATION environment variables are set. + +@@ -6,20 +6,19 @@ set -u + set -e + + if [ -s "$VBCS_LOCATION" ]; then +- CMD="RoslynCommandLineLogFile=$2 $VBCS_RUNTIME --gc-params=nursery-size=64m \"$VBCS_LOCATION\" -pipename:$3 &" + echo "Log location set to $2" + touch "$2" +- echo "cd $1; bash -c \"$CMD\"" ++ echo "cd $1; RoslynCommandLineLogFile=$2 $VBCS_RUNTIME --gc-params=nursery-size=64m \"$VBCS_LOCATION\" -pipename:$3 &" + cd "$1" +- bash -c "$CMD" ++ RoslynCommandLineLogFile=$2 "$VBCS_RUNTIME" --gc-params=nursery-size=64m "$VBCS_LOCATION" -pipename:"$3" & + RESULT=$? +- if [ $RESULT -eq 0 ]; then ++ if [ "$RESULT" -eq 0 ]; then + echo Compiler server started. + else + echo Failed to start compiler server. +- fi; ++ fi + else + echo No compiler server found at path "$VBCS_LOCATION". Ensure that VBCS_LOCATION is set in config.make or passed as a parameter to make. + echo Use ENABLE_COMPILER_SERVER=0 to disable the use of the compiler server and continue to build. + exit 1 +-fi; ++fi +diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am +index 85a5664..95286b8 100755 +--- a/mono/tests/Makefile.am ++++ b/mono/tests/Makefile.am +@@ -3030,7 +3030,7 @@ modules.exe: modules.cs modules-m1.netmodule $(TEST_DRIVER_DEPEND) + patch-libtool: + cp "../../libtool" . + sed -e 's,build_libtool_libs=no,build_libtool_libs=yes,g' libtool > 2; mv 2 libtool +- sed -e 's,LIBTOOL =,LIBTOOL2 =,g' Makefile > 2 && echo "LIBTOOL = bash ./libtool" > 1 && cat 1 2 > Makefile ++ sed -e 's,LIBTOOL =,LIBTOOL2 =,g' Makefile > 2 && echo "LIBTOOL = $(SHELL) ./libtool" > 1 && cat 1 2 > Makefile + touch libtest.c + + +diff --git a/mono/tests/Makefile.in b/mono/tests/Makefile.in +index 3d5eebd..f245b27 100644 +--- a/mono/tests/Makefile.in ++++ b/mono/tests/Makefile.in +@@ -3444,7 +3444,7 @@ modules.exe: modules.cs modules-m1.netmodule $(TEST_DRIVER_DEPEND) + patch-libtool: + cp "../../libtool" . + sed -e 's,build_libtool_libs=no,build_libtool_libs=yes,g' libtool > 2; mv 2 libtool +- sed -e 's,LIBTOOL =,LIBTOOL2 =,g' Makefile > 2 && echo "LIBTOOL = bash ./libtool" > 1 && cat 1 2 > Makefile ++ sed -e 's,LIBTOOL =,LIBTOOL2 =,g' Makefile > 2 && echo "LIBTOOL = $(SHELL) ./libtool" > 1 && cat 1 2 > Makefile + touch libtest.c + test-process-exit: + @$(MCS) $(srcdir)/threadpool-in-processexit.cs -out:threadpool-in-processexit.exe +diff --git a/support/Makefile.am b/support/Makefile.am +index d660025..2c0e425 100644 +--- a/support/Makefile.am ++++ b/support/Makefile.am +@@ -163,8 +163,8 @@ refresh: + patch-libtool: + cp "../libtool" . + sed -e 's,build_libtool_libs=no,build_libtool_libs=yes,g' libtool > 2; mv 2 libtool +- echo "LIBTOOL = bash ./libtool" > 1 +- echo "LTCOMPILE = bash ./libtool --mode=compile $(COMPILE)" >> 1 ++ echo "LIBTOOL = $(SHELL) ./libtool" > 1 ++ echo "LTCOMPILE = $(SHELL) ./libtool --mode=compile $(COMPILE)" >> 1 + sed -e 's,LIBTOOL =,LIBTOOL2 =,g' Makefile > 2 + sed -e 's,LTCOMPILE =,LTCOMPILE2 =,g' 2 > 3 + cat 1 3 > Makefile +diff --git a/support/Makefile.in b/support/Makefile.in +index a5c760c..23916c8 100644 +--- a/support/Makefile.in ++++ b/support/Makefile.in +@@ -1080,8 +1080,8 @@ uninstall-am: uninstall-libLTLIBRARIES + @ENABLE_MSVC_ONLY_FALSE@patch-libtool: + @ENABLE_MSVC_ONLY_FALSE@ cp "../libtool" . + @ENABLE_MSVC_ONLY_FALSE@ sed -e 's,build_libtool_libs=no,build_libtool_libs=yes,g' libtool > 2; mv 2 libtool +-@ENABLE_MSVC_ONLY_FALSE@ echo "LIBTOOL = bash ./libtool" > 1 +-@ENABLE_MSVC_ONLY_FALSE@ echo "LTCOMPILE = bash ./libtool --mode=compile $(COMPILE)" >> 1 ++@ENABLE_MSVC_ONLY_FALSE@ echo "LIBTOOL = $(SHELL) ./libtool" > 1 ++@ENABLE_MSVC_ONLY_FALSE@ echo "LTCOMPILE = $(SHELL) ./libtool --mode=compile $(COMPILE)" >> 1 + @ENABLE_MSVC_ONLY_FALSE@ sed -e 's,LIBTOOL =,LIBTOOL2 =,g' Makefile > 2 + @ENABLE_MSVC_ONLY_FALSE@ sed -e 's,LTCOMPILE =,LTCOMPILE2 =,g' 2 > 3 + @ENABLE_MSVC_ONLY_FALSE@ cat 1 3 > Makefile \ No newline at end of file diff --git a/mupdf/mupdf-1.27.2-ungnuify.patch b/mupdf/mupdf-1.27.2-ungnuify.patch new file mode 100644 index 0000000..f16b085 --- /dev/null +++ b/mupdf/mupdf-1.27.2-ungnuify.patch @@ -0,0 +1,558 @@ +--- a/Makefile ++++ b/Makefile +@@ -16,6 +16,12 @@ + + include Makethird + ++LINKER = $(CC) ++ifeq ($(THIRD_NEEDS_CXX_LINKER),yes) ++ LINKER = $(CXX) ++endif ++THIRD_LINK_LIBS := $(filter-out $(CXX_LINKER_FLAG),$(THIRD_LIBS)) ++ + # --- Configuration --- + + # Do not specify CFLAGS, LDFLAGS, LIB_LDFLAGS, EXE_LDFLAGS or LIBS on the make +@@ -81,20 +87,20 @@ + ifdef RANLIB + RANLIB_CMD = $(QUIET_RANLIB) $(RANLIB) $@ + endif +-LINK_CMD = $(QUIET_LINK) $(MKTGTDIR) ; $(CC) $(EXE_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) ++LINK_CMD = $(QUIET_LINK) $(MKTGTDIR) ; $(LINKER) $(EXE_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + TAGS_CMD = $(QUIET_TAGS) ctags + OBJCOPY_CMD = $(QUIET_OBJCOPY) $(MKTGTDIR) ; $(LD) -r -b binary -z noexecstack -o $@ $< + SYMLINK_CMD = $(QUIET_SYMLINK) $(MKTGTDIR) ; ln -sf + + ifeq ($(shared),yes) + ifeq ($(USE_ARGUMENT_FILE),yes) +- LINK_SO_CMD = $(QUIET_LINK_SO) $(MKTGTDIR) ; $(CC) $(LIB_LDFLAGS) $(LDFLAGS) -o $@ $(file > $@.in,$^) @$@.in ++ LINK_SO_CMD = $(QUIET_LINK_SO) $(MKTGTDIR) ; $(LINKER) $(LIB_LDFLAGS) $(LDFLAGS) -o $@ $(file > $@.in,$^) @$@.in + else +- LINK_SO_CMD = $(QUIET_LINK_SO) $(MKTGTDIR) ; $(CC) $(LIB_LDFLAGS) $(LDFLAGS) -o $@ $^ ++ LINK_SO_CMD = $(QUIET_LINK_SO) $(MKTGTDIR) ; $(LINKER) $(LIB_LDFLAGS) $(LDFLAGS) -o $@ $^ + endif + ifeq ($(OS),OpenBSD) + # OpenBSD linker magic doesn't use soname; so fake it by using -L$(OUT) and -lmupdf. +- LINK_CMD = $(QUIET_LINK) $(MKTGTDIR) ; $(CC) $(EXE_LDFLAGS) $(LDFLAGS) -o $@ -L$(OUT) \ ++ LINK_CMD = $(QUIET_LINK) $(MKTGTDIR) ; $(LINKER) $(EXE_LDFLAGS) $(LDFLAGS) -o $@ -L$(OUT) \ + $(subst $(OUT)/libmupdf.$(SO)$(SO_VERSION),-lmupdf,$^) \ + $(LIBS) + endif +@@ -244,10 +250,10 @@ + + FONT_GEN := $(FONT_BIN:%=generated/%.c) + +-generated/%.cff.c : %.cff $(HEXDUMP_SH) ; $(QUIET_GEN) $(MKTGTDIR) ; bash $(HEXDUMP_SH) > $@ $< +-generated/%.otf.c : %.otf $(HEXDUMP_SH) ; $(QUIET_GEN) $(MKTGTDIR) ; bash $(HEXDUMP_SH) > $@ $< +-generated/%.ttf.c : %.ttf $(HEXDUMP_SH) ; $(QUIET_GEN) $(MKTGTDIR) ; bash $(HEXDUMP_SH) > $@ $< +-generated/%.ttc.c : %.ttc $(HEXDUMP_SH) ; $(QUIET_GEN) $(MKTGTDIR) ; bash $(HEXDUMP_SH) > $@ $< ++generated/%.cff.c : %.cff $(HEXDUMP_SH) ; $(QUIET_GEN) $(MKTGTDIR) ; sh $(HEXDUMP_SH) > $@ $< ++generated/%.otf.c : %.otf $(HEXDUMP_SH) ; $(QUIET_GEN) $(MKTGTDIR) ; sh $(HEXDUMP_SH) > $@ $< ++generated/%.ttf.c : %.ttf $(HEXDUMP_SH) ; $(QUIET_GEN) $(MKTGTDIR) ; sh $(HEXDUMP_SH) > $@ $< ++generated/%.ttc.c : %.ttc $(HEXDUMP_SH) ; $(QUIET_GEN) $(MKTGTDIR) ; sh $(HEXDUMP_SH) > $@ $< + + ifeq ($(HAVE_OBJCOPY),yes) + MUPDF_OBJ += $(FONT_BIN:%=$(OUT)/%.o) +@@ -273,7 +279,7 @@ + + HYPH_GEN := $(HYPH_BIN:%=generated/%.c) + +-generated/%.zip.c : %.zip $(HEXDUMP_SH) ; $(QUIET_GEN) $(MKTGTDIR) ; bash $(HEXDUMP_SH) > $@ $< ++generated/%.zip.c : %.zip $(HEXDUMP_SH) ; $(QUIET_GEN) $(MKTGTDIR) ; sh $(HEXDUMP_SH) > $@ $< + + ifeq ($(HAVE_OBJCOPY),yes) + MUPDF_OBJ += $(HYPH_BIN:%.zip=$(OUT)/%.zip.o) +@@ -329,7 +335,7 @@ + + ifeq ($(shared),yes) + $(OUT)/libmupdf.$(SO)$(SO_VERSION): $(MUPDF_OBJ) $(THIRD_OBJ) +- $(LINK_SO_CMD) $(THIRD_LIBS) $(LIBCRYPTO_LIBS) $(LIBS) ++ $(LINK_SO_CMD) $(THIRD_LINK_LIBS) $(LIBCRYPTO_LIBS) $(LIBS) + ifeq ($(OS),OpenBSD) + # should never create symlink + MUPDF_LIB = $(OUT)/libmupdf.$(SO)$(SO_VERSION) +@@ -376,13 +382,13 @@ + MUTOOL_OBJ := $(MUTOOL_SRC:%.c=$(OUT)/%.o) + MUTOOL_EXE := $(OUT)/mutool + $(MUTOOL_EXE) : $(MUTOOL_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(PKCS7_LIB) $(THREAD_LIB) +- $(LINK_CMD) $(THIRD_LIBS) $(THREADING_LIBS) $(LIBCRYPTO_LIBS) ++ $(LINK_CMD) $(THIRD_LINK_LIBS) $(THREADING_LIBS) $(LIBCRYPTO_LIBS) + TOOL_APPS += $(MUTOOL_EXE) + + MURASTER_OBJ := $(OUT)/source/tools/muraster.o + MURASTER_EXE := $(OUT)/muraster + $(MURASTER_EXE) : $(MURASTER_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(PKCS7_LIB) $(THREAD_LIB) +- $(LINK_CMD) $(THIRD_LIBS) $(THREADING_LIBS) $(LIBCRYPTO_LIBS) ++ $(LINK_CMD) $(THIRD_LINK_LIBS) $(THREADING_LIBS) $(LIBCRYPTO_LIBS) + EXTRA_TOOL_APPS += $(MURASTER_EXE) + + ifeq ($(HAVE_GLUT),yes) +@@ -390,7 +396,7 @@ + MUVIEW_GLUT_OBJ := $(MUVIEW_GLUT_SRC:%.c=$(OUT)/%.o) + MUVIEW_GLUT_EXE := $(OUT)/mupdf-gl + $(MUVIEW_GLUT_EXE) : $(MUVIEW_GLUT_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(THIRD_GLUT_LIB) $(PKCS7_LIB) +- $(LINK_CMD) $(THIRD_LIBS) $(LIBCRYPTO_LIBS) $(THIRD_GLUT_LIBS) ++ $(LINK_CMD) $(THIRD_LINK_LIBS) $(LIBCRYPTO_LIBS) $(THIRD_GLUT_LIBS) + VIEW_APPS += $(MUVIEW_GLUT_EXE) + endif + +@@ -400,7 +406,7 @@ + MUVIEW_X11_OBJ += $(OUT)/platform/x11/x11_main.o + MUVIEW_X11_OBJ += $(OUT)/platform/x11/x11_image.o + $(MUVIEW_X11_EXE) : $(MUVIEW_X11_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(PKCS7_LIB) +- $(LINK_CMD) $(THIRD_LIBS) $(X11_LIBS) $(LIBCRYPTO_LIBS) ++ $(LINK_CMD) $(THIRD_LINK_LIBS) $(X11_LIBS) $(LIBCRYPTO_LIBS) + VIEW_APPS += $(MUVIEW_X11_EXE) + endif + +@@ -414,7 +420,7 @@ + MUVIEW_X11_CURL_OBJ += $(OUT)/platform/x11/curl/curl_stream.o + MUVIEW_X11_CURL_OBJ += $(OUT)/platform/x11/curl/prog_stream.o + $(MUVIEW_X11_CURL_EXE) : $(MUVIEW_X11_CURL_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(PKCS7_LIB) $(CURL_LIB) +- $(LINK_CMD) $(THIRD_LIBS) $(X11_LIBS) $(LIBCRYPTO_LIBS) $(CURL_LIBS) $(PTHREAD_LIBS) ++ $(LINK_CMD) $(THIRD_LINK_LIBS) $(X11_LIBS) $(LIBCRYPTO_LIBS) $(CURL_LIBS) $(PTHREAD_LIBS) + EXTRA_VIEW_APPS += $(MUVIEW_X11_CURL_EXE) + endif + endif +@@ -440,13 +446,13 @@ + examples: $(OUT)/example $(OUT)/multi-threaded $(OUT)/storytest $(OUT)/searchtest + + $(OUT)/example: docs/examples/example.c $(MUPDF_LIB) $(THIRD_LIB) +- $(LINK_CMD) $(CFLAGS) $(THIRD_LIBS) ++ $(LINK_CMD) $(CFLAGS) $(THIRD_LINK_LIBS) + $(OUT)/multi-threaded: docs/examples/multi-threaded.c $(MUPDF_LIB) $(THIRD_LIB) +- $(LINK_CMD) $(CFLAGS) $(THIRD_LIBS) -lpthread ++ $(LINK_CMD) $(CFLAGS) $(THIRD_LINK_LIBS) -lpthread + $(OUT)/storytest: docs/examples/storytest.c $(MUPDF_LIB) $(THIRD_LIB) +- $(LINK_CMD) $(CFLAGS) $(THIRD_LIBS) ++ $(LINK_CMD) $(CFLAGS) $(THIRD_LINK_LIBS) + $(OUT)/searchtest: docs/examples/searchtest.c $(MUPDF_LIB) $(THIRD_LIB) +- $(LINK_CMD) $(CFLAGS) $(THIRD_LIBS) ++ $(LINK_CMD) $(CFLAGS) $(THIRD_LINK_LIBS) + + # --- Format man pages --- + +@@ -523,13 +529,13 @@ + install: install-libs install-apps install-docs + + docs: +- bash scripts/build-docs.sh ++ sh scripts/build-docs.sh + + docs-live: +- bash scripts/build-docs-live.sh ++ sh scripts/build-docs-live.sh + + docs-markdown: +- bash scripts/build-docs-markdown.sh ++ sh scripts/build-docs-markdown.sh + + docs-clean: + rm -rf build/docs +@@ -541,7 +547,7 @@ + cp -r build/docs/* $(DESTDIR)$(docdir) + + tarball: +- bash scripts/archive.sh ++ sh scripts/archive.sh + + # --- Clean and Default --- + +@@ -577,7 +583,7 @@ + $(TAGS_CMD) -a --sort=no --c-kinds=t $(TAG_SRC_FILES) $(TAG_HDR_FILES) + + find-try-return: +- @ bash scripts/find-try-return.sh ++ @ sh scripts/find-try-return.sh + + cscope.files: $(shell find include source platform -name '*.[ch]') + @ echo $^ | tr ' ' '\n' > $@ +--- a/Makerules ++++ b/Makerules +@@ -207,6 +207,7 @@ + SYS_LEPTONICA_LIBS := -llept + SYS_LIBARCHIVE_LIBS := -larchive + SYS_ZXINGCPP_LIBS := -lzxing-cpp -lzint ++CXX_LINKER_FLAG := --mupdf-cxx-linker + + ifneq "$(CLUSTER)" "" + CFLAGS += -DCLUSTER +@@ -217,6 +218,7 @@ + SYS_GLUT_CFLAGS := -Wno-deprecated-declarations + SYS_GLUT_LIBS := -framework GLUT -framework OpenGL + CC = xcrun cc ++ CXX = xcrun c++ + AR = xcrun ar + LD = xcrun ld + RANLIB = xcrun ranlib +@@ -236,8 +238,15 @@ + + else + ++ LD_SUPPORTS_BINARY_OBJECTS := $(shell tmp=$$(mktemp -d 2>/dev/null || mktemp -d -t mupdf); \ ++ trap 'rm -rf "$$tmp"' EXIT HUP INT TERM; \ ++ : > "$$tmp/empty"; \ ++ if $(LD) -r -b binary -z noexecstack -o "$$tmp/empty.o" "$$tmp/empty" >/dev/null 2>&1; then \ ++ echo yes; \ ++ fi) ++ + ifeq ($(OS),Linux) +- HAVE_OBJCOPY := yes ++ HAVE_OBJCOPY := $(LD_SUPPORTS_BINARY_OBJECTS) + endif + + ifeq ($(OS),OpenBSD) +--- a/Makelists ++++ b/Makelists +@@ -612,7 +612,7 @@ + TESSERACT_BUILD_CFLAGS += $(LEPTONICA_CFLAGS) + + TESSERACT_LIBS += -lpthread +-TESSERACT_LIBS += -lstdc++ ++TESSERACT_LIBS += $(CXX_LINKER_FLAG) + + TESSERACT_SRC += thirdparty/tesseract/src/api/altorenderer.cpp + TESSERACT_SRC += thirdparty/tesseract/src/api/baseapi.cpp +@@ -817,7 +817,7 @@ + ZXINGCPP_BUILD_CFLAGS += -Ithirdparty/zint/backend + ZXINGCPP_BUILD_CFLAGS += -Iscripts/zxing-cpp + +-ZXINGCPP_LIBS += -lstdc++ ++ZXINGCPP_LIBS += $(CXX_LINKER_FLAG) + + ZXINGCPP_SRC += thirdparty/zxing-cpp/core/src/aztec/AZDecoder.cpp + ZXINGCPP_SRC += thirdparty/zxing-cpp/core/src/aztec/AZDetector.cpp +--- a/Makethird ++++ b/Makethird +@@ -141,6 +141,7 @@ + THIRD_CFLAGS += $(SYS_HARFBUZZ_CFLAGS) + THIRD_LIBS += $(SYS_HARFBUZZ_LIBS) + else ++ THIRD_NEEDS_CXX_LINKER := yes + THIRD_CFLAGS += $(HARFBUZZ_CFLAGS) + THIRD_LIBS += $(HARFBUZZ_LIBS) + THIRD_SRC += $(HARFBUZZ_SRC) +@@ -287,8 +288,9 @@ + + ifeq ($(HAVE_TESSERACT),yes) + THIRD_CFLAGS += -DHAVE_TESSERACT ++ THIRD_NEEDS_CXX_LINKER := yes + ifeq ($(USE_SYSTEM_TESSERACT),yes) +- THIRD_LIBS += $(SYS_TESSERACT_LIBS) -lstdc++ ++ THIRD_LIBS += $(SYS_TESSERACT_LIBS) $(CXX_LINKER_FLAG) + TESSERACT_CFLAGS = $(SYS_TESSERACT_CFLAGS) + TESSERACT_LANGFLAGS = + else +@@ -303,8 +305,9 @@ + + ifeq ($(HAVE_ZXINGCPP),yes) + THIRD_CFLAGS += -DHAVE_ZXINGCPP ++ THIRD_NEEDS_CXX_LINKER := yes + ifeq ($(USE_SYSTEM_ZXINGCPP),yes) +- THIRD_LIBS += $(SYS_ZXINGCPP_LIBS) -lstdc++ ++ THIRD_LIBS += $(SYS_ZXINGCPP_LIBS) $(CXX_LINKER_FLAG) + ZXINGCPP_CFLAGS = $(SYS_ZXINGCPP_CFLAGS) -DUSE_SYSTEM_ZXINGCPP + ZXINGCPP_LANGFLAGS = + else +@@ -373,7 +376,8 @@ + ifeq ($(HAVE_LIBARCHIVE),yes) + THIRD_CFLAGS += -DHAVE_LIBARCHIVE + THIRD_CFLAGS += $(SYS_LIBARCHIVE_CFLAGS) +- THIRD_LIBS += $(SYS_LIBARCHIVE_LIBS) -lstdc++ ++ THIRD_LIBS += $(SYS_LIBARCHIVE_LIBS) $(CXX_LINKER_FLAG) ++ THIRD_NEEDS_CXX_LINKER := yes + endif + + # --- HAVE_SMARTOFFICE --- +--- a/platform/java/Makefile ++++ b/platform/java/Makefile +@@ -6,6 +6,7 @@ + + JAVA := java + JAVAC := javac ++JAVA_LINK = $(CXX) + + ifndef build + build := release +@@ -25,12 +26,14 @@ + endif + + ifeq ($(OS),Darwin) ++CC = xcrun cc ++CXX = xcrun c++ + MUPDF_JAVA := ../../$(OUT)/libmupdf_java64.jnilib + JAVA_VM := $(shell /usr/libexec/java_home) + JAVA_CFLAGS := \ + -I $(JAVA_VM)/include \ + -I $(JAVA_VM)/include/darwin +-JAVA_LDFLAGS := -lstdc++ ++JAVA_LDFLAGS := + + else + +@@ -108,7 +111,7 @@ + $(JAVA_CFLAGS) $(BUILD_FLAGS) + + $(MUPDF_JAVA) : ../../$(OUT)/mupdf_native.o $(MUPDF_CORE) +- $(CC) -shared $(JAVA_LDFLAGS) -o $(MUPDF_JAVA) $^ $(JAVA_LIBS) $(BUILD_FLAGS) ++ $(JAVA_LINK) -shared $(JAVA_LDFLAGS) -o $(MUPDF_JAVA) $^ $(JAVA_LIBS) $(BUILD_FLAGS) + + jshell: $(MUPDF_JAVA) $(EXAMPLE_JAVA_OBJECTS) $(MUPDF_JAR) + jshell --class-path ../../$(OUT)/ -R-Djava.library.path="../../$(OUT)" init.jshell $$MUPDF_ARGS +--- a/platform/wasm/Makefile ++++ b/platform/wasm/Makefile +@@ -1,10 +1,10 @@ + default: + @npm install -s +- bash tools/build.sh ++ sh tools/build.sh + + memento: + BUILD=memento \ +- bash tools/build.sh ++ sh tools/build.sh + + clean: + rm -f LICENSE +--- a/platform/wasm/package.json ++++ b/platform/wasm/package.json +@@ -24,7 +24,7 @@ + "dist/*" + ], + "scripts": { +- "prepack": "bash tools/build.sh && bash tools/compress.sh", ++ "prepack": "sh tools/build.sh && sh tools/compress.sh", + "simple-viewer": "npx http-server -c -1 -b -o examples/simple-viewer", + "super-simple-viewer": "npx http-server -c -1 -b -o examples/super-simple-viewer" + }, +--- a/platform/wasm/tools/build.sh ++++ b/platform/wasm/tools/build.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # Script to build the WASM binary. + # +@@ -23,7 +23,7 @@ + fi + + export EMSDK_QUIET=1 +-source $EMSDK/emsdk_env.sh ++. "$EMSDK/emsdk_env.sh" + + emsdk install 4.0.8 >/dev/null || exit + emsdk activate 4.0.8 >/dev/null || exit +--- a/platform/wasm/tools/compress.sh ++++ b/platform/wasm/tools/compress.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + echo BROTLI + test -f dist/mupdf.js.br || brotli dist/mupdf.js +--- a/resources/fonts/sil/tocff.sh ++++ b/resources/fonts/sil/tocff.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # python3 scripts/makesubset.py -lig scripts/MES-2.TXT > resources/fonts/sil/subset.mes + # python3 scripts/makesubset.py -sc -lig scripts/MES-2.TXT > resources/fonts/sil/subset.mes.sc +--- a/resources/fonts/urw/tocff.sh ++++ b/resources/fonts/urw/tocff.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # python3 scripts/makesubset.py -lig scripts/MES-2.TXT > resources/fonts/urw/subset.mes + # python3 scripts/makesubset.py -lig scripts/SECS.TXT > resources/fonts/urw/subset.secs +--- a/scripts/archive.sh ++++ b/scripts/archive.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + REV=$(git describe --tags) + STEM=mupdf-$REV-source +@@ -7,7 +7,7 @@ + echo git archive $STEM.tar + git archive --format=tar --prefix=$STEM/ -o $STEM.tar HEAD + +-function make_submodule_archive { ++make_submodule_archive() { + # Make tarballs for submodules, stripped of unnecessary files. + M=$1 + shift +--- a/scripts/build-docs-live.sh ++++ b/scripts/build-docs-live.sh +@@ -1,8 +1,8 @@ +-#!/bin/bash ++#!/bin/sh + # Set up a 'venv' and run sphinx to build the docs! + + python -m venv build/venv-docs +-source build/venv-docs/bin/activate ++. build/venv-docs/bin/activate + + pip install -r docs/requirements.txt + +--- a/scripts/build-docs-markdown.sh ++++ b/scripts/build-docs-markdown.sh +@@ -1,8 +1,8 @@ +-#!/bin/bash ++#!/bin/sh + # Set up a 'venv' and run sphinx to build the docs! + + python -m venv build/venv-docs +-source build/venv-docs/bin/activate ++. build/venv-docs/bin/activate + + pip install -r docs/requirements.txt + +--- a/scripts/build-docs.sh ++++ b/scripts/build-docs.sh +@@ -1,8 +1,8 @@ +-#!/bin/bash ++#!/bin/sh + # Set up a 'venv' and run sphinx to build the docs! + + python -m venv build/venv-docs +-source build/venv-docs/bin/activate ++. build/venv-docs/bin/activate + + pip install -r docs/requirements.txt + +--- a/scripts/copyblob.sh ++++ b/scripts/copyblob.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + cat > copyblob.txt <&1 | grep 'libmupdf\.' | sort > build/debug/mutool.gc +--- a/scripts/githooks/pre-commit ++++ b/scripts/githooks/pre-commit +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # pre-commit hook to fix whitespace errors + # +--- a/scripts/gitsetup.sh ++++ b/scripts/gitsetup.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # Tell git to fix whitespace errors automatically + git config apply.whitespace fix +--- a/scripts/hexdump.sh ++++ b/scripts/hexdump.sh +@@ -1,9 +1,9 @@ +-#!/bin/bash ++#!/bin/sh + + FILE=$1 + if [ ! -f "$FILE" ] + then +- echo usage: bash scripts/hexdump.sh input.ttf ++ echo usage: sh scripts/hexdump.sh input.ttf + exit 1 + fi + +--- a/scripts/jshell.sh ++++ b/scripts/jshell.sh +@@ -1,3 +1,3 @@ +-#!/bin/bash ++#!/bin/sh + make -s -C platform/java + jshell -q --class-path build/java/debug -R-Djava.library.path="build/java/debug" platform/java/init.jshell "$@" +--- a/scripts/pdftohtml.sh ++++ b/scripts/pdftohtml.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # Convert PDF to hybrid HTML output with images and line art rendered to a + # background image, and text overlaid on top as absolutely positioned HTML +--- a/scripts/runcmapdump.sh ++++ b/scripts/runcmapdump.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + LIST=$(echo resources/cmaps/* | sort) + +--- a/scripts/runcmapshare.sh ++++ b/scripts/runcmapshare.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # This script expects to find the original CMap resources in thirdparty/cmap-resources. + # +@@ -6,7 +6,7 @@ + rm -f build/cmaps/* + mkdir -p build/cmaps + +-function flatten { ++flatten() { + for DIR in $(echo thirdparty/cmap-resources/Adobe-*) + do + if [ -f $DIR/CMap/$1 ] +--- a/scripts/runfontdump.sh ++++ b/scripts/runfontdump.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Generate fontdump resources and update visual studio project files. + + FONTS="resources/fonts/urw/*.cff resources/fonts/han/*.ttc resources/fonts/droid/*.ttf resources/fonts/noto/*.ttf resources/fonts/noto/*.otf resources/fonts/sil/*.cff" +--- a/scripts/runhyphen.sh ++++ b/scripts/runhyphen.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # Generate hyphenation data zip archive. + # +@@ -14,5 +14,5 @@ + advzip -4 -z resources/hyphen/hyph-std.zip + advzip -4 -z resources/hyphen/hyph-all.zip + +-bash scripts/hexdump.sh > generated/resources/hyphen/hyph-std.zip.c resources/hyphen/hyph-std.zip +-bash scripts/hexdump.sh > generated/resources/hyphen/hyph-all.zip.c resources/hyphen/hyph-all.zip ++sh scripts/hexdump.sh > generated/resources/hyphen/hyph-std.zip.c resources/hyphen/hyph-std.zip ++sh scripts/hexdump.sh > generated/resources/hyphen/hyph-all.zip.c resources/hyphen/hyph-all.zip +--- a/scripts/runiccdump.sh ++++ b/scripts/runiccdump.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + rm -f source/fitz/icc/*.h + for f in resources/icc/*.icc + do +--- a/scripts/runjsdump.sh ++++ b/scripts/runjsdump.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + for f in source/pdf/js/*.js + do + echo Dumping $f diff --git a/net-tools/net-tools-2.10-posixify-configure.patch b/net-tools/net-tools-2.10-posixify-configure.patch new file mode 100644 index 0000000..f4333cd --- /dev/null +++ b/net-tools/net-tools-2.10-posixify-configure.patch @@ -0,0 +1,202 @@ +--- a/configure.sh ++++ b/configure.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + # + # configure.sh Generates interactively a config.h from config.in + # +@@ -25,20 +25,9 @@ + # Foundation; either version 2 of the License, or (at + # your option) any later version. + # +-# +-# Make sure we're really running bash. +-# +-# I would really have preferred to write this script in a language with +-# better string handling, but alas, bash is the only scripting language +-# that I can be reasonable sure everybody has on their Linux machine. +-# +- + CONFIG=config.h + MAKECONFIG=config.make + +- +-[ -z "$BASH" ] && { echo "configure.sh requires bash" 1>&2; exit 1; } +- + cat <&2 + exit 1 + fi +-exec 7<$1 +-config_fd_redir='<&7' ++exec 7<"$1" + + # + # readln reads a line into $ans. + # + # readln prompt default + # +-function readln() ++readln() + { +- echo -n "$1" +- IFS='@' read ans || exit 1 ++ printf '%s' "$1" ++ IFS='@' read -r ans || exit 1 + [ -z "$ans" ] && ans=$2 + } + +@@ -75,21 +62,21 @@ + # + # bool tail + # +-function bool() ++bool() + { +- # Slimier hack to get bash to rescan a line. ++ # Re-scan the line so shell quoting from config.in is preserved. + eval "set -- $1" + ans="" +- while [ "$ans" != "y" -a "$ans" != "n" ] ++ while [ "$ans" != "y" ] && [ "$ans" != "n" ] + do + readln "$1 ($2) [$3] " "$3" + done + if [ "$ans" = "y" ]; then +- echo "#define $2 1" >>${CONFIG} +- echo "$2=1" >>${MAKECONFIG} ++ echo "#define $2 1" >>"${CONFIG}" ++ echo "$2=1" >>"${MAKECONFIG}" + else +- echo "#define $2 0" >>${CONFIG} +- echo "# $2=0" >> ${MAKECONFIG} ++ echo "#define $2 0" >>"${CONFIG}" ++ echo "# $2=0" >>"${MAKECONFIG}" + fi + raw_input_line="bool '$1' $2 $ans" + eval "$2=$ans" +@@ -99,16 +86,42 @@ + # + # int tail + # +-function int() ++is_integer() + { +- # Slimier hack to get bash to rescan a line. ++ case $1 in ++ ''|*[!0123456789+-]*|*[-+]*[-+]*) ++ return 1 ++ ;; ++ [+-]) ++ return 1 ++ ;; ++ esac ++ ++ case $1 in ++ [+-]*) ++ set -- "${1#?}" ++ ;; ++ esac ++ ++ case $1 in ++ ''|*[!0123456789]*) ++ return 1 ++ ;; ++ esac ++ ++ return 0 ++} ++ ++int() ++{ ++ # Re-scan the line so shell quoting from config.in is preserved. + eval "set -- $1" + ans="x" +- while [ $[$ans+0] != "$ans" ]; ++ while ! is_integer "$ans" + do + readln "$1 ($2) [$3] " "$3" + done +- echo "#define $2 ($ans)" >>${CONFIG} ++ echo "#define $2 ($ans)" >>"${CONFIG}" + raw_input_line="int '$1' $2 $ans" + eval "$2=$ans" + } +@@ -123,10 +136,10 @@ + stack='' + branch='t' + +- while IFS='@' eval read raw_input_line ${config_fd_redir} ++ while IFS='@' read -r raw_input_line <&7 + do +- # Slimy hack to get bash to rescan a line. +- read cmd rest <<-END_OF_COMMAND ++ # Re-scan the line so shell quoting from config.in is preserved. ++ IFS=' ' read -r cmd rest <<-END_OF_COMMAND + $raw_input_line + END_OF_COMMAND + +@@ -135,18 +148,18 @@ + echo "$raw_input_line" + # echo "# $rest" >>$CONFIG + if [ "$prevcmd" != "*" ]; then +- echo >>${CONFIG} +- echo "/* $rest" >>${CONFIG} ++ echo >>"${CONFIG}" ++ echo "/* $rest" >>"${CONFIG}" + else +- echo " * $rest" >>${CONFIG} ++ echo " * $rest" >>"${CONFIG}" + fi + prevcmd="*" + fi + else +- [ "$prevcmd" = "*" ] && echo " */" >>${CONFIG} ++ [ "$prevcmd" = "*" ] && echo " */" >>"${CONFIG}" + prevcmd="" + case "$cmd" in +- =) [ "$branch" = "t" ] && echo "$rest" >>${CONFIG};; ++ =) [ "$branch" = "t" ] && echo "$rest" >>"${CONFIG}";; + :) [ "$branch" = "t" ] && echo "$raw_input_line" ;; + int) [ "$branch" = "t" ] && int "$rest" ;; + bool) [ "$branch" = "t" ] && bool "$rest" ;; +@@ -160,12 +173,12 @@ + else) if [ "$branch" = "t" ]; then + branch=f + else +- read branch rest <<-END_OF_STACK +- $stack +- END_OF_STACK +- fi ;; ++ IFS=' ' read -r branch rest <<-END_OF_STACK ++ $stack ++ END_OF_STACK ++ fi ;; + fi) [ -z "$stack" ] && echo "Error! Extra fi." 1>&2 +- read branch stack <<-END_OF_STACK ++ IFS=' ' read -r branch stack <<-END_OF_STACK + $stack + END_OF_STACK + ;; +@@ -173,7 +186,7 @@ + fi + echo "$raw_input_line" >>config.new + done +- [ "$prevcmd" = "*" ] && echo " */" >>${CONFIG} ++ [ "$prevcmd" = "*" ] && echo " */" >>"${CONFIG}" + + [ -z "$stack" ] || echo "Error! Unterminated if." 1>&2 + diff --git a/nodejs/node-v25.8.1-libcxx-fmt-malloc.patch b/nodejs/node-v25.8.1-libcxx-fmt-malloc.patch new file mode 100644 index 0000000..7f0ee45 --- /dev/null +++ b/nodejs/node-v25.8.1-libcxx-fmt-malloc.patch @@ -0,0 +1,27 @@ +diff --git a/deps/LIEF/third-party/spdlog/include/spdlog/fmt/bundled/format.h b/deps/LIEF/third-party/spdlog/include/spdlog/fmt/bundled/format.h +index 50e5714..36268ce 100644 +--- a/deps/LIEF/third-party/spdlog/include/spdlog/fmt/bundled/format.h ++++ b/deps/LIEF/third-party/spdlog/include/spdlog/fmt/bundled/format.h +@@ -42,6 +42,7 @@ + + #ifndef FMT_MODULE + # include // std::signbit ++# include // std::malloc, std::free + # include // std::byte + # include // uint32_t + # include // std::memcpy +@@ -744,12 +745,12 @@ template struct allocator { + + T* allocate(size_t n) { + FMT_ASSERT(n <= max_value() / sizeof(T), ""); +- T* p = static_cast(malloc(n * sizeof(T))); ++ T* p = static_cast(std::malloc(n * sizeof(T))); + if (!p) FMT_THROW(std::bad_alloc()); + return p; + } + +- void deallocate(T* p, size_t) { free(p); } ++ void deallocate(T* p, size_t) { std::free(p); } + }; + + } // namespace detail diff --git a/nodejs/node-v25.8.1-posixify.patch b/nodejs/node-v25.8.1-posixify.patch new file mode 100644 index 0000000..4e05d9b --- /dev/null +++ b/nodejs/node-v25.8.1-posixify.patch @@ -0,0 +1,1630 @@ +diff --git a/deps/crates/vendor/autocfg/tests/wrap_ignored b/deps/crates/vendor/autocfg/tests/wrap_ignored +index 5e577d0..b3b464c 100755 +--- a/deps/crates/vendor/autocfg/tests/wrap_ignored ++++ b/deps/crates/vendor/autocfg/tests/wrap_ignored +@@ -1,11 +1,11 @@ +-#!/bin/bash ++#!/bin/sh + + for arg in "$@"; do + case "$arg" in + # Add our own version so we can check that the wrapper is used for that. + "--version") echo "release: 12345.6789.0" ;; + # Read all input so the writer doesn't get EPIPE when we exit. +- "-") read -d "" PROBE ;; ++ "-") cat >/dev/null ;; + esac + done + +diff --git a/deps/crates/vendor/displaydoc/update-readme.sh b/deps/crates/vendor/displaydoc/update-readme.sh +index f67bfd5..4976870 100755 +--- a/deps/crates/vendor/displaydoc/update-readme.sh ++++ b/deps/crates/vendor/displaydoc/update-readme.sh +@@ -1,4 +1,4 @@ +-#! /usr/bin/env bash ++#!/bin/sh + + cargo readme > ./README.md + git add ./README.md +diff --git a/deps/crates/vendor/smallvec/scripts/run_miri.sh b/deps/crates/vendor/smallvec/scripts/run_miri.sh +index 010ceb0..ecb410d 100644 +--- a/deps/crates/vendor/smallvec/scripts/run_miri.sh ++++ b/deps/crates/vendor/smallvec/scripts/run_miri.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/bash ++#!/bin/sh + + set -ex + +diff --git a/deps/nbytes/tools/run-clang-format.sh b/deps/nbytes/tools/run-clang-format.sh +index ce1a664..d6febe9 100755 +--- a/deps/nbytes/tools/run-clang-format.sh ++++ b/deps/nbytes/tools/run-clang-format.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + # Copyright 2023 Yagiz Nizipli and Daniel Lemire + +@@ -20,23 +20,23 @@ + # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + set -e +-COMMAND=$* +-SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" +-MAINSOURCE=$SCRIPTPATH/.. +-ALL_FILES=$(cd $MAINSOURCE && git ls-tree --full-tree --name-only -r HEAD | grep -e ".*\.\(c\|h\|cc\|cpp\|hh\)\$") ++SCRIPTPATH="$(cd "$(dirname "$0")" && pwd -P)" ++MAINSOURCE="$SCRIPTPATH/.." ++ALL_FILES=$(cd "$MAINSOURCE" && git ls-tree --full-tree --name-only -r HEAD | grep -e '.*\.\(c\|h\|cc\|cpp\|hh\)$') + +-if clang-format-17 --version 2>/dev/null | grep -qF 'version 17.'; then +- cd $MAINSOURCE; clang-format-17 --style=file --verbose -i "$@" $ALL_FILES ++if clang-format-17 --version 2>/dev/null | grep -qF 'version 17.'; then ++ cd "$MAINSOURCE" && clang-format-17 --style=file --verbose -i "$@" $ALL_FILES + exit 0 +-elif clang-format --version 2>/dev/null | grep -qF 'version 17.'; then +- cd $MAINSOURCE; clang-format --style=file --verbose -i "$@" $ALL_FILES ++elif clang-format --version 2>/dev/null | grep -qF 'version 17.'; then ++ cd "$MAINSOURCE" && clang-format --style=file --verbose -i "$@" $ALL_FILES + exit 0 + fi + echo "Trying to use docker" + command -v docker >/dev/null 2>&1 || { echo >&2 "Please install docker. E.g., go to https://www.docker.com/products/docker-desktop Type 'docker' to diagnose the problem."; exit 1; } + docker info >/dev/null 2>&1 || { echo >&2 "Docker server is not running? type 'docker info'."; exit 1; } + +-if [ -t 0 ]; then DOCKER_ARGS=-it; fi ++DOCKER_ARGS= ++if [ -t 0 ]; then DOCKER_ARGS='-it'; fi + docker pull kszonek/clang-format-17 + +-docker run --rm $DOCKER_ARGS -v "$MAINSOURCE":"$MAINSOURCE":Z -w "$MAINSOURCE" -u "$(id -u $USER):$(id -g $USER)" kszonek/clang-format-17 --style=file --verbose -i "$@" $ALL_FILES ++docker run --rm $DOCKER_ARGS -v "$MAINSOURCE":"$MAINSOURCE":Z -w "$MAINSOURCE" -u "$(id -u):$(id -g)" kszonek/clang-format-17 --style=file --verbose -i "$@" $ALL_FILES +diff --git a/deps/ngtcp2/ngtcp2/third-party/urlparse/.clusterfuzzlite/build.sh b/deps/ngtcp2/ngtcp2/third-party/urlparse/.clusterfuzzlite/build.sh +index 6f33867..45bd322 100755 +--- a/deps/ngtcp2/ngtcp2/third-party/urlparse/.clusterfuzzlite/build.sh ++++ b/deps/ngtcp2/ngtcp2/third-party/urlparse/.clusterfuzzlite/build.sh +@@ -1,4 +1,6 @@ +-#!/bin/bash -eu ++#!/bin/sh ++ ++set -eu + + autoreconf -i + ./configure --disable-dependency-tracking +diff --git a/deps/npm/bin/npm b/deps/npm/bin/npm +index 027dc9d..faf28ff 100755 +--- a/deps/npm/bin/npm ++++ b/deps/npm/bin/npm +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + # This is used by the Node.js installer, which expects the cygwin/mingw + # shell script to already be present in the npm dependency folder. +@@ -11,11 +11,11 @@ case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; + esac + +-if [ `uname` = 'Linux' ] && type wslpath &>/dev/null ; then ++if [ "$(uname)" = 'Linux' ] && command -v wslpath >/dev/null 2>&1 ; then + IS_WSL="true" + fi + +-function no_node_dir { ++no_node_dir() { + # if this didn't work, then everything else below will fail + echo "Could not determine Node.js install directory" >&2 + exit 1 +@@ -36,14 +36,14 @@ if [ $? -ne 0 ]; then + # this fails under WSL 1 so add an additional message. we also suppress stderr above + # because the actual error raised is not helpful. in WSL 1 node.exe cannot handle + # output redirection properly. See https://github.com/microsoft/WSL/issues/2370 +- if [ "$IS_WSL" == "true" ]; then ++ if [ "$IS_WSL" = "true" ]; then + echo "WSL 1 is not supported. Please upgrade to WSL 2 or above." >&2 + fi + no_node_dir + fi + NPM_PREFIX_JS="$CLI_BASEDIR/node_modules/npm/bin/npm-prefix.js" + NPM_CLI_JS="$CLI_BASEDIR/node_modules/npm/bin/npm-cli.js" +-NPM_PREFIX=`"$NODE_EXE" "$NPM_PREFIX_JS"` ++NPM_PREFIX=$("$NODE_EXE" "$NPM_PREFIX_JS") + if [ $? -ne 0 ]; then + no_node_dir + fi +@@ -55,8 +55,8 @@ NPM_WSL_PATH="/.." + # WSL can run Windows binaries, so we have to give it the win32 path + # however, WSL bash tests against posix paths, so we need to construct that + # to know if npm is installed globally. +-if [ "$IS_WSL" == "true" ]; then +- NPM_WSL_PATH=`wslpath "$NPM_PREFIX_NPM_CLI_JS"` ++if [ "$IS_WSL" = "true" ]; then ++ NPM_WSL_PATH=$(wslpath "$NPM_PREFIX_NPM_CLI_JS") + fi + if [ -f "$NPM_PREFIX_NPM_CLI_JS" ] || [ -f "$NPM_WSL_PATH" ]; then + NPM_CLI_JS="$NPM_PREFIX_NPM_CLI_JS" +diff --git a/deps/npm/bin/npx b/deps/npm/bin/npx +index b8619ee..4d00bda 100755 +--- a/deps/npm/bin/npx ++++ b/deps/npm/bin/npx +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + # This is used by the Node.js installer, which expects the cygwin/mingw + # shell script to already be present in the npm dependency folder. +@@ -11,11 +11,11 @@ case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; + esac + +-if [ `uname` = 'Linux' ] && type wslpath &>/dev/null ; then ++if [ "$(uname)" = 'Linux' ] && command -v wslpath >/dev/null 2>&1 ; then + IS_WSL="true" + fi + +-function no_node_dir { ++no_node_dir() { + # if this didn't work, then everything else below will fail + echo "Could not determine Node.js install directory" >&2 + exit 1 +@@ -36,14 +36,14 @@ if [ $? -ne 0 ]; then + # this fails under WSL 1 so add an additional message. we also suppress stderr above + # because the actual error raised is not helpful. in WSL 1 node.exe cannot handle + # output redirection properly. See https://github.com/microsoft/WSL/issues/2370 +- if [ "$IS_WSL" == "true" ]; then ++ if [ "$IS_WSL" = "true" ]; then + echo "WSL 1 is not supported. Please upgrade to WSL 2 or above." >&2 + fi + no_node_dir + fi + NPM_PREFIX_JS="$CLI_BASEDIR/node_modules/npm/bin/npm-prefix.js" + NPX_CLI_JS="$CLI_BASEDIR/node_modules/npm/bin/npx-cli.js" +-NPM_PREFIX=`"$NODE_EXE" "$NPM_PREFIX_JS"` ++NPM_PREFIX=$("$NODE_EXE" "$NPM_PREFIX_JS") + if [ $? -ne 0 ]; then + no_node_dir + fi +@@ -55,8 +55,8 @@ NPX_WSL_PATH="/.." + # WSL can run Windows binaries, so we have to give it the win32 path + # however, WSL bash tests against posix paths, so we need to construct that + # to know if npm is installed globally. +-if [ "$IS_WSL" == "true" ]; then +- NPX_WSL_PATH=`wslpath "$NPM_PREFIX_NPX_CLI_JS"` ++if [ "$IS_WSL" = "true" ]; then ++ NPX_WSL_PATH=$(wslpath "$NPM_PREFIX_NPX_CLI_JS") + fi + if [ -f "$NPM_PREFIX_NPX_CLI_JS" ] || [ -f "$NPX_WSL_PATH" ]; then + NPX_CLI_JS="$NPM_PREFIX_NPX_CLI_JS" +diff --git a/deps/npm/docs/content/commands/npm-root.md b/deps/npm/docs/content/commands/npm-root.md +index 8f4825b..97abfb3 100644 +--- a/deps/npm/docs/content/commands/npm-root.md ++++ b/deps/npm/docs/content/commands/npm-root.md +@@ -20,7 +20,7 @@ Useful for using npm in shell scripts that do things with the `node_modules` fol + For example: + + ```bash +-#!/bin/bash ++#!/bin/sh + global_node_modules="$(npm root --global)" + echo "Global packages installed in: ${global_node_modules}" + ``` +diff --git a/deps/npm/lib/utils/completion.sh b/deps/npm/lib/utils/completion.sh +index a3e5143..99c79ee 100755 +--- a/deps/npm/lib/utils/completion.sh ++++ b/deps/npm/lib/utils/completion.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + ###-begin-npm-completion-### + # + # npm command completion script +diff --git a/deps/npm/man/man1/npm-root.1 b/deps/npm/man/man1/npm-root.1 +index 537d4c3..781bed9 100644 +--- a/deps/npm/man/man1/npm-root.1 ++++ b/deps/npm/man/man1/npm-root.1 +@@ -18,7 +18,7 @@ Useful for using npm in shell scripts that do things with the \fBnode_modules\fR + .P + .RS 2 + .nf +-#!/bin/bash ++#!/bin/sh + global_node_modules="$(npm root --global)" + echo "Global packages installed in: ${global_node_modules}" + .fi +diff --git a/deps/npm/node_modules/node-gyp/macOS_Catalina_acid_test.sh b/deps/npm/node_modules/node-gyp/macOS_Catalina_acid_test.sh +index e1e9894..fffd88a 100644 +--- a/deps/npm/node_modules/node-gyp/macOS_Catalina_acid_test.sh ++++ b/deps/npm/node_modules/node-gyp/macOS_Catalina_acid_test.sh +@@ -1,12 +1,10 @@ +-#!/bin/bash ++#!/bin/sh + +-pkgs=( +- "com.apple.pkg.DeveloperToolsCLILeo" # standalone +- "com.apple.pkg.DeveloperToolsCLI" # from XCode +- "com.apple.pkg.CLTools_Executables" # Mavericks +-) +- +-for pkg in "${pkgs[@]}"; do ++for pkg in \ ++ "com.apple.pkg.DeveloperToolsCLILeo" \ ++ "com.apple.pkg.DeveloperToolsCLI" \ ++ "com.apple.pkg.CLTools_Executables" ++do + output=$(/usr/sbin/pkgutil --pkg-info "$pkg" 2>/dev/null) + if [ "$output" ]; then + version=$(echo "$output" | grep 'version' | cut -d' ' -f2) +diff --git a/deps/openssl/openssl/crypto/chacha/asm/chacha-armv8-sve.pl b/deps/openssl/openssl/crypto/chacha/asm/chacha-armv8-sve.pl +index 62a8be6..bcef08b 100755 +--- a/deps/openssl/openssl/crypto/chacha/asm/chacha-armv8-sve.pl ++++ b/deps/openssl/openssl/crypto/chacha/asm/chacha-armv8-sve.pl +@@ -921,7 +921,7 @@ sub create_verifier { + my $filename="./compile_sve.sh"; + + $scripts = <<___; +-#! /bin/bash ++#! /bin/sh + set -e + CROSS_COMPILE=\${CROSS_COMPILE:-'aarch64-none-linux-gnu-'} + +diff --git a/deps/openssl/openssl/util/find-unused-errs b/deps/openssl/openssl/util/find-unused-errs +index 467ef25..691b9c0 100755 +--- a/deps/openssl/openssl/util/find-unused-errs ++++ b/deps/openssl/openssl/util/find-unused-errs +@@ -1,4 +1,4 @@ +-#! /bin/bash ++#!/bin/sh + # Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. + # + # Licensed under the Apache License 2.0 (the "License"). You may not use +@@ -33,22 +33,22 @@ case "$1" in + esac + + cd include/openssl || exit 1 +-grep "$PAT" * | grep -v ERR_FATAL_ERROR | awk '{print $3;}' | sort -u >$X1 ++grep "$PAT" * | grep -v ERR_FATAL_ERROR | awk '{print $3;}' | sort -u >"$X1" + cd ../.. + +-for F in `cat $X1` ; do +- git grep -l --full-name -F $F >$X2 +- NUM=`wc -l <$X2` +- test $NUM -gt 2 && continue +- if grep -q $F crypto/err/openssl.ec ; then ++while IFS= read -r F; do ++ git grep -l --full-name -F "$F" >"$X2" ++ NUM=$(wc -l <"$X2") ++ test "$NUM" -gt 2 && continue ++ if grep -q "$F" crypto/err/openssl.ec; then + echo Possibly unused $F found in openssl.ec + continue + fi +- echo $F +- for FILE in `cat $X2` ; do +- grep -v -w $F <$FILE >$FILE.new +- mv $FILE.new $FILE +- done +-done ++ echo "$F" ++ while IFS= read -r FILE; do ++ grep -v -w "$F" <"$FILE" >"$FILE.new" ++ mv "$FILE.new" "$FILE" ++ done <"$X2" ++done <"$X1" + +-rm $X1 $X2 ++rm "$X1" "$X2" +diff --git a/deps/v8/third_party/abseil-cpp/CMake/install_test_project/test.sh b/deps/v8/third_party/abseil-cpp/CMake/install_test_project/test.sh +index 962bc8d..1a70722 100755 +--- a/deps/v8/third_party/abseil-cpp/CMake/install_test_project/test.sh ++++ b/deps/v8/third_party/abseil-cpp/CMake/install_test_project/test.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # Copyright 2019 The Abseil Authors. + # +@@ -16,8 +16,8 @@ + # + # Unit and integration tests for Abseil LTS CMake installation + +-# Fail on any error. Treat unset variables an error. Print commands as executed. +-set -euox pipefail ++# Fail on any error. Treat unset variables as an error. Print commands as executed. ++set -eux + + absl_dir=/abseil-cpp + absl_build_dir=/buildfs +@@ -33,51 +33,54 @@ fi + + # Build and install GoogleTest + mkdir "${googletest_builddir}" +-pushd "${googletest_builddir}" +-curl -L "${ABSL_GOOGLETEST_DOWNLOAD_URL}" --output "${googletest_archive}" +-tar -xz -f "${googletest_archive}" +-pushd "googletest-${ABSL_GOOGLETEST_VERSION}" +-mkdir build +-pushd build +-cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS="${build_shared_libs}" .. +-make -j $(nproc) +-make install +-ldconfig +-popd +-popd +-popd ++( ++ cd "${googletest_builddir}" ++ curl -L "${ABSL_GOOGLETEST_DOWNLOAD_URL}" --output "${googletest_archive}" ++ tar -xz -f "${googletest_archive}" ++ cd "googletest-${ABSL_GOOGLETEST_VERSION}" ++ mkdir build ++ cd build ++ cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS="${build_shared_libs}" .. ++ make -j "$(nproc)" ++ make install ++ ldconfig ++) + + # Run the LTS transformations + ./create_lts.py 99998877 + + # Build and install Abseil +-pushd "${absl_build_dir}" +-cmake "${absl_dir}" \ +- -DABSL_USE_EXTERNAL_GOOGLETEST=ON \ +- -DABSL_FIND_GOOGLETEST=ON \ +- -DCMAKE_BUILD_TYPE=Release \ +- -DABSL_BUILD_TESTING=ON \ +- -DBUILD_SHARED_LIBS="${build_shared_libs}" +-make -j $(nproc) +-ctest -j $(nproc) --output-on-failure +-make install +-ldconfig +-popd ++( ++ cd "${absl_build_dir}" ++ cmake "${absl_dir}" \ ++ -DABSL_USE_EXTERNAL_GOOGLETEST=ON \ ++ -DABSL_FIND_GOOGLETEST=ON \ ++ -DCMAKE_BUILD_TYPE=Release \ ++ -DABSL_BUILD_TESTING=ON \ ++ -DBUILD_SHARED_LIBS="${build_shared_libs}" ++ make -j "$(nproc)" ++ ctest -j "$(nproc)" --output-on-failure ++ make install ++ ldconfig ++) + + # Test the project against the installed Abseil + mkdir -p "${project_build_dir}" +-pushd "${project_build_dir}" +-cmake "${project_dir}" +-cmake --build . --target simple +- +-output="$(${project_build_dir}/simple "printme" 2>&1)" +-if [[ "${output}" != *"Arg 1: printme"* ]]; then +- echo "Faulty output on simple project:" +- echo "${output}" +- exit 1 +-fi +- +-popd ++( ++ cd "${project_build_dir}" ++ cmake "${project_dir}" ++ cmake --build . --target simple ++ ++ output="$(${project_build_dir}/simple "printme" 2>&1)" ++ case "${output}" in ++ *"Arg 1: printme"*) ;; ++ *) ++ echo "Faulty output on simple project:" ++ echo "${output}" ++ exit 1 ++ ;; ++ esac ++) + + if ! grep absl::strings "/usr/local/lib/cmake/absl/abslTargets.cmake"; then + cat "/usr/local/lib/cmake/absl/abslTargets.cmake" +@@ -85,8 +88,9 @@ if ! grep absl::strings "/usr/local/lib/cmake/absl/abslTargets.cmake"; then + exit 1 + fi + +-pushd "${HOME}" +-cat > hello-abseil.cc << EOF ++( ++cd "${HOME}" ++cat > hello-abseil.cc <<'EOF' + #include + + #include "absl/strings/str_format.h" +@@ -98,16 +102,13 @@ int main(int argc, char **argv) { + EOF + + if [ "${LINK_TYPE:-}" != "DYNAMIC" ]; then +- pc_args=($(pkg-config --cflags --libs --static absl_str_format)) +- g++ -static -o hello-abseil hello-abseil.cc "${pc_args[@]}" ++ g++ -static -o hello-abseil hello-abseil.cc $(pkg-config --cflags --libs --static absl_str_format) + else +- pc_args=($(pkg-config --cflags --libs absl_str_format)) +- g++ -o hello-abseil hello-abseil.cc "${pc_args[@]}" ++ g++ -o hello-abseil hello-abseil.cc $(pkg-config --cflags --libs absl_str_format) + fi + hello="$(./hello-abseil)" +-[[ "${hello}" == "Hello Abseil!" ]] +- +-popd ++[ "${hello}" = "Hello Abseil!" ] ++) + + echo "Install test complete!" + exit 0 +diff --git a/deps/v8/third_party/markupsafe/get_markupsafe.sh b/deps/v8/third_party/markupsafe/get_markupsafe.sh +index d268832..5acd3d5 100755 +--- a/deps/v8/third_party/markupsafe/get_markupsafe.sh ++++ b/deps/v8/third_party/markupsafe/get_markupsafe.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Download and extract MarkupSafe + # Homepage: + # https://github.com/mitsuhiko/markupsafe +@@ -12,20 +12,19 @@ CHROMIUM_FILES="README.chromium OWNERS get_markupsafe.sh" + EXTRA_FILES='LICENSE AUTHORS' + REMOVE_FILES='tests.py' + +-SRC_URL='https://pypi.python.org/packages/source/' +-SRC_URL+="${PACKAGE:0:1}/$PACKAGE/$PACKAGE-$VERSION.tar.gz" ++SRC_URL="https://pypi.python.org/packages/source/${PACKAGE%${PACKAGE#?}}/$PACKAGE/$PACKAGE-$VERSION.tar.gz" + FILENAME="$(basename $SRC_URL)" + MD5_FILENAME="$FILENAME.md5" + SHA512_FILENAME="$FILENAME.sha512" +-CHROMIUM_FILES+=" $MD5_FILENAME $SHA512_FILENAME" ++CHROMIUM_FILES="$CHROMIUM_FILES $MD5_FILENAME $SHA512_FILENAME" + + BUILD_DIR="$PACKAGE-$VERSION" +-THIRD_PARTY="$(dirname $(realpath $(dirname "${BASH_SOURCE[0]}")))" ++THIRD_PARTY="$(dirname "$(realpath "$(dirname "$0")")")" + INSTALL_DIR="$THIRD_PARTY/$PACKAGE_DIR" + OUT_DIR="$INSTALL_DIR/$BUILD_DIR/$PACKAGE_DIR" + OLD_DIR="$THIRD_PARTY/$PACKAGE_DIR.old" + +-function check_hashes { ++check_hashes() { + # Hashes generated via: + # FILENAME=MarkupSafe-0.18.tar.gz + # md5sum "$FILENAME" > "$FILENAME.md5" +diff --git a/deps/v8/tools/android-sync.sh b/deps/v8/tools/android-sync.sh +index cbe68f2..25320f7 100755 +--- a/deps/v8/tools/android-sync.sh ++++ b/deps/v8/tools/android-sync.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Copyright 2012 the V8 project authors. All rights reserved. + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are +@@ -42,14 +42,14 @@ OUTDIR=$2 + HOST_V8=$3 + ANDROID_V8=$4 + +-function LINUX_MD5 { +- local HASH=$(md5sum $1) +- echo ${HASH%% *} ++LINUX_MD5() { ++ HASH=$(md5sum "$1") ++ echo "${HASH%% *}" + } + +-function DARWIN_MD5 { +- local HASH=$(md5 $1) +- echo ${HASH} | cut -f2 -d "=" | cut -f2 -d " " ++DARWIN_MD5() { ++ HASH=$(md5 "$1") ++ echo "$HASH" | cut -f2 -d "=" | cut -f2 -d " " + } + + host_os=$(uname -s) +@@ -61,37 +61,37 @@ case "${host_os}" in + MD5=DARWIN_MD5 + ;; + *) +- echo "$0: Host platform ${host_os} is not supported" >& 2 ++ echo "$0: Host platform ${host_os} is not supported" >&2 + exit 1 + esac + +-function sync_file { +- local FILE=$1 +- local ANDROID_HASH=$(adb shell "md5 \"$ANDROID_V8/$FILE\"") +- local HOST_HASH=$($MD5 "$HOST_V8/$FILE") ++sync_file() { ++ FILE=$1 ++ ANDROID_HASH=$(adb shell "md5 \"$ANDROID_V8/$FILE\"") ++ HOST_HASH=$($MD5 "$HOST_V8/$FILE") + if [ "${ANDROID_HASH%% *}" != "${HOST_HASH}" ]; then +- adb push "$HOST_V8/$FILE" "$ANDROID_V8/$FILE" &> /dev/null ++ adb push "$HOST_V8/$FILE" "$ANDROID_V8/$FILE" >/dev/null 2>&1 + fi +- echo -n "." ++ printf '.' + } + +-function sync_dir { +- local DIR=$1 +- echo -n "sync to $ANDROID_V8/$DIR" ++sync_dir() { ++ DIR=$1 ++ printf 'sync to %s' "$ANDROID_V8/$DIR" + for FILE in $(find "$HOST_V8/$DIR" -not -path "*.svn*" -type f); do +- local RELATIVE_FILE=${FILE:${#HOST_V8}} ++ RELATIVE_FILE=${FILE#"$HOST_V8"} + sync_file "$RELATIVE_FILE" + done + echo "" + } + +-echo -n "sync to $ANDROID_V8/$OUTDIR/$ARCH_MODE" ++printf 'sync to %s' "$ANDROID_V8/$OUTDIR/$ARCH_MODE" + sync_file "$OUTDIR/$ARCH_MODE/cctest" + sync_file "$OUTDIR/$ARCH_MODE/d8" + sync_file "$OUTDIR/$ARCH_MODE/snapshot_blob.bin" + sync_file "$OUTDIR/$ARCH_MODE/v8_unittests" + echo "" +-echo -n "sync to $ANDROID_V8/tools" ++printf 'sync to %s' "$ANDROID_V8/tools" + sync_file tools/arguments.mjs + sync_file tools/codemap.mjs + sync_file tools/consarray.mjs +diff --git a/deps/v8/tools/bash-completion.sh b/deps/v8/tools/bash-completion.sh +index ab6ea9b..521140f 100755 +--- a/deps/v8/tools/bash-completion.sh ++++ b/deps/v8/tools/bash-completion.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Copyright 2012 the V8 project authors. All rights reserved. + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are +diff --git a/deps/v8/tools/check-inline-includes.sh b/deps/v8/tools/check-inline-includes.sh +index 6def974..9604989 100755 +--- a/deps/v8/tools/check-inline-includes.sh ++++ b/deps/v8/tools/check-inline-includes.sh +@@ -1,9 +1,9 @@ +-#!/bin/bash ++#!/bin/sh + # Copyright 2015 the V8 project authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + +-v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../) ++v8_root=$(readlink -f "$(dirname "$0")/../") + directories="src test/cctest test/unittests" + + for directory in $directories; do +diff --git a/deps/v8/tools/check-static-initializers.sh b/deps/v8/tools/check-static-initializers.sh +index e59b5c8..2bebb2f 100755 +--- a/deps/v8/tools/check-static-initializers.sh ++++ b/deps/v8/tools/check-static-initializers.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Copyright 2012 the V8 project authors. All rights reserved. + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are +@@ -37,9 +37,9 @@ + # See https://crbug.com/1177324 for more. + expected_static_init_count=3 + +-v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../) ++v8_root=$(readlink -f "$(dirname "$0")/../") + +-if [ -n "$1" ] ; then ++if [ -n "${1:-}" ] ; then + d8="${v8_root}/$1" + else + d8="${v8_root}/d8" +diff --git a/deps/v8/tools/check-unused-bailouts.sh b/deps/v8/tools/check-unused-bailouts.sh +index 68c2c91..04ea32d 100755 +--- a/deps/v8/tools/check-unused-bailouts.sh ++++ b/deps/v8/tools/check-unused-bailouts.sh +@@ -1,9 +1,9 @@ +-#!/bin/bash ++#!/bin/sh + # Copyright 2015 the V8 project authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + +-v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../) ++v8_root=$(readlink -f "$(dirname "$0")/../") + bailouts=$( + grep \ + --only-matching \ +diff --git a/deps/v8/tools/check-unused-symbols.sh b/deps/v8/tools/check-unused-symbols.sh +index 0348938..cbb023c 100755 +--- a/deps/v8/tools/check-unused-symbols.sh ++++ b/deps/v8/tools/check-unused-symbols.sh +@@ -1,9 +1,9 @@ +-#!/bin/bash ++#!/bin/sh + # Copyright 2018 the V8 project authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + +-v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../) ++v8_root=$(readlink -f "$(dirname "$0")/../") + symbols=$( + grep \ + --only-matching \ +diff --git a/deps/v8/tools/clusterfuzz/js_fuzzer/gen_exceptions.sh b/deps/v8/tools/clusterfuzz/js_fuzzer/gen_exceptions.sh +index b2a90b8..32025d0 100755 +--- a/deps/v8/tools/clusterfuzz/js_fuzzer/gen_exceptions.sh ++++ b/deps/v8/tools/clusterfuzz/js_fuzzer/gen_exceptions.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Copyright 2020 the V8 project authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. +diff --git a/deps/v8/tools/clusterfuzz/js_fuzzer/package.sh b/deps/v8/tools/clusterfuzz/js_fuzzer/package.sh +index 6a40391..878cdd8 100755 +--- a/deps/v8/tools/clusterfuzz/js_fuzzer/package.sh ++++ b/deps/v8/tools/clusterfuzz/js_fuzzer/package.sh +@@ -1,32 +1,32 @@ +-#!/bin/bash ++#!/bin/sh + # Copyright 2020 the V8 project authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + +-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" ++DIR="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)" + + OS="linux" + OS_LABEL="Linux" + SUFFIX="" +-if [[ -n "$1" && $1 == "win" ]]; then ++if [ -n "${1:-}" ] && [ "$1" = "win" ]; then + OS="win" + OS_LABEL="Windows" + SUFFIX=".exe" +-elif [[ -n "$1" && $1 == "macos" ]]; then ++elif [ -n "${1:-}" ] && [ "$1" = "macos" ]; then + OS="macos" + OS_LABEL="MacOS" + fi + + echo "Building and packaging for $OS_LABEL..." +-(set -x; $DIR/node_modules/.bin/pkg -t node18-$OS-x64 $DIR) ++(set -x; "$DIR/node_modules/.bin/pkg" -t "node18-$OS-x64" "$DIR") + +-rm -rf $DIR/output > /dev/null 2>&1 || true +-rm $DIR/output.zip > /dev/null 2>&1 || true ++rm -rf "$DIR/output" >/dev/null 2>&1 || true ++rm -f "$DIR/output.zip" >/dev/null 2>&1 || true + +-mkdir $DIR/output +-cd $DIR/output ++mkdir "$DIR/output" ++cd "$DIR/output" + ln -s ../db db +-ln -s ../ochang_js_fuzzer$SUFFIX run$SUFFIX ++ln -s "../ochang_js_fuzzer$SUFFIX" "run$SUFFIX" + ln -s ../foozzie_launcher.py foozzie_launcher.py + echo "Creating $DIR/output.zip" +-(set -x; zip -r $DIR/output.zip * > /dev/null) ++(set -x; zip -r "$DIR/output.zip" * >/dev/null) +diff --git a/deps/v8/tools/collect_deprecation_stats.sh b/deps/v8/tools/collect_deprecation_stats.sh +index aa3f413..76d283b 100755 +--- a/deps/v8/tools/collect_deprecation_stats.sh ++++ b/deps/v8/tools/collect_deprecation_stats.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # Collect the number of [[deprecated]] calls detected when compiling V8. + # Requires "v8_deprecate_get_isolate = true" to be useful. +@@ -6,7 +6,7 @@ + set -e + + if [ -z "$1" ]; then +- (>&2 echo "Usage: collect_deprecation_stats.sh [|]") ++ echo "Usage: collect_deprecation_stats.sh [|]" >&2 + exit 1 + fi + +@@ -22,14 +22,12 @@ fi + FILTERED_LOG=/tmp/filtered_isolate_deprecation.log + UNIQUE_WARNINGS_LOG=/tmp/unique_warnings.log + +-grep "warning:" "$FULL_LOG" | sed $' +-s|^\.\./\.\./||; +-s/: warning: \'/: /; ++grep "warning:" "$FULL_LOG" | sed \ ++ -e 's|^\.\./\.\./||' \ ++ -e "s/: warning: '/: /" \ ++ -e "s/\(<.*>\)\\?'.*//" > "$FILTERED_LOG" + +-# strip everything after deprecated function name (including template param). +-s/\(<.*>\)\\?\'.*//' > $FILTERED_LOG +- +-sort -u $FILTERED_LOG > $UNIQUE_WARNINGS_LOG ++sort -u "$FILTERED_LOG" > "$UNIQUE_WARNINGS_LOG" + + echo "Total deprecated calls: $(wc -l < $UNIQUE_WARNINGS_LOG)" +-cut -f2 -d' ' $UNIQUE_WARNINGS_LOG | sort | uniq -c ++cut -f2 -d' ' "$UNIQUE_WARNINGS_LOG" | sort | uniq -c +diff --git a/deps/v8/tools/cpu.sh b/deps/v8/tools/cpu.sh +index 5634cac..c48bb6b 100755 +--- a/deps/v8/tools/cpu.sh ++++ b/deps/v8/tools/cpu.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Copyright 2014 the V8 project authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. +@@ -9,19 +9,23 @@ MAXID=$(cat $CPUPATH/present | awk -F- '{print $NF}') + + set_governor() { + echo "Setting CPU frequency governor to \"$1\"" +- for (( i=0; i<=$MAXID; i++ )); do +- echo "$1" > $CPUPATH/cpu$i/cpufreq/scaling_governor ++ i=0 ++ while [ "$i" -le "$MAXID" ]; do ++ echo "$1" > "$CPUPATH/cpu$i/cpufreq/scaling_governor" ++ i=$((i + 1)) + done + } + + enable_cores() { + # $1: How many cores to enable. +- for (( i=1; i<=$MAXID; i++ )); do ++ i=1 ++ while [ "$i" -le "$MAXID" ]; do + if [ "$i" -lt "$1" ]; then +- echo 1 > $CPUPATH/cpu$i/online ++ echo 1 > "$CPUPATH/cpu$i/online" + else +- echo 0 > $CPUPATH/cpu$i/online ++ echo 0 > "$CPUPATH/cpu$i/online" + fi ++ i=$((i + 1)) + done + } + +@@ -72,7 +76,7 @@ case "$1" in + echo "Usage $0 limit_cores " + exit 1 + fi +- limit_cores $2 ++ limit_cores "$2" + ;; + *) + echo "Usage: $0 fast|slow|default|singlecore|dualcore|all|limit_cores" +diff --git a/deps/v8/tools/dev/update-vscode.sh b/deps/v8/tools/dev/update-vscode.sh +index 64f5db0..e927f91 100755 +--- a/deps/v8/tools/dev/update-vscode.sh ++++ b/deps/v8/tools/dev/update-vscode.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Copyright 2020 the V8 project authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. +@@ -11,21 +11,20 @@ + + # Basic checking of arguments: want at least one, and it's not --help. + VERSION="$1" +-[ -z "$VERSION" -o \ +- "$VERSION" == "-h" -o \ +- "$VERSION" == "--help" -o \ +- "$VERSION" == "help" ] && { ++case "$VERSION" in ++ ''|-h|--help|help) + echo "Usage: $0 " + echo " may be --auto for auto-detecting the latest available." + exit 1 +-} ++ ;; ++esac + + die() { + echo "Error: $1" + exit 1 + } + +-if [ "$VERSION" == "--auto" -o "$VERSION" == "auto" ]; then ++if [ "$VERSION" = "--auto" ] || [ "$VERSION" = "auto" ]; then + echo "Searching online for latest available version..." + # Where to find the latest available version. + AVAILABLE_PACKAGES_URL="https://packages.microsoft.com/repos/vscode/dists/stable/main/binary-amd64/Packages.gz" +@@ -70,17 +69,19 @@ DOWNLOAD_URL="https://update.code.visualstudio.com/$VERSION/linux-x64/stable" + CODE_BIN="$VSCODE_DIR/bin/code" + + # Check for "code" in $PATH; create a symlink if we can find a good place. +-SYMLINK=$(which code) ++SYMLINK=$(command -v code 2>/dev/null || true) + if [ -z "$SYMLINK" ]; then +- IFS=':' read -ra PATH_ARRAY <<< "$PATH" +- for P in "${PATH_ARRAY[@]}"; do +- if [ "$P" == "$HOME/bin" -o \ +- "$P" == "$HOME/local/bin" -o \ +- "$P" == "$HOME/.local/bin" ]; then ++ old_IFS=$IFS ++ IFS=':' ++ for P in $PATH; do ++ if [ "$P" = "$HOME/bin" ] || \ ++ [ "$P" = "$HOME/local/bin" ] || \ ++ [ "$P" = "$HOME/.local/bin" ]; then + LOCALBIN="$P" + break + fi + done ++ IFS=$old_IFS + if [ -n "$LOCALBIN" ]; then + echo "Adding symlink to $LOCALBIN..." + if [ ! -d "$LOCALBIN" ]; then +@@ -129,7 +130,7 @@ if [ -d "$VSCODE_DIR" ]; then + INSTALLED=$(grep '"version":' "$PACKAGE_JSON" \ + | sed 's/[^0-9]*\([0-9.]*\).*/\1/') + echo "Detected installed version: $INSTALLED" +- if [ "$VERSION" == "$INSTALLED" ] ; then ++ if [ "$VERSION" = "$INSTALLED" ] ; then + echo "You already have that version." + exit 0 + else +diff --git a/deps/v8/tools/draw_instruction_graph.sh b/deps/v8/tools/draw_instruction_graph.sh +index 549380b..97a4f82 100755 +--- a/deps/v8/tools/draw_instruction_graph.sh ++++ b/deps/v8/tools/draw_instruction_graph.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # Copyright 2013 the V8 project authors. All rights reserved. + # Redistribution and use in source and binary forms, with or without +@@ -42,14 +42,14 @@ file=${1:-$defaultfile} + out=${2:-$defaultout} + + # Check input file exists. +-if [ ! -e $file ]; then ++if [ ! -e "$file" ]; then + echo "Input file not found: $file." + echo "Usage: draw_instruction_graph.sh " + exit 1 + fi + + # Search for an error message, and if found, exit. +-error=`grep -m1 '# Error:' $file` ++error=$(grep -m1 '# Error:' "$file") + if [ -n "$error" ]; then + echo "Error message in input file:" + echo " $error" +@@ -58,10 +58,10 @@ fi + + # Sample period - period over which numbers for each category of instructions is + # counted. +-sp=`grep -m1 '# sample_period=' $file | cut -d= -f2` ++sp=$(grep -m1 '# sample_period=' "$file" | cut -d= -f2) + + # Get number of counters in the CSV file. +-nc=`grep -m1 '# counters=' $file | cut -d= -f2` ++nc=$(grep -m1 '# counters=' "$file" | cut -d= -f2) + + # Find the annotation arrows. They appear as comments in the CSV file, in the + # format: +@@ -69,14 +69,14 @@ nc=`grep -m1 '# counters=' $file | cut -d= -f2` + # Where xx is a two character annotation identifier, and yyyyy is the + # position in the executed instruction stream that generated the annotation. + # Turn these locations into labelled arrows. +-arrows=`sed '/^[^#]/ d' $file | \ +- perl -pe "s/^# .. @ (\d+)/set arrow from \1, graph 0.9 to \1, $sp/"`; +-labels=`sed '/^[^#]/d' $file | \ ++arrows=$(sed '/^[^#]/ d' "$file" | \ ++ perl -pe "s/^# .. @ (\d+)/set arrow from \1, graph 0.9 to \1, $sp/") ++labels=$(sed '/^[^#]/d' "$file" | \ + sed -r 's/^# (..) @ (.+)/set label at \2, graph 0.9 "\1" \ +- center offset 0,0.5 font "FreeSans, 8"/'`; ++ center offset 0,0.5 font "FreeSans, 8"/') + + # Check for gnuplot, and warn if not available. +-if [ ! -e $gnuplot ]; then ++if [ ! -e "$gnuplot" ]; then + echo "Can't find gnuplot at $gnuplot." + echo "Gnuplot version 4.6.3 or later required." + exit 3 +diff --git a/deps/v8/tools/eval_gc_time.sh b/deps/v8/tools/eval_gc_time.sh +index 33cc300..5d4c27e 100755 +--- a/deps/v8/tools/eval_gc_time.sh ++++ b/deps/v8/tools/eval_gc_time.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # Copyright 2015 the V8 project authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be +@@ -28,7 +28,7 @@ CSV="" + LOGFILE=/dev/stdin + PERCENTILES="" + +-while [[ $# -ge 1 ]] ++while [ $# -ge 1 ] + do + key="$1" + case $key in +@@ -73,7 +73,7 @@ do + shift + done + +-if [[ $# -ne 0 ]]; then ++if [ $# -ne 0 ]; then + echo "Unknown option(s): $@" + echo "" + print_usage_and_die +@@ -119,7 +119,7 @@ INTERESTING_OLD_GEN_KEYS="\ + sweep.old \ + " + +-if [[ "$TOP_LEVEL" = "yes" ]]; then ++if [ "$TOP_LEVEL" = "yes" ]; then + INTERESTING_OLD_GEN_KEYS="\ + ${INTERESTING_OLD_GEN_KEYS} \ + clear \ +@@ -135,12 +135,12 @@ if [[ "$TOP_LEVEL" = "yes" ]]; then + " + fi + +-BASE_DIR=$(dirname $0) ++BASE_DIR=$(dirname "$0") + + case $OP in + new-gen-rank) +- cat $LOGFILE | grep "gc=s" \ +- | $BASE_DIR/eval_gc_nvp.py \ ++ cat "$LOGFILE" | grep "gc=s" \ ++ | "$BASE_DIR/eval_gc_nvp.py" \ + --no-histogram \ + --rank $RANK_MODE \ + $CSV \ +@@ -148,8 +148,8 @@ case $OP in + ${INTERESTING_NEW_GEN_KEYS} + ;; + old-gen-rank) +- cat $LOGFILE | grep "gc=ms" \ +- | $BASE_DIR/eval_gc_nvp.py \ ++ cat "$LOGFILE" | grep "gc=ms" \ ++ | "$BASE_DIR/eval_gc_nvp.py" \ + --no-histogram \ + --rank $RANK_MODE \ + $CSV \ +diff --git a/deps/v8/tools/find-builtin b/deps/v8/tools/find-builtin +index 29cb0f4..4edc866 100755 +--- a/deps/v8/tools/find-builtin ++++ b/deps/v8/tools/find-builtin +@@ -1,10 +1,10 @@ +-#!/bin/bash ++#!/bin/sh + +-set -euo pipefail ++set -eu + + BUILTIN_NAME="$1" + +-if ! which rg >/dev/null ; then ++if ! command -v rg >/dev/null 2>&1; then + echo >&2 "This tool requires 'rg', install it with 'sudo apt install ripgrep'" + exit 1 + fi +diff --git a/deps/v8/tools/fix-inl-header-includes.sh b/deps/v8/tools/fix-inl-header-includes.sh +index d31af37..6d1c4ad 100755 +--- a/deps/v8/tools/fix-inl-header-includes.sh ++++ b/deps/v8/tools/fix-inl-header-includes.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # Copyright 2025 the V8 project authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be +@@ -7,10 +7,11 @@ + echo 'Finding inl headers with corresponding non-inl header, and making' + echo 'sure that the inl header includes the non-inl header first.' + +-while read inlh; do ++find src -name '*-inl.h' -and -not -name 'macro-assembler-*-inl.h' | ++while IFS= read -r inlh; do + h=${inlh%-inl.h}.h +- [[ -f $h ]] || continue +- echo -n . ++ [ -f "$h" ] || continue ++ printf '.' + awk ' + BEGIN { + i=0 +@@ -31,13 +32,8 @@ BEGIN { + print $0; + } + } +- ' $inlh >$inlh.new && mv $inlh.new $inlh +-done < <( +- # Exclude macro-assembler--inl.h headers because they have special +- # include rules (arch-specific macro assembler headers must be included +- # via the general macro-assembler.h). +- find src -name '*-inl.h' -and -not -name 'macro-assembler-*-inl.h' +-) ++ ' "$inlh" >"$inlh.new" && mv "$inlh.new" "$inlh" ++done + echo + + echo 'Done. Make sure to run "git cl format" and check "git diff".' +diff --git a/deps/v8/tools/fuzz-harness.sh b/deps/v8/tools/fuzz-harness.sh +index 01f0353..bd066c8 100755 +--- a/deps/v8/tools/fuzz-harness.sh ++++ b/deps/v8/tools/fuzz-harness.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Copyright 2012 the V8 project authors. All rights reserved. + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are +@@ -35,10 +35,10 @@ + JSFUNFUZZ_URL="https://bugzilla.mozilla.org/attachment.cgi?id=310631" + JSFUNFUZZ_MD5="d0e497201c5cd7bffbb1cdc1574f4e32" + +-v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../) ++v8_root=$(readlink -f "$(dirname "$0")/../") + jsfunfuzz_dir="$v8_root/tools/jsfunfuzz" + +-if [ -n "$1" ]; then ++if [ -n "${1:-}" ]; then + d8="${v8_root}/$1" + else + d8="${v8_root}/d8" +@@ -52,16 +52,16 @@ fi + # Deprecated download method. A prepatched archive is downloaded as a hook + # if jsfunfuzz=1 is specified as a gyp flag. Requires google.com authentication + # for google storage. +-if [ "$3" == "--download" ]; then ++if [ "${3:-}" = "--download" ]; then + + jsfunfuzz_file="$v8_root/tools/jsfunfuzz.zip" + if [ ! -f "$jsfunfuzz_file" ]; then + echo "Downloading $jsfunfuzz_file ..." +- wget -q -O "$jsfunfuzz_file" $JSFUNFUZZ_URL || exit 1 ++ wget -q -O "$jsfunfuzz_file" "$JSFUNFUZZ_URL" || exit 1 + fi + + jsfunfuzz_sum=$(md5sum "$jsfunfuzz_file" | awk '{ print $1 }') +- if [ $jsfunfuzz_sum != $JSFUNFUZZ_MD5 ]; then ++ if [ "$jsfunfuzz_sum" != "$JSFUNFUZZ_MD5" ]; then + echo "Failed to verify checksum!" + exit 1 + fi +@@ -99,7 +99,7 @@ else + archive=fuzz-results-$(date +%Y%m%d%H%M%S).tar.bz2 + fi + echo "Creating archive $archive" +-tar -cjf $archive err-* w* ++tar -cjf "$archive" err-* w* + rm -f err-* w* + + echo "Total failures: $exit_code" +diff --git a/deps/v8/tools/gcmole/bootstrap.sh b/deps/v8/tools/gcmole/bootstrap.sh +index 35407a9..f052051 100755 +--- a/deps/v8/tools/gcmole/bootstrap.sh ++++ b/deps/v8/tools/gcmole/bootstrap.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + # Copyright 2013 the V8 project authors. All rights reserved. + # Redistribution and use in source and binary forms, with or without +@@ -48,9 +48,9 @@ OS="$(uname -s)" + + # Xcode and clang don't get along when predictive compilation is enabled. + # http://crbug.com/96315 +-if [[ "${OS}" = "Darwin" ]] && xcodebuild -version | grep -q 'Xcode 3.2' ; then ++if [ "${OS}" = "Darwin" ] && xcodebuild -version | grep -q 'Xcode 3.2' ; then + XCONF=com.apple.Xcode +- if [[ "${GYP_GENERATORS}" != "make" ]] && \ ++ if [ "${GYP_GENERATORS:-}" != "make" ] && \ + [ "$(defaults read "${XCONF}" EnablePredictiveCompilation)" != "0" ]; then + echo + echo " HEARKEN!" +@@ -63,7 +63,7 @@ if [[ "${OS}" = "Darwin" ]] && xcodebuild -version | grep -q 'Xcode 3.2' ; then + fi + + SUB_VERSION=$(xcodebuild -version | sed -Ene 's/Xcode 3\.2\.([0-9]+)/\1/p') +- if [[ "${SUB_VERSION}" < 6 ]]; then ++ if [ "${SUB_VERSION}" -lt 6 ]; then + echo + echo " YOUR LD IS BUGGY!" + echo "Please upgrade Xcode to at least 3.2.6." +@@ -84,7 +84,7 @@ fi + set -x + + NUM_JOBS=3 +-if [[ "${OS}" = "Linux" ]]; then ++if [ "${OS}" = "Linux" ]; then + if [[ -e "/proc/cpuinfo" ]]; then + NUM_JOBS="$(grep -c "^processor" /proc/cpuinfo)" + else +@@ -105,7 +105,7 @@ cmake -GNinja -DCMAKE_CXX_FLAGS="-static-libstdc++" -DLLVM_ENABLE_TERMINFO=OFF \ + -DLLVM_ENABLE_Z3_SOLVER=OFF "${LLVM_PROJECT_DIR}/llvm" + MACOSX_DEPLOYMENT_TARGET=10.5 ninja -j"${NUM_JOBS}" clang + +-if [[ "${BUILD_TYPE}" = "Release" ]]; then ++if [ "${BUILD_TYPE}" = "Release" ]; then + # Strip the clang binary. + STRIP_FLAGS= + if [ "${OS}" = "Darwin" ]; then +@@ -114,7 +114,7 @@ if [[ "${BUILD_TYPE}" = "Release" ]]; then + fi + strip ${STRIP_FLAGS} bin/clang + fi +-cd - ++cd "${THIS_DIR}" + + # Build libgcmole.so + make -C "${THIS_DIR}" clean +diff --git a/deps/v8/tools/gcmole/package.sh b/deps/v8/tools/gcmole/package.sh +index 0b9949a..41635df 100755 +--- a/deps/v8/tools/gcmole/package.sh ++++ b/deps/v8/tools/gcmole/package.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + # Copyright 2019 the V8 project authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be +@@ -14,7 +14,7 @@ PACKAGE_DIR="${THIS_DIR}/gcmole-tools" + PACKAGE_FILE="${THIS_DIR}/gcmole-tools.tar.gz" + PACKAGE_SUM="${THIS_DIR}/gcmole-tools.tar.gz.sha1" + BUILD_DIR="${THIS_DIR}/bootstrap/build" +-V8_ROOT_DIR= `realpath "${THIS_DIR}/../.."` ++V8_ROOT_DIR=$(realpath "${THIS_DIR}/../..") + + # Echo all commands + set -x +diff --git a/deps/v8/tools/jsfunfuzz/fuzz-harness.sh b/deps/v8/tools/jsfunfuzz/fuzz-harness.sh +index fa4f9d9..9ed344a 100755 +--- a/deps/v8/tools/jsfunfuzz/fuzz-harness.sh ++++ b/deps/v8/tools/jsfunfuzz/fuzz-harness.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Copyright 2016 the V8 project authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. +@@ -12,11 +12,11 @@ + JSFUNFUZZ_URL="https://bugzilla.mozilla.org/attachment.cgi?id=310631" + JSFUNFUZZ_MD5="d0e497201c5cd7bffbb1cdc1574f4e32" + +-v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../../) ++v8_root=$(readlink -f "$(dirname "$0")/../../") + jsfunfuzz_dir="$v8_root/tools/jsfunfuzz" + cd "$jsfunfuzz_dir" + +-if [ -n "$1" ]; then ++if [ -n "${1:-}" ]; then + d8="${v8_root}/$1" + else + d8="${v8_root}/d8" +@@ -30,16 +30,16 @@ fi + # Deprecated download method. A prepatched archive is downloaded as a hook + # if jsfunfuzz=1 is specified as a gyp flag. Requires google.com authentication + # for google storage. +-if [ "$3" == "--download" ]; then ++if [ "${3:-}" = "--download" ]; then + + jsfunfuzz_file="$v8_root/tools/jsfunfuzz.zip" + if [ ! -f "$jsfunfuzz_file" ]; then + echo "Downloading $jsfunfuzz_file ..." +- wget -q -O "$jsfunfuzz_file" $JSFUNFUZZ_URL || exit 1 ++ wget -q -O "$jsfunfuzz_file" "$JSFUNFUZZ_URL" || exit 1 + fi + + jsfunfuzz_sum=$(md5sum "$jsfunfuzz_file" | awk '{ print $1 }') +- if [ $jsfunfuzz_sum != $JSFUNFUZZ_MD5 ]; then ++ if [ "$jsfunfuzz_sum" != "$JSFUNFUZZ_MD5" ]; then + echo "Failed to verify checksum!" + exit 1 + fi +@@ -92,7 +92,7 @@ else + archive=fuzz-results-$(date +%Y%m%d%H%M%S).tar.bz2 + fi + echo "Creating archive $archive" +-tar -cjf $archive err-* w* ++tar -cjf "$archive" err-* w* + rm -f err-* w* + + echo "Total failures: $exit_code" +diff --git a/deps/v8/tools/mb/mb b/deps/v8/tools/mb/mb +index d3a0cdf..bac79bf 100755 +--- a/deps/v8/tools/mb/mb ++++ b/deps/v8/tools/mb/mb +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + # Copyright 2015 The Chromium Authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. +diff --git a/deps/v8/tools/profiling/android-ll-prof.sh b/deps/v8/tools/profiling/android-ll-prof.sh +index 436f262..8314777 100755 +--- a/deps/v8/tools/profiling/android-ll-prof.sh ++++ b/deps/v8/tools/profiling/android-ll-prof.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Copyright 2012 the V8 project authors. All rights reserved. + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are +@@ -42,7 +42,7 @@ MODE=$1 + RUN_ARGS=$2 + LL_PROF_ARGS=$3 + +-BASE=`cd $(dirname "$0")/..; pwd` ++BASE=$(cd "$(dirname "$0")/.." && pwd) + DEPLOY="$BASE/deploy" + + set +e +diff --git a/deps/v8/tools/profiling/linux-perf-chrome-renderer-cmd.sh b/deps/v8/tools/profiling/linux-perf-chrome-renderer-cmd.sh +index b50dcc6..bafce15 100755 +--- a/deps/v8/tools/profiling/linux-perf-chrome-renderer-cmd.sh ++++ b/deps/v8/tools/profiling/linux-perf-chrome-renderer-cmd.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + # Copyright 2022 the V8 project authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. +@@ -84,9 +84,9 @@ done + + SAMPLE_TRIGGER="" + if [ -n "${PERF_COUNT}" ]; then +- SAMPLE_TRIGGER+="--count=${PERF_COUNT}" ++ SAMPLE_TRIGGER="--count=${PERF_COUNT}" + elif [ -n "${PERF_FREQ}" ]; then +- SAMPLE_TRIGGER+=" --freq=${PERF_FREQ}" ++ SAMPLE_TRIGGER="--freq=${PERF_FREQ}" + else + SAMPLE_TRIGGER="--freq=${PERF_FREQ_DEFAULT}" + fi +diff --git a/deps/v8/tools/system-analyzer/local-server.sh b/deps/v8/tools/system-analyzer/local-server.sh +index 3e5748e..6a59e52 100755 +--- a/deps/v8/tools/system-analyzer/local-server.sh ++++ b/deps/v8/tools/system-analyzer/local-server.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # Copyright 2022 the V8 project authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be +@@ -27,26 +27,29 @@ if ! npm list local-web-server > /dev/null; then + exit + fi + +-TOOLS_DIR=`readlink "$0"` || TOOLS_DIR="$0"; +-TOOLS_DIR=`dirname "$TOOLS_DIR"`; ++TOOLS_DIR=$(readlink "$0") || TOOLS_DIR="$0" ++TOOLS_DIR=$(dirname "$TOOLS_DIR") + cd "$TOOLS_DIR/.." +-TOOLS_DIR=`pwd -P` ++TOOLS_DIR=$(pwd -P) + + # Check if port 8000 is in use +-if [[ "$OSTYPE" == "msys" ]]; then ++case "$(uname -s)" in ++ MINGW*|MSYS*) + if netstat -ano | findstr :8000 > /dev/null; then + echo "localhost:8000 is already in use. You can kill it with:" + echo "netstat -aon | findstr :8000" + echo "taskkill /PID " + exit 1 + fi +-else ++ ;; ++ *) + if lsof -t -i TCP:8000; then + echo "localhost:8000 is already in use. You can kill it with:" + echo "lsof -t -i TCP:8000 | xargs kill" + exit 1 + fi +-fi ++ ;; ++esac + + echo "Starting local symbol server" + npm run start-webserver -- \ +@@ -56,7 +59,7 @@ npm run start-webserver -- \ + lws-index & PID=$! + + # Kill server after 1h +-for i in `seq 3600`; do ++for i in $(seq 3600); do + if ps -p $PID > /dev/null 2>&1; then + sleep 1; + fi +diff --git a/deps/v8/tools/turbolizer/deploy.sh b/deps/v8/tools/turbolizer/deploy.sh +index 184f40a..c45edc8 100755 +--- a/deps/v8/tools/turbolizer/deploy.sh ++++ b/deps/v8/tools/turbolizer/deploy.sh +@@ -1,24 +1,24 @@ +-#!/bin/bash ++#!/bin/sh + + DEST=$1 + + if [ ! -d "$DEST" ]; then +- echo -e "Destination \"$DEST\" is not a directory. Run\n\tnpm deploy -- [destination-directory]" ++ printf 'Destination "%s" is not a directory. Run\n\tnpm deploy -- [destination-directory]\n' "$DEST" + exit 1 + fi + +-function copy() { +- echo -n "." ++copy() { ++ printf '.' + cp "$@" + } + +-echo -n "Deploying..." +-copy *.png $DEST/ +-copy index.html $DEST/ +-copy info-view.html $DEST/ +-copy -R build $DEST/ +-copy -R img $DEST/ +-copy -R css $DEST/ ++printf 'Deploying...' ++copy *.png "$DEST/" ++copy index.html "$DEST/" ++copy info-view.html "$DEST/" ++copy -R build "$DEST/" ++copy -R img "$DEST/" ++copy -R css "$DEST/" + echo "done!" + + echo "Deployed to $DEST/." +diff --git a/deps/v8/tools/wasm/update-wasm-fuzzers.sh b/deps/v8/tools/wasm/update-wasm-fuzzers.sh +index 3f1ac6d..51bc882 100755 +--- a/deps/v8/tools/wasm/update-wasm-fuzzers.sh ++++ b/deps/v8/tools/wasm/update-wasm-fuzzers.sh +@@ -1,11 +1,11 @@ +-#!/bin/bash ++#!/bin/sh + # Copyright 2016 the V8 project authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + + set -ex + +-cd "$( dirname "${BASH_SOURCE[0]}" )" ++cd "$(dirname "$0")" + cd ../.. + + BUILD_DIR=out/mk_wasm_fuzzer_corpus +diff --git a/deps/v8/tools/wasm/update-wasm-spec-tests.sh b/deps/v8/tools/wasm/update-wasm-spec-tests.sh +index 7445dc8..29c380f 100755 +--- a/deps/v8/tools/wasm/update-wasm-spec-tests.sh ++++ b/deps/v8/tools/wasm/update-wasm-spec-tests.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Copyright 2017 the V8 project authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. +@@ -9,17 +9,13 @@ set -e + # Treat unset variables as an error when substituting. + set -u + +-# return value of a pipeline is the status of the last command to exit with a +-# non-zero status, or zero if no command exited with a non-zero status +-set -o pipefail +- + log() { +- echo ">>" $* ++ echo ">>" "$@" + } + + log_and_run() { +- log $* +- if ! $*; then ++ log "$@" ++ if ! "$@"; then + echo "sub-command failed: $*" + exit 1 + fi +@@ -39,8 +35,9 @@ copy_file_relative() { + echo "Incorrect usage of copy_file_relative: ${SRC_FILE} is not within ${SRC_DIR}" + exit 1 + fi +- [[ -d $(dirname ${DST_FILE}) ]] || log_and_run mkdir -pv $(dirname ${DST_FILE}) +- log_and_run cp -v ${SRC_FILE} ${DST_FILE} ++ dst_parent=$(dirname "${DST_FILE}") ++ [ -d "$dst_parent" ] || log_and_run mkdir -pv "$dst_parent" ++ log_and_run cp -v "${SRC_FILE}" "${DST_FILE}" + } + + # Copy files from $1 to $2 under their relative name within $2. +@@ -67,7 +64,7 @@ new_section() { + # Setup directories. + ############################################################################### + +-TOOLS_WASM_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd) ++TOOLS_WASM_DIR=$(cd "$(dirname "$0")" && pwd) + V8_DIR=$(cd ${TOOLS_WASM_DIR}/../.. && pwd) + SPEC_TEST_DIR=${V8_DIR}/test/wasm-spec-tests + TMP_DIR=$(mktemp -d) +diff --git a/deps/zlib/google/test/data/create_test_zip.sh b/deps/zlib/google/test/data/create_test_zip.sh +index 620e8f6..0b27cf5 100755 +--- a/deps/zlib/google/test/data/create_test_zip.sh ++++ b/deps/zlib/google/test/data/create_test_zip.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # Copyright 2011 The Chromium Authors + # Use of this source code is governed by a BSD-style license that can be +@@ -7,11 +7,10 @@ + # Run this script in its directory to recreate test.zip, test_nocompress.zip, + # and test_encrypted.zip + +-rm test.zip +-rm test_nocompress.zip +-rm test_encrypted.zip +-pushd test ++rm -f test.zip ++rm -f test_nocompress.zip ++rm -f test_encrypted.zip ++cd test || exit 1 + zip -r ../test.zip . + zip -r -0 ../test_nocompress.zip . + zip -P "fake_password" -r ../test_encrypted.zip . +-popd +diff --git a/test/fixtures/keys/selfsigned-no-keycertsign/https_renew_cert.sh b/test/fixtures/keys/selfsigned-no-keycertsign/https_renew_cert.sh +index c40046d..8a862eb 100755 +--- a/test/fixtures/keys/selfsigned-no-keycertsign/https_renew_cert.sh ++++ b/test/fixtures/keys/selfsigned-no-keycertsign/https_renew_cert.sh +@@ -1,8 +1,7 @@ +-#!/usr/bin/env bash +-set -euo pipefail +-shopt -s inherit_errexit ++#!/bin/sh ++set -eu + +-cd -- "$(dirname -- "${BASH_SOURCE[0]}")" ++cd -- "$(dirname -- "$0")" + + if [ ! -f key.pem ]; then + openssl genrsa -out key.pem 2048 +diff --git a/test/fixtures/run-script/node_modules/.bin/custom-env b/test/fixtures/run-script/node_modules/.bin/custom-env +index e6f291c..1430f2e 100755 +--- a/test/fixtures/run-script/node_modules/.bin/custom-env ++++ b/test/fixtures/run-script/node_modules/.bin/custom-env +@@ -1,2 +1,2 @@ +-#!/bin/bash ++#!/bin/sh + echo "$CUSTOM_ENV" +diff --git a/test/fixtures/run-script/node_modules/.bin/positional-args b/test/fixtures/run-script/node_modules/.bin/positional-args +index 2d80923..3dc5314 100755 +--- a/test/fixtures/run-script/node_modules/.bin/positional-args ++++ b/test/fixtures/run-script/node_modules/.bin/positional-args +@@ -1,3 +1,3 @@ +-#!/bin/bash ++#!/bin/sh + echo "Arguments: '$@'" + echo "The total number of arguments are: $#" +diff --git a/tools/create_android_makefiles b/tools/create_android_makefiles +index abf2ecf..6073bbd 100755 +--- a/tools/create_android_makefiles ++++ b/tools/create_android_makefiles +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Run this script ONLY inside an Android build system + # and after you ran lunch command! + +@@ -13,13 +13,13 @@ else + ARCH="$1" + fi + +-if [ $ARCH = "x86" ]; then ++if [ "$ARCH" = "x86" ]; then + TARGET_ARCH="ia32" + else + TARGET_ARCH="$ARCH" + fi + +-cd $(dirname $0)/.. ++cd "$(dirname "$0")/.." + + ./configure \ + --without-snapshot \ +@@ -30,9 +30,9 @@ cd $(dirname $0)/.. + export GYP_GENERATORS="android" + export GYP_GENERATOR_FLAGS="limit_to_target_all=true" + GYP_DEFINES="target_arch=$TARGET_ARCH" +-GYP_DEFINES+=" v8_target_arch=$TARGET_ARCH" +-GYP_DEFINES+=" android_target_arch=$ARCH" +-GYP_DEFINES+=" host_os=linux OS=android" ++GYP_DEFINES="$GYP_DEFINES v8_target_arch=$TARGET_ARCH" ++GYP_DEFINES="$GYP_DEFINES android_target_arch=$ARCH" ++GYP_DEFINES="$GYP_DEFINES host_os=linux OS=android" + export GYP_DEFINES + + ./deps/npm/node_modules/node-gyp/gyp/gyp \ +@@ -43,4 +43,8 @@ export GYP_DEFINES + -Dlibrary=static_library \ + node.gyp + +-echo -e "LOCAL_PATH := \$(call my-dir)\n\ninclude \$(LOCAL_PATH)/GypAndroid.mk" > Android.mk ++cat > Android.mk <<'EOF' ++LOCAL_PATH := $(call my-dir) ++ ++include $(LOCAL_PATH)/GypAndroid.mk ++EOF +diff --git a/tools/inspector_protocol/jinja2/get_jinja2.sh b/tools/inspector_protocol/jinja2/get_jinja2.sh +index bc6c4c3..13b6fea 100755 +--- a/tools/inspector_protocol/jinja2/get_jinja2.sh ++++ b/tools/inspector_protocol/jinja2/get_jinja2.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Download and extract Jinja2 + # Homepage: + # http://jinja.pocoo.org/ +@@ -18,15 +18,15 @@ REMOVE_FILES='testsuite' + FILENAME="$(basename $SRC_URL)" + MD5_FILENAME="$FILENAME.md5" + SHA512_FILENAME="$FILENAME.sha512" +-CHROMIUM_FILES+=" $MD5_FILENAME $SHA512_FILENAME" ++CHROMIUM_FILES="$CHROMIUM_FILES $MD5_FILENAME $SHA512_FILENAME" + + BUILD_DIR="$PACKAGE-$VERSION" +-THIRD_PARTY="$(dirname $(realpath $(dirname "${BASH_SOURCE[0]}")))" ++THIRD_PARTY="$(dirname "$(realpath "$(dirname "$0")")")" + INSTALL_DIR="$THIRD_PARTY/$PACKAGE_DIR" + OUT_DIR="$INSTALL_DIR/$BUILD_DIR/$PACKAGE_DIR" + OLD_DIR="$THIRD_PARTY/$PACKAGE_DIR.old" + +-function check_hashes { ++check_hashes() { + # Hashes generated via: + # FILENAME=Jinja2-2.8.tar.gz + # md5sum "$FILENAME" > "$FILENAME.md5" +diff --git a/tools/inspector_protocol/markupsafe/get_markupsafe.sh b/tools/inspector_protocol/markupsafe/get_markupsafe.sh +index d268832..5acd3d5 100755 +--- a/tools/inspector_protocol/markupsafe/get_markupsafe.sh ++++ b/tools/inspector_protocol/markupsafe/get_markupsafe.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Download and extract MarkupSafe + # Homepage: + # https://github.com/mitsuhiko/markupsafe +@@ -12,20 +12,19 @@ CHROMIUM_FILES="README.chromium OWNERS get_markupsafe.sh" + EXTRA_FILES='LICENSE AUTHORS' + REMOVE_FILES='tests.py' + +-SRC_URL='https://pypi.python.org/packages/source/' +-SRC_URL+="${PACKAGE:0:1}/$PACKAGE/$PACKAGE-$VERSION.tar.gz" ++SRC_URL="https://pypi.python.org/packages/source/${PACKAGE%${PACKAGE#?}}/$PACKAGE/$PACKAGE-$VERSION.tar.gz" + FILENAME="$(basename $SRC_URL)" + MD5_FILENAME="$FILENAME.md5" + SHA512_FILENAME="$FILENAME.sha512" +-CHROMIUM_FILES+=" $MD5_FILENAME $SHA512_FILENAME" ++CHROMIUM_FILES="$CHROMIUM_FILES $MD5_FILENAME $SHA512_FILENAME" + + BUILD_DIR="$PACKAGE-$VERSION" +-THIRD_PARTY="$(dirname $(realpath $(dirname "${BASH_SOURCE[0]}")))" ++THIRD_PARTY="$(dirname "$(realpath "$(dirname "$0")")")" + INSTALL_DIR="$THIRD_PARTY/$PACKAGE_DIR" + OUT_DIR="$INSTALL_DIR/$BUILD_DIR/$PACKAGE_DIR" + OLD_DIR="$THIRD_PARTY/$PACKAGE_DIR.old" + +-function check_hashes { ++check_hashes() { + # Hashes generated via: + # FILENAME=MarkupSafe-0.18.tar.gz + # md5sum "$FILENAME" > "$FILENAME.md5" diff --git a/nss/nss-3.122-meson-build.patch b/nss/nss-3.122-meson-build.patch new file mode 100644 index 0000000..625d32f --- /dev/null +++ b/nss/nss-3.122-meson-build.patch @@ -0,0 +1,773 @@ +diff --git a/nss/meson.build b/nss/meson.build +new file mode 100644 +--- /dev/null ++++ b/nss/meson.build +@@ -0,0 +1,147 @@ ++project('nss', 'c') ++ ++py = import('python').find_installation('python3') ++sh = find_program('sh') ++ ++buildtype = get_option('buildtype') ++if buildtype == 'debug' ++ nss_target = 'Debug' ++else ++ nss_target = 'Release' ++endif ++ ++build_args = [] ++if buildtype != 'debug' ++ build_args += ['--opt'] ++endif ++if not get_option('build_tests') ++ build_args += ['--disable-tests'] ++endif ++if get_option('enable_fips') ++ build_args += ['--enable-fips'] ++endif ++if get_option('enable_libpkix') ++ build_args += ['--enable-libpkix'] ++endif ++if get_option('enable_legacy_db') ++ build_args += ['--enable-legacy-db'] ++endif ++if get_option('system_sqlite') ++ build_args += ['--system-sqlite'] ++endif ++ ++nspr_version = get_option('nspr_version') ++if nspr_version == 'auto' ++ nspr_dep = dependency('nspr', required : false) ++ if not nspr_dep.found() ++ nspr_dep = dependency('nspr4', required : false) ++ endif ++ if not nspr_dep.found() ++ error('Unable to determine the NSPR version. Install pkg-config metadata for NSPR or configure with -Dnspr_version=...') ++ endif ++ nspr_version = nspr_dep.version() ++endif ++ ++version_cmd = [ ++ '-c', ++ '''import pathlib,re,sys ++text = pathlib.Path(sys.argv[1]).read_text() ++match = re.search(r'#define\s+NSS_VERSION\s+"([^"]+)"', text) ++if not match: ++ raise SystemExit('unable to parse NSS_VERSION') ++version = match.group(1) ++parts = (version.split('.') + ['0', '0'])[:3] ++print(version) ++print(parts[0]) ++print(parts[1]) ++print(parts[2]) ++''', ++ join_paths(meson.current_source_dir(), 'lib', 'nss', 'nss.h'), ++] ++version_info = run_command(py, version_cmd, check : true).stdout().strip().split('\n') ++nss_version = version_info[0] ++nss_major_version = version_info[1] ++nss_minor_version = version_info[2] ++nss_patch_version = version_info[3] ++ ++prefix = get_option('prefix') ++exec_prefix = prefix ++libdir = join_paths(prefix, get_option('libdir')) ++includedir = join_paths(prefix, get_option('includedir'), 'nss') ++ ++pkgconf = configuration_data() ++pkgconf.set('prefix', prefix) ++pkgconf.set('exec_prefix', exec_prefix) ++pkgconf.set('libdir', libdir) ++pkgconf.set('includedir', includedir) ++pkgconf.set('NSS_VERSION', nss_version) ++pkgconf.set('NSPR_VERSION', nspr_version) ++ ++scriptconf = configuration_data() ++scriptconf.set('prefix', prefix) ++scriptconf.set('MOD_MAJOR_VERSION', nss_major_version) ++scriptconf.set('MOD_MINOR_VERSION', nss_minor_version) ++scriptconf.set('MOD_PATCH_VERSION', nss_patch_version) ++ ++configure_file( ++ input : 'meson/nss.pc.in', ++ output : 'nss.pc', ++ configuration : pkgconf, ++ install : true, ++ install_dir : join_paths(get_option('libdir'), 'pkgconfig'), ++) ++ ++configure_file( ++ input : 'meson/nss-config.in', ++ output : 'nss-config', ++ configuration : scriptconf, ++ install : true, ++ install_dir : get_option('bindir'), ++ install_mode : 'rwxr-xr-x', ++) ++ ++nss_build_root = join_paths(meson.current_build_dir(), 'nss-build') ++ ++custom_target( ++ 'nss-build', ++ output : 'nss-build.stamp', ++ command : [ ++ sh, ++ files('meson/build_nss.sh'), ++ '--source-dir', ++ meson.current_source_dir(), ++ '--build-root', ++ nss_build_root, ++ '--gyp', ++ get_option('gyp'), ++ '--nspr', ++ get_option('nspr'), ++ '--stamp', ++ '@OUTPUT@', ++ '--', ++ ] + build_args, ++ build_by_default : true, ++ build_always_stale : true, ++ console : true, ++) ++ ++meson.add_install_script( ++ py, ++ files('meson/install_nss.py'), ++ '--build-root', ++ nss_build_root, ++ '--target', ++ nss_target, ++ '--libdir', ++ get_option('libdir'), ++ '--bindir', ++ get_option('bindir'), ++ '--includedir', ++ get_option('includedir'), ++ '--install-private-headers', ++ get_option('install_private_headers') ? 'true' : 'false', ++ '--install-tools', ++ get_option('install_tools') ? 'true' : 'false', ++ '--install-ckbi', ++ get_option('install_ckbi') ? 'true' : 'false', ++) +diff --git a/nss/meson_options.txt b/nss/meson_options.txt +new file mode 100644 +--- /dev/null ++++ b/nss/meson_options.txt +@@ -0,0 +1,66 @@ ++option( ++ 'build_tests', ++ type : 'boolean', ++ value : false, ++ description : 'Build NSS tests and the extra test-only helper binaries' ++) ++option( ++ 'enable_fips', ++ type : 'boolean', ++ value : false, ++ description : 'Enable FIPS checks in the GYP build' ++) ++option( ++ 'enable_libpkix', ++ type : 'boolean', ++ value : false, ++ description : 'Build libpkix support' ++) ++option( ++ 'enable_legacy_db', ++ type : 'boolean', ++ value : false, ++ description : 'Build the legacy DB module' ++) ++option( ++ 'system_sqlite', ++ type : 'boolean', ++ value : false, ++ description : 'Link against the system sqlite library' ++) ++option( ++ 'install_private_headers', ++ type : 'boolean', ++ value : false, ++ description : 'Install headers from dist/private/nss in addition to the public API' ++) ++option( ++ 'install_tools', ++ type : 'boolean', ++ value : true, ++ description : 'Install the NSS command-line tools from dist//bin' ++) ++option( ++ 'install_ckbi', ++ type : 'boolean', ++ value : false, ++ description : 'Install libnssckbi.so; disable by default to avoid conflicts with p11-kit trust modules' ++) ++option( ++ 'gyp', ++ type : 'string', ++ value : 'auto', ++ description : 'Path to the gyp executable, or auto to resolve gyp/gyp-next from PATH' ++) ++option( ++ 'nspr', ++ type : 'string', ++ value : 'auto', ++ description : 'NSPR include:lib pair for build.sh, or auto to resolve it with pkg-config' ++) ++option( ++ 'nspr_version', ++ type : 'string', ++ value : 'auto', ++ description : 'NSPR version string to embed in nss.pc when pkg-config metadata is unavailable' ++) +diff --git a/nss/meson/build_nss.sh b/nss/meson/build_nss.sh +new file mode 100644 +--- /dev/null ++++ b/nss/meson/build_nss.sh +@@ -0,0 +1,243 @@ ++#!/bin/sh ++ ++set -eu ++ ++source_dir= ++build_root= ++gyp_bin=auto ++nspr=auto ++stamp= ++build_args= ++ ++append_arg() { ++ if [ -n "$build_args" ]; then ++ build_args="$build_args ++$1" ++ else ++ build_args=$1 ++ fi ++} ++ ++while [ $# -gt 0 ]; do ++ case "$1" in ++ --source-dir) ++ source_dir=$2 ++ shift 2 ++ ;; ++ --build-root) ++ build_root=$2 ++ shift 2 ++ ;; ++ --gyp) ++ gyp_bin=$2 ++ shift 2 ++ ;; ++ --nspr) ++ nspr=$2 ++ shift 2 ++ ;; ++ --stamp) ++ stamp=$2 ++ shift 2 ++ ;; ++ --) ++ shift ++ break ++ ;; ++ *) ++ echo "Unknown option: $1" >&2 ++ exit 2 ++ ;; ++ esac ++done ++ ++while [ $# -gt 0 ]; do ++ append_arg "$1" ++ shift ++done ++ ++if [ -z "$source_dir" ] || [ -z "$build_root" ] || [ -z "$stamp" ]; then ++ echo "Missing required arguments" >&2 ++ exit 2 ++fi ++ ++resolve_gyp() { ++ if [ "$gyp_bin" != "auto" ]; then ++ echo "$gyp_bin" ++ return 0 ++ fi ++ ++ if [ -n "${GYP:-}" ]; then ++ echo "$GYP" ++ return 0 ++ fi ++ ++ if command -v gyp >/dev/null 2>&1; then ++ command -v gyp ++ return 0 ++ fi ++ ++ if command -v gyp-next >/dev/null 2>&1; then ++ command -v gyp-next ++ return 0 ++ fi ++ ++ echo "Unable to find gyp. Configure Meson with -Dgyp=/path/to/gyp." >&2 ++ exit 1 ++} ++ ++pkg_config_var() { ++ package=$1 ++ variable=$2 ++ if pkg-config --exists "$package" 2>/dev/null; then ++ pkg-config --variable="$variable" "$package" ++ return 0 ++ fi ++ return 1 ++} ++ ++resolve_nspr() { ++ if [ "$nspr" != "auto" ]; then ++ case "$nspr" in ++ *:*) ++ echo "$nspr" ++ return 0 ++ ;; ++ *) ++ echo "The -Dnspr option must use the form :." >&2 ++ exit 1 ++ ;; ++ esac ++ fi ++ ++ for package in nspr nspr4; do ++ include_dir=$(pkg_config_var "$package" includedir || true) ++ lib_dir=$(pkg_config_var "$package" libdir || true) ++ if [ -n "$include_dir" ] && [ -n "$lib_dir" ]; then ++ echo "$include_dir:$lib_dir" ++ return 0 ++ fi ++ done ++ ++ echo "Unable to resolve NSPR. Configure Meson with -Dnspr=:." >&2 ++ exit 1 ++} ++ ++detect_jobs() { ++ if [ -n "${MESON_NUM_PROCESSES:-}" ]; then ++ echo "$MESON_NUM_PROCESSES" ++ return 0 ++ fi ++ ++ if command -v getconf >/dev/null 2>&1; then ++ jobs=$(getconf _NPROCESSORS_ONLN 2>/dev/null || true) ++ if [ -n "$jobs" ]; then ++ echo "$jobs" ++ return 0 ++ fi ++ fi ++ ++ echo 1 ++} ++ ++detect_target_arch() { ++ "${PYTHON:-python3}" "$source_dir/coreconf/detect_host_arch.py" ++} ++ ++gyp_bin=$(resolve_gyp) ++nspr=$(resolve_nspr) ++jobs=$(detect_jobs) ++target_arch=$(detect_target_arch) ++target=Debug ++disable_tests=0 ++enable_fips=0 ++enable_libpkix=0 ++enable_legacy_db=0 ++system_sqlite=0 ++ ++if [ -n "$build_args" ]; then ++ old_ifs=$IFS ++ IFS=' ++' ++ for arg in $build_args; do ++ case "$arg" in ++ --opt) ++ target=Release ++ ;; ++ --disable-tests) ++ disable_tests=1 ++ ;; ++ --enable-fips) ++ enable_fips=1 ++ ;; ++ --enable-libpkix) ++ enable_libpkix=1 ++ ;; ++ --enable-legacy-db) ++ enable_legacy_db=1 ++ ;; ++ --system-sqlite) ++ system_sqlite=1 ++ ;; ++ *) ++ echo "Unsupported build option: $arg" >&2 ++ exit 1 ++ ;; ++ esac ++ done ++ IFS=$old_ifs ++fi ++ ++dist_dir=$build_root/dist ++out_dir=$build_root/out ++target_dir=$out_dir/$target ++mkdir -p "$dist_dir" "$target_dir" ++ ++nspr_include_dir=${nspr%%:*} ++nspr_lib_dir=${nspr#*:} ++ ++set -- \ ++ --depth="$source_dir" \ ++ --generator-output="$build_root" \ ++ -Dtarget_arch="$target_arch" \ ++ -Dnss_dist_dir="$dist_dir" \ ++ -Dnss_dist_obj_dir="$dist_dir/$target" \ ++ -Dnspr_include_dir="$nspr_include_dir" \ ++ -Dnspr_lib_dir="$nspr_lib_dir" \ ++ -Denable_sslkeylogfile=1 ++ ++if [ "$disable_tests" = 1 ]; then ++ set -- "$@" -Ddisable_tests=1 ++fi ++if [ "$enable_fips" = 1 ]; then ++ set -- "$@" -Ddisable_fips=0 ++fi ++if [ "$enable_libpkix" = 1 ]; then ++ set -- "$@" -Ddisable_libpkix=0 ++fi ++if [ "$enable_legacy_db" = 1 ]; then ++ set -- "$@" -Ddisable_dbm=0 ++fi ++if [ "$system_sqlite" = 1 ]; then ++ set -- "$@" -Duse_system_sqlite=1 ++fi ++ ++( ++ cd "$source_dir" ++ "$gyp_bin" -f ninja "$@" "$source_dir/nss.gyp" ++) ++if command -v ninja-build >/dev/null 2>&1; then ++ ninja_bin=$(command -v ninja-build) ++elif command -v ninja >/dev/null 2>&1; then ++ ninja_bin=$(command -v ninja) ++else ++ echo "Unable to find ninja." >&2 ++ exit 1 ++fi ++ ++( ++ cd "$source_dir" ++ "$ninja_bin" -C "$target_dir" -j "$jobs" ++) ++ ++printf '%s\n' "$build_root" >"$stamp" +diff --git a/nss/meson/install_nss.py b/nss/meson/install_nss.py +new file mode 100644 +--- /dev/null ++++ b/nss/meson/install_nss.py +@@ -0,0 +1,105 @@ ++#!/usr/bin/env python3 ++ ++import argparse ++import os ++import pathlib ++import shutil ++ ++ ++def bool_arg(value: str) -> bool: ++ return value.lower() in {'1', 'true', 'yes', 'on'} ++ ++ ++def install_root(prefix: pathlib.Path, path: str) -> pathlib.Path: ++ candidate = pathlib.Path(path) ++ if candidate.is_absolute(): ++ return candidate ++ return prefix / candidate ++ ++ ++def install_entry(src: pathlib.Path, dst: pathlib.Path) -> None: ++ dst.parent.mkdir(parents=True, exist_ok=True) ++ if dst.exists() or dst.is_symlink(): ++ if dst.is_dir() and not dst.is_symlink(): ++ shutil.rmtree(dst) ++ else: ++ dst.unlink() ++ ++ if src.is_symlink(): ++ dst.symlink_to(os.readlink(src)) ++ elif src.is_dir(): ++ shutil.copytree(src, dst, symlinks=True) ++ else: ++ shutil.copy2(src, dst) ++ ++ ++def install_tree(src: pathlib.Path, dst: pathlib.Path) -> None: ++ if not src.exists(): ++ return ++ ++ for entry in sorted(src.iterdir()): ++ install_entry(entry, dst / entry.name) ++ ++ ++def install_filtered_libs(src: pathlib.Path, dst: pathlib.Path, install_ckbi: bool) -> None: ++ if not src.exists(): ++ return ++ ++ for entry in sorted(src.iterdir()): ++ if entry.name.endswith('.TOC'): ++ continue ++ if not install_ckbi and entry.name.startswith('libnssckbi.so'): ++ continue ++ if entry.suffix in {'.a', '.chk', '.so'} or '.so.' in entry.name: ++ install_entry(entry, dst / entry.name) ++ ++ ++def install_tools(src: pathlib.Path, dst: pathlib.Path) -> None: ++ if not src.exists(): ++ return ++ ++ for entry in sorted(src.iterdir()): ++ if entry.is_dir(): ++ continue ++ if os.access(entry, os.X_OK): ++ install_entry(entry, dst / entry.name) ++ ++ ++def main() -> int: ++ parser = argparse.ArgumentParser() ++ parser.add_argument('--build-root', required=True) ++ parser.add_argument('--target', required=True) ++ parser.add_argument('--libdir', required=True) ++ parser.add_argument('--bindir', required=True) ++ parser.add_argument('--includedir', required=True) ++ parser.add_argument('--install-private-headers', required=True) ++ parser.add_argument('--install-tools', required=True) ++ parser.add_argument('--install-ckbi', required=True) ++ args = parser.parse_args() ++ ++ install_prefix = pathlib.Path( ++ os.environ.get('MESON_INSTALL_DESTDIR_PREFIX', os.environ['MESON_INSTALL_PREFIX']) ++ ) ++ libdir = install_root(install_prefix, args.libdir) ++ bindir = install_root(install_prefix, args.bindir) ++ includedir = install_root(install_prefix, args.includedir) ++ ++ build_root = pathlib.Path(args.build_root) ++ dist_root = build_root / 'dist' ++ public_headers = dist_root / 'public' / 'nss' ++ private_headers = dist_root / 'private' / 'nss' ++ target_root = dist_root / args.target ++ ++ install_tree(public_headers, includedir / 'nss') ++ if bool_arg(args.install_private_headers): ++ install_tree(private_headers, includedir / 'nss-private') ++ ++ install_filtered_libs(target_root / 'lib', libdir, bool_arg(args.install_ckbi)) ++ if bool_arg(args.install_tools): ++ install_tools(target_root / 'bin', bindir) ++ ++ return 0 ++ ++ ++if __name__ == '__main__': ++ raise SystemExit(main()) +diff --git a/nss/meson/nss-config.in b/nss/meson/nss-config.in +new file mode 100644 +--- /dev/null ++++ b/nss/meson/nss-config.in +@@ -0,0 +1,144 @@ ++#!/bin/sh ++ ++prefix=@prefix@ ++ ++major_version=@MOD_MAJOR_VERSION@ ++minor_version=@MOD_MINOR_VERSION@ ++patch_version=@MOD_PATCH_VERSION@ ++ ++usage() ++{ ++ cat <&2 ++fi ++ ++lib_ssl=yes ++lib_smime=yes ++lib_nss=yes ++lib_nssutil=yes ++ ++while test $# -gt 0; do ++ case "$1" in ++ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; ++ *) optarg= ;; ++ esac ++ ++ case $1 in ++ --prefix=*) ++ prefix=$optarg ++ ;; ++ --prefix) ++ echo_prefix=yes ++ ;; ++ --exec-prefix=*) ++ exec_prefix=$optarg ++ ;; ++ --exec-prefix) ++ echo_exec_prefix=yes ++ ;; ++ --includedir=*) ++ includedir=$optarg ++ ;; ++ --includedir) ++ echo_includedir=yes ++ ;; ++ --libdir=*) ++ libdir=$optarg ++ ;; ++ --libdir) ++ echo_libdir=yes ++ ;; ++ --version) ++ echo ${major_version}.${minor_version}.${patch_version} ++ ;; ++ --cflags) ++ echo_cflags=yes ++ ;; ++ --libs) ++ echo_libs=yes ++ ;; ++ ssl) ++ lib_ssl=yes ++ ;; ++ smime) ++ lib_smime=yes ++ ;; ++ nss) ++ lib_nss=yes ++ ;; ++ nssutil) ++ lib_nssutil=yes ++ ;; ++ *) ++ usage 1 1>&2 ++ ;; ++ esac ++ shift ++done ++ ++# Set variables that may be dependent upon other variables ++if test -z "$exec_prefix"; then ++ exec_prefix=`pkg-config --variable=exec_prefix nss` ++fi ++if test -z "$includedir"; then ++ includedir=`pkg-config --variable=includedir nss` ++fi ++if test -z "$libdir"; then ++ libdir=`pkg-config --variable=libdir nss` ++fi ++ ++if test "$echo_prefix" = "yes"; then ++ echo $prefix ++fi ++ ++if test "$echo_exec_prefix" = "yes"; then ++ echo $exec_prefix ++fi ++ ++if test "$echo_includedir" = "yes"; then ++ echo $includedir ++fi ++ ++if test "$echo_libdir" = "yes"; then ++ echo $libdir ++fi ++ ++if test "$echo_cflags" = "yes"; then ++ echo -I$includedir ++fi ++ ++if test "$echo_libs" = "yes"; then ++ libdirs="-Wl,-rpath-link,$libdir -L$libdir" ++ if test -n "$lib_ssl"; then ++ libdirs="$libdirs -lssl${major_version}" ++ fi ++ if test -n "$lib_smime"; then ++ libdirs="$libdirs -lsmime${major_version}" ++ fi ++ if test -n "$lib_nss"; then ++ libdirs="$libdirs -lnss${major_version}" ++ fi ++ if test -n "$lib_nssutil"; then ++ libdirs="$libdirs -lnssutil${major_version}" ++ fi ++ echo $libdirs ++fi +diff --git a/nss/meson/nss.pc.in b/nss/meson/nss.pc.in +new file mode 100644 +--- /dev/null ++++ b/nss/meson/nss.pc.in +@@ -0,0 +1,11 @@ ++prefix=@prefix@ ++exec_prefix=@exec_prefix@ ++libdir=@libdir@ ++includedir=@includedir@ ++ ++Name: NSS ++Description: Network Security Services ++Version: @NSS_VERSION@ ++Requires: nspr >= @NSPR_VERSION@ ++Libs: -L${libdir} -lssl3 -lsmime3 -lnss3 -lnssutil3 ++Cflags: -I${includedir} +diff --git a/nss/readme.md b/nss/readme.md +--- a/nss/readme.md ++++ b/nss/readme.md +@@ -44,6 +44,23 @@ + See [help.txt](https://hg.mozilla.org/projects/nss/raw-file/tip/help.txt) for + more information on using build.sh. + ++## Building and Installing with Meson ++ ++NSS also ships a Meson wrapper that drives the existing `build.sh`/GYP build ++and installs the resulting headers, libraries, tools, `nss.pc`, and ++`nss-config`. ++ ++ meson setup build -Dgyp=/path/to/gyp ++ meson compile -C build ++ meson install -C build ++ ++If NSPR is not available via `pkg-config`, pass it explicitly as ++`-Dnspr=/path/to/include:/path/to/lib`. Meson keeps the GYP output inside the ++Meson build tree and installs public headers to `${includedir}/nss`. The ++Meson install defaults to skipping `libnssckbi.so` to avoid file conflicts ++with `p11-kit` trust module packages; enable `-Dinstall_ckbi=true` if you ++explicitly want NSS to install that module. ++ + ## Building NSS (legacy build system) + + After changing into the NSS directory a typical build of 32-bit NSS is done as diff --git a/perl/perl-5.42.2-lbi-fixes.patch b/perl/perl-5.42.2-lbi-fixes.patch new file mode 100644 index 0000000..ca139d8 --- /dev/null +++ b/perl/perl-5.42.2-lbi-fixes.patch @@ -0,0 +1,188 @@ +--- a/Makefile.SH ++++ b/Makefile.SH +@@ -373,16 +373,64 @@ + $spitshell >>$Makefile <>$Makefile <>$Makefile <>$Makefile <<'!NO!SUBS!' ++.PHONY: buildext-Cwd ++buildext-Cwd: $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE $(PERLEXPORT) $(LIBPERL) ++ $(MINIPERL) make_ext.pl lib/auto/Cwd/Cwd$(DLSUFFIX) $(MAKE_EXT_ARGS) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic ++ ++!NO!SUBS! + ;; + definedefine) + util_deps='$(PERL_EXE) $(CONFIGPM) FORCE' +@@ -820,8 +876,8 @@ + case "$osname" in + amigaos*) + $spitshell >>$Makefile <<'!NO!SUBS!' +-perlmain.c: $(MINIPERL_EXE) ext/ExtUtils-Miniperl/pm_to_blib +- $(MINIPERL) -MExtUtils::Miniperl -e 'writemain(\\"perlmain.c", @ARGV)' DynaLoader $(static_ext) ++perlmain.c: $(MINIPERL_EXE) $(CONFIGPM) ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm ++ $(MINIPERL) -Iext/ExtUtils-Miniperl/lib -MExtUtils::Miniperl -e 'writemain(\\"perlmain.c", @ARGV)' DynaLoader $(static_ext) + + # The file ext.libs is a list of libraries that must be linked in + # for static extensions, e.g. -lm -lgdbm, etc. The individual +@@ -829,18 +885,24 @@ + ext.libs: $(static_ext) + -@test -f ext.libs || touch ext.libs + ++dist/XSLoader/XSLoader.pm: $(MINIPERL_EXE) $(CONFIGPM) dist/XSLoader/XSLoader_pm.PL ++ cd dist/XSLoader && ../../$(MINIPERL_EXE) -I../../lib XSLoader_pm.PL ++ + !NO!SUBS! + ;; + *) + $spitshell >>$Makefile <<'!NO!SUBS!' +-perlmain.c: $(MINIPERL_EXE) ext/ExtUtils-Miniperl/pm_to_blib +- $(MINIPERL) -MExtUtils::Miniperl -e 'writemain(\"perlmain.c", @ARGV)' DynaLoader $(static_ext) ++perlmain.c: $(MINIPERL_EXE) $(CONFIGPM) ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm ++ $(MINIPERL) -Iext/ExtUtils-Miniperl/lib -MExtUtils::Miniperl -e 'writemain(\"perlmain.c", @ARGV)' DynaLoader $(static_ext) + + # The file ext.libs is a list of libraries that must be linked in + # for static extensions, e.g. -lm -lgdbm, etc. The individual + # static extension Makefile's add to it. + ext.libs: $(static_ext) + -@test -f ext.libs || touch ext.libs ++ ++dist/XSLoader/XSLoader.pm: $(MINIPERL_EXE) $(CONFIGPM) dist/XSLoader/XSLoader_pm.PL ++ cd dist/XSLoader && ../../$(MINIPERL_EXE) -I../../lib XSLoader_pm.PL + + !NO!SUBS! + ;; +@@ -1130,11 +1192,12 @@ + # can in this makefile to decide if needs to run or not + # touch uni.data + +-# $(PERL_EXE) and ext because pod_lib.pl needs Digest::MD5 +-# But also this ensures that all extensions are built before we try to scan ++# Build this with miniperl plus the same expanded \@INC as RUN_PERL so ++# File::Spec can load PathTools without needing the XS Cwd extension. ++# $(ext) still ensures that all extensions are built before we try to scan + # them, which picks up Devel::PPPort's documentation. +-pod/perltoc.pod: $(perltoc_pod_prereqs) $(PERL_EXE) $(ext) pod/buildtoc +- $(RUN_PERL) -f pod/buildtoc -q ++pod/perltoc.pod: $(perltoc_pod_prereqs) $(MINIPERL_EXE) $(ext) pod/buildtoc ++ $(RUN_MINIPERL) -f pod/buildtoc -q + + pod/perlapi.pod: pod/perlintern.pod + +@@ -1300,11 +1363,11 @@ + .PHONY: manisort manicheck + + manisort: FORCE +- @perl Porting/manisort -q || (echo "WARNING: re-sorting MANIFEST"; \ +- perl Porting/manisort -q -o MANIFEST; sh -c true) ++ @$(RUN_PERL) Porting/manisort -q || (echo "WARNING: re-sorting MANIFEST"; \ ++ $(RUN_PERL) Porting/manisort -q -o MANIFEST; sh -c true) + + manicheck: FORCE +- perl Porting/manicheck ++ $(RUN_PERL) Porting/manicheck + + # Extensions: + # Names added to $(dynamic_ext) or $(static_ext) or $(nonxs_ext) will +--- a/write_buildcustomize.pl ++++ b/write_buildcustomize.pl +@@ -47,15 +47,16 @@ + cpan/Getopt-Long/lib + cpan/Text-ParseWords/lib + cpan/ExtUtils-PL2Bat/lib ++ cpan/parent/lib ++ dist/ExtUtils-ParseXS/lib ++ dist/base/lib ++ dist/XSLoader + ); + + # These are for XS building on Win32, since nonxs and xs build simultaneously + # on Win32 if parallel building + push @toolchain, qw( +- dist/ExtUtils-ParseXS/lib +- cpan/parent/lib + cpan/ExtUtils-Constant/lib +- dist/base/lib + ) if $^O eq 'MSWin32'; + push @toolchain, 'ext/VMS-Filespec/lib' if $^O eq 'VMS'; + diff --git a/python/python-3.14.4-libressl-hostflags-guard.patch b/python/python-3.14.4-libressl-hostflags-guard.patch new file mode 100644 index 0000000..86bd37f --- /dev/null +++ b/python/python-3.14.4-libressl-hostflags-guard.patch @@ -0,0 +1,32 @@ +diff -Naur a/Modules/_ssl.c b/Modules/_ssl.c +--- a/Modules/_ssl.c 2026-04-07 08:13:20.000000000 -0500 ++++ b/Modules/_ssl.c 2026-04-19 17:40:55.497794723 -0500 +@@ -909,6 +909,7 @@ + #undef SID_CTX + } + ++#ifndef LIBRESSL_VERSION_NUMBER + /* bpo43522 and OpenSSL < 1.1.1l: copy hostflags manually */ + #if OPENSSL_VERSION_NUMBER < 0x101010cf + X509_VERIFY_PARAM *ssl_verification_params = SSL_get0_param(self->ssl); +@@ -917,6 +918,7 @@ + unsigned int ssl_ctx_host_flags = X509_VERIFY_PARAM_get_hostflags(ssl_ctx_verification_params); + X509_VERIFY_PARAM_set_hostflags(ssl_verification_params, ssl_ctx_host_flags); + #endif ++#endif + SSL_set_app_data(self->ssl, self); + if (sock) { + SSL_set_fd(self->ssl, Py_SAFE_DOWNCAST(sock->sock_fd, SOCKET_T, int)); +@@ -3875,7 +3877,11 @@ + unsigned int host_flags; + + ssl_verification_params = SSL_CTX_get0_param(self->ctx); +- host_flags = X509_VERIFY_PARAM_get_hostflags(ssl_verification_params); ++#ifdef LIBRESSL_VERSION_NUMBER ++ host_flags = 0; ++#else ++ host_flags = X509_VERIFY_PARAM_get_hostflags(ssl_verification_params); ++#endif + return PyLong_FromUnsignedLong(host_flags); + } + diff --git a/qt5/qt5-base-libressl.patch b/qt5/qt5-base-libressl.patch new file mode 100644 index 0000000..6905cf0 --- /dev/null +++ b/qt5/qt5-base-libressl.patch @@ -0,0 +1,682 @@ +diff --git a/src/network/ssl/qdtls_openssl.cpp b/src/network/ssl/qdtls_openssl.cpp +index ede9595f197..e8af73acfb9 100644 +--- a/src/network/ssl/qdtls_openssl.cpp ++++ b/src/network/ssl/qdtls_openssl.cpp +@@ -267,6 +267,7 @@ extern "C" int q_X509DtlsCallback(int ok, X509_STORE_CTX *ctx) + return 1; + } + ++#ifndef OPENSSL_NO_PSK + extern "C" unsigned q_PSK_client_callback(SSL *ssl, const char *hint, char *identity, + unsigned max_identity_len, unsigned char *psk, + unsigned max_psk_len) +@@ -291,6 +292,7 @@ extern "C" unsigned q_PSK_server_callback(SSL *ssl, const char *identity, unsign + Q_ASSERT(dtls->dtlsPrivate); + return dtls->dtlsPrivate->pskServerCallback(identity, psk, max_psk_len); + } ++#endif // OPENSSL_NO_PSK + + } // namespace dtlscallbacks + +@@ -551,18 +553,24 @@ extern "C" long q_dgram_ctrl(BIO *bio, int cmd, long num, void *ptr) + case BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT: + // DTLSTODO: I'm not sure yet, how it's used by OpenSSL. + return 1; ++#ifdef BIO_CTRL_DGRAM_SET_DONT_FRAG + case BIO_CTRL_DGRAM_SET_DONT_FRAG: + qDtlsDebug("BIO_CTRL_DGRAM_SET_DONT_FRAG"); + // To be done in QUdpSocket, it's about IP_DONTFRAG etc. + return 1; ++#endif // BIO_CTRL_DGRAM_SET_DONT_FRAG ++#ifdef BIO_CTRL_DGRAM_GET_MTU_OVERHEAD + case BIO_CTRL_DGRAM_GET_MTU_OVERHEAD: + // AFAIK it's 28 for IPv4 and 48 for IPv6, but let's pretend it's 0 + // so that OpenSSL does not start suddenly fragmenting the first + // client hello (which will result in DTLSv1_listen rejecting it). + return 0; ++#endif // BIO_CTRL_DGRAM_GET_MTU_OVERHEAD ++#ifdef BIO_CTRL_DGRAM_SET_PEEK_MODE + case BIO_CTRL_DGRAM_SET_PEEK_MODE: + dtls->peeking = num; + return 1; ++#endif // BIO_CTRL_DGRAM_SET_PEEK_MODE + default:; + #if QT_DTLS_VERBOSE + qWarning() << "Unexpected cmd (" << cmd << ")"; +@@ -702,12 +710,16 @@ bool DtlsState::initCtxAndConnection(QDtlsBasePrivate *dtlsBase) + } + + if (dtlsBase->mode == QSslSocket::SslServerMode) { +- if (dtlsBase->dtlsConfiguration.dtlsCookieEnabled) +- q_SSL_set_options(newConnection.data(), SSL_OP_COOKIE_EXCHANGE); +- q_SSL_set_psk_server_callback(newConnection.data(), dtlscallbacks::q_PSK_server_callback); +- } else { +- q_SSL_set_psk_client_callback(newConnection.data(), dtlscallbacks::q_PSK_client_callback); +- } ++ if (dtlsBase->dtlsConfiguration.dtlsCookieEnabled) ++ q_SSL_set_options(newConnection.data(), SSL_OP_COOKIE_EXCHANGE); ++#ifndef OPENSSL_NO_PSK ++ q_SSL_set_psk_server_callback(newConnection.data(), dtlscallbacks::q_PSK_server_callback); ++#endif // OPENSSL_NO_PSK ++} else { ++#ifndef OPENSSL_NO_PSK ++ q_SSL_set_psk_client_callback(newConnection.data(), dtlscallbacks::q_PSK_client_callback); ++#endif // OPENSSL_NO_PSK ++} + + tlsContext.swap(newContext); + tlsConnection.swap(newConnection); +diff --git a/src/network/ssl/qsslcertificate_openssl.cpp b/src/network/ssl/qsslcertificate_openssl.cpp +index d1794d4dbd7..1f1aa5edb36 100644 +--- a/src/network/ssl/qsslcertificate_openssl.cpp ++++ b/src/network/ssl/qsslcertificate_openssl.cpp +@@ -727,7 +727,7 @@ static QMultiMap _q_mapFromX509Name(X509_NAME *name) + unsigned char *data = nullptr; + int size = q_ASN1_STRING_to_UTF8(&data, q_X509_NAME_ENTRY_get_data(e)); + info.insert(name, QString::fromUtf8((char*)data, size)); +-#if QT_CONFIG(opensslv11) ++#if QT_CONFIG(opensslv11) && !defined(LIBRESSL_VERSION_NUMBER) + q_CRYPTO_free(data, nullptr, 0); + #else + q_CRYPTO_free(data); +diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp +index e4bb61ecb57..325ea3b58f8 100644 +--- a/src/network/ssl/qsslcontext_openssl.cpp ++++ b/src/network/ssl/qsslcontext_openssl.cpp +@@ -54,12 +54,14 @@ + + QT_BEGIN_NAMESPACE + ++#ifdef SSL_SECOP_PEER + Q_GLOBAL_STATIC(bool, forceSecurityLevel) + + Q_NETWORK_EXPORT void qt_ForceTlsSecurityLevel() + { + *forceSecurityLevel() = true; + } ++#endif //SSL_SECOP_PEER + + // defined in qsslsocket_openssl.cpp: + extern int q_X509Callback(int ok, X509_STORE_CTX *ctx); +@@ -351,9 +353,11 @@ init_context: + return; + } + ++#ifdef SSL_SECOP_PEER + // A nasty hacked OpenSSL using a level that will make our auto-tests fail: + if (q_SSL_CTX_get_security_level(sslContext->ctx) > 1 && *forceSecurityLevel()) + q_SSL_CTX_set_security_level(sslContext->ctx, 1); ++#endif //SSL_SECOP_PEER + + const long anyVersion = + #if QT_CONFIG(dtls) +@@ -408,16 +412,28 @@ init_context: + maxVersion = DTLS1_VERSION; + break; + case QSsl::DtlsV1_0OrLater: ++#ifdef DTLS_MAX_VERSION + minVersion = DTLS1_VERSION; + maxVersion = 0; ++#else ++ Q_UNREACHABLE(); ++#endif // DTLS_MAX_VERSION + break; + case QSsl::DtlsV1_2: ++#ifdef DTLS1_2_VERSION + minVersion = DTLS1_2_VERSION; + maxVersion = DTLS1_2_VERSION; ++#else ++ Q_UNREACHABLE(); ++#endif // DTLS1_2_VERSION + break; + case QSsl::DtlsV1_2OrLater: ++#if defined(DTLS1_2_VERSION) + minVersion = DTLS1_2_VERSION; + maxVersion = 0; ++#else ++ Q_UNREACHABLE(); ++#endif // DTLS1_2_VERSION + break; + case QSsl::TlsV1_3OrLater: + #ifdef TLS1_3_VERSION +@@ -722,6 +738,7 @@ void QSslContext::applyBackendConfig(QSslContext *sslContext) + } + #endif // ocsp + ++#ifndef LIBRESSL_VERSION_NUMBER + QSharedPointer cctx(q_SSL_CONF_CTX_new(), &q_SSL_CONF_CTX_free); + if (cctx) { + q_SSL_CONF_CTX_set_ssl_ctx(cctx.data(), sslContext->ctx); +@@ -768,7 +785,9 @@ void QSslContext::applyBackendConfig(QSslContext *sslContext) + sslContext->errorStr = msgErrorSettingBackendConfig(QSslSocket::tr("SSL_CONF_finish() failed")); + sslContext->errorCode = QSslError::UnspecifiedError; + } +- } else { ++ } else ++#endif // LIBRESSL_VERSION_NUMBER ++ { + sslContext->errorStr = msgErrorSettingBackendConfig(QSslSocket::tr("SSL_CONF_CTX_new() failed")); + sslContext->errorCode = QSslError::UnspecifiedError; + } +diff --git a/src/network/ssl/qsslcontext_openssl_p.h b/src/network/ssl/qsslcontext_openssl_p.h +index 70cb97aad82..01a61cf5352 100644 +--- a/src/network/ssl/qsslcontext_openssl_p.h ++++ b/src/network/ssl/qsslcontext_openssl_p.h +@@ -61,6 +61,13 @@ + + QT_BEGIN_NAMESPACE + ++#ifndef DTLS_ANY_VERSION ++#define DTLS_ANY_VERSION 0x1FFFF ++#endif ++#ifndef TLS_ANY_VERSION ++#define TLS_ANY_VERSION 0x10000 ++#endif ++ + #ifndef QT_NO_SSL + + class QSslContextPrivate; +diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp +index 8f6858c867a..8292cec8b3c 100644 +--- a/src/network/ssl/qsslsocket_openssl.cpp ++++ b/src/network/ssl/qsslsocket_openssl.cpp +@@ -246,6 +246,12 @@ static int q_ssl_psk_use_session_callback(SSL *ssl, const EVP_MD *md, const unsi + return 1; // need to return 1 or else "the connection setup fails." + } + ++#endif // TLS1_3_VERSION ++ ++#endif // !OPENSSL_NO_PSK ++ ++#if (!defined(OPENSSL_NO_PSK) || defined(LIBRESSL_VERSION_NUMBER)) \ ++&& defined(TLS1_3_VERSION) + int q_ssl_sess_set_new_cb(SSL *ssl, SSL_SESSION *session) + { + if (!ssl) { +@@ -261,9 +267,7 @@ int q_ssl_sess_set_new_cb(SSL *ssl, SSL_SESSION *session) + QSslSocketBackendPrivate::s_indexForSSLExtraData)); + return socketPrivate->handleNewSessionTicket(ssl); + } +-#endif // TLS1_3_VERSION +- +-#endif // !OPENSSL_NO_PSK ++#endif + + #if QT_CONFIG(ocsp) + +@@ -675,7 +679,7 @@ bool QSslSocketBackendPrivate::initSslContext() + else if (mode == QSslSocket::SslServerMode) + q_SSL_set_psk_server_callback(ssl, &q_ssl_psk_server_callback); + +-#if OPENSSL_VERSION_NUMBER >= 0x10101006L ++#if OPENSSL_VERSION_NUMBER >= 0x10101006L && !defined(LIBRESSL_VERSION_NUMBER) + // Set the client callback for TLSv1.3 PSK + if (mode == QSslSocket::SslClientMode + && QSslSocket::sslLibraryBuildVersionNumber() >= 0x10101006L) { +diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp +index 6a9a3ef3b3f..a7c112c367e 100644 +--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp ++++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp +@@ -142,14 +142,21 @@ DEFINEFUNC2(int, OPENSSL_init_ssl, uint64_t opts, opts, const OPENSSL_INIT_SETTI + DEFINEFUNC2(int, OPENSSL_init_crypto, uint64_t opts, opts, const OPENSSL_INIT_SETTINGS *settings, settings, return 0, return) + DEFINEFUNC(BIO *, BIO_new, const BIO_METHOD *a, a, return nullptr, return) + DEFINEFUNC(const BIO_METHOD *, BIO_s_mem, void, DUMMYARG, return nullptr, return) ++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER >= 0x03050000fL + DEFINEFUNC2(int, BN_is_word, BIGNUM *a, a, BN_ULONG w, w, return 0, return) ++#endif + DEFINEFUNC(int, EVP_CIPHER_CTX_reset, EVP_CIPHER_CTX *c, c, return 0, return) + DEFINEFUNC(int, EVP_PKEY_up_ref, EVP_PKEY *a, a, return 0, return) ++#ifdef OPENSSL_NO_DEPRECATED_3_0 + DEFINEFUNC2(EVP_PKEY_CTX *, EVP_PKEY_CTX_new, EVP_PKEY *pkey, pkey, ENGINE *e, e, return nullptr, return) + DEFINEFUNC(int, EVP_PKEY_param_check, EVP_PKEY_CTX *ctx, ctx, return 0, return) + DEFINEFUNC(void, EVP_PKEY_CTX_free, EVP_PKEY_CTX *ctx, ctx, return, return) ++#endif // OPENSSL_NO_DEPRECATED_3_0 + DEFINEFUNC(int, RSA_bits, RSA *a, a, return 0, return) ++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER >= 0x03050000fL + DEFINEFUNC(int, DSA_bits, DSA *a, a, return 0, return) ++#endif ++#if !defined(LIBRESSL_VERSION_NUMBER) + DEFINEFUNC(int, OPENSSL_sk_num, OPENSSL_STACK *a, a, return -1, return) + DEFINEFUNC2(void, OPENSSL_sk_pop_free, OPENSSL_STACK *a, a, void (*b)(void*), b, return, DUMMYARG) + DEFINEFUNC(OPENSSL_STACK *, OPENSSL_sk_new_null, DUMMYARG, DUMMYARG, return nullptr, return) +@@ -158,8 +165,18 @@ DEFINEFUNC(void, OPENSSL_sk_free, OPENSSL_STACK *a, a, return, DUMMYARG) + DEFINEFUNC2(void *, OPENSSL_sk_value, OPENSSL_STACK *a, a, int b, b, return nullptr, return) + DEFINEFUNC(int, SSL_session_reused, SSL *a, a, return 0, return) + DEFINEFUNC2(qssloptions, SSL_CTX_set_options, SSL_CTX *ctx, ctx, qssloptions op, op, return 0, return) ++#else ++DEFINEFUNC(int, sk_num, STACK *a, a, return -1, return) ++DEFINEFUNC2(void, sk_pop_free, STACK *a, a, void (*b)(void*), b, return, DUMMYARG) ++DEFINEFUNC(_STACK *, sk_new_null, DUMMYARG, DUMMYARG, return nullptr, return) ++DEFINEFUNC2(void, sk_push, _STACK *a, a, void *b, b, return, DUMMYARG) ++DEFINEFUNC(void, sk_free, _STACK *a, a, return, DUMMYARG) ++DEFINEFUNC2(void *, sk_value, STACK *a, a, int b, b, return nullptr, return) ++#endif // LIBRESSL_VERSION_NUMBER ++#ifdef SSL_SECOP_PEER + DEFINEFUNC(int, SSL_CTX_get_security_level, const SSL_CTX *ctx, ctx, return -1, return) + DEFINEFUNC2(void, SSL_CTX_set_security_level, SSL_CTX *ctx, ctx, int level, level, return, return) ++#endif //SSL_SECOP_PEER + #ifdef TLS1_3_VERSION + DEFINEFUNC2(int, SSL_CTX_set_ciphersuites, SSL_CTX *ctx, ctx, const char *str, str, return 0, return) + DEFINEFUNC2(void, SSL_set_psk_use_session_callback, SSL *ssl, ssl, q_SSL_psk_use_session_cb_func_t callback, callback, return, DUMMYARG) +@@ -169,7 +186,9 @@ DEFINEFUNC(int, SSL_SESSION_is_resumable, const SSL_SESSION *s, s, return 0, ret + DEFINEFUNC3(size_t, SSL_get_client_random, SSL *a, a, unsigned char *out, out, size_t outlen, outlen, return 0, return) + DEFINEFUNC3(size_t, SSL_SESSION_get_master_key, const SSL_SESSION *ses, ses, unsigned char *out, out, size_t outlen, outlen, return 0, return) + DEFINEFUNC6(int, CRYPTO_get_ex_new_index, int class_index, class_index, long argl, argl, void *argp, argp, CRYPTO_EX_new *new_func, new_func, CRYPTO_EX_dup *dup_func, dup_func, CRYPTO_EX_free *free_func, free_func, return -1, return) ++#ifndef LIBRESSL_VERSION_NUMBER + DEFINEFUNC2(unsigned long, SSL_set_options, SSL *ssl, ssl, unsigned long op, op, return 0, return) ++#endif + + DEFINEFUNC(const SSL_METHOD *, TLS_method, DUMMYARG, DUMMYARG, return nullptr, return) + DEFINEFUNC(const SSL_METHOD *, TLS_client_method, DUMMYARG, DUMMYARG, return nullptr, return) +@@ -185,7 +204,23 @@ DEFINEFUNC2(void, X509_STORE_set_verify_cb, X509_STORE *a, a, X509_STORE_CTX_ver + DEFINEFUNC3(int, X509_STORE_set_ex_data, X509_STORE *a, a, int idx, idx, void *data, data, return 0, return) + DEFINEFUNC2(void *, X509_STORE_get_ex_data, X509_STORE *r, r, int idx, idx, return nullptr, return) + DEFINEFUNC(STACK_OF(X509) *, X509_STORE_CTX_get0_chain, X509_STORE_CTX *a, a, return nullptr, return) +-DEFINEFUNC3(void, CRYPTO_free, void *str, str, const char *file, file, int line, line, return, DUMMYARG) ++#if defined(QT_LINKED_OPENSSL) ++void q_CRYPTO_free(void *str, const char *, int) ++{ ++ OPENSSL_free(str); ++} ++#else ++typedef void (*_q_PTR_CRYPTO_free)(void *str, const char *file, int line); ++static _q_PTR_CRYPTO_free _q_CRYPTO_free = nullptr; ++void q_CRYPTO_free(void *str, const char *file, int line) ++{ ++ if (Q_UNLIKELY(!_q_CRYPTO_free)) { ++ qsslSocketUnresolvedSymbolWarning("CRYPTO_free"); ++ return; ++ } ++ _q_CRYPTO_free(str, file, line); ++} ++#endif // QT_LINKED_OPENSSL + DEFINEFUNC(long, OpenSSL_version_num, void, DUMMYARG, return 0, return) + DEFINEFUNC(const char *, OpenSSL_version, int a, a, return nullptr, return) + DEFINEFUNC(unsigned long, SSL_SESSION_get_ticket_lifetime_hint, const SSL_SESSION *session, session, return 0, return) +@@ -193,9 +228,25 @@ DEFINEFUNC4(void, DH_get0_pqg, const DH *dh, dh, const BIGNUM **p, p, const BIGN + DEFINEFUNC(int, DH_bits, DH *dh, dh, return 0, return) + + #if QT_CONFIG(dtls) ++#if !defined(LIBRESSL_VERSION_NUMBER) || defined(BIO_F_BIO_ADDR_NEW) + DEFINEFUNC2(int, DTLSv1_listen, SSL *s, s, BIO_ADDR *c, c, return -1, return) + DEFINEFUNC(BIO_ADDR *, BIO_ADDR_new, DUMMYARG, DUMMYARG, return nullptr, return) + DEFINEFUNC(void, BIO_ADDR_free, BIO_ADDR *ap, ap, return, DUMMYARG) ++#else ++int q_DTLSv1_listen(SSL *, BIO_ADDR *) ++{ ++ return -1; ++} ++ ++BIO_ADDR *q_BIO_ADDR_new() ++{ ++ return nullptr; ++} ++ ++void q_BIO_ADDR_free(BIO_ADDR *) ++{ ++} ++#endif // !LIBRESSL_VERSION_NUMBER || BIO_F_BIO_ADDR_NEW + DEFINEFUNC2(BIO_METHOD *, BIO_meth_new, int type, type, const char *name, name, return nullptr, return) + DEFINEFUNC(void, BIO_meth_free, BIO_METHOD *biom, biom, return, DUMMYARG) + DEFINEFUNC2(int, BIO_meth_set_write, BIO_METHOD *biom, biom, DgramWriteCallback write, write, return 0, return) +@@ -225,7 +276,9 @@ DEFINEFUNC5(int, OCSP_id_get0_info, ASN1_OCTET_STRING **piNameHash, piNameHash, + ASN1_OCTET_STRING **piKeyHash, piKeyHash, ASN1_INTEGER **pserial, pserial, OCSP_CERTID *cid, cid, + return 0, return) + DEFINEFUNC2(OCSP_RESPONSE *, OCSP_response_create, int status, status, OCSP_BASICRESP *bs, bs, return nullptr, return) ++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER >= 0x03050000fL + DEFINEFUNC(const STACK_OF(X509) *, OCSP_resp_get0_certs, const OCSP_BASICRESP *bs, bs, return nullptr, return) ++#endif + DEFINEFUNC2(int, OCSP_id_cmp, OCSP_CERTID *a, a, OCSP_CERTID *b, b, return -1, return) + DEFINEFUNC7(OCSP_SINGLERESP *, OCSP_basic_add1_status, OCSP_BASICRESP *r, r, OCSP_CERTID *c, c, int s, s, + int re, re, ASN1_TIME *rt, rt, ASN1_TIME *t, t, ASN1_TIME *n, n, return nullptr, return) +@@ -358,12 +411,14 @@ DEFINEFUNC2(int, SSL_CTX_use_PrivateKey, SSL_CTX *a, a, EVP_PKEY *b, b, return - + DEFINEFUNC2(int, SSL_CTX_use_RSAPrivateKey, SSL_CTX *a, a, RSA *b, b, return -1, return) + DEFINEFUNC3(int, SSL_CTX_use_PrivateKey_file, SSL_CTX *a, a, const char *b, b, int c, c, return -1, return) + DEFINEFUNC(X509_STORE *, SSL_CTX_get_cert_store, const SSL_CTX *a, a, return nullptr, return) ++#ifndef LIBRESSL_VERSION_NUMBER + DEFINEFUNC(SSL_CONF_CTX *, SSL_CONF_CTX_new, DUMMYARG, DUMMYARG, return nullptr, return); + DEFINEFUNC(void, SSL_CONF_CTX_free, SSL_CONF_CTX *a, a, return ,return); + DEFINEFUNC2(void, SSL_CONF_CTX_set_ssl_ctx, SSL_CONF_CTX *a, a, SSL_CTX *b, b, return, return); + DEFINEFUNC2(unsigned int, SSL_CONF_CTX_set_flags, SSL_CONF_CTX *a, a, unsigned int b, b, return 0, return); + DEFINEFUNC(int, SSL_CONF_CTX_finish, SSL_CONF_CTX *a, a, return 0, return); + DEFINEFUNC3(int, SSL_CONF_cmd, SSL_CONF_CTX *a, a, const char *b, b, const char *c, c, return 0, return); ++#endif + DEFINEFUNC(void, SSL_free, SSL *a, a, return, DUMMYARG) + DEFINEFUNC(STACK_OF(SSL_CIPHER) *, SSL_get_ciphers, const SSL *a, a, return nullptr, return) + DEFINEFUNC(const SSL_CIPHER *, SSL_get_current_cipher, SSL *a, a, return nullptr, return) +@@ -388,7 +443,11 @@ DEFINEFUNC3(void, SSL_set_bio, SSL *a, a, BIO *b, b, BIO *c, c, return, DUMMYARG + DEFINEFUNC(void, SSL_set_accept_state, SSL *a, a, return, DUMMYARG) + DEFINEFUNC(void, SSL_set_connect_state, SSL *a, a, return, DUMMYARG) + DEFINEFUNC(int, SSL_shutdown, SSL *a, a, return -1, return) ++#ifndef LIBRESSL_VERSION_NUMBER + DEFINEFUNC(int, SSL_in_init, const SSL *a, a, return 0, return) ++#else ++DEFINEFUNC(int, SSL_state, const SSL *a, a, return 0, return) ++#endif + DEFINEFUNC(int, SSL_get_shutdown, const SSL *ssl, ssl, return 0, return) + DEFINEFUNC2(int, SSL_set_session, SSL* to, to, SSL_SESSION *session, session, return -1, return) + DEFINEFUNC(void, SSL_SESSION_free, SSL_SESSION *ses, ses, return, DUMMYARG) +@@ -870,20 +929,35 @@ bool q_resolveOpenSslSymbols() + RESOLVEFUNC(EVP_CIPHER_CTX_reset) + RESOLVEFUNC(AUTHORITY_INFO_ACCESS_free) + RESOLVEFUNC(EVP_PKEY_up_ref) ++#ifdef OPENSSL_NO_DEPRECATED_3_0 + RESOLVEFUNC(EVP_PKEY_CTX_new) + RESOLVEFUNC(EVP_PKEY_param_check) + RESOLVEFUNC(EVP_PKEY_CTX_free) ++#endif // OPENSSL_NO_DEPRECATED_3_0 + RESOLVEFUNC(RSA_bits) ++#if !defined(LIBRESSL_VERSION_NUMBER) + RESOLVEFUNC(OPENSSL_sk_new_null) + RESOLVEFUNC(OPENSSL_sk_push) + RESOLVEFUNC(OPENSSL_sk_free) + RESOLVEFUNC(OPENSSL_sk_num) + RESOLVEFUNC(OPENSSL_sk_pop_free) + RESOLVEFUNC(OPENSSL_sk_value) ++#else ++ RESOLVEFUNC(sk_new_null) ++ RESOLVEFUNC(sk_push) ++ RESOLVEFUNC(sk_free) ++ RESOLVEFUNC(sk_num) ++ RESOLVEFUNC(sk_pop_free) ++ RESOLVEFUNC(sk_value) ++#endif + RESOLVEFUNC(DH_get0_pqg) ++#ifndef LIBRESSL_VERSION_NUMBER + RESOLVEFUNC(SSL_CTX_set_options) ++#endif ++#ifdef SSL_SECOP_PEER + RESOLVEFUNC(SSL_CTX_get_security_level) + RESOLVEFUNC(SSL_CTX_set_security_level) ++#endif //SSL_SECOP_PEER + #ifdef TLS1_3_VERSION + RESOLVEFUNC(SSL_CTX_set_ciphersuites) + RESOLVEFUNC(SSL_set_psk_use_session_callback) +@@ -893,9 +967,13 @@ bool q_resolveOpenSslSymbols() + + RESOLVEFUNC(SSL_get_client_random) + RESOLVEFUNC(SSL_SESSION_get_master_key) ++#ifndef LIBRESSL_VERSION_NUMBER + RESOLVEFUNC(SSL_session_reused) ++#endif + RESOLVEFUNC(SSL_get_session) ++#ifndef LIBRESSL_VERSION_NUMBER + RESOLVEFUNC(SSL_set_options) ++#endif + RESOLVEFUNC(CRYPTO_get_ex_new_index) + RESOLVEFUNC(TLS_method) + RESOLVEFUNC(TLS_client_method) +@@ -936,12 +1014,16 @@ bool q_resolveOpenSslSymbols() + + RESOLVEFUNC(SSL_SESSION_get_ticket_lifetime_hint) + RESOLVEFUNC(DH_bits) ++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER >= 0x03050000fL + RESOLVEFUNC(DSA_bits) ++#endif + + #if QT_CONFIG(dtls) ++#if !defined(LIBRESSL_VERSION_NUMBER) || defined(BIO_F_BIO_ADDR_NEW) + RESOLVEFUNC(DTLSv1_listen) + RESOLVEFUNC(BIO_ADDR_new) + RESOLVEFUNC(BIO_ADDR_free) ++#endif // !LIBRESSL_VERSION_NUMBER || BIO_F_BIO_ADDR_NEW + RESOLVEFUNC(BIO_meth_new) + RESOLVEFUNC(BIO_meth_free) + RESOLVEFUNC(BIO_meth_set_write) +@@ -966,7 +1048,9 @@ bool q_resolveOpenSslSymbols() + RESOLVEFUNC(OCSP_check_validity) + RESOLVEFUNC(OCSP_cert_to_id) + RESOLVEFUNC(OCSP_id_get0_info) ++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER >= 0x03050000fL + RESOLVEFUNC(OCSP_resp_get0_certs) ++#endif + RESOLVEFUNC(OCSP_basic_sign) + RESOLVEFUNC(OCSP_response_create) + RESOLVEFUNC(i2d_OCSP_RESPONSE) +@@ -1003,7 +1087,9 @@ bool q_resolveOpenSslSymbols() + RESOLVEFUNC(EC_GROUP_get_degree) + #endif + RESOLVEFUNC(BN_num_bits) ++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER >= 0x03050000fL + RESOLVEFUNC(BN_is_word) ++#endif + RESOLVEFUNC(BN_mod_word) + RESOLVEFUNC(DSA_new) + RESOLVEFUNC(DSA_free) +@@ -1096,12 +1182,14 @@ bool q_resolveOpenSslSymbols() + RESOLVEFUNC(SSL_CTX_use_RSAPrivateKey) + RESOLVEFUNC(SSL_CTX_use_PrivateKey_file) + RESOLVEFUNC(SSL_CTX_get_cert_store); ++#ifndef LIBRESSL_VERSION_NUMBER + RESOLVEFUNC(SSL_CONF_CTX_new); + RESOLVEFUNC(SSL_CONF_CTX_free); + RESOLVEFUNC(SSL_CONF_CTX_set_ssl_ctx); + RESOLVEFUNC(SSL_CONF_CTX_set_flags); + RESOLVEFUNC(SSL_CONF_CTX_finish); + RESOLVEFUNC(SSL_CONF_cmd); ++#endif + RESOLVEFUNC(SSL_accept) + RESOLVEFUNC(SSL_clear) + RESOLVEFUNC(SSL_connect) +@@ -1129,7 +1217,11 @@ bool q_resolveOpenSslSymbols() + RESOLVEFUNC(SSL_set_bio) + RESOLVEFUNC(SSL_set_connect_state) + RESOLVEFUNC(SSL_shutdown) ++#ifndef LIBRESSL_VERSION_NUMBER + RESOLVEFUNC(SSL_in_init) ++#else ++ RESOLVEFUNC(SSL_state) ++#endif + RESOLVEFUNC(SSL_get_shutdown) + RESOLVEFUNC(SSL_set_session) + RESOLVEFUNC(SSL_SESSION_free) +diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h +index bf165f67ad0..08caa050b2e 100644 +--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h ++++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h +@@ -72,6 +72,8 @@ + #include "qsslsocket_openssl_p.h" + #include + ++#include ++ + #if QT_CONFIG(ocsp) + #include "qocsp_p.h" + #endif +@@ -80,6 +82,16 @@ QT_BEGIN_NAMESPACE + + #define DUMMYARG + ++#ifdef LIBRESSL_VERSION_NUMBER ++typedef _STACK STACK; ++typedef STACK OPENSSL_STACK; ++typedef void OPENSSL_INIT_SETTINGS; ++typedef int (*X509_STORE_CTX_verify_cb)(int ok,X509_STORE_CTX *ctx); ++#ifndef BIO_F_BIO_ADDR_NEW ++typedef struct bio_addr_st BIO_ADDR; ++#endif ++#endif ++ + #if !defined QT_LINKED_OPENSSL + // **************** Shared declarations ****************** + // ret func(arg) +@@ -230,21 +242,20 @@ const unsigned char * q_ASN1_STRING_get0_data(const ASN1_STRING *x); + Q_AUTOTEST_EXPORT BIO *q_BIO_new(const BIO_METHOD *a); + Q_AUTOTEST_EXPORT const BIO_METHOD *q_BIO_s_mem(); + ++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER >= 0x03050000fL + int q_DSA_bits(DSA *a); ++#else ++#define q_DSA_bits(dsa) q_BN_num_bits((dsa)->p) ++#endif + void q_AUTHORITY_INFO_ACCESS_free(AUTHORITY_INFO_ACCESS *a); + int q_EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c); + Q_AUTOTEST_EXPORT int q_EVP_PKEY_up_ref(EVP_PKEY *a); ++#ifdef OPENSSL_NO_DEPRECATED_3_0 + EVP_PKEY_CTX *q_EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); + void q_EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); + int q_EVP_PKEY_param_check(EVP_PKEY_CTX *ctx); ++#endif // OPENSSL_NO_DEPRECATED_3_0 + int q_RSA_bits(RSA *a); +-Q_AUTOTEST_EXPORT int q_OPENSSL_sk_num(OPENSSL_STACK *a); +-Q_AUTOTEST_EXPORT void q_OPENSSL_sk_pop_free(OPENSSL_STACK *a, void (*b)(void *)); +-Q_AUTOTEST_EXPORT OPENSSL_STACK *q_OPENSSL_sk_new_null(); +-Q_AUTOTEST_EXPORT void q_OPENSSL_sk_push(OPENSSL_STACK *st, void *data); +-Q_AUTOTEST_EXPORT void q_OPENSSL_sk_free(OPENSSL_STACK *a); +-Q_AUTOTEST_EXPORT void * q_OPENSSL_sk_value(OPENSSL_STACK *a, int b); +-int q_SSL_session_reused(SSL *a); + + #if OPENSSL_VERSION_MAJOR < 3 + using qssloptions = unsigned long; +@@ -252,7 +263,33 @@ using qssloptions = unsigned long; + using qssloptions = uint64_t; + #endif // OPENSSL_VERSION_MAJOR + ++#if !defined(LIBRESSL_VERSION_NUMBER) ++Q_AUTOTEST_EXPORT int q_OPENSSL_sk_num(OPENSSL_STACK *a); ++Q_AUTOTEST_EXPORT void q_OPENSSL_sk_pop_free(OPENSSL_STACK *a, void (*b)(void *)); ++Q_AUTOTEST_EXPORT OPENSSL_STACK *q_OPENSSL_sk_new_null(); ++Q_AUTOTEST_EXPORT void q_OPENSSL_sk_push(OPENSSL_STACK *st, void *data); ++Q_AUTOTEST_EXPORT void q_OPENSSL_sk_free(OPENSSL_STACK *a); ++Q_AUTOTEST_EXPORT void * q_OPENSSL_sk_value(OPENSSL_STACK *a, int b); ++int q_SSL_session_reused(SSL *a); + qssloptions q_SSL_CTX_set_options(SSL_CTX *ctx, qssloptions op); ++#else // LIBRESSL_VERSION_NUMBER ++int q_sk_num(STACK *a); ++#define q_OPENSSL_sk_num(a) q_sk_num(a) ++void q_sk_pop_free(STACK *a, void (*b)(void *)); ++#define q_OPENSSL_sk_pop_free(a, b) q_sk_pop_free(a, b) ++STACK *q_sk_new_null(); ++#define q_OPENSSL_sk_new_null() q_sk_new_null() ++void q_sk_push(STACK *st, void *data); ++#define q_OPENSSL_sk_push(st, data) q_sk_push(st, data) ++void q_sk_free(STACK *a); ++#define q_OPENSSL_sk_free q_sk_free ++void *q_sk_value(STACK *a, int b); ++#define q_OPENSSL_sk_value(a, b) q_sk_value(a, b) ++#define q_SSL_session_reused(ssl) \ ++q_SSL_ctrl((ssl), SSL_CTRL_GET_SESSION_REUSED, 0, NULL) ++#define q_SSL_CTX_set_options(ctx, op) \ ++q_SSL_CTX_ctrl((ctx), SSL_CTRL_OPTIONS, (op), NULL) ++#endif // LIBRESSL_VERSION_NUMBER + int q_OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); + size_t q_SSL_get_client_random(SSL *a, unsigned char *out, size_t outlen); + size_t q_SSL_SESSION_get_master_key(const SSL_SESSION *session, unsigned char *out, size_t outlen); +@@ -278,8 +315,13 @@ int q_DH_bits(DH *dh); + # define q_SSL_load_error_strings() q_OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \ + | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) + ++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER >= 0x03050000fL + #define q_SKM_sk_num(st) q_OPENSSL_sk_num((OPENSSL_STACK *)st) + #define q_SKM_sk_value(type, st,i) (type *)q_OPENSSL_sk_value((OPENSSL_STACK *)st, i) ++#else ++#define q_SKM_sk_num(st) q_sk_num((OPENSSL_STACK *)st) ++#define q_SKM_sk_value(type, st,i) (type *)q_sk_value((OPENSSL_STACK *)st, i) ++#endif // LIBRESSL_VERSION_NUMBER + + #define q_OPENSSL_add_all_algorithms_conf() q_OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ + | OPENSSL_INIT_ADD_ALL_DIGESTS \ +@@ -292,7 +334,12 @@ long q_OpenSSL_version_num(); + const char *q_OpenSSL_version(int type); + + unsigned long q_SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *session); ++#ifndef LIBRESSL_VERSION_NUMBER + unsigned long q_SSL_set_options(SSL *s, unsigned long op); ++#else ++#define q_SSL_set_options(ssl, op) \ ++q_SSL_ctrl((ssl), SSL_CTRL_OPTIONS, (op), NULL) ++#endif + + #ifdef TLS1_3_VERSION + int q_SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str); +@@ -381,7 +428,12 @@ BIO *q_BIO_new_mem_buf(void *a, int b); + int q_BIO_read(BIO *a, void *b, int c); + Q_AUTOTEST_EXPORT int q_BIO_write(BIO *a, const void *b, int c); + int q_BN_num_bits(const BIGNUM *a); ++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER >= 0x03050000fL + int q_BN_is_word(BIGNUM *a, BN_ULONG w); ++#else ++#define q_BN_is_word(a, w) (((((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) \ ++|| (((w) == 0) && ((a)->top == 0))) && (!(w) || !(a)->neg)) ++#endif + BN_ULONG q_BN_mod_word(const BIGNUM *a, BN_ULONG w); + + #ifndef OPENSSL_NO_EC +@@ -515,12 +567,14 @@ int q_SSL_CTX_use_PrivateKey(SSL_CTX *a, EVP_PKEY *b); + int q_SSL_CTX_use_RSAPrivateKey(SSL_CTX *a, RSA *b); + int q_SSL_CTX_use_PrivateKey_file(SSL_CTX *a, const char *b, int c); + X509_STORE *q_SSL_CTX_get_cert_store(const SSL_CTX *a); ++#ifndef LIBRESSL_VERSION_NUMBER + SSL_CONF_CTX *q_SSL_CONF_CTX_new(); + void q_SSL_CONF_CTX_free(SSL_CONF_CTX *a); + void q_SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX *a, SSL_CTX *b); + unsigned int q_SSL_CONF_CTX_set_flags(SSL_CONF_CTX *a, unsigned int b); + int q_SSL_CONF_CTX_finish(SSL_CONF_CTX *a); + int q_SSL_CONF_cmd(SSL_CONF_CTX *a, const char *b, const char *c); ++#endif + void q_SSL_free(SSL *a); + STACK_OF(SSL_CIPHER) *q_SSL_get_ciphers(const SSL *a); + const SSL_CIPHER *q_SSL_get_current_cipher(SSL *a); +@@ -536,7 +590,12 @@ void q_SSL_set_bio(SSL *a, BIO *b, BIO *c); + void q_SSL_set_accept_state(SSL *a); + void q_SSL_set_connect_state(SSL *a); + int q_SSL_shutdown(SSL *a); ++#ifndef LIBRESSL_VERSION_NUMBER + int q_SSL_in_init(const SSL *s); ++#else ++int q_SSL_state(const SSL *s); ++#define q_SSL_in_init(s) (q_SSL_state((s))&SSL_ST_INIT) ++#endif + int q_SSL_get_shutdown(const SSL *ssl); + int q_SSL_set_session(SSL *to, SSL_SESSION *session); + void q_SSL_SESSION_free(SSL_SESSION *ses); +@@ -695,9 +754,23 @@ void *q_X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx, int idx); + int q_SSL_get_ex_data_X509_STORE_CTX_idx(); + + #if QT_CONFIG(dtls) ++#ifdef DTLS_CTRL_SET_LINK_MTU + #define q_DTLS_set_link_mtu(ssl, mtu) q_SSL_ctrl((ssl), DTLS_CTRL_SET_LINK_MTU, (mtu), nullptr) ++#else ++#define q_DTLS_set_link_mtu(ssl, mtu) 0 ++#endif // DTLS_CTRL_SET_LINK_MTU ++ ++#ifdef DTLS_CTRL_GET_TIMEOUT + #define q_DTLSv1_get_timeout(ssl, arg) q_SSL_ctrl(ssl, DTLS_CTRL_GET_TIMEOUT, 0, arg) ++#else ++#define q_DTLSv1_get_timeout(ssl, arg) 0 ++#endif // DTLS_CTRL_GET_TIMEOUT ++ ++#ifdef DTLS_CTRL_HANDLE_TIMEOUT + #define q_DTLSv1_handle_timeout(ssl) q_SSL_ctrl(ssl, DTLS_CTRL_HANDLE_TIMEOUT, 0, nullptr) ++#else ++#define q_DTLSv1_handle_timeout(ssl) 0 ++#endif // DTLS_CTRL_HANDLE_TIMEOUT + #endif // dtls + + void q_BIO_set_flags(BIO *b, int flags); +@@ -742,7 +815,11 @@ int q_OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, ASN1_GENERALIZEDTIME *n + int q_OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, ASN1_OCTET_STRING **pikeyHash, + ASN1_INTEGER **pserial, OCSP_CERTID *cid); + ++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER >= 0x03050000fL + const STACK_OF(X509) *q_OCSP_resp_get0_certs(const OCSP_BASICRESP *bs); ++#else ++#define q_OCSP_resp_get0_certs(bs) ((bs)->certs) ++#endif + Q_AUTOTEST_EXPORT OCSP_CERTID *q_OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer); + Q_AUTOTEST_EXPORT void q_OCSP_CERTID_free(OCSP_CERTID *cid); + int q_OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b); +@@ -762,10 +839,13 @@ int q_OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b); + void *q_CRYPTO_malloc(size_t num, const char *file, int line); + #define q_OPENSSL_malloc(num) q_CRYPTO_malloc(num, "", 0) + void q_CRYPTO_free(void *str, const char *file, int line); ++inline void q_CRYPTO_free(void *str) { q_CRYPTO_free(str, "", 0); } + #define q_OPENSSL_free(addr) q_CRYPTO_free(addr, "", 0) + ++#ifdef SSL_SECOP_PEER + int q_SSL_CTX_get_security_level(const SSL_CTX *ctx); + void q_SSL_CTX_set_security_level(SSL_CTX *ctx, int level); ++#endif //SSL_SECOP_PEER + + QT_END_NAMESPACE + diff --git a/rust/rustc-1.93.1-external-llvm-bootstrap-lld-fallback.patch b/rust/rustc-1.93.1-external-llvm-bootstrap-lld-fallback.patch new file mode 100644 index 0000000..9805fac --- /dev/null +++ b/rust/rustc-1.93.1-external-llvm-bootstrap-lld-fallback.patch @@ -0,0 +1,74 @@ +--- a/src/bootstrap/src/core/config/config.rs ++++ b/src/bootstrap/src/core/config/config.rs +@@ -628,7 +628,7 @@ + ); + } + +- let bootstrap_override_lld = ++ let mut bootstrap_override_lld = + rust_bootstrap_override_lld.or(rust_bootstrap_override_lld_legacy).unwrap_or_default(); + + if rust_optimize.as_ref().is_some_and(|v| matches!(v, RustOptimize::Bool(false))) { +@@ -978,6 +978,20 @@ + let is_host_system_llvm = + is_system_llvm(&target_config, llvm_from_ci, host_target, host_target); + ++ // Self-contained bootstrap LLD comes from the stage0 sysroot (`rust-lld`), whose LLVM ++ // version may differ from an externally configured host LLVM. In that case, linking LLVM ++ // bitcode objects can fail with "Unknown attribute kind". ++ if is_host_system_llvm ++ && matches!(bootstrap_override_lld, BootstrapOverrideLld::SelfContained) ++ { ++ eprintln!( ++ "WARNING: `rust.bootstrap-override-lld = \"self-contained\"` with external host \ ++ `llvm-config` can cause LLVM bitcode version mismatches; falling back to \ ++ `rust.bootstrap-override-lld = \"external\"` for bootstrap linking." ++ ); ++ bootstrap_override_lld = BootstrapOverrideLld::External; ++ } ++ + if llvm_from_ci { + let warn = |option: &str| { + println!( +@@ -1042,21 +1056,27 @@ + let default_linux_linker_override = match linker_override { + DefaultLinuxLinkerOverride::Off => continue, + DefaultLinuxLinkerOverride::SelfContainedLldCc => { +- // If we automatically default to the self-contained LLD linker, +- // we also need to handle the rust.lld option. +- match rust_lld_enabled { +- // If LLD was not enabled explicitly, we enable it, unless LLVM config has +- // been set +- None if !is_host_system_llvm => { +- lld_enabled = true; +- Some(DefaultLinuxLinkerOverride::SelfContainedLldCc) ++ // If bootstrap is explicitly using an external `lld` binary, do not also ++ // embed a self-contained rust-lld default into rustc's Linux target spec. ++ if matches!(bootstrap_override_lld, BootstrapOverrideLld::External) { ++ None ++ } else { ++ // If we automatically default to the self-contained LLD linker, ++ // we also need to handle the rust.lld option. ++ match rust_lld_enabled { ++ // If LLD was not enabled explicitly, we enable it, unless LLVM config has ++ // been set ++ None if !is_host_system_llvm => { ++ lld_enabled = true; ++ Some(DefaultLinuxLinkerOverride::SelfContainedLldCc) ++ } ++ None => None, ++ // If it was enabled already, we don't need to do anything ++ Some(true) => Some(DefaultLinuxLinkerOverride::SelfContainedLldCc), ++ // If it was explicitly disabled, we do not apply the ++ // linker override ++ Some(false) => None, + } +- None => None, +- // If it was enabled already, we don't need to do anything +- Some(true) => Some(DefaultLinuxLinkerOverride::SelfContainedLldCc), +- // If it was explicitly disabled, we do not apply the +- // linker override +- Some(false) => None, + } + } + }; diff --git a/rust/rustc-1.93.1-llvm22-passplugin-include.patch b/rust/rustc-1.93.1-llvm22-passplugin-include.patch new file mode 100644 index 0000000..5b2697a --- /dev/null +++ b/rust/rustc-1.93.1-llvm22-passplugin-include.patch @@ -0,0 +1,14 @@ +--- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp ++++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +@@ -23,7 +23,11 @@ + #include "llvm/MC/TargetRegistry.h" + #include "llvm/Object/ObjectFile.h" + #include "llvm/Passes/PassBuilder.h" ++#if LLVM_VERSION_GE(22, 0) ++#include "llvm/Plugins/PassPlugin.h" ++#else + #include "llvm/Passes/PassPlugin.h" ++#endif + #include "llvm/Passes/StandardInstrumentations.h" + #include "llvm/Support/CBindingWrapping.h" + #include "llvm/Support/FileSystem.h" diff --git a/rust/rustc-1.93.1-uefi-use-lld-link.patch b/rust/rustc-1.93.1-uefi-use-lld-link.patch new file mode 100644 index 0000000..7e459e2 --- /dev/null +++ b/rust/rustc-1.93.1-uefi-use-lld-link.patch @@ -0,0 +1,13 @@ +--- a/compiler/rustc_target/src/spec/base/uefi_msvc.rs ++++ b/compiler/rustc_target/src/spec/base/uefi_msvc.rs +@@ -45,7 +45,9 @@ + // "Windows". + stack_probes: StackProbeType::Call, + singlethread: true, +- linker: Some("rust-lld".into()), ++ // Use the system LLD frontend name. Distro/toolchain builds that use an external LLVM ++ // often do not ship a `rust-lld` wrapper binary. ++ linker: Some("lld-link".into()), + entry_name: "efi_main".into(), + ..base + } diff --git a/shared-mime-info/shared-mime-info-2.4-posixify.patch b/shared-mime-info/shared-mime-info-2.4-posixify.patch new file mode 100644 index 0000000..8216772 --- /dev/null +++ b/shared-mime-info/shared-mime-info-2.4-posixify.patch @@ -0,0 +1,71 @@ +diff --git a/po/check_translations.sh b/po/check_translations.sh +index 76562cb..146b810 100755 +--- a/po/check_translations.sh ++++ b/po/check_translations.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + # Go to po directory + cd "$(dirname "${0}")" || exit 1 +diff --git a/tests/test_duplicate_mime_types.sh b/tests/test_duplicate_mime_types.sh +index e7dfb15..1b1245b 100755 +--- a/tests/test_duplicate_mime_types.sh ++++ b/tests/test_duplicate_mime_types.sh +@@ -1,20 +1,20 @@ +-#!/usr/bin/env bash +-set -euo pipefail ++#!/bin/sh ++set -eu + + : ${1:?filename argument missing} + xml_db_file="${1}" +-test -f ${xml_db_file} || { +- printf "%s: no such file\n" ${xml_db_file} >&2 ++test -f "${xml_db_file}" || { ++ printf '%s: no such file\n' "${xml_db_file}" >&2 + exit 1 + } + + duplicated=$( + xmllint --xpath \ + "//*[local-name()='mime-type' or local-name()='alias']/@type" \ +- ${xml_db_file} | tr ' ' '\n' | sort | uniq -d ++ "${xml_db_file}" | tr ' ' '\n' | sort | uniq -d + ) + +-if [[ -n "${duplicated}" ]]; then ++if [ -n "${duplicated}" ]; then + echo "*************************************************************" + echo "** Some mime-types are duplicated, fix before committing: **" + echo "${duplicated}" +diff --git a/tests/test_generic_icons.sh b/tests/test_generic_icons.sh +index de6c56f..41877f6 100755 +--- a/tests/test_generic_icons.sh ++++ b/tests/test_generic_icons.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + + xml_db_file="${1}" + +diff --git a/tests/test_mime.sh b/tests/test_mime.sh +index 49c531b..b3e9fef 100755 +--- a/tests/test_mime.sh ++++ b/tests/test_mime.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + set -e + + source_root="${1}" +diff --git a/tests/test_staging.sh b/tests/test_staging.sh +index a993dce..b62878c 100755 +--- a/tests/test_staging.sh ++++ b/tests/test_staging.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + set -e + + source_root="${1}" diff --git a/toybox/toybox-0.8.13-bmake-compat.patch b/toybox/toybox-0.8.13-bmake-compat.patch new file mode 100644 index 0000000..ddd35e2 --- /dev/null +++ b/toybox/toybox-0.8.13-bmake-compat.patch @@ -0,0 +1,19 @@ +--- a/Makefile 2025-10-14 11:45:35.000000000 -0500 ++++ b/Makefile 2026-04-19 19:05:43.860155683 -0500 +@@ -7,7 +7,15 @@ + + HOSTCC?=cc + +-export CROSS_COMPILE CFLAGS OPTIMIZE LDOPTIMIZE CC HOSTCC V STRIP ASAN ++export CROSS_COMPILE?= ++export CFLAGS?= ++export OPTIMIZE?= ++export LDOPTIMIZE?= ++export CC?= ++export HOSTCC?= ++export V?= ++export STRIP?= ++export ASAN?= + + all: toybox + diff --git a/toybox/toybox-0.8.13-posix-shell.patch b/toybox/toybox-0.8.13-posix-shell.patch new file mode 100644 index 0000000..3acf980 --- /dev/null +++ b/toybox/toybox-0.8.13-posix-shell.patch @@ -0,0 +1,468 @@ +--- a/configure ++++ b/configure +@@ -1,10 +1,10 @@ +-#!/bin/bash ++#!/bin/sh + + # set environment variables used by scripts/make.sh + + # People run ./configure out of habit, so do "defconfig" for them. + +-if [ "$(basename "$0")" == configure ] ++if [ "$(basename "$0")" = configure ] + then + echo "Assuming you want 'make defconfig', but you should probably check the README." + make defconfig +@@ -12,8 +12,12 @@ + fi + + # Warn about stuff, disable stupid warnings, be 8-bit clean for utf8. +-[ "${CFLAGS/-funsigned-char//}" == "$CFLAGS" ] && +- CFLAGS+=" -Wall -Wundef -Werror=implicit-function-declaration -Wno-char-subscripts -Wno-pointer-sign -funsigned-char" ++case " ${CFLAGS-} " in ++ *" -funsigned-char "*) ;; ++ *) ++ CFLAGS="${CFLAGS-} -Wall -Wundef -Werror=implicit-function-declaration -Wno-char-subscripts -Wno-pointer-sign -funsigned-char" ++ ;; ++esac + + # Set default values if variable not already set + : ${CC:=cc} ${HOSTCC:=cc} ${GENDIR:=generated} ${KCONFIG_CONFIG:=.config} +--- a/scripts/portability.sh ++++ b/scripts/portability.sh +@@ -1,6 +1,6 @@ + # sourced to find alternate names for things + +-source ./configure ++. ./configure + + if [ -z "$(command -v "$CROSS_COMPILE$CC")" ] + then +@@ -8,15 +8,20 @@ + exit 1 + fi + +-if [ -z "$SED" ] ++if [ -z "${SED:-}" ] + then +- [ ! -z "$(command -v gsed 2>/dev/null)" ] && SED=gsed || SED=sed ++ if command -v gsed >/dev/null 2>&1 ++ then ++ SED=gsed ++ else ++ SED=sed ++ fi + fi + + # Tell linker to do dead code elimination at function level +-if [ "$(uname)" == "Darwin" ] ++if [ "$(uname)" = "Darwin" ] + then +- CFLAGS+=" -Wno-deprecated-declarations" ++ CFLAGS="${CFLAGS} -Wno-deprecated-declarations" + : ${LDOPTIMIZE:=-Wl,-dead_strip} ${STRIP:=strip} + else + : ${LDOPTIMIZE:=-Wl,--gc-sections -Wl,--as-needed} ${STRIP:=strip -s -R .note* -R .comment} +@@ -24,9 +29,9 @@ + + # Disable pointless warnings only clang produces + [ -n "$("$CROSS_COMPILE$CC" --version | grep -w clang)" ] && +- CFLAGS+=" -Wno-string-plus-int -Wno-invalid-source-encoding" || ++ CFLAGS="${CFLAGS} -Wno-string-plus-int -Wno-invalid-source-encoding" || + # And ones only gcc produces +- CFLAGS+=" -Wno-restrict -Wno-format-overflow" ++ CFLAGS="${CFLAGS} -Wno-restrict -Wno-format-overflow" + + # Address Sanitizer + if [ -n "$ASAN" ]; then +@@ -55,9 +60,10 @@ + + # Run a C file from scripts/*.c using $HOSTCC as necessary + brun() { +- [ ! -e "$UNSTRIPPED"/$1 -o "$UNSTRIPPED"/$1 -ot scripts/$1.c ] && ++ tool=$1 ++ shift ++ [ ! -e "$UNSTRIPPED"/$tool -o "$UNSTRIPPED"/$tool -ot scripts/$tool.c ] && + { mkdir -p "$UNSTRIPPED" && +- do_loudly $HOSTCC scripts/$1.c -o "$UNSTRIPPED"/$1 || exit 1; } +- do_loudly "$UNSTRIPPED"/$1 "${@:2}" ++ do_loudly $HOSTCC scripts/$tool.c -o "$UNSTRIPPED"/$tool || exit 1; } ++ do_loudly "$UNSTRIPPED"/$tool "$@" + } +- +--- a/scripts/genconfig.sh ++++ b/scripts/genconfig.sh +@@ -1,9 +1,9 @@ +-#!/bin/bash ++#!/bin/sh + + # This has to be a separate file from scripts/make.sh so it can be called + # before menuconfig. (It's called again from scripts/make.sh just to be sure.) + +-source scripts/portability.sh ++. scripts/portability.sh + + mkdir -p "$GENDIR" + +@@ -16,9 +16,11 @@ + # Symbol name is first argument, flags second, feed C file to stdin + probesymbol() + { +- probecc "${@:2}" 2>/dev/null && DEFAULT=y || DEFAULT=n ++ symbol=$1 ++ shift ++ probecc "$@" 2>/dev/null && DEFAULT=y || DEFAULT=n + rm a.out 2>/dev/null +- echo -e "config $1\n\tbool\n\tdefault $DEFAULT\n" || exit 1 ++ printf 'config %s\n\tbool\n\tdefault %s\n\n' "$symbol" "$DEFAULT" || exit 1 + } + + probeconfig() +@@ -35,7 +37,7 @@ + #include + int main(int argc, char *argv[]) { return fork(); } + EOF +- echo -e '\tdepends on !TOYBOX_FORCE_NOMMU' ++ printf '\tdepends on !TOYBOX_FORCE_NOMMU\n' + } + + genconfig() +@@ -77,20 +79,22 @@ + toys toys/*/*.c | ( + while IFS=":" read FILE NAME + do +- echo -e "test_$NAME:\n\tscripts/test.sh $NAME\n" +- [ "$NAME" == help ] && continue +- [ "$NAME" == install ] && continue +- [ "$NAME" == sh ] && FILE="toys/*/*.c" +- echo -e "$NAME: $FILE *.[ch] lib/*.[ch]\n\tscripts/single.sh $NAME\n" +- [ "${FILE/example//}" != "$FILE" ] && EXAMPLE="$EXAMPLE $NAME" || +- [ "${FILE/pending//}" != "$FILE" ] && PENDING="$PENDING $NAME" || +- WORKING="$WORKING $NAME" ++ printf 'test_%s:\n\tscripts/test.sh %s\n\n' "$NAME" "$NAME" ++ [ "$NAME" = help ] && continue ++ [ "$NAME" = install ] && continue ++ [ "$NAME" = sh ] && FILE="toys/*/*.c" ++ printf '%s: %s *.[ch] lib/*.[ch]\n\tscripts/single.sh %s\n\n' "$NAME" "$FILE" "$NAME" ++ case $FILE in ++ *example*) EXAMPLE="$EXAMPLE $NAME" ;; ++ *pending*) PENDING="$PENDING $NAME" ;; ++ *) WORKING="$WORKING $NAME" ;; ++ esac + done && +-echo -e "clean::\n\t@rm -f $WORKING $PENDING" && +-echo -e "list:\n\t@echo $(echo $WORKING | tr ' ' '\n' | sort | xargs)" && +-echo -e "list_example:\n\t@echo $(echo $EXAMPLE | tr ' ' '\n' | sort | xargs)"&& +-echo -e "list_pending:\n\t@echo $(echo $PENDING | tr ' ' '\n' | sort | xargs)"&& +-echo -e ".PHONY: $WORKING $PENDING" | $SED 's/ \([^ ]\)/ test_\1/g' ++printf 'clean::\n\t@rm -f%s%s\n' "$WORKING" "$PENDING" && ++printf 'list:\n\t@echo %s\n' "$(echo "$WORKING" | tr ' ' '\n' | sort | xargs)" && ++printf 'list_example:\n\t@echo %s\n' "$(echo "$EXAMPLE" | tr ' ' '\n' | sort | xargs)" && ++printf 'list_pending:\n\t@echo %s\n' "$(echo "$PENDING" | tr ' ' '\n' | sort | xargs)" && ++printf '.PHONY:%s%s\n' "$WORKING" "$PENDING" | $SED 's/ \([^ ]\)/ test_\1/g' + ) > .singlemake + + brun kconfig -h > "$GENDIR"/help.h || exit 1 +--- a/scripts/make.sh ++++ b/scripts/make.sh +@@ -1,50 +1,16 @@ +-#!/bin/bash ++#!/bin/sh + + # Grab default values for $CFLAGS and such. +-set -o pipefail +-source scripts/portability.sh +- +-# Shell functions called by the build +- +-DASHN=-n +-true & wait -n 2>/dev/null || { wait; unset DASHN; } +-ratelimit() +-{ +- if [ "$#" -eq 0 ] +- then +- [ -z "$DASHN" ] && PIDS="$PIDS$! " +- [ $((++COUNT)) -lt $CPUS ] && return 0 +- fi +- ((--COUNT)) +- if [ -n "$DASHN" ] +- then +- wait -n +- DONE=$(($DONE+$?)) +- else +- # MacOS uses an ancient version of bash which hasn't got "wait -n", and +- # wait without arguments always returns 0 instead of process exit code. +- # This keeps $CPUS less busy when jobs finish out of order. +- wait ${PIDS%% *} +- DONE=$(($DONE+$?)) +- PIDS=${PIDS#* } +- fi +- +- return $DONE +-} +- +-# Respond to V= by echoing command lines as well as running them +-do_loudly() +-{ +- { [ -n "$V" ] && echo "$@" || echo -n "$DOTPROG" ; } >&2 +- "$@" +-} ++. scripts/portability.sh + + # Is anything under directory $2 newer than generated/$1 (or does it not exist)? + isnewer() + { +- [ -e "$GENDIR/$1" ] && [ -z "$(find "${@:2}" -newer "$GENDIR/$1")" ] && ++ target=$1 ++ shift ++ [ -e "$GENDIR/$target" ] && [ -z "$(find "$@" -newer "$GENDIR/$target")" ] && + return 1 +- echo -n "${DIDNEWER:-$GENDIR/{}$1" ++ printf '%s' "${DIDNEWER:-$GENDIR/{}}$target" + DIDNEWER=, + } + +@@ -64,16 +30,18 @@ + [ -z "$V" ] && X=/dev/null || X=/dev/stderr + for i in util crypt m resolv selinux smack attr crypto z log iconv tls ssl + do +- do_loudly ${CROSS_COMPILE}${CC} $CFLAGS $LDFLAGS -xc - -l$i >>$X 2>&1 \ +- -o /dev/null <<<"int main(int argc,char*argv[]){return 0;}" && +- echo -l$i & ++ printf '%s\n' 'int main(int argc,char*argv[]){return 0;}' | ++ do_loudly ${CROSS_COMPILE}${CC} $CFLAGS $LDFLAGS -xc - -l$i >>$X 2>&1 \ ++ -o /dev/null && echo -l$i & + done | sort | xargs + ) + # Actually resolve dangling dependencies in extra libraries when static linking +-[ -n "$LIBRARIES" ] && [ "$LDFLAGS" != "${LDFLAGS/-static/}" ] && +- LIBRARIES="-Wl,--start-group $LIBRARIES -Wl,--end-group" ++[ -n "$LIBRARIES" ] && ++case $LDFLAGS in ++ *-static*) LIBRARIES="-Wl,--start-group $LIBRARIES -Wl,--end-group" ;; ++esac + +-[ -z "$VERSION" ] && [ -d ".git" ] && [ -n "$(which git 2>/dev/null)" ] && ++[ -z "$VERSION" ] && [ -d ".git" ] && command -v git >/dev/null 2>&1 && + VERSION="$(git describe --tags --abbrev=12 2>/dev/null)" + + # Set/record build environment information +@@ -93,33 +61,42 @@ + + # Make sure rm -rf isn't gonna go funny + B="$(readlink -f "$PWD")/" A="$(readlink -f "$GENDIR")" A="${A%/}"/ +-[ "$A" == "${B::${#A}}" ] && +- { echo "\$GENDIR=$GENDIR cannot include \$PWD=$PWD"; exit 1; } ++case $B in ++ "$A"*) ++ echo "\$GENDIR=$GENDIR cannot include \$PWD=$PWD" ++ exit 1 ++ ;; ++esac + unset A B DOTPROG DIDNEWER + + # Force full rebuild if our compiler/linker options changed +-cmp -s <(compflags | grep '#d') <(grep '%d' "$GENDIR"/build.sh 2>/dev/null) || +- rm -rf "$GENDIR"/* # Keep symlink, delete contents ++new_build=$(mktemp) ++old_build=$(mktemp) ++compflags | grep '#d' > "$new_build" ++grep '#d' "$GENDIR"/build.sh 2>/dev/null > "$old_build" || : ++cmp -s "$new_build" "$old_build" || rm -rf "$GENDIR"/* # Keep symlink, delete contents ++rm -f "$new_build" "$old_build" + mkdir -p "$UNSTRIPPED" "$(dirname $OUTNAME)" || exit 1 + + # Extract a list of toys/*/*.c files to compile from the data in $KCONFIG_CONFIG + # (First command names, then filenames with relevant {NEW,OLD}TOY() macro.) + +-[ -n "$V" ] && echo -e "\nWhich C files to build..." ++[ -n "$V" ] && printf '\nWhich C files to build...\n' + TOYFILES="$($SED -n 's/^CONFIG_\([^=]*\)=.*/\1/p' "$KCONFIG_CONFIG" | xargs | tr ' ' '|')" + TOYFILES="main.c $(egrep -l "^USE_($TOYFILES)[(]...TOY[(]" toys/*/*.c | xargs)" + +-if [ "${TOYFILES/pending//}" != "$TOYFILES" ] +-then +- echo -e "\n\033[1;31mwarning: using unfinished code from toys/pending\033[0m" +-fi ++case $TOYFILES in ++ *pending*) ++ printf '\n\033[1;31mwarning: using unfinished code from toys/pending\033[0m\n' ++ ;; ++esac + + # Write build variables (and set them locally), then append build invocation. +-compflags > "$GENDIR"/build.sh && source "$GENDIR/build.sh" && ++compflags > "$GENDIR"/build.sh && . "$GENDIR"/build.sh && + { +- echo FILES=$'"\n'"$(fold -s <<<"$TOYFILES")"$'\n"' && ++ printf 'FILES="\n%s\n"\n' "$(printf '%s\n' "$TOYFILES" | fold -s)" && + echo && +- echo -e "\$BUILD lib/*.c \$FILES \$LINK -o $OUTNAME" ++ printf '%s\n' "\$BUILD lib/*.c \$FILES \$LINK -o $OUTNAME" + } >> "$GENDIR"/build.sh && + chmod +x "$GENDIR"/build.sh || exit 1 + +@@ -133,7 +110,7 @@ + B="$(egrep "^CONFIG_($(echo "$A" | sed 's/=[yn]//' | xargs | tr ' ' '|'))=" "$KCONFIG_CONFIG" | $SED 's/^CONFIG_//' | sort)" + A="$(echo "$A" | grep -v =n)" + [ "$A" != "$B" ] && +- { echo -e "\nWarning: Config.probed changed, run 'make oldconfig'" >&2; } ++ { printf "\nWarning: Config.probed changed, run 'make oldconfig'\n" >&2; } + unset A B + + # Create a list of all the commands toybox can provide. +@@ -171,7 +148,7 @@ + + echo "#define NEWTOY(aa,bb,cc) aa $I bb" + echo '#define OLDTOY(...)' +- if [ "$I" == A ] ++ if [ "$I" = A ] + then + cat "$GENDIR"/config.h + else +@@ -207,8 +184,8 @@ + $TOYFILES)" + echo "$STRUX" && + echo "extern union global_union {" && +- $SED -n 's/^struct \(.*\)_data .*/\1/;T;s/.*/\tstruct &_data &;/p' \ +- <<<"$STRUX" && ++ printf '%s\n' "$STRUX" | \ ++ $SED -n 's/^struct \(.*\)_data .*/\1/;T;s/.*/\tstruct &_data &;/p' && + echo "} this;" + } > "$GENDIR"/globals.h || exit 1 + +@@ -220,8 +197,10 @@ + for j in $i; do + [ $X -eq 31 ] && LL=LL + NAME="$HEAD$j" ++ VALUE="(1$LL<<$X)" + printf "#define $NAME %*s%s\n#define _$NAME %*s%s\n" \ +- $((32-${#NAME})) "" "$X" $((31-${#NAME})) "" "(1$LL<<$((X++)))" || exit 1 ++ $((32-${#NAME})) "" "$X" $((31-${#NAME})) "" "$VALUE" || exit 1 ++ X=$((X+1)) + done + done > "$GENDIR"/tags.h || exit 1 + +@@ -240,7 +219,7 @@ + rm -f "$GENDIR"/zhelp.h + fi + +-[ -z "$DIDNEWER" ] || echo } ++[ -z "$DIDNEWER" ] || echo '}' + [ -n "$NOBUILD" ] && exit 0 + + echo "Compile $OUTNAME" +@@ -260,12 +239,16 @@ + + # build each generated/obj/*.o file in parallel + +-PENDING= LNKFILES= CLICK= DONE=0 COUNT=0 ++LNKFILES= ++CLICK= + for i in lib/*.c click $TOYFILES + do +- [ "$i" == click ] && CLICK=1 && continue ++ [ "$i" = click ] && CLICK=1 && continue + +- X=${i/lib\//lib_} ++ X=$i ++ case $X in ++ lib/*) X=lib_${X#lib/} ;; ++ esac + X=${X##*/} + OUT="$GENDIR/obj/${X%%.c}.o" + LNKFILES="$LNKFILES $OUT" +@@ -274,19 +257,10 @@ + [ "$OUT" -nt "$i" ] && [ -z "$CLICK" -o "$OUT" -nt "$KCONFIG_CONFIG" ] && + continue + +- do_loudly $BUILD -c $i -o $OUT & +- +- ratelimit || break +-done +- +-# wait for all background jobs, detecting errors +-while [ "$COUNT" -gt 0 ] +-do +- ratelimit done ++ do_loudly $BUILD -c $i -o $OUT || exit 1 + done +-[ $DONE -ne 0 ] && exit 1 + +-UNSTRIPPED="$UNSTRIPPED/${OUTNAME/*\//}" ++UNSTRIPPED="$UNSTRIPPED/${OUTNAME##*/}" + do_loudly $BUILD $LNKFILES $LINK -o "$UNSTRIPPED" || exit 1 + if [ -n "$NOSTRIP" ] || + ! do_loudly ${CROSS_COMPILE}${STRIP} "$UNSTRIPPED" -o "$OUTNAME" +--- a/scripts/install.sh ++++ b/scripts/install.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # usage: PREFIX=/target/path scripts/install.sh [--options] + +@@ -12,29 +12,29 @@ + + # Grab default values for $CFLAGS and such (to build scripts/install.c) + +-source scripts/portability.sh ++. scripts/portability.sh + + [ -z "$PREFIX" ] && PREFIX="$PWD/install" + + # Parse command line arguments. + + LONG_PATH="" +-while [ ! -z "$1" ] ++while [ -n "${1:-}" ] + do + # Create symlinks instead of hardlinks? +- [ "$1" == "--symlink" ] && TYPE="-s" ++ [ "$1" = "--symlink" ] && TYPE="-s" + + # Uninstall? +- [ "$1" == "--uninstall" ] && UNINSTALL=Uninstall ++ [ "$1" = "--uninstall" ] && UNINSTALL=Uninstall + + # Delete destination command if it exists? +- [ "$1" == "--force" ] && FORCE="-f" ++ [ "$1" = "--force" ] && FORCE="-f" + + # Use {,usr}/{bin,sbin} paths instead of all files in one directory? +- [ "$1" == "--long" ] && LONG_PATH="bin/" ++ [ "$1" = "--long" ] && LONG_PATH="bin/" + + # Symlink host toolchain binaries to destination to create cross compile $PATH +- [ "$1" == "--airlock" ] && AIRLOCK=1 ++ [ "$1" = "--airlock" ] && AIRLOCK=1 + + shift + done +@@ -52,7 +52,7 @@ + then + mkdir -p "${PREFIX}/${LONG_PATH}" && + rm -f "${PREFIX}/${LONG_PATH}/toybox" && +- cp toybox"${TARGET:+-$TARGET}" ${PREFIX}/${LONG_PATH} || exit 1 ++ cp toybox"${TARGET:+-$TARGET}" "${PREFIX}/${LONG_PATH}/" || exit 1 + else + rm -f "${PREFIX}/${LONG_PATH}/toybox" 2>/dev/null + fi +@@ -107,7 +107,7 @@ + # python and deciding to #include Python.h). + + # mkroot has patches to remove the need for "bc" and "gcc" +-TOOLCHAIN="${TOOLCHAIN//,/ } as cc ld objdump bc gcc" ++TOOLCHAIN="$(printf '%s' "${TOOLCHAIN:-}" | tr ',' ' ') as cc ld objdump bc gcc" + + # The following are commands toybox should provide, but doesn't yet. + # For now symlink the host version. This list must go away by 1.0. +@@ -134,7 +134,7 @@ + ln -sf "$j" "$FALLBACK/$i" || exit 1 + fi + +- X=$[$X+1] ++ X=$((X+1)) + FALLBACK="$PREFIX/fallback-$X" + done + diff --git a/util-linux/all_errnos-posix.patch b/util-linux/all_errnos-posix.patch new file mode 100644 index 0000000..9b398f4 --- /dev/null +++ b/util-linux/all_errnos-posix.patch @@ -0,0 +1,32 @@ +--- a/tools/all_errnos 2025-12-15 05:51:15.366671264 -0600 ++++ b/tools/all_errnos 2026-02-20 21:39:20.242109706 -0600 +@@ -1,9 +1,8 @@ +-#!/bin/bash ++#!/bin/sh + + # Derived from all_syscalls. + + set -e +-set -o pipefail + + SED="$1" + shift +@@ -13,9 +12,16 @@ + #include + " + +-trap 'rm -f $OUTPUT $OUTPUT.deps' ERR ++cleanup() { ++ status=$? ++ if [ "$status" -ne 0 ]; then ++ rm -f "$OUTPUT" "$OUTPUT.deps" ++ fi ++} + +-"$@" -MD -MF "$OUTPUT.deps" <<< "$ERRNO_INCLUDES" -dM -E - \ ++trap cleanup EXIT HUP INT TERM ++ ++printf '%s\n' "$ERRNO_INCLUDES" | "$@" -MD -MF "$OUTPUT.deps" -dM -E - \ + | "$SED" -n -e 's/^[ \t]*#define[ \t]*E\([^ ]*\).*$/UL_ERRNO("E\1", E\1)/p' \ + | sort \ + > "$OUTPUT" diff --git a/util-linux/all_syscalls-posix.patch b/util-linux/all_syscalls-posix.patch new file mode 100644 index 0000000..94faea7 --- /dev/null +++ b/util-linux/all_syscalls-posix.patch @@ -0,0 +1,30 @@ +--- a/tools/all_syscalls 2025-12-15 05:51:15.366671264 -0600 ++++ b/tools/all_syscalls 2026-02-20 21:41:57.730328949 -0600 +@@ -1,7 +1,6 @@ +-#!/bin/bash ++#!/bin/sh + + set -e +-set -o pipefail + + SED="$1" + shift +@@ -11,9 +10,16 @@ + #include + " + +-trap 'rm -f $OUTPUT $OUTPUT.deps' ERR ++cleanup() { ++ status=$? ++ if [ "$status" -ne 0 ]; then ++ rm -f "$OUTPUT" "$OUTPUT.deps" ++ fi ++} + +-"$@" -MD -MF "$OUTPUT.deps" <<< "$SYSCALL_INCLUDES" -dM -E - \ ++trap cleanup EXIT HUP INT TERM ++ ++printf '%s\n' "$SYSCALL_INCLUDES" | "$@" -MD -MF "$OUTPUT.deps" -dM -E - \ + | "$SED" -n -e 's/^#define __NR_\([^ ]*\).*$/UL_SYSCALL("\1", __NR_\1)/p' \ + | sort \ + > "$OUTPUT" diff --git a/vala/vala-0.56.18-posixify.patch b/vala/vala-0.56.18-posixify.patch new file mode 100644 index 0000000..a51e04a --- /dev/null +++ b/vala/vala-0.56.18-posixify.patch @@ -0,0 +1,245 @@ +--- a/build-aux/testrunner.sh ++++ b/build-aux/testrunner.sh +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/sh + # testrunner.sh + # + # Copyright (C) 2006-2008 Jürg Billeter +@@ -26,14 +26,22 @@ + + EXTRA_ENVIRONMENT_FILE=tests-extra-environment.sh + ++sanitize_name() { ++ printf '%s\n' "$1" | tr '/-' '__' ++} ++ ++package_flags() { ++ for package in $PACKAGES; do ++ printf ' --pkg %s' "$package" ++ done ++} ++ + testfile=$1 +-testdirname="$(dirname $testfile)" ++testdirname=$(dirname "$testfile") + testfile=${testfile#$srcdir/} +-testpath=${testfile/.*/} +-testpath=${testpath//\//_} +-testpath=${testpath//-/_} +-if test -f $testdirname/$EXTRA_ENVIRONMENT_FILE; then +- source $testdirname/$EXTRA_ENVIRONMENT_FILE ++testpath=$(sanitize_name "${testfile%.*}") ++if test -f "$testdirname/$EXTRA_ENVIRONMENT_FILE"; then ++ . "$testdirname/$EXTRA_ENVIRONMENT_FILE" + fi + + vapidir=$abs_top_srcdir/vapi +@@ -57,21 +65,25 @@ + + # Incorporate the TEST_CFLAGS. + for cflag in ${TEST_CFLAGS}; do +- VALAFLAGS="${VALAFLAGS} -X ${cflag}" ++ VALAFLAGS="${VALAFLAGS} -X ${cflag}" + done + + # Incorporate the user's CFLAGS. Matters if the user decided to insert + # -m32 in CFLAGS, for example. + for cflag in ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do +- if [[ ! $cflag =~ ^\-O[0-9]$ ]]; then +- VALAFLAGS="${VALAFLAGS} -X ${cflag}" +- fi ++ case $cflag in ++ -O[0-9]) ++ ;; ++ *) ++ VALAFLAGS="${VALAFLAGS} -X ${cflag}" ++ ;; ++ esac + done + +-function testheader() { ++testheader() { + if [ "$1" = "Packages:" ]; then + shift +- PACKAGES="$PACKAGES $@" ++ PACKAGES="$PACKAGES $*" + elif [ "$*" = "Invalid Code" ]; then + INVALIDCODE=1 + INHEADER=0 +@@ -84,21 +96,19 @@ + fi + } + +-function sourceheader() { ++sourceheader() { + if [ "$1" = "Program:" ]; then + if [ "$2" = "server" ]; then + ISSERVER=1 + fi +- ns=$testpath/$2 +- ns=${ns//\//_} +- ns=${ns//-/_} ++ ns=$(sanitize_name "$testpath/$2") + SOURCEFILE=$ns.vala + SOURCEFILES="$SOURCEFILES $SOURCEFILE" +- elif [ $GIRWRITERTEST -eq 1 ]; then ++ elif [ "$GIRWRITERTEST" -eq 1 ]; then + if [ "$1" = "Input:" ]; then + ns=$testpath + SOURCEFILE=$testpath.vala +- cat < $SOURCEFILE ++ cat < "$SOURCEFILE" + [CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.2", lower_case_cprefix = "test_")] + namespace Test { + EOF +@@ -108,26 +118,26 @@ + fi + } + +-function sourceend() { +- if [ $INVALIDCODE -eq 1 ]; then +- PACKAGEFLAGS=$([ -z "$PACKAGES" ] || echo $PACKAGES | xargs -n 1 echo -n " --pkg") ++sourceend() { ++ if [ "$INVALIDCODE" -eq 1 ]; then ++ PACKAGEFLAGS=$(package_flags) + echo '' > prepare + echo "$VALAC $VALAFLAGS $PACKAGEFLAGS -C $SOURCEFILE" > check + echo "RET=\$?" >> check + echo "if [ \$RET -ne 1 ]; then exit 1; fi" >> check + echo "exit 0" >> check +- elif [ $GIRWRITERTEST -eq 1 ]; then +- if [ $PART -eq 1 ]; then +- echo "}" >> $SOURCEFILE ++ elif [ "$GIRWRITERTEST" -eq 1 ]; then ++ if [ "$PART" -eq 1 ]; then ++ echo "}" >> "$SOURCEFILE" + fi +- PACKAGEFLAGS=$([ -z "$PACKAGES" ] || echo $PACKAGES | xargs -n 1 echo -n " --pkg") ++ PACKAGEFLAGS=$(package_flags) + echo "$VALAC $VALAFLAGS $PACKAGEFLAGS -C --library test -H test.h --gir Test-1.2.gir $ns.vala && tail -n +4 Test-1.2.gir|sed '\$d'|diff -wu Test-1.2.gir.ref -" > check + else +- PACKAGEFLAGS=$([ -z "$PACKAGES" ] || echo $PACKAGES | xargs -n 1 echo -n " --pkg") ++ PACKAGEFLAGS=$(package_flags) + echo "$VALAC $VALAFLAGS $PACKAGEFLAGS -o $ns$EXEEXT $SOURCEFILE" >> prepare +- if [ $DBUSTEST -eq 1 ]; then ++ if [ "$DBUSTEST" -eq 1 ]; then + echo "UPDATE_EXPECTED=$UPDATE_EXPECTED" >> prepare +- if [ $ISSERVER -eq 1 ]; then ++ if [ "$ISSERVER" -eq 1 ]; then + echo "if [ -n \"$UPDATE_EXPECTED\" ]; then" >> prepare + echo " cp -p ${SOURCEFILE%.*}.c $abs_srcdir/${testfile%.*}_server.c-expected" >> prepare + echo "elif [ -f $abs_srcdir/${testfile%.*}_server.c-expected ]; then" >> prepare +@@ -152,38 +162,40 @@ + unset SOURCEFILE + + testdir=_test.$$ +-rm -rf ./$testdir +-mkdir $testdir +-cd $testdir ++rm -rf "./$testdir" ++mkdir "$testdir" ++cd "$testdir" + + case "$testfile" in +-*.gs) +- SOURCEFILE=$testpath.gs +- ;& +-*.vala) ++*.gs|*.vala) ++ case "$testfile" in ++ *.gs) ++ SOURCEFILE=$testpath.gs ++ ;; ++ esac + SOURCEFILE=${SOURCEFILE:-$testpath.vala} +- cat "$abs_srcdir/$testfile" > ./$SOURCEFILE +- PACKAGEFLAGS=$([ -z "$PACKAGES" ] || echo $PACKAGES | xargs -n 1 echo -n " --pkg") +- $VALAC $VALAFLAGS $PACKAGEFLAGS -o $testpath$EXEEXT $SOURCEFILE ++ cat "$abs_srcdir/$testfile" > "./$SOURCEFILE" ++ PACKAGEFLAGS=$(package_flags) ++ $VALAC $VALAFLAGS $PACKAGEFLAGS -o "$testpath$EXEEXT" "$SOURCEFILE" + if [ -n "$UPDATE_EXPECTED" ]; then +- cp -p ${SOURCEFILE%.*}.c $abs_srcdir/${testfile%.*}.c-expected ++ cp -p "${SOURCEFILE%.*}.c" "$abs_srcdir/${testfile%.*}.c-expected" + if [ -f test.h ]; then +- cp -p test.h $abs_srcdir/${testfile%.*}.h-expected || exit 1 ++ cp -p test.h "$abs_srcdir/${testfile%.*}.h-expected" || exit 1 + fi +- elif [ -f $abs_srcdir/${testfile%.*}.c-expected ]; then +- diff -wu $abs_srcdir/${testfile%.*}.c-expected ${SOURCEFILE%.*}.c || exit 1 +- if [ -f $abs_srcdir/${testfile%.*}.h-expected ]; then +- diff -wu $abs_srcdir/${testfile%.*}.h-expected test.h || exit 1 ++ elif [ -f "$abs_srcdir/${testfile%.*}.c-expected" ]; then ++ diff -wu "$abs_srcdir/${testfile%.*}.c-expected" "${SOURCEFILE%.*}.c" || exit 1 ++ if [ -f "$abs_srcdir/${testfile%.*}.h-expected" ]; then ++ diff -wu "$abs_srcdir/${testfile%.*}.h-expected" test.h || exit 1 + fi + fi +- ./$testpath$EXEEXT ++ "./$testpath$EXEEXT" + ;; + *.gir) + SOURCEFILE=$testpath.gir +- cat "$abs_srcdir/$testfile" > ./$SOURCEFILE +- PACKAGEFLAGS=$([ -z "$PACKAGES" ] || echo $PACKAGES | xargs -n 1 echo -n " --pkg") +- $VAPIGEN $VAPIGENFLAGS $PACKAGEFLAGS --library $testpath $SOURCEFILE || exit 1 +- tail -n +3 ${SOURCEFILE%.*}.vapi | diff -wu $abs_srcdir/${testfile%.*}.vapi-expected - || exit 1 ++ cat "$abs_srcdir/$testfile" > "./$SOURCEFILE" ++ PACKAGEFLAGS=$(package_flags) ++ $VAPIGEN $VAPIGENFLAGS $PACKAGEFLAGS --library "$testpath" "$SOURCEFILE" || exit 1 ++ tail -n +3 "${SOURCEFILE%.*}.vapi" | diff -wu "$abs_srcdir/${testfile%.*}.vapi-expected" - || exit 1 + ;; + *.test) + rm -f prepare check +@@ -195,37 +207,41 @@ + GIRWRITERTEST=0 + DBUSTEST=0 + ISSERVER=0 +- while IFS="" read -r line; do +- if [ $PART -eq 0 ]; then ++ while IFS= read -r line; do ++ if [ "$PART" -eq 0 ]; then + if [ -n "$line" ]; then + testheader $line + else + PART=1 + fi + else +- if [ $INHEADER -eq 1 ]; then ++ if [ "$INHEADER" -eq 1 ]; then + if [ -n "$line" ]; then + sourceheader $line + else + INHEADER=0 + fi + else +- if echo "$line" | grep -q "^[A-Za-z]\+:"; then ++ if printf '%s\n' "$line" | grep -q '^[A-Za-z][A-Za-z]*:'; then + sourceend +- PART=$(($PART + 1)) ++ PART=$((PART + 1)) + INHEADER=1 + sourceheader $line + else +- echo "$line" >> $SOURCEFILE ++ echo "$line" >> "$SOURCEFILE" + fi + fi + fi + done < "$abs_srcdir/$testfile" + sourceend +- cat prepare check > $ns.check +- $run_prefix bash $ns.check ++ cat prepare check > "$ns.check" ++ if [ -n "$run_prefix" ]; then ++ $run_prefix sh "$ns.check" ++ else ++ sh "$ns.check" ++ fi + ;; + esac + + cd .. +-rm -rf ./$testdir ++rm -rf "./$testdir" diff --git a/valgrind/valgrind-3.26.0-ungnuify.patch b/valgrind/valgrind-3.26.0-ungnuify.patch new file mode 100644 index 0000000..3ca0b69 --- /dev/null +++ b/valgrind/valgrind-3.26.0-ungnuify.patch @@ -0,0 +1,482 @@ +diff -urN a/Makefile.tool.am b/Makefile.tool.am +--- a/Makefile.tool.am 2025-10-24 13:43:21.000000000 -0500 ++++ b/Makefile.tool.am 2026-03-22 13:02:33.492002899 -0500 +@@ -16,7 +16,9 @@ + $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a + endif + +-TOOL_LDADD_COMMON = -lgcc ++# Ask the compiler driver for its runtime support archive at link time so ++# clang can use compiler-rt instead of a hardcoded GNU libgcc. ++TOOL_LDADD_COMMON = + TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@ = \ + $(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@) $(TOOL_LDADD_COMMON) + if VGCONF_HAVE_PLATFORM_SEC +@@ -290,4 +292,3 @@ + install-exec-local: install-noinst_PROGRAMS install-noinst_DSYMS + + uninstall-local: uninstall-noinst_PROGRAMS uninstall-noinst_DSYMS +- +diff -urN a/cachegrind/Makefile.in b/cachegrind/Makefile.in +--- a/cachegrind/Makefile.in 2025-10-24 13:43:44.000000000 -0500 ++++ b/cachegrind/Makefile.in 2026-03-22 12:59:22.464512205 -0500 +@@ -742,7 +742,7 @@ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/coregrind/libcoregrind-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a + +-TOOL_LDADD_COMMON = -lgcc ++TOOL_LDADD_COMMON = + TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@ = \ + $(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@) \ + $(TOOL_LDADD_COMMON) $(am__append_7) $(am__append_9) +diff -urN a/callgrind/Makefile.in b/callgrind/Makefile.in +--- a/callgrind/Makefile.in 2025-10-24 13:43:45.000000000 -0500 ++++ b/callgrind/Makefile.in 2026-03-22 12:59:22.464050754 -0500 +@@ -789,7 +789,7 @@ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/coregrind/libcoregrind-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a + +-TOOL_LDADD_COMMON = -lgcc ++TOOL_LDADD_COMMON = + TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@ = \ + $(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@) \ + $(TOOL_LDADD_COMMON) $(am__append_7) $(am__append_9) +diff -urN a/coregrind/link_tool_exe_freebsd.in b/coregrind/link_tool_exe_freebsd.in +--- a/coregrind/link_tool_exe_freebsd.in 2025-10-24 13:43:21.000000000 -0500 ++++ b/coregrind/link_tool_exe_freebsd.in 2026-03-22 12:59:22.464512205 -0500 +@@ -56,6 +56,84 @@ + use warnings; + use strict; + ++sub capture_command_output { ++ my (@cmd) = @_; ++ my $pid = open(my $fh, "-|"); ++ die "Can't fork: $!" if !defined $pid; ++ ++ if ($pid == 0) { ++ open(STDERR, ">", "/dev/null") ++ or die "Can't redirect stderr: $!"; ++ exec @cmd or die "Can't exec @cmd: $!"; ++ } ++ ++ local $/ = undef; ++ my $output = <$fh>; ++ close($fh); ++ ++ return defined $output ? $output : ""; ++} ++ ++sub compiler_cmd_prefix { ++ my (@args) = @_; ++ my @prefix = (); ++ ++ foreach my $arg (@args) { ++ last if $arg =~ /^-/; ++ last if $arg =~ /\.(?:a|o|c|cc|cpp|cxx|s|S)$/; ++ push @prefix, $arg; ++ } ++ ++ die "Can't determine compiler command" ++ if scalar(@prefix) == 0; ++ ++ return @prefix; ++} ++ ++sub compiler_runtime_probe_args { ++ my (@args) = @_; ++ my @probe_args = (); ++ ++ for (my $n = 0; $n <= $#args; $n++) { ++ my $arg = $args[$n]; ++ ++ if ($arg eq "-m32" || $arg eq "-m64") { ++ push @probe_args, $arg; ++ next; ++ } ++ ++ if ($arg eq "-B" || $arg eq "--sysroot" || $arg eq "-resource-dir" ++ || $arg eq "-target" || $arg eq "--target" ++ || $arg eq "--gcc-toolchain") { ++ last if $n == $#args; ++ push @probe_args, $arg, $args[++$n]; ++ next; ++ } ++ ++ if ($arg =~ /^(-B|--sysroot=|-resource-dir=|-target=|--target=|--gcc-toolchain=|--rtlib=|-rtlib=|-stdlib=|-fuse-ld=)/) { ++ push @probe_args, $arg; ++ next; ++ } ++ } ++ ++ return @probe_args; ++} ++ ++sub compiler_runtime_archive { ++ my (@args) = @_; ++ my @compiler = compiler_cmd_prefix(@args); ++ my @probe_args = compiler_runtime_probe_args(@args); ++ ++ foreach my $probe ("-print-libgcc-file-name", "-print-file-name=libgcc.a") { ++ my $path = capture_command_output(@compiler, @probe_args, $probe); ++ chomp $path; ++ next if $path eq "" || $path eq "libgcc.a"; ++ return $path if -f $path; ++ } ++ ++ return "-lgcc"; ++} ++ + # expect at least: alt-load-address gcc -o foo bar.o + die "Not enough arguments" + if (($#ARGV + 1) < 5); +@@ -67,7 +145,9 @@ + die "Bogus alt-load address" + if (length($ala) < 3 || index($ala, "0x") != 0); + +-my $cmd = join(" ", @ARGV, "-static -Wl,@FLAG_T_TEXT@=$ala"); ++my $compiler_runtime = compiler_runtime_archive(@ARGV); ++ ++my $cmd = join(" ", @ARGV, $compiler_runtime, "-static -Wl,@FLAG_T_TEXT@=$ala"); + + #print "link_tool_exe_freebsd: $cmd\n"; + +diff -urN a/coregrind/link_tool_exe_linux.in b/coregrind/link_tool_exe_linux.in +--- a/coregrind/link_tool_exe_linux.in 2025-10-24 13:43:21.000000000 -0500 ++++ b/coregrind/link_tool_exe_linux.in 2026-03-22 12:59:22.464512205 -0500 +@@ -58,6 +58,84 @@ + use warnings; + use strict; + ++sub capture_command_output { ++ my (@cmd) = @_; ++ my $pid = open(my $fh, "-|"); ++ die "Can't fork: $!" if !defined $pid; ++ ++ if ($pid == 0) { ++ open(STDERR, ">", "/dev/null") ++ or die "Can't redirect stderr: $!"; ++ exec @cmd or die "Can't exec @cmd: $!"; ++ } ++ ++ local $/ = undef; ++ my $output = <$fh>; ++ close($fh); ++ ++ return defined $output ? $output : ""; ++} ++ ++sub compiler_cmd_prefix { ++ my (@args) = @_; ++ my @prefix = (); ++ ++ foreach my $arg (@args) { ++ last if $arg =~ /^-/; ++ last if $arg =~ /\.(?:a|o|c|cc|cpp|cxx|s|S)$/; ++ push @prefix, $arg; ++ } ++ ++ die "Can't determine compiler command" ++ if scalar(@prefix) == 0; ++ ++ return @prefix; ++} ++ ++sub compiler_runtime_probe_args { ++ my (@args) = @_; ++ my @probe_args = (); ++ ++ for (my $n = 0; $n <= $#args; $n++) { ++ my $arg = $args[$n]; ++ ++ if ($arg eq "-m32" || $arg eq "-m64") { ++ push @probe_args, $arg; ++ next; ++ } ++ ++ if ($arg eq "-B" || $arg eq "--sysroot" || $arg eq "-resource-dir" ++ || $arg eq "-target" || $arg eq "--target" ++ || $arg eq "--gcc-toolchain") { ++ last if $n == $#args; ++ push @probe_args, $arg, $args[++$n]; ++ next; ++ } ++ ++ if ($arg =~ /^(-B|--sysroot=|-resource-dir=|-target=|--target=|--gcc-toolchain=|--rtlib=|-rtlib=|-stdlib=|-fuse-ld=)/) { ++ push @probe_args, $arg; ++ next; ++ } ++ } ++ ++ return @probe_args; ++} ++ ++sub compiler_runtime_archive { ++ my (@args) = @_; ++ my @compiler = compiler_cmd_prefix(@args); ++ my @probe_args = compiler_runtime_probe_args(@args); ++ ++ foreach my $probe ("-print-libgcc-file-name", "-print-file-name=libgcc.a") { ++ my $path = capture_command_output(@compiler, @probe_args, $probe); ++ chomp $path; ++ next if $path eq "" || $path eq "libgcc.a"; ++ return $path if -f $path; ++ } ++ ++ return "-lgcc"; ++} ++ + # expect at least: alt-load-address gcc -o foo bar.o + die "Not enough arguments" + if (($#ARGV + 1) < 5); +@@ -69,7 +147,9 @@ + die "Bogus alt-load address" + if (length($ala) < 3 || index($ala, "0x") != 0); + +-my $cmd = join(" ", @ARGV, "-static -Wl,@FLAG_T_TEXT@=$ala"); ++my $compiler_runtime = compiler_runtime_archive(@ARGV); ++ ++my $cmd = join(" ", @ARGV, $compiler_runtime, "-static -Wl,@FLAG_T_TEXT@=$ala"); + + #print "link_tool_exe_linux: $cmd\n"; + +diff -urN a/coregrind/link_tool_exe_solaris.in b/coregrind/link_tool_exe_solaris.in +--- a/coregrind/link_tool_exe_solaris.in 2025-10-24 13:43:21.000000000 -0500 ++++ b/coregrind/link_tool_exe_solaris.in 2026-03-22 12:59:22.464512205 -0500 +@@ -21,6 +21,84 @@ + use File::Temp qw/tempfile unlink0/; + use Fcntl qw/F_SETFD/; + ++sub capture_command_output { ++ my (@cmd) = @_; ++ my $pid = open(my $fh, "-|"); ++ die "Can't fork: $!" if !defined $pid; ++ ++ if ($pid == 0) { ++ open(STDERR, ">", "/dev/null") ++ or die "Can't redirect stderr: $!"; ++ exec @cmd or die "Can't exec @cmd: $!"; ++ } ++ ++ local $/ = undef; ++ my $output = <$fh>; ++ close($fh); ++ ++ return defined $output ? $output : ""; ++} ++ ++sub compiler_cmd_prefix { ++ my (@args) = @_; ++ my @prefix = (); ++ ++ foreach my $arg (@args) { ++ last if $arg =~ /^-/; ++ last if $arg =~ /\.(?:a|o|c|cc|cpp|cxx|s|S)$/; ++ push @prefix, $arg; ++ } ++ ++ die "Can't determine compiler command" ++ if scalar(@prefix) == 0; ++ ++ return @prefix; ++} ++ ++sub compiler_runtime_probe_args { ++ my (@args) = @_; ++ my @probe_args = (); ++ ++ for (my $n = 0; $n <= $#args; $n++) { ++ my $arg = $args[$n]; ++ ++ if ($arg eq "-m32" || $arg eq "-m64") { ++ push @probe_args, $arg; ++ next; ++ } ++ ++ if ($arg eq "-B" || $arg eq "--sysroot" || $arg eq "-resource-dir" ++ || $arg eq "-target" || $arg eq "--target" ++ || $arg eq "--gcc-toolchain") { ++ last if $n == $#args; ++ push @probe_args, $arg, $args[++$n]; ++ next; ++ } ++ ++ if ($arg =~ /^(-B|--sysroot=|-resource-dir=|-target=|--target=|--gcc-toolchain=|--rtlib=|-rtlib=|-stdlib=|-fuse-ld=)/) { ++ push @probe_args, $arg; ++ next; ++ } ++ } ++ ++ return @probe_args; ++} ++ ++sub compiler_runtime_archive { ++ my (@args) = @_; ++ my @compiler = compiler_cmd_prefix(@args); ++ my @probe_args = compiler_runtime_probe_args(@args); ++ ++ foreach my $probe ("-print-libgcc-file-name", "-print-file-name=libgcc.a") { ++ my $path = capture_command_output(@compiler, @probe_args, $probe); ++ chomp $path; ++ next if $path eq "" || $path eq "libgcc.a"; ++ return $path if -f $path; ++ } ++ ++ return "-lgcc"; ++} ++ + # expect at least: alt-load-address gcc -o foo bar.o + die "Not enough arguments" + if (($#ARGV + 1) < 5); +@@ -62,7 +140,9 @@ + END + + # build up the complete command here: +-# 'cc' -Wl,-Mtmpfile 'restargs' ++# 'cc' -Wl,-Mtmpfile 'restargs' compiler-runtime-archive ++ ++my $compiler_runtime = compiler_runtime_archive(@ARGV[1 .. $#ARGV]); + + my $cmd="$cc -Wl,-M/proc/$$/fd/" . fileno($fh); + +@@ -71,6 +151,8 @@ + $cmd = "$cmd $ARGV[$n]"; + } + ++$cmd = "$cmd $compiler_runtime"; ++ + #print "link_tool_exe_solaris: $cmd\n"; + + +diff -urN a/dhat/Makefile.in b/dhat/Makefile.in +--- a/dhat/Makefile.in 2025-10-24 13:43:45.000000000 -0500 ++++ b/dhat/Makefile.in 2026-03-22 12:59:22.461512099 -0500 +@@ -767,7 +767,7 @@ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/coregrind/libcoregrind-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a + +-TOOL_LDADD_COMMON = -lgcc ++TOOL_LDADD_COMMON = + TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@ = \ + $(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@) \ + $(TOOL_LDADD_COMMON) $(am__append_7) $(am__append_9) +diff -urN a/drd/Makefile.in b/drd/Makefile.in +--- a/drd/Makefile.in 2025-10-24 13:43:45.000000000 -0500 ++++ b/drd/Makefile.in 2026-03-22 12:59:22.460512064 -0500 +@@ -848,7 +848,7 @@ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/coregrind/libcoregrind-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a + +-TOOL_LDADD_COMMON = -lgcc ++TOOL_LDADD_COMMON = + TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@ = \ + $(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@) \ + $(TOOL_LDADD_COMMON) $(am__append_7) $(am__append_9) +diff -urN a/exp-bbv/Makefile.in b/exp-bbv/Makefile.in +--- a/exp-bbv/Makefile.in 2025-10-24 13:43:45.000000000 -0500 ++++ b/exp-bbv/Makefile.in 2026-03-22 12:59:22.462512134 -0500 +@@ -703,7 +703,7 @@ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/coregrind/libcoregrind-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a + +-TOOL_LDADD_COMMON = -lgcc ++TOOL_LDADD_COMMON = + TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@ = \ + $(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@) \ + $(TOOL_LDADD_COMMON) $(am__append_7) $(am__append_9) +diff -urN a/helgrind/Makefile.in b/helgrind/Makefile.in +--- a/helgrind/Makefile.in 2025-10-24 13:43:46.000000000 -0500 ++++ b/helgrind/Makefile.in 2026-03-22 12:59:22.464050754 -0500 +@@ -790,7 +790,7 @@ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/coregrind/libcoregrind-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a + +-TOOL_LDADD_COMMON = -lgcc ++TOOL_LDADD_COMMON = + TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@ = \ + $(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@) \ + $(TOOL_LDADD_COMMON) $(am__append_7) $(am__append_9) +diff -urN a/lackey/Makefile.in b/lackey/Makefile.in +--- a/lackey/Makefile.in 2025-10-24 13:43:46.000000000 -0500 ++++ b/lackey/Makefile.in 2026-03-22 12:59:22.461512099 -0500 +@@ -703,7 +703,7 @@ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/coregrind/libcoregrind-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a + +-TOOL_LDADD_COMMON = -lgcc ++TOOL_LDADD_COMMON = + TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@ = \ + $(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@) \ + $(TOOL_LDADD_COMMON) $(am__append_7) $(am__append_9) +diff -urN a/massif/Makefile.in b/massif/Makefile.in +--- a/massif/Makefile.in 2025-10-24 13:43:46.000000000 -0500 ++++ b/massif/Makefile.in 2026-03-22 12:59:22.462512134 -0500 +@@ -757,7 +757,7 @@ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/coregrind/libcoregrind-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a + +-TOOL_LDADD_COMMON = -lgcc ++TOOL_LDADD_COMMON = + TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@ = \ + $(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@) \ + $(TOOL_LDADD_COMMON) $(am__append_7) $(am__append_9) +diff -urN a/memcheck/Makefile.in b/memcheck/Makefile.in +--- a/memcheck/Makefile.in 2025-10-24 13:43:46.000000000 -0500 ++++ b/memcheck/Makefile.in 2026-03-22 12:59:22.459512028 -0500 +@@ -790,7 +790,7 @@ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/coregrind/libcoregrind-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a + +-TOOL_LDADD_COMMON = -lgcc ++TOOL_LDADD_COMMON = + TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@ = \ + $(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@) \ + $(TOOL_LDADD_COMMON) $(am__append_7) $(am__append_9) +diff -urN a/none/Makefile.in b/none/Makefile.in +--- a/none/Makefile.in 2025-10-24 13:43:47.000000000 -0500 ++++ b/none/Makefile.in 2026-03-22 12:59:22.461512099 -0500 +@@ -701,7 +701,7 @@ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/coregrind/libcoregrind-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \ + @VGCONF_HAVE_PLATFORM_SEC_TRUE@ $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a + +-TOOL_LDADD_COMMON = -lgcc ++TOOL_LDADD_COMMON = + TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@ = \ + $(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@) \ + $(TOOL_LDADD_COMMON) $(am__append_7) $(am__append_9) +diff -urN a/none/tests/Makefile.am b/none/tests/Makefile.am +--- a/none/tests/Makefile.am 2025-10-24 13:43:21.000000000 -0500 ++++ b/none/tests/Makefile.am 2026-03-22 12:59:22.458511993 -0500 +@@ -502,9 +502,8 @@ + vgprintf_nvalgrind_CFLAGS = ${AM_CFLAGS} -DNVALGRIND + + valgrind_cpp_test_SOURCES = valgrind_cpp_test.cpp +-valgrind_cpp_test_LDADD = -lstdc++ ++valgrind_cpp_test_LDADD = + + # C++ tests + coolo_sigaction_SOURCES = coolo_sigaction.cpp + gxx304_SOURCES = gxx304.cpp +- +diff -urN a/none/tests/Makefile.in b/none/tests/Makefile.in +--- a/none/tests/Makefile.in 2025-10-24 13:43:47.000000000 -0500 ++++ b/none/tests/Makefile.in 2026-03-22 12:59:22.459512028 -0500 +@@ -1581,7 +1581,7 @@ + vgprintf_nvalgrind_SOURCES = vgprintf.c + vgprintf_nvalgrind_CFLAGS = ${AM_CFLAGS} -DNVALGRIND + valgrind_cpp_test_SOURCES = valgrind_cpp_test.cpp +-valgrind_cpp_test_LDADD = -lstdc++ ++valgrind_cpp_test_LDADD = + + # C++ tests + coolo_sigaction_SOURCES = coolo_sigaction.cpp +diff -urN a/valgrind.pc.in b/valgrind.pc.in +--- a/valgrind.pc.in 2025-10-24 13:43:21.000000000 -0500 ++++ b/valgrind.pc.in 2026-03-22 12:59:22.458511993 -0500 +@@ -11,6 +11,5 @@ + Description: A dynamic binary instrumentation framework + Version: @VERSION@ + Requires: +-Libs: -L${libdir}/valgrind -lcoregrind-@VGCONF_ARCH_PRI@-@VGCONF_OS@ -lvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@ -lgcc ++Libs: -L${libdir}/valgrind -lcoregrind-@VGCONF_ARCH_PRI@-@VGCONF_OS@ -lvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@ + Cflags: -I${includedir} +- diff --git a/x264/x264-posixify.patch b/x264/x264-posixify.patch new file mode 100644 index 0000000..0807c6b --- /dev/null +++ b/x264/x264-posixify.patch @@ -0,0 +1,282 @@ +--- a/configure 2025-08-16 00:29:41.000000000 -0500 ++++ b/configure 2026-03-25 01:07:23.787385597 -0500 +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + if test x"$1" = x"-h" -o x"$1" = x"--help" ; then + cat <> config.log ++ printf 'checking %s... ' "$1" >> config.log + } + + log_ok() { +@@ -81,13 +81,14 @@ + # several non gcc compilers issue an incredibly large number of warnings on high warning levels, + # suppress them by reducing the warning level rather than having to use #pragmas + for arg in $*; do +- [[ "$arg" = -falign-loops* ]] && arg= ++ case $arg in ++ -falign-loops*|-mpreferred-stack-boundary*|-l*|-L*) ++ arg= ++ ;; ++ esac + [ "$arg" = -fno-tree-vectorize ] && arg= + [ "$arg" = -Wshadow ] && arg= + [ "$arg" = -Wno-maybe-uninitialized ] && arg= +- [[ "$arg" = -mpreferred-stack-boundary* ]] && arg= +- [[ "$arg" = -l* ]] && arg= +- [[ "$arg" = -L* ]] && arg= + if [ $compiler_style = MS ]; then + [ "$arg" = -ffast-math ] && arg="-fp:fast" + [ "$arg" = -Wall ] && arg= +@@ -103,15 +104,27 @@ + fi + [ $compiler = CL -a "$arg" = -O3 ] && arg=-O2 + +- [ -n "$arg" ] && echo -n "$arg " ++ [ -n "$arg" ] && printf '%s ' "$arg" + done + } + + cl_ldflags() { + for arg in $*; do +- arg=${arg/LIBPATH/libpath} +- [ "${arg#-libpath:}" == "$arg" -a "${arg#-l}" != "$arg" ] && arg=${arg#-l}.lib +- [ "${arg#-L}" != "$arg" ] && arg=-libpath:${arg#-L} ++ case $arg in ++ *LIBPATH*) ++ arg=$(printf '%s\n' "$arg" | sed 's/LIBPATH/libpath/') ++ ;; ++ esac ++ case $arg in ++ -libpath:*) ++ ;; ++ -l*) ++ arg=${arg#-l}.lib ++ ;; ++ -L*) ++ arg=-libpath:${arg#-L} ++ ;; ++ esac + [ "$arg" = -Wl,--large-address-aware ] && arg=-largeaddressaware + [ "$arg" = -s ] && arg= + [ "$arg" = -Wl,-Bsymbolic ] && arg= +@@ -119,15 +132,23 @@ + [ "$arg" = -Werror ] && arg= + [ "$arg" = -Wshadow ] && arg= + [ "$arg" = -Wmaybe-uninitialized ] && arg= +- [[ "$arg" = -Qdiag-error* ]] && arg= +- +- arg=${arg/pthreadGC/pthreadVC} ++ case $arg in ++ -Qdiag-error*) ++ arg= ++ ;; ++ esac ++ ++ case $arg in ++ *pthreadGC*) ++ arg=$(printf '%s\n' "$arg" | sed 's/pthreadGC/pthreadVC/') ++ ;; ++ esac + [ "$arg" = avifil32.lib ] && arg=vfw32.lib + [ "$arg" = gpac_static.lib ] && arg=libgpac_static.lib + [ "$arg" = gpac.lib ] && arg=libgpac.lib + [ "$arg" = x264.lib ] && arg=libx264.lib + +- [ -n "$arg" ] && echo -n "$arg " ++ [ -n "$arg" ] && printf '%s ' "$arg" + done + } + +@@ -191,7 +212,7 @@ + for arg in $1; do + echo "#include <$arg>" >> conftest.c + done +- echo -e "#if !($3) \n#error $4 \n#endif " >> conftest.c ++ printf '#if !(%s)\n#error %s\n#endif\n' "$3" "$4" >> conftest.c + if [ $compiler_style = MS ]; then + cpp_cmd="$CC conftest.c $(cc_cflags $CFLAGS $2) -P" + else +@@ -352,16 +373,21 @@ + + # Construct a path to the specified directory relative to the working directory + relative_path() { +- local base="${PWD%/}" +- local path="$(cd "$1" >/dev/null; printf '%s/.' "${PWD%/}")" +- local up='' +- +- while [[ $path != "$base/"* ]]; do +- base="${base%/*}" +- up="../$up" ++ relative_base="${PWD%/}" ++ relative_pathname=$(cd "$1" >/dev/null && printf '%s/.' "${PWD%/}") || return 1 ++ relative_up= ++ ++ while :; do ++ case $relative_pathname in ++ "$relative_base"/*) ++ break ++ ;; ++ esac ++ relative_base=${relative_base%/*} ++ relative_up="../$relative_up" + done + +- dirname "$up${path#"$base/"}" ++ dirname "$relative_up${relative_pathname#"$relative_base/"}" + } + + SRCPATH="$(relative_path "$(dirname "$0")")" +@@ -604,10 +630,16 @@ + # test for use of compilers that require specific handling + cc_base="$(basename "$CC")" + QPRE="-" +-if [[ $host_os = mingw* || $host_os = msys* || $host_os = cygwin* ]]; then +- if [[ "$cc_base" = icl || "$cc_base" = icl[\ .]* ]]; then ++case $host_os in ++mingw*|msys*|cygwin*) ++ case $cc_base in ++ icl|icl.*|icl\ *) + # Windows Intel Compiler creates dependency generation with absolute Windows paths, Cygwin's make does not support Windows paths. +- [[ $host_os = cygwin* ]] && die "Windows Intel Compiler support requires MSYS" ++ case $host_os in ++ cygwin*) ++ die "Windows Intel Compiler support requires MSYS" ++ ;; ++ esac + compiler=ICL + compiler_style=MS + CFLAGS="$CFLAGS -Qstd=c99 -nologo -Qms0 -DHAVE_STRING_H -I\$(SRCPATH)/extras" +@@ -621,7 +653,8 @@ + if cc_check '' -Qdiag-error:10006,10157 ; then + CHECK_CFLAGS="$CHECK_CFLAGS -Qdiag-error:10006,10157" + fi +- elif [[ "$cc_base" = cl || "$cc_base" = cl[\ .]* ]]; then ++ ;; ++ cl|cl.*|cl\ *) + # Standard Microsoft Visual Studio + compiler=CL + compiler_style=MS +@@ -636,16 +669,22 @@ + elif cpp_check '' '' 'defined(_M_ARM)' ; then + host_cpu=arm + fi +- else ++ ;; ++ *) + # MinGW uses broken pre-VS2015 Microsoft printf functions unless it's told to use the POSIX ones. + CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112L" +- fi +-else +- if [[ "$cc_base" = icc || "$cc_base" = icc[\ .]* ]]; then ++ ;; ++ esac ++ ;; ++*) ++ case $cc_base in ++ icc|icc.*|icc\ *) + AR="xiar" + compiler=ICC +- fi +-fi ++ ;; ++ esac ++ ;; ++esac + + if [ $compiler = GNU ]; then + if cc_check '' -Werror=unknown-warning-option ; then +@@ -711,7 +750,7 @@ + ;; + cygwin*|mingw*|msys*) + EXE=".exe" +- if [[ $host_os = cygwin* ]] && cpp_check "" "" "defined(__CYGWIN__)" ; then ++ if case $host_os in cygwin*) true ;; *) false ;; esac && cpp_check "" "" "defined(__CYGWIN__)" ; then + SYS="CYGWIN" + define HAVE_MALLOC_H + else +@@ -766,11 +805,23 @@ + AS_EXT=".asm" + ASFLAGS="$ASFLAGS -DARCH_X86_64=0 -I\$(SRCPATH)/common/x86/" + if [ $compiler = GNU ]; then +- if [[ "$asm" == auto && "$CFLAGS" != *-march* ]]; then +- CFLAGS="$CFLAGS -march=i686" ++ if [ "$asm" = auto ]; then ++ case " $CFLAGS " in ++ *" -march"*) ++ ;; ++ *) ++ CFLAGS="$CFLAGS -march=i686" ++ ;; ++ esac + fi +- if [[ "$asm" == auto && "$CFLAGS" != *-mfpmath* ]]; then +- CFLAGS="$CFLAGS -mfpmath=sse -msse -msse2" ++ if [ "$asm" = auto ]; then ++ case " $CFLAGS " in ++ *" -mfpmath"*) ++ ;; ++ *) ++ CFLAGS="$CFLAGS -mfpmath=sse -msse -msse2" ++ ;; ++ esac + fi + CFLAGS="-m32 $CFLAGS" + LDFLAGS="-m32 $LDFLAGS" +@@ -1000,7 +1051,7 @@ + + if [ $asm = auto -a $ARCH = ARM ] ; then + # set flags so neon is built by default +- [ $compiler == CL ] || echo $CFLAGS | grep -Eq '(-mcpu|-march|-mfpu)' || CFLAGS="$CFLAGS -mcpu=cortex-a8 -mfpu=neon" ++ [ "$compiler" = CL ] || printf '%s\n' "$CFLAGS" | grep -Eq '(^| )(-mcpu|-march|-mfpu)' || CFLAGS="$CFLAGS -mcpu=cortex-a8 -mfpu=neon" + + cc_check '' '' '__asm__("add r0, r1, r2");' && define HAVE_ARM_INLINE_ASM + if [ $compiler = CL ] && cpp_check '' '' 'defined(_M_ARM) && _M_ARM >= 7' ; then +@@ -1392,7 +1443,13 @@ + + if [ "$pic" = "yes" ] ; then + [ "$SYS" != WINDOWS -a "$SYS" != CYGWIN ] && CFLAGS="$CFLAGS -fPIC" +- [[ "$ASFLAGS" != *"-DPIC"* ]] && ASFLAGS="$ASFLAGS -DPIC" ++ case " $ASFLAGS " in ++ *" -DPIC "*) ++ ;; ++ *) ++ ASFLAGS="$ASFLAGS -DPIC" ++ ;; ++ esac + # resolve textrels in the x86 asm + cc_check stdio.h "-shared -Wl,-Bsymbolic" && SOFLAGS="$SOFLAGS -Wl,-Bsymbolic" + [ $SYS = SunOS -a "$ARCH" = "X86" ] && SOFLAGS="$SOFLAGS -mimpure-text" +@@ -1682,8 +1739,14 @@ + if [ "$bashcompletion" = "auto" ]; then + if [ "$cli" = "no" ]; then + bashcompletion="no" +- elif [[ -z "$bashcompletionsdir" && "$prefix" != "/usr" && "$prefix" != "/usr/"* ]]; then +- bashcompletion="no" ++ elif [ -z "$bashcompletionsdir" ]; then ++ case $prefix in ++ /usr|/usr/*) ++ ;; ++ *) ++ bashcompletion="no" ++ ;; ++ esac + fi + fi + +@@ -1750,8 +1813,7 @@ + cat conftest.log + + [ "$SRCPATH" != "." ] && ln -sf ${SRCPATH}/Makefile ./Makefile +-mkdir -p common/{aarch64,arm,mips,ppc,x86,loongarch} encoder extras filters/video input output tools ++mkdir -p common/aarch64 common/arm common/mips common/ppc common/x86 common/loongarch encoder extras filters/video input output tools + + echo + echo "You can run 'make' or 'make fprofiled' now." +- diff --git a/xmlto/xmlto-0.0.29-posixify.patch b/xmlto/xmlto-0.0.29-posixify.patch new file mode 100644 index 0000000..5f623d6 --- /dev/null +++ b/xmlto/xmlto-0.0.29-posixify.patch @@ -0,0 +1,385 @@ +diff --git a/Makefile.am b/Makefile.am +index cbbe124..496f993 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -68,7 +68,7 @@ EXTRA_DIST = xmlto.spec \ + doc/xmlif.xml \ + xmlto.mak + +-GEN_MANPAGE = FORMAT_DIR=$(top_srcdir)/format $(XMLTO_BASH_PATH) ./xmlto --skip-validation -o $(@D) man $< ++GEN_MANPAGE = FORMAT_DIR=$(top_srcdir)/format $(XMLTO_SH_PATH) ./xmlto --skip-validation -o $(@D) man $< + man/man1/xmlto.1: doc/xmlto.xml ; $(GEN_MANPAGE) + man/man1/xmlif.1: doc/xmlif.xml ; $(GEN_MANPAGE) + +diff --git a/configure.ac b/configure.ac +index 675dcb8..e5e3b7a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -18,8 +18,11 @@ AC_CHECK_PROG([MKTEMP], [mktemp],, [mktemp]) + AC_ARG_VAR([FIND], [Name of the GNU `find' program.]) + AC_CHECK_PROG([FIND], [find],, [find] ) + +-AC_ARG_VAR([XMLTO_BASH_PATH], [Name and path of the GNU `bash' shell.]) +-AC_PATH_PROG([XMLTO_BASH_PATH], [bash], [/bin/bash]) ++AC_ARG_VAR([XMLTO_SH_PATH], [Name and path of the POSIX `sh' shell.]) ++AC_ARG_VAR([XMLTO_BASH_PATH], [Deprecated alias for XMLTO_SH_PATH.]) ++AS_IF([test -n "$XMLTO_BASH_PATH" && test -z "$XMLTO_SH_PATH"], ++ [XMLTO_SH_PATH=$XMLTO_BASH_PATH]) ++AC_PATH_PROG([XMLTO_SH_PATH], [sh], [/bin/sh]) + + AC_ARG_VAR([GETOPT], [Name of the `getopt' program (requires longopt support).]) + AC_CHECK_PROG([GETOPT], [getopt],, [getopt]) +diff --git a/format/docbook/epub b/format/docbook/epub +index 118d605..7acf1d4 100755 +--- a/format/docbook/epub ++++ b/format/docbook/epub +@@ -1,4 +1,4 @@ +-if [ -z "`type -t $ZIP_PATH`" ] ++if ! command -v "$ZIP_PATH" >/dev/null 2>&1 + then + echo >&2 "Missing zip utility at $ZIP_PATH, conversion to epub not possible." + echo >&2 "Exiting !" +@@ -26,7 +26,7 @@ case "$1" in + do + ${GCP_PATH:-cp} -R -P -p -- $INPUT_DIR/$CSS_SOURCE $CSS_DEST_DIR/ + done +- echo -n "application/epub+zip" > mimetype ++ printf '%s' 'application/epub+zip' > mimetype + EPUB_NAME=$(basename "${XSLT_PROCESSED%.*}").epub + [ -e "$XSLT_PROCESSED" ] && rm "$XSLT_PROCESSED" + ${ZIP_PATH} -0Xq $EPUB_NAME mimetype +diff --git a/format/docbook/txt b/format/docbook/txt +index fe42a1f..f356b47 100755 +--- a/format/docbook/txt ++++ b/format/docbook/txt +@@ -1,14 +1,14 @@ + case "$USE_BACKEND" in + DEFAULT|DBLATEX) +- if [ -n "`type -t $W3M_PATH`" ] ++ if command -v "$W3M_PATH" >/dev/null 2>&1 + then + CONVERT="$W3M_PATH" + ARGS="-T text/html -dump" +- elif [ -n "`type -t $LYNX_PATH`" ] ++ elif command -v "$LYNX_PATH" >/dev/null 2>&1 + then + CONVERT="$LYNX_PATH" + ARGS="-force_html -dump -nolist -width=72" +- elif [ -n "`type -t $LINKS_PATH`" ] ++ elif command -v "$LINKS_PATH" >/dev/null 2>&1 + then + CONVERT="$LINKS_PATH" + ARGS="-dump" +diff --git a/format/fo/dvi b/format/fo/dvi +index 6615048..82794cc 100755 +--- a/format/fo/dvi ++++ b/format/fo/dvi +@@ -6,7 +6,7 @@ post-process) + then + echo >&2 "Post-process XSL-FO to DVI" + fi +- if [ -z "`type -t $XMLTEX_PATH`" ] ++ if ! command -v "$XMLTEX_PATH" >/dev/null 2>&1 + then + echo >&2 "Can't process, xmltex tool not found at $XMLTEX_PATH." + exit 3 +diff --git a/format/fo/pdf b/format/fo/pdf +index 9e586b3..63936eb 100755 +--- a/format/fo/pdf ++++ b/format/fo/pdf +@@ -8,7 +8,7 @@ DEFAULT|DBLATEX) + then + echo >&2 "Post-process XSL-FO to PDF" + fi +- if [ -z "`type -t $PDFXMLTEX_PATH`" ] ++ if ! command -v "$PDFXMLTEX_PATH" >/dev/null 2>&1 + then + echo >&2 "Can't process, pdfxmltex tool not found at $PDFXMLTEX_PATH." + exit 3 +diff --git a/format/xhtml1/txt b/format/xhtml1/txt +index eb1c07a..2c843c2 100755 +--- a/format/xhtml1/txt ++++ b/format/xhtml1/txt +@@ -1,14 +1,14 @@ + case "$USE_BACKEND" in + DEFAULT|DBLATEX) +- if [ -n "`type -t $W3M_PATH`" ] ++ if command -v "$W3M_PATH" >/dev/null 2>&1 + then + CONVERT="$W3M_PATH" + ARGS="-T text/html -dump" +- elif [ -n "`type -t $LYNX_PATH`" ] ++ elif command -v "$LYNX_PATH" >/dev/null 2>&1 + then + CONVERT="$LYNX_PATH" + ARGS="-force_html -dump -nolist -width=72" +- elif [ -n "`type -t $LINKS_PATH`" ] ++ elif command -v "$LINKS_PATH" >/dev/null 2>&1 + then + CONVERT="$LINKS_PATH" + ARGS="-dump" +diff --git a/xmlif/test/run-test b/xmlif/test/run-test +index a7ddbca..f007928 100755 +--- a/xmlif/test/run-test ++++ b/xmlif/test/run-test +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + XMLIF=${top_builddir}/xmlif/xmlif + INPUT=${top_srcdir}/xmlif/test/test.xml +diff --git a/xmlto.in b/xmlto.in +index d5a81a8..f75bfe3 100755 +--- a/xmlto.in ++++ b/xmlto.in +@@ -1,4 +1,4 @@ +-#!@XMLTO_BASH_PATH@ ++#!@XMLTO_SH_PATH@ + # + # @PACKAGE@ - apply an XSL stylesheet to an XML document + # Copyright (C) 2001, 2002, 2003 Tim Waugh +@@ -19,7 +19,7 @@ + # Utilities that we need that aren't everywhere + FIND=@FIND@ # This must be GNU find (need -maxdepth) + MKTEMP=@MKTEMP@ # See http://www.mktemp.org if missing on your system +-BASH=@XMLTO_BASH_PATH@ # GNU bash, for running the format scripts ++SH=@XMLTO_SH_PATH@ # POSIX sh, for running the format scripts + GETOPT=@GETOPT@ # a getopt that supports --longoptions + TAIL=@TAIL@ # a tail that supports -n (posix) + GREP=@GREP@ # GNU grep, for searching patterns +@@ -78,28 +78,41 @@ EOF + # * Remembers the temporary file's name so it can be deleted on exit + # * If the failure message is empty or missing, exits on failure + make_temp () { +- local dirflag="" prefix="@PACKAGE@" +- [ "$1" = "-d" ] && { dirflag="-d"; shift; } +- [ -n "$1" ] && prefix="@PACKAGE@-$1" ++ make_temp_dirflag= ++ make_temp_prefix="@PACKAGE@" ++ if [ "$1" = "-d" ] ++ then ++ make_temp_dirflag="-d" ++ shift ++ fi ++ if [ -n "$1" ] ++ then ++ make_temp_prefix="@PACKAGE@-$1" ++ fi + +- if eval $2='$(${MKTEMP} $dirflag "${TMPDIR:-/tmp}/${prefix}.XXXXXX")' ++ if eval "$2=\$(${MKTEMP} $make_temp_dirflag \"\${TMPDIR:-/tmp}/${make_temp_prefix}.XXXXXX\")" + then +- CLEANFILES="$CLEANFILES ${!2}" ++ eval "make_temp_path=\${$2}" ++ CLEANFILES="$CLEANFILES $make_temp_path" ++ unset make_temp_dirflag make_temp_path make_temp_prefix + return 0 + elif [ -z "$3" ] + then ++ unset make_temp_dirflag make_temp_prefix + echo >&2 "mktemp failed!" + exit 2 + else ++ unset make_temp_dirflag make_temp_prefix + echo >&2 "mktemp failed. $3" + return 2 + fi + } + + compute_searchpath () { +- local oldIFS="${IFS}" ++ compute_searchpath_oldIFS="${IFS}" + IFS=":" +- for asearchpath in "$1"; do ++ for asearchpath in $1 ++ do + # wrangle relative paths into absolute ones so that the user + # isn't surprised if he does ``--searchpath .'' + case "${asearchpath}" in +@@ -111,7 +124,8 @@ compute_searchpath () { + # and only after the first iteration. + XML_SEARCHPATH_SEPARATOR=":" + done +- IFS="${oldIFS}" ++ IFS="${compute_searchpath_oldIFS}" ++ unset compute_searchpath_oldIFS + } + + # Allow FORMAT_DIR to be over-ridden, so that we can be +@@ -135,7 +149,7 @@ XSL_MODS= + + # List of files to remove after exit + CLEANFILES= +-trap -- 'cd /; [ -z "$CLEANFILES" ] || rm -rf $CLEANFILES' EXIT ++trap 'cd /; [ -z "$CLEANFILES" ] || rm -rf $CLEANFILES' 0 + + XSLTOPTS= + SEARCHPATH= +@@ -145,13 +159,13 @@ XMLLINT_PATH=@XMLLINT@ + XSLTPROC_PATH=@XSLTPROC@ + + # Try to setup papersize using libpaper first ... +-if type "$PAPERCONF_PATH" >/dev/null 2>&1 ++if command -v "$PAPERCONF_PATH" >/dev/null 2>&1 + then + papername=`"$PAPERCONF_PATH" -n` + paperheight=`"$PAPERCONF_PATH" -mh | sed 's/ //g'` + paperwidth=`"$PAPERCONF_PATH" -mw | sed 's/ //g'` + +- if [ -n "$paperheight" -a -n "$paperwidth" ] ++ if [ -n "$paperheight" ] && [ -n "$paperwidth" ] + then + make_temp xsl papersizemod "Using default paper type." && + cat << EOF > "$papersizemod" +@@ -176,7 +190,7 @@ EOF + fi + + # ... or use magic paper size, based on LC_PAPER +-elif type "$LOCALE_PATH" >/dev/null 2>&1 ++elif command -v "$LOCALE_PATH" >/dev/null 2>&1 + then + # For paper sizes we know about, specify them. + h=$("$LOCALE_PATH" LC_PAPER 2>/dev/null | head -n 1) +@@ -199,7 +213,7 @@ EOF + fi + + # Magic encoding, based on locale +-if type "$LOCALE_PATH" >/dev/null 2>&1 ++if command -v "$LOCALE_PATH" >/dev/null 2>&1 + then + charmap=$("$LOCALE_PATH" charmap 2>/dev/null) + +@@ -249,12 +263,12 @@ XMLTEX_PATH=@XMLTEX@ + PDFXMLTEX_PATH=@PDFXMLTEX@ + + #check if we could use fop/dblatex backend as default(if not, use passivetex) +-if [ x"$USE_BACKEND" = xFOP ] && ! type "$FOP_PATH" >/dev/null 2>&1 ++if [ x"$USE_BACKEND" = xFOP ] && ! command -v "$FOP_PATH" >/dev/null 2>&1 + then + echo >&2 "@PACKAGE@: Warning: fop not found or not executable." + echo >&2 "@PACKAGE@: Using default backend..." + USE_BACKEND=DEFAULT +-elif type "$FOP_PATH" >/dev/null 2>&1 ++elif command -v "$FOP_PATH" >/dev/null 2>&1 + then + # we should enable fop.extensions for fop 0_17,0_18 and 0_20*, + # fop1.extensions for the rest +@@ -265,7 +279,7 @@ then + fi + fi + if [ x"$USE_BACKEND" = xDBLATEX ] && \ +- ! type "$DBLATEX_PATH" >/dev/null 2>&1 ++ ! command -v "$DBLATEX_PATH" >/dev/null 2>&1 + then + echo >&2 "@PACKAGE@: Warning: dblatex not found or not executable." + echo >&2 "@PACKAGE@: Using default backend..." +@@ -315,7 +329,7 @@ while [ "$#" -gt "0" ]; do + ;; + -o) + OUTPUT_DIR="$2" +- if type -p cygpath >/dev/null; then ++ if command -v cygpath >/dev/null 2>&1; then + OUTPUT_DIR=$(cygpath "$OUTPUT_DIR") + fi + case "$OUTPUT_DIR" in +@@ -362,7 +376,7 @@ while [ "$#" -gt "0" ]; do + shift 2 + ;; + --noclean) +- trap -- 'cd /; [ -z "$CLEANFILES" ] || echo "$CLEANFILES"' EXIT ++ trap 'cd /; [ -z "$CLEANFILES" ] || echo "$CLEANFILES"' 0 + shift + ;; + --noautosize) +@@ -371,7 +385,7 @@ while [ "$#" -gt "0" ]; do + ;; + --with-fop) + ##use fop instead of passivetex where possible +- if ! type "$FOP_PATH" >/dev/null 2>&1 ++ if ! command -v "$FOP_PATH" >/dev/null 2>&1 + then + echo >&2 Warning: fop not found or not executable. + echo >&2 Using default backend... +@@ -382,7 +396,7 @@ while [ "$#" -gt "0" ]; do + ;; + --with-dblatex) + ##use dblatex instead of passivetex where possible +- if ! type "$DBLATEX_PATH" >/dev/null 2>&1 ++ if ! command -v "$DBLATEX_PATH" >/dev/null 2>&1 + then + echo >&2 Warning: dblatex not found or not executable. + echo >&2 Using default backend... +@@ -426,7 +440,7 @@ case "$2" in + *) INPUT_FILE="$PWD/$2" ;; + esac + +-if [ -z "$DEST_FORMAT" -o -z "$INPUT_FILE" ] ++if [ -z "$DEST_FORMAT" ] || [ -z "$INPUT_FILE" ] + then + usage + exit 1 +@@ -454,7 +468,7 @@ rootel_xpath='concat("{", namespace-uri(/*), "}", local-name(/*))' + rootel="$("$XMLLINT_PATH" --xpath "$rootel_xpath" "$INPUT_FILE" 2>/dev/null)" + + +-case $(echo $rootel) in ++case $rootel in + "{http://www.w3.org/1999/XSL/Format}root") + SOURCE_FORMAT="fo" + ;; +@@ -498,13 +512,13 @@ export PDFXMLTEX_PATH + export USE_BACKEND + if [ -z "$STYLESHEET" ] + then +- STYLESHEET="$(${BASH} "$FORMAT" stylesheet)" || exit 1 ++ STYLESHEET="$(${SH} "$FORMAT" stylesheet)" || exit 1 + [ "$VERBOSE" -ge 1 ] && echo >&2 "Stylesheet: ${STYLESHEET}" + fi + + # We might need to create a temporary stylesheet if there are + # XSL fragments that need adding. +-if [ -n "$XSL_MODS" -a -n "$STYLESHEET" ] ++if [ -n "$XSL_MODS" ] && [ -n "$STYLESHEET" ] + then + REAL_STYLESHEET="$STYLESHEET" + [ "$VERBOSE" -ge 1 ] && echo >&2 "Real stylesheet: ${REAL_STYLESHEET}" +@@ -536,7 +550,7 @@ cd "$XSLT_PROCESSED_DIR" + if [ "$SKIP_VALIDATION" -eq 0 ] && [ "$SOURCE_FORMAT" != "fo" ] + then + #do we have xmllint validation tool? +- if ! type "$XMLLINT_PATH" >/dev/null 2>&1 ++ if ! command -v "$XMLLINT_PATH" >/dev/null 2>&1 + then + echo >&2 "@PACKAGE@: xmllint validation tool not found or not executable." + echo >&2 "@PACKAGE@: Skipping validation... " \ +@@ -572,7 +586,7 @@ XSLTOPTS="${XSLTPARAMS} ${XSLTOPTS}" + if [ "$PROFILE" -eq 1 ] || [ -n "${STYLESHEET}" ] + then + #do we have xsltproc tool? +- if ! type "$XSLTPROC_PATH" >/dev/null 2>&1 ++ if ! command -v "$XSLTPROC_PATH" >/dev/null 2>&1 + then + echo >&2 "@PACKAGE@: Can't continue, xsltproc tool not found or not executable." + exit 3 +@@ -653,6 +667,6 @@ export SEARCHPATH + if [ "$VERBOSE" -gt 2 ] + then + # Extremely verbose +- BASH="${BASH} -x" ++ SH="${SH} -x" + fi +-${BASH} "$FORMAT" post-process || exit 1 ++${SH} "$FORMAT" post-process || exit 1 +diff --git a/xmlto.spec.in b/xmlto.spec.in +index b9eb4a2..763f76d 100644 +--- a/xmlto.spec.in ++++ b/xmlto.spec.in +@@ -57,7 +57,7 @@ xhtml1 source format. + %autosetup -p1 + + %build +-%configure BASH=/bin/bash ++%configure XMLTO_SH_PATH=/bin/sh + %make_build + + %check diff --git a/yelp-xsl/yelp-xsl-49.0-posixify.patch b/yelp-xsl/yelp-xsl-49.0-posixify.patch new file mode 100644 index 0000000..c147cf3 --- /dev/null +++ b/yelp-xsl/yelp-xsl-49.0-posixify.patch @@ -0,0 +1,19 @@ +diff --git a/xslt/common/domains/gen_yelp_xml.sh b/xslt/common/domains/gen_yelp_xml.sh +index 29e133b..e77ca99 100755 +--- a/xslt/common/domains/gen_yelp_xml.sh ++++ b/xslt/common/domains/gen_yelp_xml.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + set -e + +@@ -10,7 +10,7 @@ output='' + target='' + + parse_options() { +- while [[ -n "${1}" ]]; do ++ while [ -n "${1}" ]; do + case "${1}" in + --input) + input="${2}" diff --git a/zsh_patches/zsh-cmdsubst-hang.patch b/zsh_patches/zsh-cmdsubst-hang.patch new file mode 100644 index 0000000..bf073f2 --- /dev/null +++ b/zsh_patches/zsh-cmdsubst-hang.patch @@ -0,0 +1,63 @@ +diff -u a/Src/exec.c b/Src/exec.c +--- a/Src/exec.c 2022-05-08 01:18:22.000000000 -0500 ++++ b/Src/exec.c 2026-02-25 22:23:44.602848997 -0600 +@@ -4679,7 +4679,34 @@ + zclose(pipes[1]); + retval = readoutput(pipes[0], qt, NULL); + fdtable[pipes[0]] = FDT_UNUSED; +- waitforpid(pid, 0); /* unblocks */ ++ wait_for_processes(); ++ /* ++ * The SIGCHLD handler may already have reaped the command ++ * substitution child while readoutput() had signals unblocked. ++ * In that case cmdoutpid is cleared, and calling waitforpid() ++ * on a stale PID can hang if the PID has been reused. ++ */ ++ if (cmdoutpid == pid) { ++ int status; ++ pid_t waitret; ++ ++ while ((waitret = waitpid(pid, &status, 0)) < 0 && errno == EINTR) ++ ; ++ if (waitret == pid) { ++ cmdoutpid = 0; ++ if (WIFSIGNALED(status)) ++ cmdoutval = (0200 | WTERMSIG(status)); ++ else ++ cmdoutval = WEXITSTATUS(status); ++ use_cmdoutval = 1; ++ get_usage(); ++ } else if (waitret < 0 && errno == ECHILD) { ++ wait_for_processes(); ++ if (cmdoutpid == pid) ++ cmdoutpid = 0; ++ } ++ } ++ child_unblock(); + lastval = cmdoutval; + return retval; + } +@@ -4884,7 +4911,22 @@ + return nam; + } else if (pid) { + close(fd); +- waitforpid(pid, 0); ++ wait_for_processes(); ++ if (cmdoutpid == pid) { ++ int status; ++ pid_t waitret; ++ ++ while ((waitret = waitpid(pid, &status, 0)) < 0 && errno == EINTR) ++ ; ++ if (waitret == pid) ++ cmdoutpid = 0; ++ else if (waitret < 0 && errno == ECHILD) { ++ wait_for_processes(); ++ if (cmdoutpid == pid) ++ cmdoutpid = 0; ++ } ++ } ++ child_unblock(); + cmdoutval = 0; + return nam; + }