Skip to content

Commit 8d16e6d

Browse files
committed
legacy
1 parent 0ccafa9 commit 8d16e6d

6 files changed

Lines changed: 88 additions & 68 deletions

File tree

pkgs/roc/lib/build.sh

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ DEFAULT_APPLICATION="hello"
1313
application="${APPLICATION:-$DEFAULT_APPLICATION}"
1414
static=0
1515
skip_run=0
16-
eval set -- "$(getopt -o "" --long platform:,app:,static,skip-run,help -- "$@")"
16+
linker="default" # default: surgical, options: surgical, legacy
17+
legacy=default
18+
eval set -- "$(getopt -o "" --long platform:,app:,static,skip-run,help,legacy,surgical,linker: -- "$@")"
1719
if [[ $# -gt 1 ]]; then
1820
while true; do
1921
case ${1:""} in
@@ -37,6 +39,18 @@ if [[ $# -gt 1 ]]; then
3739
skip_run=1
3840
shift
3941
;;
42+
--linker)
43+
linker="$2"
44+
shift 2
45+
;;
46+
--surgical)
47+
linker="surgical"
48+
shift
49+
;;
50+
--legacy)
51+
linker="legacy"
52+
shift
53+
;;
4054
--help) usage ;;
4155
--)
4256
shift
@@ -59,6 +73,12 @@ if [[ $# -gt 1 ]]; then
5973
esac
6074
done
6175
fi
76+
if [[ "$linker" = "default" ]]; then
77+
linker="legacy"
78+
fi
79+
if [[ ! -z "$linker" ]]; then
80+
linker="--linker=$linker"
81+
fi
6282
platform="${platform:-$DEFAULT_PLATFORM}"
6383
application="${application:-$DEFAULT_APPLICATION}"
6484
platform_path="${PLATFORM_PATH:-./platforms/${platform}}"
@@ -87,7 +107,7 @@ app_lib="$app_path/libapp.so"
87107
rm -f "$app_lib" 2>/dev/null || true
88108
app_main="$app_path/main.roc"
89109
# --linker=legacy
90-
roc build --lib "$app_main" --output "$app_lib"
110+
roc build $linker --lib "$app_main" --output "$app_lib"
91111
if [[ -d "$platform_path" ]]; then
92112
if [[ ! -d "$platform_roc_path/Lib" ]]; then
93113
if [[ -L "$platform_roc_path/Lib" ]]; then
@@ -107,10 +127,10 @@ if [[ -d "$platform_path" ]]; then
107127
# nix_file="./flake.nix"
108128
# if [[ -f "$nix_file" ]] && command -v nix && eval "nix eval --json .#devShell.x86_64-linux >/dev/null 2>&1"; then
109129
# --linker=legacy
110-
# nix develop --command "roc \"$roc_build_file\""
130+
# nix develop --command "roc $linker \"$roc_build_file\""
111131
# else
112132
# --linker=legacy
113-
roc "$roc_build_file"
133+
roc $linker "$roc_build_file"
114134
# fi
115135
if [[ -d "target/release" ]]; then
116136
host_bin="$platform_path/target/release/host"
@@ -131,4 +151,4 @@ if [[ -d "$platform_path" ]]; then
131151
roc preprocess-host "$host_bin" "$host_main" "$app_lib"
132152
fi
133153
# --linker=legacy
134-
((skip_run)) || roc "$app_main"
154+
((skip_run)) || roc $linker "$app_main"
-529 KB
Binary file not shown.

pkgs/roc/platforms/rust-basic-cli-2/crates/roc_host/src/lib.rs

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -291,71 +291,71 @@ pub unsafe extern "C" fn roc_memset(dst: *mut c_void, c: i32, n: usize) -> *mut
291291
// TODO: remove all of this when we switch to effect interpreter.
292292
pub fn init() {
293293
let funcs: &[*const extern "C" fn()] = &[
294-
roc_alloc as _,
295-
roc_realloc as _,
296-
roc_dealloc as _,
297-
roc_panic as _,
298-
roc_dbg as _,
299-
roc_memset as _,
300-
roc_fx_env_dict as _,
301-
roc_fx_env_var as _,
302-
roc_fx_set_cwd as _,
303-
roc_fx_exe_path as _,
304-
roc_fx_stdin_line as _,
305-
roc_fx_stdin_bytes as _,
306-
roc_fx_stdin_read_to_end as _,
294+
// roc_alloc as _,
295+
// roc_realloc as _,
296+
// roc_dealloc as _,
297+
// roc_panic as _,
298+
// roc_dbg as _,
299+
// roc_memset as _,
300+
// roc_fx_env_dict as _,
301+
// roc_fx_env_var as _,
302+
// roc_fx_set_cwd as _,
303+
// roc_fx_exe_path as _,
304+
// roc_fx_stdin_line as _,
305+
// roc_fx_stdin_bytes as _,
306+
// roc_fx_stdin_read_to_end as _,
307307
roc_fx_stdout_line as _,
308-
roc_fx_stdout_write as _,
309-
roc_fx_stdout_write_bytes as _,
308+
// roc_fx_stdout_write as _,
309+
// roc_fx_stdout_write_bytes as _,
310310
roc_fx_hello as _,
311-
roc_fx_stderr_line as _,
312-
roc_fx_stderr_write as _,
313-
roc_fx_stderr_write_bytes as _,
314-
roc_fx_tty_mode_canonical as _,
315-
roc_fx_tty_mode_raw as _,
316-
roc_fx_file_write_utf8 as _,
317-
roc_fx_file_write_bytes as _,
318-
roc_fx_path_type as _,
319-
roc_fx_file_read_bytes as _,
320-
roc_fx_file_reader as _,
321-
roc_fx_file_read_line as _,
322-
roc_fx_file_delete as _,
323-
roc_fx_file_size_in_bytes as _,
324-
roc_fx_file_is_executable as _,
325-
roc_fx_file_is_readable as _,
326-
roc_fx_file_is_writable as _,
327-
roc_fx_file_time_accessed as _,
328-
roc_fx_file_time_modified as _,
329-
roc_fx_file_time_created as _,
330-
roc_fx_file_exists as _,
331-
roc_fx_file_rename as _,
332-
roc_fx_hard_link as _,
333-
roc_fx_cwd as _,
334-
roc_fx_posix_time as _,
335-
roc_fx_sleep_millis as _,
336-
roc_fx_dir_list as _,
337-
roc_fx_send_request as _,
338-
roc_fx_tcp_connect as _,
339-
roc_fx_tcp_read_up_to as _,
340-
roc_fx_tcp_read_exactly as _,
341-
roc_fx_tcp_read_until as _,
342-
roc_fx_tcp_write as _,
343-
roc_fx_command_status as _,
344-
roc_fx_command_output as _,
345-
roc_fx_dir_create as _,
346-
roc_fx_dir_create_all as _,
347-
roc_fx_dir_delete_empty as _,
348-
roc_fx_dir_delete_all as _,
349-
roc_fx_current_arch_os as _,
350-
roc_fx_temp_dir as _,
351-
roc_fx_get_locale as _,
352-
roc_fx_get_locales as _,
353-
roc_fx_sqlite_bind as _,
354-
roc_fx_sqlite_column_value as _,
355-
roc_fx_sqlite_columns as _,
356-
roc_fx_sqlite_prepare as _,
357-
roc_fx_sqlite_reset as _,
358-
roc_fx_sqlite_step as _,
311+
// roc_fx_stderr_line as _,
312+
// roc_fx_stderr_write as _,
313+
// roc_fx_stderr_write_bytes as _,
314+
// roc_fx_tty_mode_canonical as _,
315+
// roc_fx_tty_mode_raw as _,
316+
// roc_fx_file_write_utf8 as _,
317+
// roc_fx_file_write_bytes as _,
318+
// roc_fx_path_type as _,
319+
// roc_fx_file_read_bytes as _,
320+
// roc_fx_file_reader as _,
321+
// roc_fx_file_read_line as _,
322+
// roc_fx_file_delete as _,
323+
// roc_fx_file_size_in_bytes as _,
324+
// roc_fx_file_is_executable as _,
325+
// roc_fx_file_is_readable as _,
326+
// roc_fx_file_is_writable as _,
327+
// roc_fx_file_time_accessed as _,
328+
// roc_fx_file_time_modified as _,
329+
// roc_fx_file_time_created as _,
330+
// roc_fx_file_exists as _,
331+
// roc_fx_file_rename as _,
332+
// roc_fx_hard_link as _,
333+
// roc_fx_cwd as _,
334+
// roc_fx_posix_time as _,
335+
// roc_fx_sleep_millis as _,
336+
// roc_fx_dir_list as _,
337+
// roc_fx_send_request as _,
338+
// roc_fx_tcp_connect as _,
339+
// roc_fx_tcp_read_up_to as _,
340+
// roc_fx_tcp_read_exactly as _,
341+
// roc_fx_tcp_read_until as _,
342+
// roc_fx_tcp_write as _,
343+
// roc_fx_command_status as _,
344+
// roc_fx_command_output as _,
345+
// roc_fx_dir_create as _,
346+
// roc_fx_dir_create_all as _,
347+
// roc_fx_dir_delete_empty as _,
348+
// roc_fx_dir_delete_all as _,
349+
// roc_fx_current_arch_os as _,
350+
// roc_fx_temp_dir as _,
351+
// roc_fx_get_locale as _,
352+
// roc_fx_get_locales as _,
353+
// roc_fx_sqlite_bind as _,
354+
// roc_fx_sqlite_column_value as _,
355+
// roc_fx_sqlite_columns as _,
356+
// roc_fx_sqlite_prepare as _,
357+
// roc_fx_sqlite_reset as _,
358+
// roc_fx_sqlite_step as _,
359359
];
360360
#[allow(forgetting_references)]
361361
std::mem::forget(std::hint::black_box(funcs));
-518 Bytes
Binary file not shown.
-1.97 KB
Binary file not shown.
-2.05 KB
Binary file not shown.

0 commit comments

Comments
 (0)