shithub: m8c

Download patch

ref: 75bee36d3ceb4eb65c98728048d920a42e574046
parent: 0bda7c38249c145f0a3b27cc3bcd2bee0d7f828a
author: laamaa <jonne.kokkonen@gmail.com>
date: Sat Jun 22 16:57:20 EDT 2024

try new things for macos packaging, separate yml files for jobs

--- /dev/null
+++ b/.github/workflows/build-macos.yml
@@ -1,0 +1,98 @@
+name: m8c macos build
+
+on:
+  push:
+  pull_request:
+  workflow_dispatch:
+
+jobs:
+     
+  build-macos:
+    runs-on: macos-12
+    env:
+      SDL_VERSION: 2.30.4
+    
+    steps:
+      - name: 'Install dependencies'
+        run: brew install cmake pkg-config autoconf automake libtool
+
+      - name: 'Cache x86_64 files'
+        id: cache-x86_64-files
+        uses: actions/cache@v4
+        with:
+          path: '/Users/runner/x86_64'
+          key: mac-x86_64-files
+
+      - name: 'Cache arm64 files'
+        id: cache-arm64-files
+        uses: actions/cache@v4
+        with:
+          path: '/Users/runner/arm64'
+          key: mac-arm64-files     
+          
+      - name: 'Download 10.9 SDK for x86_64'
+        if: steps.cache-x86_64-files.outputs.cache-hit != 'true'
+        run: |
+          mkdir -p "$HOME/x86_64"
+          pushd "$HOME/x86_64"
+          mkdir SDKs
+          cd SDKs
+          curl -L "https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.9.sdk.tar.xz" | tar -xvf -
+          popd
+
+      - name: 'Download 11.0 SDK for arm64'
+        if: steps.cache-arm64-files.outputs.cache-hit != 'true'
+        run: |
+          mkdir -p "$HOME/arm64"
+          pushd "$HOME/arm64"
+          mkdir SDKs
+          cd SDKs
+          curl -L "https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.0.sdk.tar.xz" | tar -xvf -
+          popd
+
+      - name: 'Checkout'
+        uses: actions/checkout@v4
+
+      - name: Set current date as env variable
+        run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
+        
+      - name: 'Download SDL2 sources'
+        run: |
+          (curl https://www.libsdl.org/release/SDL2-$SDL_VERSION.tar.gz || curl -L https://github.com/libsdl-org/SDL/releases/download/release-$SDL_VERSION/SDL2-$SDL_VERSION.tar.gz) | tar xvf -
+        
+      - name: 'Build SDL2'
+        run: |
+          (export MACOSX_DEPLOYMENT_TARGET="10.9" && cd SDL2-$SDL_VERSION && mkdir build_x86_64 && cd build_x86_64 && ../configure CPPFLAGS="-mmacosx-version-min=10.7 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070 -isysroot $HOME/x86_64/SDKs/MacOSX10.9.sdk" --prefix="$HOME/x86_64prefix" && make && make install) &
+          (export MACOSX_DEPLOYMENT_TARGET="11.0" && cd SDL2-$SDL_VERSION && mkdir build_arm64 && cd build_arm64 && ../configure CPPFLAGS="-mmacosx-version-min=11.0 -isysroot $HOME/arm64/SDKs/MacOSX11.0.sdk" CFLAGS="-arch arm64" LDFLAGS="-arch arm64" --host=aarch64-apple-darwin20 --prefix="$HOME/arm64prefix" && make && make install) &
+          wait
+
+      - name: 'Download libserialport sources'
+        run: |
+          curl -L -O https://github.com/sigrokproject/libserialport/archive/refs/heads/master.zip && unzip master.zip && rm master.zip
+          
+      - name: 'Build libserialport'
+        run: |
+          pushd libserialport-master
+          autoreconf -I"$HOME/x86_64prefix/share/aclocal" -i
+          (export MACOSX_DEPLOYMENT_TARGET="10.9" && mkdir build_x86_64 && cd build_x86_64 && ../configure CFLAGS="-mmacosx-version-min=10.7 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070 -isysroot $HOME/x86_64/SDKs/MacOSX10.9.sdk" --prefix="$HOME/x86_64prefix" && make && make install) &
+          (export MACOSX_DEPLOYMENT_TARGET="11.0" && mkdir build_arm64 && cd build_arm64 && ../configure CFLAGS="-mmacosx-version-min=11.0 -isysroot $HOME/arm64/SDKs/MacOSX11.0.sdk" CFLAGS="-arch arm64" LDFLAGS="-arch arm64" --host=aarch64-apple-darwin20 --prefix="$HOME/arm64prefix" && make && make install) &
+          wait
+          popd
+
+      - name: 'Build m8c'
+        run: |
+          (export MACOSX_DEPLOYMENT_TARGET="10.9" && export PKG_CONFIG_PATH="$HOME/x86_64prefix/lib/pkgconfig" && export CFLAGS="-mmacosx-version-min=10.7 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070 -isysroot $HOME/x86_64/SDKs/MacOSX10.9.sdk" && mkdir build_x86_64 && cd build_x86_64 && cmake .. && cpack -V) &
+          (export MACOSX_DEPLOYMENT_TARGET="11.0" && export PKG_CONFIG_PATH="$HOME/arm64prefix/lib/pkgconfig" && mkdir -p build_arm64 && cd build_arm64 && export CFLAGS="-mmacosx-version-min=11.0 -isysroot $HOME/arm64/SDKs/MacOSX11.0.sdk -arch arm64" LDFLAGS="-arch arm64"  && cmake .. && cpack -V) &
+          wait          
+
+      - name: 'Build package'
+        run: |
+          mv build_arm64/m8c-0.1.1-Darwin.dmg m8c-${{ env.NOW }}-applesilicon.dmg
+          mv build_x86_64/m8c-0.1.1-Darwin.dmg m8c-${{ env.NOW }}-intel.dmg
+      - name: 'Upload artifact'
+        uses: actions/upload-artifact@v4
+        with:
+          name: m8c-${{ env.NOW }}-macos
+          path: |
+            m8c-${{ env.NOW }}-applesilicon.dmg
+            m8c-${{ env.NOW }}-intel.dmg
\ No newline at end of file
--- /dev/null
+++ b/.github/workflows/build-ubuntu.yml
@@ -1,0 +1,36 @@
+name: m8c linux x64 build
+
+on:
+  push:
+  pull_request:
+  workflow_dispatch:
+
+jobs:
+ 
+  build-linux:
+    runs-on: ubuntu-latest
+    name: linux-x86_64
+    steps:
+      - name: 'Install dependencies'
+        run: |
+          sudo apt-get update
+          sudo apt-get install --fix-missing build-essential libsdl2-dev libserialport-dev zip
+      - name: 'Checkout'
+        uses: actions/checkout@v4
+
+      - name: Set current date as env variable
+        run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
+
+      - name: 'Build package'
+        run: |
+          make
+      - name: 'Upload artifact'
+        uses: actions/upload-artifact@v4
+        with:
+          name: m8c-${{ env.NOW }}-linux
+          path: |
+            LICENSE
+            README.md
+            AUDIOGUIDE.md
+            m8c
+            gamecontrollerdb.txt
\ No newline at end of file
--- /dev/null
+++ b/.github/workflows/build-windows.yml
@@ -1,0 +1,86 @@
+name: m8c win32/win64 build
+
+on:
+  push:
+  pull_request:
+  workflow_dispatch:
+
+jobs:
+  build-win:
+    runs-on: windows-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - { sys: mingw32, env: i686, win: win32 }
+          - { sys: mingw64, env: x86_64, win: win64 }
+    name: ${{ matrix.win }}
+    defaults:
+      run:
+        shell: msys2 {0}
+    env:
+      MINGW_ARCH: ${{ matrix.sys }}
+    steps:
+
+    - name: 'git config'
+      run: git config --global core.autocrlf input
+      shell: bash
+
+    - name: 'Checkout'
+      uses: actions/checkout@v4
+      with:
+        fetch-depth: 0
+
+    - name: 'Setup MSYS2'
+      uses: msys2/setup-msys2@v2
+      with:
+        msystem: ${{ matrix.sys }}
+        update: true
+        install: mingw-w64-${{ matrix.env }}-toolchain make mingw-w64-${{ matrix.env }}-SDL2 mingw-w64-${{ matrix.env }}-libserialport zip dos2unix
+  
+    - name: Set current date as env variable
+      run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
+
+    - name: 'Build package'
+      run: |
+        make
+        strip -g m8c.exe
+        if [ ${{ matrix.win }} == "win32" ]
+        then        
+          cp /mingw32/bin/SDL2.dll .
+          cp /mingw32/bin/libgcc_s_dw2-1.dll .
+          cp /mingw32/bin/libserialport-0.dll .
+          cp /mingw32/bin/libwinpthread-1.dll .
+        else
+          cp /mingw64/bin/SDL2.dll .
+          cp /mingw64/bin/libserialport-0.dll .
+        fi
+        unix2dos README.md LICENSE AUDIOGUIDE.md
+    - name: 'Upload artifact (win32)'
+      if: matrix.win == 'win32'
+      uses: actions/upload-artifact@v4
+      with:
+        name: m8c-${{ env.NOW }}-${{ matrix.win }}
+        path: |
+          m8c.exe
+          SDL2.dll
+          libserialport-0.dll
+          libgcc_s_dw2-1.dll
+          libwinpthread-1.dll
+          gamecontrollerdb.txt
+          LICENSE
+          README.md
+          AUDIOGUIDE.md
+    - name: 'Upload artifact (win64)'
+      if: matrix.win == 'win64'
+      uses: actions/upload-artifact@v4
+      with:
+        name: m8c-${{ env.NOW }}-${{ matrix.win }}
+        path: |
+          m8c.exe
+          SDL2.dll
+          libserialport-0.dll
+          gamecontrollerdb.txt
+          LICENSE
+          README.md
+          AUDIOGUIDE.md
\ No newline at end of file
--- a/.github/workflows/build.yml
+++ /dev/null
@@ -1,144 +1,0 @@
-name: m8c build
-
-on:
-  push:
-  pull_request:
-  workflow_dispatch:
-
-jobs:
-  build-win:
-    runs-on: windows-latest
-    strategy:
-      fail-fast: false
-      matrix:
-        include:
-          - { sys: mingw32, env: i686, win: win32 }
-          - { sys: mingw64, env: x86_64, win: win64 }
-    name: ${{ matrix.win }}
-    defaults:
-      run:
-        shell: msys2 {0}
-    env:
-      MINGW_ARCH: ${{ matrix.sys }}
-    steps:
-
-    - name: 'git config'
-      run: git config --global core.autocrlf input
-      shell: bash
-
-    - name: 'Checkout'
-      uses: actions/checkout@v4
-      with:
-        fetch-depth: 0
-
-    - name: 'Setup MSYS2'
-      uses: msys2/setup-msys2@v2
-      with:
-        msystem: ${{ matrix.sys }}
-        update: true
-        install: mingw-w64-${{ matrix.env }}-toolchain make mingw-w64-${{ matrix.env }}-SDL2 mingw-w64-${{ matrix.env }}-libserialport zip dos2unix
-  
-    - name: Set current date as env variable
-      run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
-
-    - name: 'Build package'
-      run: |
-        make
-        strip -g m8c.exe
-        if [ ${{ matrix.win }} == "win32" ]
-        then        
-          cp /mingw32/bin/SDL2.dll .
-          cp /mingw32/bin/libgcc_s_dw2-1.dll .
-          cp /mingw32/bin/libserialport-0.dll .
-          cp /mingw32/bin/libwinpthread-1.dll .
-        else
-          cp /mingw64/bin/SDL2.dll .
-          cp /mingw64/bin/libserialport-0.dll .
-        fi
-        unix2dos README.md LICENSE AUDIOGUIDE.md
-    - name: 'Upload artifact (win32)'
-      if: matrix.win == 'win32'
-      uses: actions/upload-artifact@v4
-      with:
-        name: m8c-${{ env.NOW }}-${{ matrix.win }}
-        path: |
-          m8c.exe
-          SDL2.dll
-          libserialport-0.dll
-          libgcc_s_dw2-1.dll
-          libwinpthread-1.dll
-          gamecontrollerdb.txt
-          LICENSE
-          README.md
-          AUDIOGUIDE.md
-    - name: 'Upload artifact (win64)'
-      if: matrix.win == 'win64'
-      uses: actions/upload-artifact@v4
-      with:
-        name: m8c-${{ env.NOW }}-${{ matrix.win }}
-        path: |
-          m8c.exe
-          SDL2.dll
-          libserialport-0.dll
-          gamecontrollerdb.txt
-          LICENSE
-          README.md
-          AUDIOGUIDE.md
-
-  build-linux:
-    runs-on: ubuntu-latest
-    name: linux-x86_64
-    steps:
-      - name: 'Install dependencies'
-        run: |
-          sudo apt-get update
-          sudo apt-get install --fix-missing build-essential libsdl2-dev libserialport-dev zip
-      - name: 'Checkout'
-        uses: actions/checkout@v4
-
-      - name: Set current date as env variable
-        run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
-
-      - name: 'Build package'
-        run: |
-          make
-      - name: 'Upload artifact'
-        uses: actions/upload-artifact@v4
-        with:
-          name: m8c-${{ env.NOW }}-linux
-          path: |
-            LICENSE
-            README.md
-            AUDIOGUIDE.md
-            m8c
-            gamecontrollerdb.txt
-      
-  build-macos:
-    runs-on: macos-latest
-    
-    steps:
-      - name: 'Install dependencies'
-        run: brew install cmake sdl2 libserialport pkg-config
-
-      - name: 'Checkout'
-        uses: actions/checkout@v4
-
-      - name: Set current date as env variable
-        run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV        
-
-      - name: 'Build package'
-        run: |
-          INSTALL_PREFIX=/tmp/
-          mkdir build && cd build
-          cmake ..
-          cmake --build .
-          cmake --install . --prefix=$INSTALL_PREFIX
-          codesign --deep --force --verify --verbose --timestamp --sign - "$INSTALL_PREFIX/m8c.app" "$INSTALL_PREFIX/m8c.app/Contents/Frameworks/libSDL2-2.0.0.dylib" "$INSTALL_PREFIX/m8c.app/Contents/Frameworks/libserialport.0.dylib"
-          cd ..
-          cp -r /tmp/m8c.app .
-          zip -r m8c.zip m8c.app LICENSE README.md AUDIOGUIDE.md gamecontrollerdb.txt
-      - name: 'Upload artifact'
-        uses: actions/upload-artifact@v4
-        with:
-          name: m8c-${{ env.NOW }}-macos
-          path: m8c.zip           
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,11 +44,12 @@
             )
 
     set_target_properties(${APP_NAME} PROPERTIES
+            MACOSX_BUNDLE TRUE
             MACOSX_BUNDLE_BUNDLE_NAME "m8c"
             MACOSX_BUNDLE_BUNDLE_VERSION "1"
-            MACOSX_BUNDLE_GUI_IDENTIFIER "com.laamaa.m8c"
-            MACOSX_BUNDLE_SHORT_VERSION_STRING "1.0"
             MACOSX_BUNDLE_COPYRIGHT "Copyright © 2021 laamaa. All rights reserved."
+            MACOSX_BUNDLE_GUI_IDENTIFIER "fi.laamaa.m8c"
+            MACOSX_BUNDLE_SHORT_VERSION_STRING "1.7.3"
             MACOSX_BUNDLE_ICON_FILE "m8c.icns")
 
     set(APPS "\${CMAKE_INSTALL_PREFIX}/${APP_NAME}.app")
