From 98f1d2a2a4bab1115e2e747dae8287275fef9fbb Mon Sep 17 00:00:00 2001 From: Aviv Beeri Date: Fri, 3 Mar 2023 10:28:18 +0000 Subject: [PATCH 1/2] Universal Mac OS Binary (#254) * universal binary support * update action workflow --- .github/workflows/build-all.yml | 37 ++++++++++++++++++--------------- .github/workflows/itch.yml | 2 +- Makefile | 2 ++ scripts/setup_static_mac_sdl.sh | 4 ++-- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index cb916c27..2054ab02 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -15,10 +15,10 @@ jobs: - name: Verify run: emcc -v - name: Checkout - uses: actions/checkout@v2.0.0 + uses: actions/checkout@v3.0.0 - run: git fetch --prune --unshallow - run: make MODE=release dome.html ARCH=web - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: dome-web path: | @@ -31,13 +31,13 @@ jobs: static: [1, 0] steps: - name: Checkout - uses: actions/checkout@v2.0.0 + uses: actions/checkout@v3.0.0 - run: git fetch --prune --unshallow - run: sudo apt-get update - run: sudo apt-get install build-essential mercurial make cmake autoconf automake libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev libxss-dev libgl1-mesa-dev libdbus-1-dev libudev-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev fcitx-libs-dev libsamplerate0-dev libsndio-dev libwayland-dev libxkbcommon-dev - name: Cache dependancies if: ${{matrix.static == 1}} - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ./lib/SDL* @@ -49,7 +49,7 @@ jobs: - run: ./scripts/setup_static_linux_sdl.sh if: ${{matrix.static == 1}} - run: make MODE=release STATIC=${{matrix.static}} - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 if: ${{matrix.static == 1}} with: name: dome-linux-x64 @@ -57,7 +57,7 @@ jobs: dome main.wren - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 if: ${{matrix.static == 0}} with: name: dome-linux-x64-shared @@ -69,10 +69,13 @@ jobs: runs-on: macOS-latest steps: - name: Checkout - uses: actions/checkout@v2.0.0 - - run: sudo xcode-select -switch /Applications/Xcode_14.2.app/Contents/Developer + uses: actions/checkout@v3.0.0 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '14.2' + # - run: sudo xcode-select -switch /Applications/Xcode_14.2.app/Contents/Developer - name: Cache dependancies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ./lib/SDL* @@ -81,9 +84,9 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('./scripts/vars.sh') }}-sdl - run: ./scripts/setup_static_mac_sdl.sh - run: make MIN_MAC_VERSION=10.12 STATIC=1 - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: - name: dome-macosx-x64 + name: dome-macosx-all path: | dome main.wren @@ -96,7 +99,7 @@ jobs: run: shell: msys2 {0} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: msys2/setup-msys2@v2 with: msystem: ${{ matrix.msystem }} @@ -112,14 +115,14 @@ jobs: - run: git fetch --prune --unshallow - run: gcc -v - run: "make STATIC=1 TARGET_NAME=dome CC=gcc" - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 if: ${{ (matrix.msystem == 'MINGW32') }} with: name: dome-windows-x32 path: | dome.exe main.wren - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 if: ${{ (matrix.msystem == 'MINGW64') }} with: name: dome-windows-x64 @@ -148,7 +151,7 @@ jobs: args: zip -qq -r dome-windows-x32.zip dome-windows-x32 - uses: montudor/action-zip@v0.1.0 with: - args: zip -qq -r dome-macosx-x64.zip dome-macosx-x64 + args: zip -qq -r dome-macosx-all.zip dome-macosx-all - uses: montudor/action-zip@v0.1.0 with: args: zip -qq -r dome-web.zip dome-web @@ -195,8 +198,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ./dome-macosx-x64.zip - asset_name: dome-${{github.event.release.tag_name}}-macosx-x64.zip + asset_path: ./dome-macosx-all.zip + asset_name: dome-${{github.event.release.tag_name}}-macosx-all.zip asset_content_type: application/zip - name: Upload Web Engine uses: actions/upload-release-asset@v1 diff --git a/.github/workflows/itch.yml b/.github/workflows/itch.yml index 4f5db3e9..fa3dabc0 100644 --- a/.github/workflows/itch.yml +++ b/.github/workflows/itch.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - platform: ["windows-x64", "windows-x32", "macosx-x64", "linux-x64", "linux-x64-shared"] + platform: ["windows-x64", "windows-x32", "macosx-all", "linux-x64", "linux-x64-shared"] # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/Makefile b/Makefile index 8fbdf44d..62540f16 100644 --- a/Makefile +++ b/Makefile @@ -107,6 +107,8 @@ CFLAGS += -D_XOPEN_SOURCE=500 else ifneq ($(filter macosx,$(TAGS)),) CFLAGS += -mmacosx-version-min=10.12 CFLAGS += -D_DARWIN_C_SOURCE +CFLAGS += -arch x86_64 -arch arm64 +WREN_PARAMS += -arch x86_64 -arch arm64 endif ifneq ($(filter release,$(TAGS)),) diff --git a/scripts/setup_static_mac_sdl.sh b/scripts/setup_static_mac_sdl.sh index e97e3730..1156a218 100755 --- a/scripts/setup_static_mac_sdl.sh +++ b/scripts/setup_static_mac_sdl.sh @@ -5,9 +5,9 @@ git submodule update --init -- $DIRECTORY if ! [ -d "$DIRECTORY/$FOLDER" ]; then cd $DIRECTORY mkdir ${FOLDER} ; cd ${FOLDER} - ../configure CC=$(sh $DIRECTORY/build-scripts/clang-fat.sh) # --disable-shared + ../configure CC="sh $DIRECTORY/build-scripts/clang-fat.sh" #--disable-shared else - cd $DIRECTORY/${FOLDER} + cd $DIRECTORY/$FOLDER fi make From ac27b5640af2f2844ade3e2b4c76977ba7f340c6 Mon Sep 17 00:00:00 2001 From: Aviv Beeri Date: Thu, 9 Mar 2023 07:30:48 +0000 Subject: [PATCH 2/2] Stack iterator doesn't iterate in LIFO order, causing bugs --- src/modules/collections.wren | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/collections.wren b/src/modules/collections.wren index 593c86ca..134384a1 100644 --- a/src/modules/collections.wren +++ b/src/modules/collections.wren @@ -18,19 +18,19 @@ class Stack is Sequence { count { _list.count } push(v) { - _list.add(v) + _list.insert(0, v) } peek() { if (_list.isEmpty) { return null } - return _list[-1] + return _list[0] } pop() { if (_list.isEmpty) { return null } - return _list.removeAt(-1) + return _list.removeAt(0) } clear() { _list.clear() }