diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 333bc59..e57c3ad 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -107,7 +107,7 @@ jobs: echo "linux=true" >> $GITHUB_OUTPUT; echo "macos=true" >> $GITHUB_OUTPUT; echo "windows=true" >> $GITHUB_OUTPUT; - + ###################################################################################### @@ -123,7 +123,7 @@ jobs: steps: # Checkout the actions for this repo owner - name: Checkout Actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/.github path: ./Actions_${{ github.sha }} @@ -157,7 +157,7 @@ jobs: steps: # Checkout the actions for this repo owner - name: Checkout Actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/.github path: ./Actions_${{ github.sha }} @@ -165,7 +165,7 @@ jobs: # Checkout the branch - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Setup release tag - name: Setup Release Tag @@ -272,11 +272,11 @@ jobs: # Checkout the branch - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Checkout the actions for this repo owner - name: Checkout Actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/.github path: ./Actions_${{ github.sha }} @@ -324,7 +324,7 @@ jobs: export LDEARCH=aarch64-apple-darwin ./makeright init mkdir -p ../darwin.universal - exe=ldeinit + exe=ldeinit lipo -create \ -arch arm64 ../darwin.aarch64/${exe} \ -arch x86_64 ../darwin.x86_64/${exe} \ @@ -346,7 +346,7 @@ jobs: lipo ${exe} -output ../darwin.x86_64/${exe} -extract x86_64 lipo ${exe} -output ../darwin.aarch64/${exe} -extract arm64 cp -p ${exe} ../darwin.universal/${exe} - done + done # Create release tar for github. - name: Make release tar(s) @@ -369,7 +369,7 @@ jobs: # Push Release - name: Push the release uses: ncipollo/release-action@v1 - with: + with: allowUpdates: true artifacts: /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.x86_64.tgz, @@ -383,7 +383,7 @@ jobs: # Windows: build for Windows-Cygwin via Docker build and use results to # create and push release assets to github - + windows: needs: [inputs, sentry] @@ -418,7 +418,7 @@ jobs: # Retrieve SDL2 and install in cygwin - name: Install SDL2 id: sdl2 - env: + env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh release download 2.26.5 --repo interlisp/cygwin-sdl --pattern *.tgz --output .\cygwin\sdl2.tar.gz @@ -426,13 +426,13 @@ jobs: # Checkout the branch - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: cygwin\maiko # Checkout the actions for this repo owner - name: Checkout Actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/.github path: ./Actions_${{ github.sha }} @@ -473,6 +473,80 @@ jobs: +###################################################################################### + + # Emscripten: build and push Maiko compiled for Emscripten (to run Maiko in browser) + + emscripten: + + needs: [inputs, sentry] + if: | + needs.inputs.outputs.linux == 'true' + && ( + needs.sentry.outputs.release_not_built == 'true' + || needs.inputs.outputs.force == 'true' + ) + + runs-on: ubuntu-latest + + steps: + + # Checkout the actions for this repo owner + - name: Checkout Actions + uses: actions/checkout@v4 + with: + repository: ${{ github.repository_owner }}/.github + path: ./Actions_${{ github.sha }} + - run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }} + + # Install SDL2 + - name: Install SDL2 + run: | + export DEBIAN_FRONTEND=noninteractive + sudo -E apt-get install -y libsdl2-dev libsdl2-2.0-0 + + # Install Emscripten SDK + - name: Install Empscripten + working-directory: ../ + run: | + git clone https://github.com/emscripten-core/emsdk.git + cd emsdk + ./emsdk install latest + ./emsdk activate latest + CWD="$(pwd)" + echo "${CWD}" >> ${GITHUB_PATH} + echo "${CWD}/upstream/emscripten" >> ${GITHUB_PATH} + echo "${CWD}/upstream/emscripten/tools" >> ${GITHUB_PATH} + echo "${CWD}/node/$(ls -d node/*64bit | tail -1)/bin" >> ${GITHUB_PATH} + + # Checkout the maiko branch + - name: Checkout + uses: actions/checkout@v4 + + # Setup release tag + - name: Setup Release Tag + id: tag + uses: ./../actions/release-tag-action + + # Compile maiko using Emscripten (no load build) + - name: Compile Maiko using Emscripten + working-directory: ./bin + run: | + ./makeright wasm_nl + cd ../emscripten.wasm_nl + tar -c -z -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz * + + # Push Release to github + - name: Push the release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: ${{ steps.tag.outputs.release_tag }}-emscripten.tgz + tag: ${{ steps.tag.outputs.release_tag }} + draft: ${{ needs.inputs.outputs.draft }} + token: ${{ secrets.GITHUB_TOKEN }} + + ###################################################################################### # Use set-sentry-action to determine set the sentry that says this release has @@ -485,12 +559,12 @@ jobs: outputs: build_successful: ${{ steps.output.outputs.build_successful }} - needs: [inputs, sentry, linux, macos, windows] + needs: [inputs, sentry, linux, macos, windows, emscripten] steps: # Checkout the actions for this repo owner - name: Checkout Actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/.github path: ./Actions_${{ github.sha }} diff --git a/.gitignore b/.gitignore index 306defa..dd4fecf 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,8 @@ cmake-build-*/** *.x86_64/** *.wasm/** *.wasm-wasm/** +*.wasm_nl/** +*.wasm_nl-wasm_nl/** *.armv7l-x/** *.armv7l/** *.aarch64-x/** diff --git a/bin/makefile-emscripten.wasm_nl-wasm_nl b/bin/makefile-emscripten.wasm_nl-wasm_nl new file mode 100644 index 0000000..b9f5736 --- /dev/null +++ b/bin/makefile-emscripten.wasm_nl-wasm_nl @@ -0,0 +1,23 @@ +# Options for Emscripten, WASM and SDL + +CC = emcc $(CLANG_CFLAGS) + +XFILES = $(OBJECTDIR)sdl.o + +XFLAGS = -DSDL -sUSE_SDL=2 + +# OPTFLAGS is normally -O2. +OPTFLAGS = -O2 +DFLAGS = $(XFLAGS) -DRELEASE=351 -DMAIKO_ENABLE_NETHUB + +MEDLEY?=../../medley +SYSOUT?=$(MEDLEY)/loadups/full.sysout + +LD = emcc +LDFLAGS = -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH -sEXIT_RUNTIME=1 -sFORCE_FILESYSTEM -sLZ4 + +LDELDFLAGS = + +OBJECTDIR = ../$(RELEASENAME)/ + +default : ../$(OSARCHNAME)/ldesdl.js diff --git a/bin/makeright b/bin/makeright index 156685c..25f21f1 100755 --- a/bin/makeright +++ b/bin/makeright @@ -79,6 +79,11 @@ case "$display" in releasename=${osversion}.${architecture}-${display} ldename=ldesdl.js ;; + wasm_nl) osversion=emscripten + architecture=wasm_nl + releasename=${osversion}.${architecture}-${display} + ldename=ldesdl.js + ;; *) echo "display-option: $display is not supported." exit ;;