From 8c54c0fbe0bfa39ea69994ceb633e7e8f7d22cde Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 12:55:49 -0800 Subject: [PATCH 01/16] First pass at workflow to build maiko for emscripten --- .github/workflows/buildRelease.yml | 324 ++---------------------- .gitignore | 2 + bin/makefile-emscripten.wasm_nl-wasm_nl | 23 ++ bin/makeright | 5 + 4 files changed, 58 insertions(+), 296 deletions(-) create mode 100644 bin/makefile-emscripten.wasm_nl-wasm_nl diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 333bc59..ec1a350 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; - + ###################################################################################### @@ -137,12 +137,12 @@ jobs: with: tag: "release_docker" + ###################################################################################### - # Linux: build and push multi-platform docker image for Linux - # Use docker images to create and push release assets to github + # Emscripten: build and push Maiko compiled for Emscripten (to run Maiko in browser) - linux: + emscripten: needs: [inputs, sentry] if: | @@ -155,6 +155,7 @@ jobs: runs-on: ubuntu-latest steps: + # Checkout the actions for this repo owner - name: Checkout Actions uses: actions/checkout@v3 @@ -163,7 +164,22 @@ jobs: path: ./Actions_${{ github.sha }} - run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }} - # Checkout the branch + # Install SDL2 + - name: Install SDL2 + run: DEBIAN_FRONTEND=noninteractive apt-get install -y libsdl2-dev libsdl2-2.0-0 + + # Install Emscripten SDK + - name: Install Empscripten + run: | + git clone https://github.com/emscripten-core/emsdk.git + cd emsdk + ./emsdk install latest + ./emsdk activate latest + echo "source \"${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh\" >> ~/.bash_profile + echo "export PATH=${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:\${PATH}" >> ~/.bash_profile + + + # Checkout the maiko branch - name: Checkout uses: actions/checkout@v3 @@ -172,307 +188,23 @@ jobs: id: tag uses: ./../actions/release-tag-action - # Setup docker environment variables - - name: Setup Docker Environment Variables - id: docker_env + # Compile maiko using Emscripten (no load build) + - name: Compile Maiko using Emscripten + working-directory: ./bin run: | - DOCKER_NAMESPACE=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') - echo "DOCKER_NAMESPACE=${DOCKER_NAMESPACE}" >> ${GITHUB_ENV} - DOCKER_IMAGE=${DOCKER_NAMESPACE}/${{ steps.tag.outputs.repo_name }} - DOCKER_TAGS="${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:${RELEASE_TAG#*-}" - echo "build_time=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT - echo "docker_tags=${DOCKER_TAGS}" >> $GITHUB_OUTPUT - - # Setup the Docker Machine Emulation environment. - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - with: - platforms: linux/amd64,linux/arm64,linux/arm/v7 - - # Setup the Docker Buildx funtion - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v2 - - # Do the Docker Build using the Dockerfile in the repository we - # checked out. Save the results in a directory under /tmp to be used - # for creating release tars. Does not creatre a docker image and does not - # push anything to Docker Hub. - # - # NOTE: THE ACTUAL MAIKO BUILD (FOR LINUX) HAPPENS HERE - I.E., IN THE - # DOCKER BUILD CALL. BUILD COMMANDS ARE SPECIFIED IN THE - # Dockerfile, NOT HERE IN THE WORKFLOW. - # - - name: Build Docker Image and Save It Locally - uses: docker/build-push-action@v4 - with: - builder: ${{ steps.buildx.outputs.name }} - build-args: | - BUILD_DATE=${{ steps.docker_env.outputs.build_time }} - RELEASE_TAG=${{ steps.tag.outputs.release_tag }} - context: . - file: ./.github/workflows/Dockerfile_maiko - platforms: linux/amd64,linux/arm64,linux/arm/v7 - # Put the results out to the local file system - outputs: type=local,dest=/tmp/docker_images - tags: ${{ steps.docker_env.outputs.docker_tags }} - - # Use docker results to create releases for github. - # Docker results are in /tmp/docker_images. One subdir for each platform. - - name: Make release tars for each platform - env: - RELEASE_TAG: ${{ steps.tag.outputs.release_tag }} - run: | - mkdir -p /tmp/release_tars - for OSARCH in "linux.x86_64:linux_amd64" "linux.aarch64:linux_arm64" "linux.armv7l:linux_arm_v7" ; \ - do \ - pushd /tmp/docker_images/${OSARCH##*:}/usr/local/interlisp >/dev/null ; \ - /usr/bin/tar -c -z \ - -f /tmp/release_tars/${RELEASE_TAG}-${OSARCH%%:*}.tgz \ - maiko/bin/osversion \ - maiko/bin/machinetype \ - maiko/bin/config.guess \ - maiko/bin/config.sub \ - maiko/${OSARCH%%:*}/lde* \ - ; \ - popd >/dev/null ; \ - done + ./makeright wasm_nl + tar -c -z -C ../emscripten.wasm_nl -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: - /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.x86_64.tgz, - /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.aarch64.tgz, - /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.armv7l.tgz + artifacts: ${{ steps.tag.outputs.release_tag }}-emscripten.tgz tag: ${{ steps.tag.outputs.release_tag }} draft: ${{ needs.inputs.outputs.draft }} token: ${{ secrets.GITHUB_TOKEN }} - -###################################################################################### - - # MacOS: build for MacOS (x86_64, aarch64, universal) and use results to - # create and push release assets to github - macos: - - needs: [inputs, sentry] - if: | - needs.inputs.outputs.macos == 'true' - && ( - needs.sentry.outputs.release_not_built == 'true' - || needs.inputs.outputs.force == 'true' - ) - - runs-on: macos-latest - - steps: - - # Checkout the branch - - name: Checkout - uses: actions/checkout@v3 - - # Checkout the actions for this repo owner - - name: Checkout Actions - uses: actions/checkout@v3 - with: - repository: ${{ github.repository_owner }}/.github - path: ./Actions_${{ github.sha }} - - run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }} - - # Setup release tag - - name: Setup Release Tag - id: tag - uses: ./../actions/release-tag-action - - # Uninstall exisitng X11 stuff preconfigured on runner then install correct X11 dependencies - - name: Unistall X components already on the runner - run: | - brew uninstall --ignore-dependencies libxft - brew uninstall --ignore-dependencies libxrender - brew uninstall --ignore-dependencies libxext - brew uninstall --ignore-dependencies libx11 - brew uninstall --ignore-dependencies xorgproto - brew uninstall --ignore-dependencies libxdmcp - brew uninstall --ignore-dependencies libxau - - - name: Install X11 dependencies on MacOS - env: - GH_TOKEN: ${{ github.token }} - run: | - gh release download XQuartz-2.8.5 --repo XQuartz/XQuartz --pattern XQuartz-2.8.5.pkg - sudo installer -pkg ./XQuartz-2.8.5.pkg -target / - - # Install SDL dependencies - - name: Install SDL2 dependencies on MacOS - env: - GH_TOKEN: ${{ github.token }} - run: | - gh release download release-2.26.5 --repo libsdl-org/SDL --pattern SDL2-2.26.5.dmg - hdiutil attach SDL2-2.26.5.dmg - sudo ditto /Volumes/SDL2/SDL2.framework /Library/Frameworks/SDL2.framework - hdiutil detach /Volumes/SDL2/ - - # Build maiko - - name: Build ldeinit - working-directory: ./bin - run: | - export LDEARCH=x86_64-apple-darwin - ./makeright init - export LDEARCH=aarch64-apple-darwin - ./makeright init - mkdir -p ../darwin.universal - exe=ldeinit - lipo -create \ - -arch arm64 ../darwin.aarch64/${exe} \ - -arch x86_64 ../darwin.x86_64/${exe} \ - -output ../darwin.universal/${exe} - - - name: Build lde, ldex, & ldesdl - run: | - mkdir build - cd build - # -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 - cmake .. \ - -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \ - -DMAIKO_DISPLAY_SDL=ON \ - -DMAIKO_DISPLAY_X11=ON \ - -DCMAKE_BUILD_TYPE=Release - cmake --build . --config Release - for exe in lde ldex ldesdl - do - 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 - - # Create release tar for github. - - name: Make release tar(s) - env: - RELEASE_TAG: ${{ steps.tag.outputs.release_tag }} - run: | - mkdir -p /tmp/release_tars - cd ${GITHUB_WORKSPACE}/../ - for arch in x86_64 aarch64 universal - do - tar -c -z \ - -f /tmp/release_tars/${RELEASE_TAG}-darwin.${arch}.tgz \ - maiko/bin/osversion \ - maiko/bin/machinetype \ - maiko/bin/config.guess \ - maiko/bin/config.sub \ - maiko/darwin.${arch}/lde* - done - - # Push Release - - name: Push the release - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - artifacts: - /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.x86_64.tgz, - /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.aarch64.tgz, - /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.universal.tgz - tag: ${{ steps.tag.outputs.release_tag }} - draft: ${{ needs.inputs.outputs.draft }} - token: ${{ secrets.GITHUB_TOKEN }} - -###################################################################################### - - # Windows: build for Windows-Cygwin via Docker build and use results to - # create and push release assets to github - - windows: - - needs: [inputs, sentry] - if: | - needs.inputs.outputs.windows == 'true' - && ( - needs.sentry.outputs.release_not_built == 'true' - || needs.inputs.outputs.force == 'true' - ) - - runs-on: windows-2022 - - defaults: - run: - shell: powershell - - steps: - - # setup git to not mess up line endings - - name: git config - run: git config --global core.autocrlf input - - # Retrieve Cygwin setup and install cygwin - - name: Install cygwin - id: cygwin - run: | - wget https://cygwin.com/setup-x86_64.exe -OutFile setup-x86_64.exe - Unblock-File setup-x86_64.exe - Start-Process setup-x86_64.exe -Wait -ArgumentList @("--root", ".\cygwin", "--quiet-mode", "--no-admin", "--wait", "--no-shortcuts", "--no-write-registry", "--verbose", "--site", "http://www.gtlib.gatech.edu/pub/cygwin/", "--packages", "nano,binutils,make,cmake,gcc,clang") - cygwin\bin\bash -login -c 'sed -i -e "s/^none/#none/" /etc/fstab; echo "none / cygdrive binary,posix=0,user 0 0" >>/etc/fstab' - - # Retrieve SDL2 and install in cygwin - - name: Install SDL2 - id: sdl2 - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release download 2.26.5 --repo interlisp/cygwin-sdl --pattern *.tgz --output .\cygwin\sdl2.tar.gz - cygwin\bin\bash -login -c 'cd /; tar xzf sdl2.tar.gz' - - # Checkout the branch - - name: Checkout - uses: actions/checkout@v3 - with: - path: cygwin\maiko - - # Checkout the actions for this repo owner - - name: Checkout Actions - uses: actions/checkout@v3 - with: - repository: ${{ github.repository_owner }}/.github - path: ./Actions_${{ github.sha }} - - run: | - mv ./Actions_${{ github.sha }}/actions ../actions - rm -recurse -force ./Actions_${{ github.sha }} - - # Setup release tag - - name: Setup Release Tag - id: tag - uses: ./../actions/release-tag-action - with: - path: cygwin/maiko - - # Build maiko TODO-cleanup - - name: Build Cygwin-SDL Maiko - run: | - cygwin\bin\bash -login -c 'cd /maiko/bin && ./makeright sdl cleanup && ./makeright sdl' - cygwin\bin\bash -login -c 'mkdir /tmp/maiko; mkdir /tmp/maiko/bin; mkdir /tmp/maiko/cygwin.x86_64' - cygwin\bin\bash -login -c 'cp /maiko/bin/osversion /tmp/maiko/bin; cp /maiko/bin/machinetype /tmp/maiko/bin' - cygwin\bin\bash -login -c 'cp /maiko/bin/config.guess /tmp/maiko/bin; cp /maiko/bin/config.sub /tmp/maiko/bin' - cygwin\bin\bash -login -c 'cp /maiko/cygwin.x86_64/* /tmp/maiko/cygwin.x86_64; cp /usr/local/bin/SDL2.DLL /tmp/maiko/cygwin.x86_64' - cygwin\bin\bash -login -c 'chmod +x /tmp/maiko/bin/*; chmod +x /tmp/maiko/cygwin.x86_64/*' - cygwin\bin\bash -login -c 'echo lde > /tmp/maiko/cygwin.x86_64/lde.exe.local; echo ldesdl > /tmp/maiko/cygwin.x86_64/ldesdl.exe.local' - cygwin\bin\bash -login -c 'mkdir -p /tmp/release_tars' - cygwin\bin\bash -login -c 'tar -c -z -C /tmp -f /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-cygwin.x86_64.tgz maiko' - - # Push Release to github - - name: Push the release - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - artifacts: - cygwin/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-cygwin.x86_64.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,7 +217,7 @@ jobs: outputs: build_successful: ${{ steps.output.outputs.build_successful }} - needs: [inputs, sentry, linux, macos, windows] + needs: [inputs, sentry, emscripten] steps: # Checkout the actions for this repo owner 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..1bb48f4 --- /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 + +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 ;; From 696ac9a675f41b698f5a5a6590c58a3dafa733b3 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 13:08:39 -0800 Subject: [PATCH 02/16] Fix install of SDL2 --- .github/workflows/buildRelease.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index ec1a350..bb55372 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -166,7 +166,9 @@ jobs: # Install SDL2 - name: Install SDL2 - run: DEBIAN_FRONTEND=noninteractive apt-get install -y libsdl2-dev libsdl2-2.0-0 + run: | + export DEBIAN_FRONTEND=noninteractive + sudo -E apt-get install -y libsdl2-dev libsdl2-2.0-0 # Install Emscripten SDK - name: Install Empscripten From 75c815f5851cbbaa72a8667c9524d6d62a23354b Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 13:13:04 -0800 Subject: [PATCH 03/16] Fix typo in emscripten install --- .github/workflows/buildRelease.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index bb55372..49f93e3 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -177,7 +177,7 @@ jobs: cd emsdk ./emsdk install latest ./emsdk activate latest - echo "source \"${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh\" >> ~/.bash_profile + echo "source \"${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh\"" >> ~/.bash_profile echo "export PATH=${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:\${PATH}" >> ~/.bash_profile From e657b2e1dc15a0537c31b0f51a9d2e655861075f Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 13:21:01 -0800 Subject: [PATCH 04/16] Debugging emscriten build --- .github/workflows/buildRelease.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 49f93e3..ff1196f 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -194,6 +194,8 @@ jobs: - name: Compile Maiko using Emscripten working-directory: ./bin run: | + echo $(pwd) + ls ../src ./makeright wasm_nl tar -c -z -C ../emscripten.wasm_nl -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz * From 400f3b7835994ef08269640e994f50d435d13981 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 16:49:26 -0800 Subject: [PATCH 05/16] Fix emscripten install PATH updates --- .github/workflows/buildRelease.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index ff1196f..5967294 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -177,8 +177,8 @@ jobs: cd emsdk ./emsdk install latest ./emsdk activate latest - echo "source \"${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh\"" >> ~/.bash_profile - echo "export PATH=${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:\${PATH}" >> ~/.bash_profile + echo "source \"${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh\"" >> ~/.bashrc + echo "export PATH=${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:\${PATH}" >> ~/.bashrc # Checkout the maiko branch From 640f69877f46e0776797867659fa8a7e7394b831 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 16:57:04 -0800 Subject: [PATCH 06/16] More on fixing emscripten install PATH updates --- .github/workflows/buildRelease.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 5967294..20cd1a2 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -177,9 +177,6 @@ jobs: cd emsdk ./emsdk install latest ./emsdk activate latest - echo "source \"${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh\"" >> ~/.bashrc - echo "export PATH=${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:\${PATH}" >> ~/.bashrc - # Checkout the maiko branch - name: Checkout @@ -194,8 +191,10 @@ jobs: - name: Compile Maiko using Emscripten working-directory: ./bin run: | - echo $(pwd) - ls ../src + echo "${GITHUB_WORKSPACE}" + ls "${GITHUB_WORKSPACE}" + source "${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh" + export PATH="${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:${PATH}" ./makeright wasm_nl tar -c -z -C ../emscripten.wasm_nl -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz * From efd200dbf70a8711467a7bfd673af155b868caa1 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 17:02:21 -0800 Subject: [PATCH 07/16] Debugging emscripten install PATH updates --- .github/workflows/buildRelease.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 20cd1a2..22015b3 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -173,8 +173,10 @@ jobs: # Install Emscripten SDK - name: Install Empscripten run: | + echo "$(pwd)" git clone https://github.com/emscripten-core/emsdk.git cd emsdk + ls ./emsdk install latest ./emsdk activate latest From b841a44427263aecb2667a3111d1f6cbca431f1c Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 17:10:01 -0800 Subject: [PATCH 08/16] 2 Debugging emscripten install PATH updates --- .github/workflows/buildRelease.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 22015b3..699bff0 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -172,13 +172,14 @@ jobs: # Install Emscripten SDK - name: Install Empscripten + working-directory: ../ run: | - echo "$(pwd)" git clone https://github.com/emscripten-core/emsdk.git cd emsdk - ls ./emsdk install latest ./emsdk activate latest + echo "source \"${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh\"" >> $HOME/.bashrc + echo "export PATH=\"${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:\${PATH}\"" >> $HOME/.bashrc # Checkout the maiko branch - name: Checkout @@ -193,10 +194,6 @@ jobs: - name: Compile Maiko using Emscripten working-directory: ./bin run: | - echo "${GITHUB_WORKSPACE}" - ls "${GITHUB_WORKSPACE}" - source "${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh" - export PATH="${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:${PATH}" ./makeright wasm_nl tar -c -z -C ../emscripten.wasm_nl -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz * From 587ce1983a7fdec8ae271381c320b7bdb965ebec Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 17:14:16 -0800 Subject: [PATCH 09/16] 3 Debugging emscripten install PATH updates --- .github/workflows/buildRelease.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 699bff0..3d4fd08 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -178,8 +178,9 @@ jobs: cd emsdk ./emsdk install latest ./emsdk activate latest - echo "source \"${GITHUB_WORKSPACE}/emsdk/emsdk_env.sh\"" >> $HOME/.bashrc - echo "export PATH=\"${GITHUB_WORKSPACE}/emsdk/upstream/emscripten/tools:\${PATH}\"" >> $HOME/.bashrc + CWD="$(pwd)" + echo "source \"${CWD}/emsdk_env.sh\"" >> $HOME/.bashrc + echo "export PATH=\"${CWD}/upstream/emscripten/tools:\${PATH}\"" >> $HOME/.bashrc # Checkout the maiko branch - name: Checkout From ebe4babbe1e85e4953bd22c2e615d818612e44fb Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 17:23:40 -0800 Subject: [PATCH 10/16] 4 Debugging emscripten install PATH updates --- .github/workflows/buildRelease.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 3d4fd08..abcb478 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -179,8 +179,9 @@ jobs: ./emsdk install latest ./emsdk activate latest CWD="$(pwd)" - echo "source \"${CWD}/emsdk_env.sh\"" >> $HOME/.bashrc - echo "export PATH=\"${CWD}/upstream/emscripten/tools:\${PATH}\"" >> $HOME/.bashrc + source "${CWD}/emsdk_env.sh" + export PATH="${CWD}/upstream/emscripten/tools:\${PATH}" + echo "PATH=${PATH}" >> ${GITHUB_ENV} # Checkout the maiko branch - name: Checkout From 3d341e3bbde6c7ce462d67457642f30ac1ed3768 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 17:53:53 -0800 Subject: [PATCH 11/16] 5 Debugging emscripten install PATH updates --- .github/workflows/buildRelease.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index abcb478..502c546 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -179,9 +179,10 @@ jobs: ./emsdk install latest ./emsdk activate latest CWD="$(pwd)" - source "${CWD}/emsdk_env.sh" - export PATH="${CWD}/upstream/emscripten/tools:\${PATH}" - echo "PATH=${PATH}" >> ${GITHUB_ENV} + 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 From df6dd883a630c44f5fc4959aeac9ad250c777d4c Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 18:01:36 -0800 Subject: [PATCH 12/16] fix tar of emscripten files --- .github/workflows/buildRelease.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 502c546..1655b0f 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -198,7 +198,7 @@ jobs: working-directory: ./bin run: | ./makeright wasm_nl - tar -c -z -C ../emscripten.wasm_nl -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz * + tar -c -z -C ../emscripten.wasm_nl -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz . # Push Release to github - name: Push the release From 52a3512379efe620699bef1b0a8b88cb265ac469 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 18:09:39 -0800 Subject: [PATCH 13/16] additional fix to tar of emscripten files --- .github/workflows/buildRelease.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 1655b0f..7bdc64b 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -198,7 +198,8 @@ jobs: working-directory: ./bin run: | ./makeright wasm_nl - tar -c -z -C ../emscripten.wasm_nl -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz . + cd ../emscripten.wasm_nl + tar -c -z -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz * # Push Release to github - name: Push the release From 3ae25f81f86b0aef088a93e71a31144ee1095559 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 18:29:22 -0800 Subject: [PATCH 14/16] update actions to later versions to account for githiubs move from node16 to node20 --- .github/workflows/buildRelease.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 7bdc64b..3e9680d 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -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 }} @@ -158,7 +158,7 @@ jobs: # 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 }} @@ -186,7 +186,7 @@ jobs: # Checkout the maiko branch - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Setup release tag - name: Setup Release Tag @@ -228,7 +228,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 }} From 0b0c82ce181b611c934a99735820aa4f69633d1b Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Wed, 7 Feb 2024 18:37:47 -0800 Subject: [PATCH 15/16] Returning buildRelease to full builds --- .github/workflows/buildRelease.yml | 338 ++++++++++++++++++++++++++++- 1 file changed, 337 insertions(+), 1 deletion(-) diff --git a/.github/workflows/buildRelease.yml b/.github/workflows/buildRelease.yml index 3e9680d..e57c3ad 100644 --- a/.github/workflows/buildRelease.yml +++ b/.github/workflows/buildRelease.yml @@ -137,6 +137,341 @@ jobs: with: tag: "release_docker" +###################################################################################### + + # Linux: build and push multi-platform docker image for Linux + # Use docker images to create and push release assets to github + + linux: + + 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 }} + + # Checkout the branch + - name: Checkout + uses: actions/checkout@v4 + + # Setup release tag + - name: Setup Release Tag + id: tag + uses: ./../actions/release-tag-action + + # Setup docker environment variables + - name: Setup Docker Environment Variables + id: docker_env + run: | + DOCKER_NAMESPACE=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') + echo "DOCKER_NAMESPACE=${DOCKER_NAMESPACE}" >> ${GITHUB_ENV} + DOCKER_IMAGE=${DOCKER_NAMESPACE}/${{ steps.tag.outputs.repo_name }} + DOCKER_TAGS="${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:${RELEASE_TAG#*-}" + echo "build_time=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT + echo "docker_tags=${DOCKER_TAGS}" >> $GITHUB_OUTPUT + + # Setup the Docker Machine Emulation environment. + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: linux/amd64,linux/arm64,linux/arm/v7 + + # Setup the Docker Buildx funtion + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + + # Do the Docker Build using the Dockerfile in the repository we + # checked out. Save the results in a directory under /tmp to be used + # for creating release tars. Does not creatre a docker image and does not + # push anything to Docker Hub. + # + # NOTE: THE ACTUAL MAIKO BUILD (FOR LINUX) HAPPENS HERE - I.E., IN THE + # DOCKER BUILD CALL. BUILD COMMANDS ARE SPECIFIED IN THE + # Dockerfile, NOT HERE IN THE WORKFLOW. + # + - name: Build Docker Image and Save It Locally + uses: docker/build-push-action@v4 + with: + builder: ${{ steps.buildx.outputs.name }} + build-args: | + BUILD_DATE=${{ steps.docker_env.outputs.build_time }} + RELEASE_TAG=${{ steps.tag.outputs.release_tag }} + context: . + file: ./.github/workflows/Dockerfile_maiko + platforms: linux/amd64,linux/arm64,linux/arm/v7 + # Put the results out to the local file system + outputs: type=local,dest=/tmp/docker_images + tags: ${{ steps.docker_env.outputs.docker_tags }} + + # Use docker results to create releases for github. + # Docker results are in /tmp/docker_images. One subdir for each platform. + - name: Make release tars for each platform + env: + RELEASE_TAG: ${{ steps.tag.outputs.release_tag }} + run: | + mkdir -p /tmp/release_tars + for OSARCH in "linux.x86_64:linux_amd64" "linux.aarch64:linux_arm64" "linux.armv7l:linux_arm_v7" ; \ + do \ + pushd /tmp/docker_images/${OSARCH##*:}/usr/local/interlisp >/dev/null ; \ + /usr/bin/tar -c -z \ + -f /tmp/release_tars/${RELEASE_TAG}-${OSARCH%%:*}.tgz \ + maiko/bin/osversion \ + maiko/bin/machinetype \ + maiko/bin/config.guess \ + maiko/bin/config.sub \ + maiko/${OSARCH%%:*}/lde* \ + ; \ + popd >/dev/null ; \ + done + + # Push Release to github + - name: Push the release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: + /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.x86_64.tgz, + /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.aarch64.tgz, + /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.armv7l.tgz + tag: ${{ steps.tag.outputs.release_tag }} + draft: ${{ needs.inputs.outputs.draft }} + token: ${{ secrets.GITHUB_TOKEN }} + + +###################################################################################### + + # MacOS: build for MacOS (x86_64, aarch64, universal) and use results to + # create and push release assets to github + macos: + + needs: [inputs, sentry] + if: | + needs.inputs.outputs.macos == 'true' + && ( + needs.sentry.outputs.release_not_built == 'true' + || needs.inputs.outputs.force == 'true' + ) + + runs-on: macos-latest + + steps: + + # Checkout the branch + - name: Checkout + uses: actions/checkout@v4 + + # 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 }} + + # Setup release tag + - name: Setup Release Tag + id: tag + uses: ./../actions/release-tag-action + + # Uninstall exisitng X11 stuff preconfigured on runner then install correct X11 dependencies + - name: Unistall X components already on the runner + run: | + brew uninstall --ignore-dependencies libxft + brew uninstall --ignore-dependencies libxrender + brew uninstall --ignore-dependencies libxext + brew uninstall --ignore-dependencies libx11 + brew uninstall --ignore-dependencies xorgproto + brew uninstall --ignore-dependencies libxdmcp + brew uninstall --ignore-dependencies libxau + + - name: Install X11 dependencies on MacOS + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release download XQuartz-2.8.5 --repo XQuartz/XQuartz --pattern XQuartz-2.8.5.pkg + sudo installer -pkg ./XQuartz-2.8.5.pkg -target / + + # Install SDL dependencies + - name: Install SDL2 dependencies on MacOS + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release download release-2.26.5 --repo libsdl-org/SDL --pattern SDL2-2.26.5.dmg + hdiutil attach SDL2-2.26.5.dmg + sudo ditto /Volumes/SDL2/SDL2.framework /Library/Frameworks/SDL2.framework + hdiutil detach /Volumes/SDL2/ + + # Build maiko + - name: Build ldeinit + working-directory: ./bin + run: | + export LDEARCH=x86_64-apple-darwin + ./makeright init + export LDEARCH=aarch64-apple-darwin + ./makeright init + mkdir -p ../darwin.universal + exe=ldeinit + lipo -create \ + -arch arm64 ../darwin.aarch64/${exe} \ + -arch x86_64 ../darwin.x86_64/${exe} \ + -output ../darwin.universal/${exe} + + - name: Build lde, ldex, & ldesdl + run: | + mkdir build + cd build + # -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 + cmake .. \ + -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \ + -DMAIKO_DISPLAY_SDL=ON \ + -DMAIKO_DISPLAY_X11=ON \ + -DCMAKE_BUILD_TYPE=Release + cmake --build . --config Release + for exe in lde ldex ldesdl + do + 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 + + # Create release tar for github. + - name: Make release tar(s) + env: + RELEASE_TAG: ${{ steps.tag.outputs.release_tag }} + run: | + mkdir -p /tmp/release_tars + cd ${GITHUB_WORKSPACE}/../ + for arch in x86_64 aarch64 universal + do + tar -c -z \ + -f /tmp/release_tars/${RELEASE_TAG}-darwin.${arch}.tgz \ + maiko/bin/osversion \ + maiko/bin/machinetype \ + maiko/bin/config.guess \ + maiko/bin/config.sub \ + maiko/darwin.${arch}/lde* + done + + # Push Release + - name: Push the release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: + /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.x86_64.tgz, + /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.aarch64.tgz, + /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.universal.tgz + tag: ${{ steps.tag.outputs.release_tag }} + draft: ${{ needs.inputs.outputs.draft }} + token: ${{ secrets.GITHUB_TOKEN }} + +###################################################################################### + + # Windows: build for Windows-Cygwin via Docker build and use results to + # create and push release assets to github + + windows: + + needs: [inputs, sentry] + if: | + needs.inputs.outputs.windows == 'true' + && ( + needs.sentry.outputs.release_not_built == 'true' + || needs.inputs.outputs.force == 'true' + ) + + runs-on: windows-2022 + + defaults: + run: + shell: powershell + + steps: + + # setup git to not mess up line endings + - name: git config + run: git config --global core.autocrlf input + + # Retrieve Cygwin setup and install cygwin + - name: Install cygwin + id: cygwin + run: | + wget https://cygwin.com/setup-x86_64.exe -OutFile setup-x86_64.exe + Unblock-File setup-x86_64.exe + Start-Process setup-x86_64.exe -Wait -ArgumentList @("--root", ".\cygwin", "--quiet-mode", "--no-admin", "--wait", "--no-shortcuts", "--no-write-registry", "--verbose", "--site", "http://www.gtlib.gatech.edu/pub/cygwin/", "--packages", "nano,binutils,make,cmake,gcc,clang") + cygwin\bin\bash -login -c 'sed -i -e "s/^none/#none/" /etc/fstab; echo "none / cygdrive binary,posix=0,user 0 0" >>/etc/fstab' + + # Retrieve SDL2 and install in cygwin + - name: Install SDL2 + id: sdl2 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release download 2.26.5 --repo interlisp/cygwin-sdl --pattern *.tgz --output .\cygwin\sdl2.tar.gz + cygwin\bin\bash -login -c 'cd /; tar xzf sdl2.tar.gz' + + # Checkout the branch + - name: Checkout + uses: actions/checkout@v4 + with: + path: cygwin\maiko + + # 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 -recurse -force ./Actions_${{ github.sha }} + + # Setup release tag + - name: Setup Release Tag + id: tag + uses: ./../actions/release-tag-action + with: + path: cygwin/maiko + + # Build maiko TODO-cleanup + - name: Build Cygwin-SDL Maiko + run: | + cygwin\bin\bash -login -c 'cd /maiko/bin && ./makeright sdl cleanup && ./makeright sdl' + cygwin\bin\bash -login -c 'mkdir /tmp/maiko; mkdir /tmp/maiko/bin; mkdir /tmp/maiko/cygwin.x86_64' + cygwin\bin\bash -login -c 'cp /maiko/bin/osversion /tmp/maiko/bin; cp /maiko/bin/machinetype /tmp/maiko/bin' + cygwin\bin\bash -login -c 'cp /maiko/bin/config.guess /tmp/maiko/bin; cp /maiko/bin/config.sub /tmp/maiko/bin' + cygwin\bin\bash -login -c 'cp /maiko/cygwin.x86_64/* /tmp/maiko/cygwin.x86_64; cp /usr/local/bin/SDL2.DLL /tmp/maiko/cygwin.x86_64' + cygwin\bin\bash -login -c 'chmod +x /tmp/maiko/bin/*; chmod +x /tmp/maiko/cygwin.x86_64/*' + cygwin\bin\bash -login -c 'echo lde > /tmp/maiko/cygwin.x86_64/lde.exe.local; echo ldesdl > /tmp/maiko/cygwin.x86_64/ldesdl.exe.local' + cygwin\bin\bash -login -c 'mkdir -p /tmp/release_tars' + cygwin\bin\bash -login -c 'tar -c -z -C /tmp -f /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-cygwin.x86_64.tgz maiko' + + # Push Release to github + - name: Push the release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: + cygwin/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-cygwin.x86_64.tgz + tag: ${{ steps.tag.outputs.release_tag }} + draft: ${{ needs.inputs.outputs.draft }} + token: ${{ secrets.GITHUB_TOKEN }} + + ###################################################################################### @@ -211,6 +546,7 @@ jobs: draft: ${{ needs.inputs.outputs.draft }} token: ${{ secrets.GITHUB_TOKEN }} + ###################################################################################### # Use set-sentry-action to determine set the sentry that says this release has @@ -223,7 +559,7 @@ jobs: outputs: build_successful: ${{ steps.output.outputs.build_successful }} - needs: [inputs, sentry, emscripten] + needs: [inputs, sentry, linux, macos, windows, emscripten] steps: # Checkout the actions for this repo owner From ce7deadad3e85fa958b5f2c9447e505beeef5fa1 Mon Sep 17 00:00:00 2001 From: Frank Halasz Date: Sat, 10 Feb 2024 00:40:20 -0800 Subject: [PATCH 16/16] Added LZ4 compression to wasm_nl --- bin/makefile-emscripten.wasm_nl-wasm_nl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/makefile-emscripten.wasm_nl-wasm_nl b/bin/makefile-emscripten.wasm_nl-wasm_nl index 1bb48f4..b9f5736 100644 --- a/bin/makefile-emscripten.wasm_nl-wasm_nl +++ b/bin/makefile-emscripten.wasm_nl-wasm_nl @@ -14,7 +14,7 @@ MEDLEY?=../../medley SYSOUT?=$(MEDLEY)/loadups/full.sysout LD = emcc -LDFLAGS = -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH -sEXIT_RUNTIME=1 -sFORCE_FILESYSTEM +LDFLAGS = -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH -sEXIT_RUNTIME=1 -sFORCE_FILESYSTEM -sLZ4 LDELDFLAGS =