Skip to content

Add experimental support for NetBSD #1224

Add experimental support for NetBSD

Add experimental support for NetBSD #1224

Workflow file for this run

#
#
#
# *** If you edit this file, make sure that CONTRIBUTING.md stays up to date.
#
#
#
on:
push:
branches:
- main
pull_request:
jobs:
# I created a zip file that contains mingw64, but with some large files deleted.
# These large files are most of the time unnecessary for developing Jou.
# People with slow internet need the smaller zip file.
#
# This check fails if the zip file contains anything else than what's in the original/full zip file.
# It serves two purposes:
# * People can trust the random zip file I have created locally on my system and committed.
# * I can be sure that I didn't accidentally include something unnecessary or do something else dumb.
check-small-mingw64:
runs-on: ubuntu-latest
steps:
# Same URLs as in windows_setup.sh
- name: Download the small mingw64
run: curl -L -o mingw64-small.zip https://akuli.github.io/mingw64-small.zip
- name: Download the full mingw64
run: curl -L -o mingw64.zip https://github.com/brechtsanders/winlibs_mingw/releases/download/12.1.0-14.0.6-10.0.0-msvcrt-r3/winlibs-x86_64-posix-seh-gcc-12.1.0-llvm-14.0.6-mingw-w64msvcrt-10.0.0-r3.zip
# Same SHA hashes as in windows_setup.sh
- name: Veriy the small mingw64
run: |
if [ "$(sha256sum mingw64-small.zip | cut -d' ' -f1)" != "4d858bd22f084ae362ee6a22a52c2c5b5281d996f96693984a31336873b92686" ]; then
echo "verifying failed"
exit 1
fi
- name: Veriy the full mingw64
run: |
if [ "$(sha256sum mingw64.zip | cut -d' ' -f1)" != "9ffef7f7a8dab893bd248085fa81a5a37ed6f775ae220ef673bea8806677836d" ]; then
echo "verifying failed"
exit 1
fi
- name: Make sure that all file paths start with mingw64
run: |
zipinfo -1 mingw64.zip > output.txt
zipinfo -1 mingw64-small.zip >> output.txt
cat output.txt
if [ "$(cut -d/ -f1 output.txt | uniq)" != "mingw64" ]; then
exit 1
fi
- run: ls -lh mingw64*.zip
- name: Extract mingw64.zip
run: mkdir full && cd full && unzip ../mingw64.zip
- name: Extract mingw64-small.zip
run: mkdir small && cd small && unzip ../mingw64-small.zip
- name: Compare files
run: |
# diff exits with status 1 because the folders differ.
# Put errors to output.txt as well, so that we notice if something goes wrong.
(diff -r full small || true) &> output.txt
cat output.txt
if [ "$(cut -d/ -f1 output.txt | uniq)" != "Only in full" ]; then
exit 1
fi
build-zip:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
# TODO: figure out why --small doesn't work here
- run: source activate && ./windows_setup.sh
shell: bash
- run: source activate && mingw32-make
shell: bash
# We don't need to copy all of mingw64. We only need the GNU linker.
# The less we copy, the smaller the resulting zip becomes.
#
# gcc is needed only to run the linker. It would be possible to invoke ld.exe
# directly, but the command-line it wants is a bit complicated and it's just
# easier to let a C compiler figure it out. I also tried using clang instead
# of gcc, but it depends on many LLVM DLLs and the zip file became huge.
- name: Copy the linker from mingw64 to jou/mingw64
shell: bash
run: |
# Executables are copied without their DLLs (added later)
# Names of .a files figured out by deleting them all and looking at error message.
# CRT (C RunTime) files are needed because the linker implicitly adds them to every executable.
for file in \
mingw64/version_info.txt \
$(find mingw64 -name 'crt*.o') \
mingw64/bin/gcc.exe \
mingw64/lib/gcc/x86_64-w64-mingw32/12.1.0/libgcc.a \
mingw64/lib/gcc/x86_64-w64-mingw32/12.1.0/libgcc_eh.a \
mingw64/libexec/gcc/x86_64-w64-mingw32/12.1.0/liblto_plugin.dll \
mingw64/x86_64-w64-mingw32/bin/ld.exe \
mingw64/x86_64-w64-mingw32/lib/libadvapi32.a \
mingw64/x86_64-w64-mingw32/lib/libkernel32.a \
mingw64/x86_64-w64-mingw32/lib/libm.a \
mingw64/x86_64-w64-mingw32/lib/libmingw32.a \
mingw64/x86_64-w64-mingw32/lib/libmingwex.a \
mingw64/x86_64-w64-mingw32/lib/libmoldname.a \
mingw64/x86_64-w64-mingw32/lib/libmsvcrt.a \
mingw64/x86_64-w64-mingw32/lib/libpthread.a \
mingw64/x86_64-w64-mingw32/lib/libshell32.a \
mingw64/x86_64-w64-mingw32/lib/libuser32.a
do
mkdir -vp jou/$(dirname $file)
cp -v $file jou/$file
done
- name: Copy more files to jou/
# Please keep this list of files in sync with update.ps1
run: cp -rv stdlib doc examples LICENSE jou.exe update.ps1 jou
shell: bash
- name: Copy missing DLL files to jou/
shell: bash
run: |
function copy_dlls() {
local from=$1
local to=$2
local queue=($to/*.exe)
while [ ${#queue[@]} != 0 ]; do
local args=(${queue[@]})
queue=()
for dll in $(mingw64/bin/objdump -p ${args[@]} | grep 'DLL Name:' | cut -d: -f2 | sort -u); do
if [ -f $from/$dll ] && ! [ -f $to/$dll ]; then
cp -v $from/$dll $to/
queue+=($to/$dll)
fi
done
done
}
copy_dlls mingw64/bin jou
copy_dlls mingw64/bin jou/mingw64/bin
copy_dlls mingw64/x86_64-w64-mingw32/bin jou/mingw64/x86_64-w64-mingw32/bin
- name: Convert text files to Windows-style CRLF line endings
run: mingw64/bin/unix2dos $(find jou -name '*.jou') $(find jou -name '*.md') jou/LICENSE
shell: bash
- run: Compress-Archive -Path jou -DestinationPath jou.zip
- name: Display size of jou.zip
run: ls -lh jou.zip
shell: bash
- uses: actions/upload-artifact@v3
with:
name: windows-zip
path: jou.zip
test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
# Add a space in the folder name to trigger bugs like #165
path: "test dir"
- run: cd "test dir" && ./windows_setup.sh --small
shell: bash
- run: cd "test dir" && source activate && ./runtests.sh --verbose
shell: bash
doctest:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- run: ./windows_setup.sh --small
shell: bash
- run: source activate && ./doctest.sh
shell: bash
test-zip:
needs: build-zip
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
path: repo
- uses: actions/download-artifact@v3
with:
name: windows-zip
- run: unzip jou.zip
- run: cp -r repo/tests repo/runtests.sh jou
shell: bash
- run: cd jou && ./jou.exe --verbose examples/hello.jou
shell: bash
- run: cd jou && ./runtests.sh --dont-run-make --verbose
shell: bash
compare-compilers:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- run: source activate && ./windows_setup.sh --small
shell: bash
- run: source activate && ./compare_compilers.sh
shell: bash