@@ -55,5 +56,7 @@
 
     install(CODE "include(BundleUtilities)
     fixup_bundle(\"${APPS}\" \"\" \"\")")
+    set(CPACK_GENERATOR "DragNDrop")
+    include(CPack)
 endif ()
 
--- a/package/macos/m8c.app/Contents/Info.plist
+++ /dev/null
@@ -1,54 +1,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>BuildMachineOSBuild</key>
-	<string>17G11023</string>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>en</string>
-	<key>CFBundleIconFile</key>
-	<string>m8c</string>
-	<key>CFBundleExecutable</key>
-	<string>m8c</string>
-	<key>CFBundleIdentifier</key>
-	<string>com.laamaa.m8c</string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundleName</key>
-	<string>m8c</string>
-	<key>CFBundlePackageType</key>
-	<string>APPL</string>
-	<key>CFBundleShortVersionString</key>
-	<string>1.0</string>
-	<key>CFBundleSupportedPlatforms</key>
-	<array>
-		<string>MacOSX</string>
-	</array>
-	<key>CFBundleVersion</key>
-	<string>1</string>
-	<key>DTCompiler</key>
-	<string>com.apple.compilers.llvm.clang.1_0</string>
-	<key>DTPlatformBuild</key>
-	<string>10B61</string>
-	<key>DTPlatformVersion</key>
-	<string>GM</string>
-	<key>DTSDKBuild</key>
-	<string>18B71</string>
-	<key>DTSDKName</key>
-	<string>macosx10.14</string>
-	<key>DTXcode</key>
-	<string>1010</string>
-	<key>DTXcodeBuild</key>
-	<string>10B61</string>
-	<key>LSApplicationCategoryType</key>
-	<string>public.app-category.utilities</string>
-	<key>LSMinimumSystemVersion</key>
-	<string>10.13</string>
-	<key>NSHumanReadableCopyright</key>
-	<string>Copyright © 2021 laamaa. All rights reserved.</string>
-	<key>NSMainNibFile</key>
-	<string>MainMenu</string>
-	<key>NSPrincipalClass</key>
-	<string>NSApplication</string>
-</dict>
-</plist>
--