Skip to content

Commit

Permalink
MACOSX/i386: Make the 10.13 SDK somewhat compatible with 10.6
Browse files Browse the repository at this point in the history
Download 10.6 SDK is harder and there is not much incompatibilities.
  • Loading branch information
lephilousophe committed Dec 24, 2024
1 parent 659d1bf commit 8807ca6
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 0 deletions.
2 changes: 2 additions & 0 deletions toolchains/macosx-i386/Dockerfile.m4
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ m4_define(`MACOSX_ARCHITECTURES',`i386')m4_dnl
m4_define(`MACOSX_PORTS_ARCH_ARG',`--i386')m4_dnl
m4_include(`apple/macosx.m4')m4_dnl

local_package(sdk10.13-patcher)

define_aliases(MACOSX_TARGET_ARCH`'-apple-darwin`'MACOSX_TARGET_VERSION, bundle, --enable-static --with-staticlib-prefix=${DESTDIR}/${PREFIX} --disable-osx-dock-plugin)
50 changes: 50 additions & 0 deletions toolchains/macosx-i386/packages/sdk10.13-patcher/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#! /bin/sh

PACKAGE_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
HELPERS_DIR=$PACKAGE_DIR/../..
. $HELPERS_DIR/functions.sh

# libcurl provided in SDK 10.13 is too recent for MacOS 10.6 system libcurl
# Patch the header and the stub to make sure it will work

# First, make apps believe they compile against the original libcurl version
sed -i -f - "${TARGET_DIR}/SDK/MacOSX10.13.sdk/usr/include/curl/curlver.h" <<'EOF'
s/LIBCURL_VERSION .*/LIBCURL_VERSION "7.19.7"/
s/LIBCURL_VERSION_MINOR .*/LIBCURL_VERSION_MINOR 19/
s/LIBCURL_VERSION_PATCH .*/LIBCURL_VERSION_PATCH 7/
s/LIBCURL_VERSION_NUM .*/LIBCURL_VERSION_NUM 0x071307/
s/LIBCURL_TIMESTAMP .*/LIBCURL_TIMESTAMP "Wed Nov 4 12:34:59 UTC 2009"/
EOF

# Then, copy the proper stub (generated using tapi from MacOS 10.6 libcurl.4.dylib)
cp "${PACKAGE_DIR}/libcurl.4.tbd" "${TARGET_DIR}/SDK/MacOSX10.13.sdk/usr/lib/libcurl.4.tbd"

# libedit provided in SDK 10.13 is too recent for MacOS 10.6 system libedit
# Patch the headers and the stub to make sure it will work

sed -i -f - "${TARGET_DIR}/SDK/MacOSX10.13.sdk/usr/include/histedit.h" <<'EOF'
/_el_fn_sh_complete/d
/EL_R\?PROMPT_ESC/d
/EL_RESIZE/d
/Begin Wide Character Support/{N;a\
#if 0
}
/tok_wstr/{N;a\
#endif
}
EOF

sed -i -f - "${TARGET_DIR}/SDK/MacOSX10.13.sdk/usr/include/editline/readline.h" <<'EOF'
/RL_PROMPT_/d
/rl_completion_word_break_hook/d
/rl_set_prompt/d
/rl_on_new_line/d
EOF

# Then, copy the proper stub (generated using tapi from MacOS 10.6 libedit.2.dylib) and switch to version 2 instead of 3
rm "${TARGET_DIR}/SDK/MacOSX10.13.sdk/usr/lib/libedit.2.tbd" \
"${TARGET_DIR}/SDK/MacOSX10.13.sdk/usr/lib/libedit.tbd" \
"${TARGET_DIR}/SDK/MacOSX10.13.sdk/usr/lib/libreadline.tbd"
cp "${PACKAGE_DIR}/libedit.2.tbd" "${TARGET_DIR}/SDK/MacOSX10.13.sdk/usr/lib/libedit.2.tbd"
ln -s "libedit.2.tbd" "${TARGET_DIR}/SDK/MacOSX10.13.sdk/usr/lib/libedit.tbd"
ln -s "libedit.2.tbd" "${TARGET_DIR}/SDK/MacOSX10.13.sdk/usr/lib/libreadline.tbd"
28 changes: 28 additions & 0 deletions toolchains/macosx-i386/packages/sdk10.13-patcher/libcurl.4.tbd
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- !tapi-tbd-v3
archs: [ i386, x86_64 ]
uuids: [ 'i386: 242954AD-3BE1-29E8-E2E0-08063201F105', 'x86_64: 1E041185-131C-C237-C250-38BE933A269A' ]
platform: macosx
install-name: /usr/lib/libcurl.4.dylib
current-version: 6.1
compatibility-version: 6
objc-constraint: none
exports:
- archs: [ i386, x86_64 ]
symbols: [ _curl_easy_cleanup, _curl_easy_duphandle, _curl_easy_escape,
_curl_easy_getinfo, _curl_easy_init, _curl_easy_pause, _curl_easy_perform,
_curl_easy_recv, _curl_easy_reset, _curl_easy_send, _curl_easy_setopt,
_curl_easy_strerror, _curl_easy_unescape, _curl_escape, _curl_formadd,
_curl_formfree, _curl_formget, _curl_free, _curl_getdate,
_curl_getenv, _curl_global_cleanup, _curl_global_init, _curl_global_init_mem,
_curl_maprintf, _curl_mfprintf, _curl_mprintf, _curl_msnprintf,
_curl_msprintf, _curl_multi_add_handle, _curl_multi_assign,
_curl_multi_cleanup, _curl_multi_fdset, _curl_multi_info_read,
_curl_multi_init, _curl_multi_perform, _curl_multi_remove_handle,
_curl_multi_setopt, _curl_multi_socket, _curl_multi_socket_action,
_curl_multi_socket_all, _curl_multi_strerror, _curl_multi_timeout,
_curl_mvaprintf, _curl_mvfprintf, _curl_mvprintf, _curl_mvsnprintf,
_curl_mvsprintf, _curl_share_cleanup, _curl_share_init, _curl_share_setopt,
_curl_share_strerror, _curl_slist_append, _curl_slist_free_all,
_curl_strequal, _curl_strnequal, _curl_unescape, _curl_version,
_curl_version_info ]
...
108 changes: 108 additions & 0 deletions toolchains/macosx-i386/packages/sdk10.13-patcher/libedit.2.tbd
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
--- !tapi-tbd-v3
archs: [ i386, x86_64 ]
uuids: [ 'i386: 5B7A7635-1B37-3F65-D3C1-9ED8E6D89C83', 'x86_64: DB35EEA3-A6D3-7D82-6EFB-70383A153E0A' ]
platform: macosx
install-name: /usr/lib/libedit.2.dylib
current-version: 2.11
compatibility-version: 2
objc-constraint: none
exports:
- archs: [ i386, x86_64 ]
symbols: [ ___edit_2VersionNumber, ___edit_2VersionString, __el_fn_complete,
__rl_abort_internal, __rl_print_completions_horizontally,
__rl_qsort_string_compare, _add_history, _c__next_word, _c__prev_word,
_c_delafter, _c_delafter1, _c_delbefore, _c_delbefore1, _c_gets,
_c_hmatch, _c_hpos, _c_insert, _c_setpat, _ce__isword, _ce_inc_search,
_ce_search_line, _ch_end, _ch_enlargebufs, _ch_init, _ch_reset,
_clear_history, _completion_matches, _current_history, _cv__endword,
_cv__isWord, _cv__isword, _cv_csearch, _cv_delfini, _cv_next_word,
_cv_prev_word, _cv_repeat_srch, _cv_search, _cv_undo, _cv_yank,
_ed_argument_digit, _ed_clear_screen, _ed_command, _ed_delete_next_char,
_ed_delete_prev_char, _ed_delete_prev_word, _ed_digit, _ed_end_of_file,
_ed_insert, _ed_kill_line, _ed_move_to_beg, _ed_move_to_end,
_ed_newline, _ed_next_char, _ed_next_history, _ed_next_line,
_ed_prev_char, _ed_prev_history, _ed_prev_line, _ed_prev_word,
_ed_quoted_insert, _ed_redisplay, _ed_search_next_history,
_ed_search_prev_history, _ed_sequence_lead_in, _ed_start_over,
_ed_transpose_chars, _ed_tty_dsusp, _ed_tty_flush_output,
_ed_tty_sigint, _ed_tty_sigquit, _ed_tty_sigtstp, _ed_tty_start_output,
_ed_tty_stop_output, _ed_unassigned, _el_beep, _el_deletestr,
_el_editmode, _el_end, _el_get, _el_getc, _el_gets, _el_init,
_el_insertstr, _el_line, _el_match, _el_parse, _el_push, _el_read_getfn,
_el_read_setfn, _el_reset, _el_resize, _el_set, _el_source,
_em_capitol_case, _em_copy_prev_word, _em_copy_region, _em_delete_next_word,
_em_delete_or_list, _em_delete_prev_char, _em_exchange_mark,
_em_gosmacs_transpose, _em_inc_search_next, _em_inc_search_prev,
_em_kill_line, _em_kill_region, _em_lower_case, _em_meta_next,
_em_next_word, _em_set_mark, _em_toggle_overwrite, _em_universal_argument,
_em_upper_case, _em_yank, _emacs_ctlx_keymap, _emacs_meta_keymap,
_emacs_standard_keymap, _filename_completion_function, _fn_complete,
_fn_display_match_list, _fn_filename_completion_function,
_fn_tilde_expand, _func__get, _get_history_event, _help__get,
_hist_command, _hist_end, _hist_enlargebuf, _hist_get, _hist_init,
_hist_set, _history, _history_arg_extract, _history_base,
_history_end, _history_expand, _history_expansion_char, _history_get,
_history_get_history_state, _history_inhibit_expansion_function,
_history_init, _history_is_stifled, _history_length, _history_no_expand_chars,
_history_search, _history_search_pos, _history_search_prefix,
_history_set_pos, _history_subst_char, _history_tokenize,
_history_total_bytes, _history_truncate_file, _key__decode_char,
_key__decode_str, _key_add, _key_clear, _key_delete, _key_end,
_key_get, _key_init, _key_kprint, _key_map_cmd, _key_map_str,
_key_print, _key_reset, _libedit_fgetln, _libedit_strlcat,
_libedit_strlcpy, _map_addfunc, _map_bind, _map_end, _map_get_editor,
_map_init, _map_init_emacs, _map_init_vi, _map_set_editor,
_max_input_history, _next_history, _parse__escape, _parse__string,
_parse_cmd, _parse_line, _previous_history, _prompt_end, _prompt_get,
_prompt_init, _prompt_print, _prompt_set, _re_clear_display,
_re_clear_lines, _re_fastaddc, _re_goto_bottom, _re_putc,
_re_refresh, _re_refresh_cursor, _read_finish, _read_history,
_read_init, _read_prepare, _readline, _readline_echoing_p,
_remove_history, _replace_history_entry, _rl_add_defun, _rl_already_prompted,
_rl_attempted_completion_function, _rl_attempted_completion_over,
_rl_basic_word_break_characters, _rl_bind_key, _rl_bind_key_in_map,
_rl_callback_handler_install, _rl_callback_handler_remove,
_rl_callback_read_char, _rl_catch_signals, _rl_cleanup_after_signal,
_rl_complete, _rl_completer_quote_characters, _rl_completer_word_break_characters,
_rl_completion_append_character, _rl_completion_display_matches_hook,
_rl_completion_entry_function, _rl_completion_matches, _rl_completion_query_items,
_rl_completion_type, _rl_deprep_term_function, _rl_deprep_terminal,
_rl_display_match_list, _rl_done, _rl_end, _rl_event_hook,
_rl_filename_completion_desired, _rl_filename_completion_function,
_rl_forced_update_display, _rl_free_line_state, _rl_generic_bind,
_rl_get_keymap, _rl_get_previous_history, _rl_get_screen_size,
_rl_getc_function, _rl_ignore_completion_duplicates, _rl_inhibit_completion,
_rl_initialize, _rl_insert, _rl_insert_text, _rl_instream,
_rl_kill_text, _rl_library_version, _rl_line_buffer, _rl_linefunc,
_rl_make_bare_keymap, _rl_newline, _rl_outstream, _rl_parse_and_bind,
_rl_point, _rl_pre_input_hook, _rl_prep_term_function, _rl_prep_terminal,
_rl_prompt, _rl_read_init_file, _rl_read_key, _rl_readline_name,
_rl_readline_version, _rl_redisplay, _rl_redisplay_function,
_rl_reset_terminal, _rl_set_keymap, _rl_set_screen_size, _rl_special_prefixes,
_rl_startup1_hook, _rl_startup_hook, _rl_stuff_char, _rl_terminal_name,
_rl_variable_bind, _search_end, _search_init, _sig_clr, _sig_end,
_sig_init, _sig_set, _stifle_history, _strsvis, _strsvisx,
_strunvis, _strunvisx, _strvis, _strvisx, _svis, _term__flush,
_term__putc, _term_beep, _term_bind_arrow, _term_change_size,
_term_clear_EOL, _term_clear_arrow, _term_clear_screen, _term_deletechars,
_term_echotc, _term_end, _term_get, _term_get_size, _term_gettc,
_term_init, _term_insertwrite, _term_move_to_char, _term_move_to_line,
_term_overwrite, _term_print_arrow, _term_set, _term_set_arrow,
_term_settc, _term_telltc, _term_writec, _tilde_expand, _tok_end,
_tok_init, _tok_line, _tok_reset, _tok_str, _tty_bind_char,
_tty_cookedmode, _tty_end, _tty_init, _tty_noquotemode, _tty_quotemode,
_tty_rawmode, _tty_stty, _unstifle_history, _unvis, _username_completion_function,
_using_history, _vi_add, _vi_add_at_eol, _vi_alias, _vi_change_case,
_vi_change_meta, _vi_change_to_eol, _vi_command_mode, _vi_comment_out,
_vi_delete_meta, _vi_delete_prev_char, _vi_end_big_word, _vi_end_word,
_vi_histedit, _vi_history_word, _vi_insert, _vi_insert_at_bol,
_vi_kill_line_prev, _vi_list_or_eof, _vi_match, _vi_next_big_word,
_vi_next_char, _vi_next_word, _vi_paste_next, _vi_paste_prev,
_vi_prev_big_word, _vi_prev_char, _vi_prev_word, _vi_redo,
_vi_repeat_next_char, _vi_repeat_prev_char, _vi_repeat_search_next,
_vi_repeat_search_prev, _vi_replace_char, _vi_replace_mode,
_vi_search_next, _vi_search_prev, _vi_substitute_char, _vi_substitute_line,
_vi_to_column, _vi_to_history_line, _vi_to_next_char, _vi_to_prev_char,
_vi_undo, _vi_undo_line, _vi_yank, _vi_yank_end, _vi_zero,
_vis, _where_history, _write_history ]
...

0 comments on commit 8807ca6

Please sign in to comment.