Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 1 addition & 113 deletions .github/workflows/zeroperl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,119 +184,7 @@ jobs:
- name: Create WASI hint file
shell: bash
run: |
cat <<'EOF' > hintfile_wasi.sh

# fix bizarre preprocessor bug
d_perl_lc_all_category_positions_init='define'
d_perl_lc_all_separator='undef'
d_perl_lc_all_uses_name_value_pairs='undef'
perl_lc_all_category_positions_init='{ 0, 1, 5, 2, 3, 4 }'
perl_lc_all_separator=''

usemymalloc="n"
usedevel="n"
usemultiplicity="undef"
usenm='undef'
usemallocwrap="define"
d_procselfexe='undef'
d_dlopen='undef'
# Disable wait-related features
d_wait='undef'
d_waitpid='undef'
d_wait3='undef'
d_wait4='undef'
i_syswait='undef' # This tells perl not to include sys/wait.h

i_grp='define'
i_pwd='define'
d_getpwnam='undef'
d_getpwent='undef'
d_getpwuid='undef'
d_getspnam='undef'
d_getpwnam_r='undef'
d_getpwent_r='undef'
d_getpwuid_r='undef'
d_getprpwnam='undef'
d_setpwent='undef'
d_setpwent_r='undef'
d_getgrnam='undef'
d_getgrgid='undef'
d_getgrent='undef'
d_getgrnam_r='undef'
d_getgrgid_r='undef'
d_getgrent_r='undef'
d_setgrent='undef'
d_setgrent_r='undef'
d_endgrent='undef'
d_endgrent_r='undef'
d_getuid='undef'
d_geteuid='undef'
d_getgid='undef'
d_getegid='undef'

uselargefiles='define'
use64bitint='define'
useperlio='define'
usequadmath='undef'
usethreads='undef'
use64bitall='define'

d_off64_t='define'
use_off64_t='define'
d_stat='define'
d_fstat='define'
d_lstat='define'
d_statblks='undef'
d_fstat64='define'
d_fdclose='undef'
d_dirnamlen='undef'
d_readdir64_r='define'

quadtype='long long'
uquadtype='unsigned long long'
quadkind='3'

d_setrgid='undef'
d_setruid='undef'
d_setproctitle='undef'
d_malloc_size='undef'
d_malloc_good_size='undef'

d_clearenv='undef'
d_cuserid='undef'
d_eaccess='undef'
d_getspnam='undef'
d_msgctl='undef'
d_msgget='undef'
d_msgrcv='undef'
d_msgsnd='undef'
d_semget='undef'
d_semop='undef'
d_shmat='undef'
d_shmctl='undef'
d_shmdt='undef'
d_shmget='undef'
d_syscall='undef'


d_killpg='undef'
d_pause='undef'

d_wait4='undef'
d_waitpid='undef'
d_vfork='undef'
d_pseudofork='undef'
i_pthread='undef'
d_pthread_atfork='undef'
d_pthread_attr_setscope='undef'
d_pthread_yield='undef'

noextensions='Socket POSIX Time/HiRes Devel/Peek Sys/Syslog'

ldflags='-static -lwasi-emulated-signal -lwasi-emulated-getpid -lwasi-emulated-process-clocks -lwasi-emulated-mman'
ccflags='$ccflags -DBIG_TIME -DNO_MATHOMS -Wno-implicit-function-declaration -D_WASI_EMULATED_PROCESS_CLOCKS -lwasi-emulated-process-clocks -D_WASI_EMULATED_GETPID -lwasi-emulated-getpid -D_GNU_SOURCE -D_POSIX_C_SOURCE -Wno-null-pointer-arithmetic -D_WASI_EMULATED_SIGNAL -lwasi-emulated-signal -include /opt/wasi-sdk/share/wasi-sysroot/include/wasm32-wasi/fcntl.h -I${{ github.workspace }}/stubs'
cppflags='-lm -Wno-implicit-function-declaration -DBIG_TIME -DNO_MATHOMS -D_WASI_EMULATED_PROCESS_CLOCKS -lwasi-emulated-process-clocks -D_WASI_EMULATED_GETPID -lwasi-emulated-getpid -D_GNU_SOURCE -D_POSIX_C_SOURCE -DSTANDARD_C -DPERL_USE_SAFE_PUTENV -D_WASI_EMULATED_SIGNAL -lwasi-emulated-signal -Wno-null-pointer-arithmetic -fno-strict-aliasing -pipe -fstack-protector-strong -include /opt/wasi-sdk/share/wasi-sysroot/include/wasm32-wasi/fcntl.h -I${{ github.workspace }}/stubs'
EOF
sed -e "s&\\[% github_workspace %\\]&${{ github.workspace }}&g" < tools/hintfile_wasi_template.sh > hintfile_wasi.sh

- name: Install Perl (WASI build)
shell: bash
Expand Down
110 changes: 110 additions & 0 deletions tools/hintfile_wasi_template.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# fix bizarre preprocessor bug
d_perl_lc_all_category_positions_init='define'
d_perl_lc_all_separator='undef'
d_perl_lc_all_uses_name_value_pairs='undef'
perl_lc_all_category_positions_init='{ 0, 1, 5, 2, 3, 4 }'
perl_lc_all_separator=''

