ref: a7bc443594a319178f48a3d0fa5a918f6f425248
parent: c08e0604e8c731dde7430077ab7c04c19cacf9d8
author: Jonne Kokkonen <jonne.kokkonen@gmail.com>
date: Sun Mar 2 10:19:02 EST 2025
fix macos arm, ubuntu and windows builds
--- a/.github/workflows/build-macos-arm.yml
+++ b/.github/workflows/build-macos-arm.yml
@@ -25,8 +25,14 @@
run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: 'Build m8c'
+ id: buildApplication
+ continue-on-error: true
run: |
mkdir -p build_arm64 && cd build_arm64 && cmake .. && cpack -V
+
+ - name: 'View debug log if compilation fails'
+ if: failure() && steps.buildApplication.outcome == 'failure'
+ run: cat /Users/runner/work/m8c/m8c/build_arm64/_CPack_Packages/Darwin/DragNDrop/PreinstallOutput.log
- name: 'Build package'
run: |
--- a/.github/workflows/build-macos-intel.yml
+++ b/.github/workflows/build-macos-intel.yml
@@ -24,7 +24,7 @@
path: '/Users/runner/x86_64'
key: mac-x86_64-files
- - name: 'Download 10.7 SDK for x86_64'
+ - name: 'Download 10.14 SDK for x86_64'
if: steps.cache-x86_64-files.outputs.cache-hit != 'true'
run: |
mkdir -p "$HOME/x86_64"
@@ -31,7 +31,7 @@
pushd "$HOME/x86_64"
mkdir SDKs
cd SDKs
- curl -L "https://github.com/alexey-lysiuk/macos-sdk/releases/download/10.7/MacOSX10.7.tar.bz2" | tar -xvf -
+ curl -L "https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.14.sdk.tar.xz" | tar -xvf -
popd
- name: 'Checkout'
@@ -50,17 +50,18 @@
- name: 'Download SDL3 sources'
if: steps.cache-x86_64-sdl2-files.outputs.cache-hit != 'true'
run: |
- (curl https://www.libsdl.org/release/SDL3-$SDL_VERSION.tar.gz || curl -L https://github.com/libsdl-org/SDL/releases/download/release-$SDL_VERSION/SDL3-$SDL_VERSION.tar.gz) | tar xvf -
+ (curl https://www.libsdl.org/release/SDL3-$SDL_VERSION.tar.gz || curl -L https://github.com/libsdl-org/SDL/releases/download/release-$SDL_VERSION/SDL3-$SDL_VERSION.tar.gz) | tar zxvf -
- name: 'Build SDL3'
if: steps.cache-x86_64-sdl2-files.outputs.cache-hit != 'true'
run: |
- export MACOSX_DEPLOYMENT_TARGET="10.9"
+ export MACOSX_DEPLOYMENT_TARGET="10.14"
pushd SDL3-$SDL_VERSION
mkdir build_x86_64
- cd build_x86_64
- ../configure CPPFLAGS="-arch x86_64 -mmacosx-version-min=10.7 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070 -isysroot $HOME/x86_64/SDKs/MacOSX10.7.sdk" CFLAGS="-arch x86_64" CXXFLAGS="-arch x86_64" LDFLAGS="-arch x86_64 -F$HOME/x86_64/SDKs/MacOSX10.7.sdk/System/Library/Frameworks -L/usr/lib -L/usr/lib/system -Wl,-syslibroot,$HOME/x86_64/SDKs/MacOSX10.7.sdk" --host=x86_64-apple-darwin13 --prefix="$HOME/x86_64prefix"
- make
+ export MACOSX_DEPLOYMENT_TARGET="10.14" && export PKG_CONFIG_PATH="$HOME/x86_64prefix/lib/pkgconfig" && export CFLAGS="-arch x86_64 -mmacosx-version-min=10.14 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070 -isysroot $HOME/x86_64/SDKs/MacOSX10.14.sdk"
+ cmake -S . -B build_x86_64 -DSDL_FRAMEWORK=ON -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 -DMAC_OS_X_VERSION_MIN_REQUIRED=1014 -DCMAKE_OSX_SYSROOT=$HOME/x86_64/SDKs/MacOSX10.14.sdk
+ cmake --build build_x86_64
+ cmake --install build_x86_64 --prefix $HOME/x86_64prefix
popd
- name: 'Install SDL3'
@@ -78,12 +79,12 @@
pushd libserialport-master
mkdir autostuff
autoreconf -I"$HOME/x86_64prefix/share/aclocal" -i
- export MACOSX_DEPLOYMENT_TARGET="10.7" && mkdir build_x86_64 && cd build_x86_64 && ../configure CFLAGS="-arch x86_64 -mmacosx-version-min=10.7 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070 -isysroot $HOME/x86_64/SDKs/MacOSX10.7.sdk" LDFLAGS="-arch x86_64 -F$HOME/x86_64/SDKs/MacOSX10.7.sdk/System/Library/Frameworks -L/usr/lib -L/usr/lib/system -Wl,-syslibroot,$HOME/x86_64/SDKs/MacOSX10.7.sdk" --host=x86_64-apple-darwin13 --prefix="$HOME/x86_64prefix" && make && make install
+ export MACOSX_DEPLOYMENT_TARGET="10.14" && mkdir build_x86_64 && cd build_x86_64 && ../configure CFLAGS="-arch x86_64 -mmacosx-version-min=10.14 -DMAC_OS_X_VERSION_MIN_REQUIRED=1014 -isysroot $HOME/x86_64/SDKs/MacOSX10.14.sdk" LDFLAGS="-arch x86_64 -F$HOME/x86_64/SDKs/MacOSX10.14.sdk/System/Library/Frameworks -L/usr/lib -L/usr/lib/system -Wl,-syslibroot,$HOME/x86_64/SDKs/MacOSX10.14.sdk" --host=x86_64-apple-darwin13 --prefix="$HOME/x86_64prefix" && make && make install
popd
- name: 'Build m8c'
run: |
- export MACOSX_DEPLOYMENT_TARGET="10.7" && export PKG_CONFIG_PATH="$HOME/x86_64prefix/lib/pkgconfig" && export CFLAGS="-arch x86_64 -mmacosx-version-min=10.7 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070 -isysroot $HOME/x86_64/SDKs/MacOSX10.7.sdk" && mkdir build_x86_64 && cd build_x86_64 && cmake -DCMAKE_OSX_ARCHITECTURES="x86_64" .. && cpack -V
+ export MACOSX_DEPLOYMENT_TARGET="10.14" && export PKG_CONFIG_PATH="$HOME/x86_64prefix/lib/pkgconfig" && export CFLAGS="-arch x86_64 -mmacosx-version-min=10.14 -DMAC_OS_X_VERSION_MIN_REQUIRED=1014 -isysroot $HOME/x86_64/SDKs/MacOSX10.14.sdk" && mkdir build_x86_64 && cd build_x86_64 && cmake -DCMAKE_OSX_ARCHITECTURES="x86_64" .. && cpack -V
- name: 'Build package'
run: |
--- a/.github/workflows/build-ubuntu.yml
+++ b/.github/workflows/build-ubuntu.yml
@@ -8,6 +8,8 @@
jobs:
build-linux:
+ env:
+ SDL_VERSION: 3.2.4
runs-on: ubuntu-latest
name: linux-x86_64
steps:
@@ -14,7 +16,7 @@
- name: 'Install dependencies'
run: |
sudo apt-get update
- sudo apt-get install --fix-missing build-essential libserialport-dev zip
+ sudo apt-get install --fix-missing build-essential libserialport-dev zip git make pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev
- name: 'Cache SDL3 files'
id: cache-x86_64-sdl3-files
@@ -26,7 +28,7 @@
- name: 'Download SDL3 sources'
if: steps.cache-x86_64-sdl3-files.outputs.cache-hit != 'true'
run: |
- (curl https://www.libsdl.org/release/SDL3-$SDL_VERSION.tar.gz || curl -L https://github.com/libsdl-org/SDL/releases/download/release-$SDL_VERSION/SDL3-$SDL_VERSION.tar.gz) | tar xvf -
+ (curl https://www.libsdl.org/release/SDL3-$SDL_VERSION.tar.gz || curl -L https://github.com/libsdl-org/SDL/releases/download/release-$SDL_VERSION/SDL3-$SDL_VERSION.tar.gz) | tar zxvf -
- name: 'Build SDL3'
if: steps.cache-x86_64-sdl3-files.outputs.cache-hit != 'true'
@@ -33,16 +35,11 @@
run: |
pushd SDL3-$SDL_VERSION
mkdir build_x86_64
- cd build_x86_64
- ../configure
- make
+ cmake -S . -B build_x86_64
+ cmake --build build_x86_64
+ sudo cmake --install build_x86_64
popd
- - name: 'Install SDL3'
- run: |
- pushd SDL3-$SDL_VERSION/build_x86_64
- make install
- popd
- name: 'Checkout'
uses: actions/checkout@v4
--- a/.github/workflows/build-windows.yml
+++ b/.github/workflows/build-windows.yml
@@ -37,7 +37,7 @@
with:
msystem: ${{ matrix.sys }}update: true
- install: mingw-w64-${{ matrix.env }}-toolchain make mingw-w64-${{ matrix.env }}-sdl3 zip dos2unix autoconf automake-wrapper libtool make unzip+ install: mingw-w64-${{ matrix.env }}-toolchain make mingw-w64-${{ matrix.env }}-cmake zip dos2unix autoconf automake-wrapper libtool make unzip- name: 'Cache SDL3 files'
id: cache-sdl3-files
@@ -44,30 +44,37 @@
uses: actions/cache@v4
with:
path: 'SDL3-3.2.4'
- key: win-sdl3-files
+ key: win-sdl3-files-${{ matrix.sys }}- name: 'Download SDL3 sources'
if: steps.cache-sdl3-files.outputs.cache-hit != 'true'
run: |
- (curl https://www.libsdl.org/release/SDL3-$SDL_VERSION.tar.gz || curl -L https://github.com/libsdl-org/SDL/releases/download/release-$SDL_VERSION/SDL3-$SDL_VERSION.tar.gz) | tar xvf -
+ (curl https://www.libsdl.org/release/SDL3-$SDL_VERSION.tar.gz || curl -L https://github.com/libsdl-org/SDL/releases/download/release-$SDL_VERSION/SDL3-$SDL_VERSION.tar.gz) | tar zxvf -
- - name: 'Build SDL3'
+ - name: 'Build and install SDL3'
if: steps.cache-sdl3-files.outputs.cache-hit != 'true'
run: |
pushd SDL3-$SDL_VERSION
mkdir build_${{ matrix.env }}- cd build_${{ matrix.env }}- ../configure
- make
+ cmake -S . -B build_${{ matrix.env }} -DCMAKE_TOOLCHAIN_FILE=build-scripts/cmake-toolchain-mingw64-${{ matrix.env }}.cmake+ cmake --build build_${{ matrix.env }} --parallelpopd
- name: 'Install SDL3'
run: |
- pushd SDL3-$SDL_VERSION/build_x86_64
- make install
- popd
+ pushd SDL3-$SDL_VERSION
+ cmake --install build_${{ matrix.env }} --prefix C:/Libraries+ popd
+ - name: 'Cache libserialport files'
+ id: cache-libserialport-files
+ uses: actions/cache@v4
+ with:
+ path: 'libserialport-master'
+ key: win-libserialport-files-${{ matrix.sys }}+
- name: 'Build libserialport manually'
+ if: steps.cache-libserialport-files.outputs.cache-hit != 'true'
run: |
wget https://github.com/sigrokproject/libserialport/archive/refs/heads/master.zip
unzip master.zip
@@ -75,6 +82,11 @@
./autogen.sh
./configure
make
+ popd
+
+ - name: 'Install libserialport'
+ run: |
+ pushd libserialport-master
make install
popd
@@ -83,16 +95,17 @@
- name: 'Build package'
run: |
- make
+ cmake . -G Ninja -DCMAKE_PREFIX_PATH=C:/Libraries
+ cmake --build .
strip -g m8c.exe
if [ ${{ matrix.win }} == "win32" ]then
- cp /mingw32/bin/SDL3.dll .
+ cp C:/Libraries/bin/SDL3.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/SDL3.dll .
+ cp C:/Libraries/bin/SDL3.dll .
cp /mingw64/bin/libserialport-0.dll .
fi
unix2dos README.md LICENSE AUDIOGUIDE.md
--- a/src/config.h
+++ b/src/config.h
@@ -58,8 +58,7 @@
} config_params_s;
-
-config_params_s init_config();
+config_params_s init_config(char *filename);
void read_config(config_params_s *conf);
void read_audio_config(const ini_t *ini, config_params_s *conf);
void read_graphics_config(const ini_t *ini, config_params_s *conf);
--- a/src/ini.c
+++ b/src/ini.c
@@ -106,6 +106,7 @@
/* Splits data in place into strings containing section-headers, keys and
* values using one or more '\0' as a delimiter. Unescapes quoted values */
static void split_data(const ini_t *ini) {+ char *value_start, *line_start;
char *p = ini->data;
while (p < ini->end) {@@ -131,7 +132,7 @@
break;
default:
- char *line_start = p;
+ line_start = p;
p += strcspn(p, "=\n");
/* Is line missing a '='? */
@@ -154,7 +155,7 @@
if (*p == '"') {/* Handle quoted string value */
- char *value_start = p;
+ value_start = p;
p = unescape_quoted_value(ini, p);
/* Was the string empty? */
--- a/src/input.c
+++ b/src/input.c
@@ -187,6 +187,7 @@
void handle_sdl_events(config_params_s *conf) {static int prev_key_analog = 0;
+ static unsigned int ticks_window_resized = 0;
SDL_Event event;
@@ -218,7 +219,6 @@
break;
case SDL_EVENT_WINDOW_RESIZED:
- static uint32_t ticks_window_resized = 0;
if (SDL_GetTicks() - ticks_window_resized > 500) { SDL_Log("Resizing window..."); key = (input_msg_s){special, msg_reset_display, 0, 0};--
⑨