usemymalloc="n"
usedevel="n"
usemultiplicity="undef"
usenm='undef'
usemallocwrap="define"
d_procselfexe='undef'
d_dlopen='undef'
# Disable wait-related features
d_wait='undef'
d_waitpid='undef'
d_wait3='undef'
d_wait4='undef'
i_syswait='undef' # This tells perl not to include sys/wait.h

i_grp='define'
i_pwd='define'
d_getpwnam='undef'
d_getpwent='undef'
d_getpwuid='undef'
d_getspnam='undef'
d_getpwnam_r='undef'
d_getpwent_r='undef'
d_getpwuid_r='undef'
d_getprpwnam='undef'
d_setpwent='undef'
d_setpwent_r='undef'
d_getgrnam='undef'
d_getgrgid='undef'
d_getgrent='undef'
d_getgrnam_r='undef'
d_getgrgid_r='undef'
d_getgrent_r='undef'
d_setgrent='undef'
d_setgrent_r='undef'
d_endgrent='undef'
d_endgrent_r='undef'
d_getuid='undef'
d_geteuid='undef'
d_getgid='undef'
d_getegid='undef'

uselargefiles='define'
use64bitint='define'
useperlio='define'
usequadmath='undef'
usethreads='undef'
use64bitall='define'

d_off64_t='define'
use_off64_t='define'
d_stat='define'
d_fstat='define'
d_lstat='define'
d_statblks='undef'
d_fstat64='define'
d_fdclose='undef'
d_dirnamlen='undef'
d_readdir64_r='define'

quadtype='long long'
uquadtype='unsigned long long'
quadkind='3'

d_setrgid='undef'
d_setruid='undef'
d_setproctitle='undef'
d_malloc_size='undef'
d_malloc_good_size='undef'

d_clearenv='undef'
d_cuserid='undef'
d_eaccess='undef'
d_getspnam='undef'
d_msgctl='undef'
d_msgget='undef'
d_msgrcv='undef'
d_msgsnd='undef'
d_semget='undef'
d_semop='undef'
d_shmat='undef'
d_shmctl='undef'
d_shmdt='undef'
d_shmget='undef'
d_syscall='undef'


d_killpg='undef'
d_pause='undef'

d_wait4='undef'
d_waitpid='undef'
d_vfork='undef'
d_pseudofork='undef'
i_pthread='undef'
d_pthread_atfork='undef'
d_pthread_attr_setscope='undef'
d_pthread_yield='undef'

noextensions='Socket POSIX Time/HiRes Devel/Peek Sys/Syslog'

ldflags='-static -lwasi-emulated-signal -lwasi-emulated-getpid -lwasi-emulated-process-clocks -lwasi-emulated-mman'
ccflags='$ccflags -DBIG_TIME -DNO_MATHOMS -Wno-implicit-function-declaration -D_WASI_EMULATED_PROCESS_CLOCKS -lwasi-emulated-process-clocks -D_WASI_EMULATED_GETPID -lwasi-emulated-getpid -D_GNU_SOURCE -D_POSIX_C_SOURCE -Wno-null-pointer-arithmetic -D_WASI_EMULATED_SIGNAL -lwasi-emulated-signal -include /opt/wasi-sdk/share/wasi-sysroot/include/wasm32-wasi/fcntl.h -I[% github_workspace %]/stubs'
cppflags='-lm -Wno-implicit-function-declaration -DBIG_TIME -DNO_MATHOMS -D_WASI_EMULATED_PROCESS_CLOCKS -lwasi-emulated-process-clocks -D_WASI_EMULATED_GETPID -lwasi-emulated-getpid -D_GNU_SOURCE -D_POSIX_C_SOURCE -DSTANDARD_C -DPERL_USE_SAFE_PUTENV -D_WASI_EMULATED_SIGNAL -lwasi-emulated-signal -Wno-null-pointer-arithmetic -fno-strict-aliasing -pipe -fstack-protector-strong -include /opt/wasi-sdk/share/wasi-sysroot/include/wasm32-wasi/fcntl.h -I[% github_workspace %]/stubs'
Comment on lines +109 to +110
Copy link

@teohhanhui teohhanhui Jun 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The placeholder shouldn't be called github_workspace.

The default working directory on the runner for steps, and the default location of your repository when using the checkout action.

https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context

So perhaps project_directory?

(It'd probably make sense to pass this as $1, so that no templating is necessary?)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. Where do you see project_directory? Moreover, positional parameters ( $1 ) are less reliable, robust, and powerful than named template fields.

Copy link

@teohhanhui teohhanhui Jun 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

project_directory is my suggestion, because that's what this path is.

positional parameters ( $1 ) are less reliable, robust, and powerful than named template fields.

The user will be forced to run an additional step to substitute variables to prepare the template for use (e.g. with envsubst), so I'm not sure that's worth it for a simple shell script.

Perhaps a good compromise is to just read a PROJECT_DIR env var directly from the script.