Skip to content

Commit df12234

Browse files
authored
ci: Docker build for Fedora/Mingw (#535)
Use GithubActions Docker build for Fedora/Mingw builds. To avoid using `builds.sr.ht`. Related: #476
1 parent 8588168 commit df12234

3 files changed

Lines changed: 83 additions & 33 deletions

File tree

.builds/fedora-mingw.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/builds.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,3 +312,73 @@ jobs:
312312
name: hidapi-win
313313
path: artifacts/
314314
retention-days: ${{ (github.event_name == 'pull_request' || github.ref_name != 'master') && 7 || 90 }}
315+
316+
317+
fedora-mingw:
318+
319+
runs-on: ubuntu-latest
320+
container: fedora:latest
321+
steps:
322+
- uses: actions/checkout@v3
323+
with:
324+
path: hidapisrc
325+
- name: Install dependencies
326+
run: sudo dnf install -y autoconf automake libtool mingw64-gcc cmake ninja-build make
327+
- name: Configure CMake
328+
run: |
329+
rm -rf build install
330+
mingw64-cmake -B build/shared-cmake -S hidapisrc -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/shared-cmake -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}"
331+
mingw64-cmake -B build/static-cmake -S hidapisrc -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/static-cmake -DBUILD_SHARED_LIBS=FALSE -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}"
332+
- name: Configure Automake
333+
working-directory: hidapisrc
334+
run: |
335+
./bootstrap
336+
mingw64-configure
337+
- name: Build CMake Shared
338+
working-directory: build/shared-cmake
339+
run: ninja install
340+
- name: Build CMake Static
341+
working-directory: build/static-cmake
342+
run: ninja install
343+
- name: Build Automake
344+
working-directory: hidapisrc
345+
run: |
346+
make
347+
make DESTDIR=$PWD/../install/automake install
348+
make clean
349+
- name: Build manual Makefile
350+
working-directory: hidapisrc/windows
351+
run: make -f Makefile-manual OS=MINGW CC=x86_64-w64-mingw32-gcc
352+
- name: Check artifacts
353+
uses: andstor/file-existence-action@v2
354+
with:
355+
files: "install/shared-cmake/bin/libhidapi.dll, \
356+
install/shared-cmake/lib/libhidapi.dll.a, \
357+
install/shared-cmake/include/hidapi/hidapi.h, \
358+
install/shared-cmake/include/hidapi/hidapi_winapi.h, \
359+
install/static-cmake/lib/libhidapi.a, \
360+
install/static-cmake/include/hidapi/hidapi.h, \
361+
install/static-cmake/include/hidapi/hidapi_winapi.h"
362+
fail: true
363+
- name: Check CMake Export Package Shared
364+
run: |
365+
mingw64-cmake \
366+
-GNinja \
367+
-B build/shared_test \
368+
-S hidapisrc/hidtest \
369+
-Dhidapi_DIR=$PWD/install/shared-cmake/lib/cmake/hidapi \
370+
-DCMAKE_INSTALL_PREFIX=install/shared_test \
371+
"-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}"
372+
cd build/shared_test
373+
ninja install
374+
- name: Check CMake Export Package Static
375+
run: |
376+
mingw64-cmake \
377+
-GNinja \
378+
-B build/static_test \
379+
-S hidapisrc/hidtest \
380+
-Dhidapi_DIR=$PWD/install/static-cmake/lib/cmake/hidapi \
381+
-DCMAKE_INSTALL_PREFIX=install/static_test \
382+
"-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}"
383+
cd build/static_test
384+
ninja install

windows/hid.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,15 @@ static void register_winapi_error_to_buffer(wchar_t **error_buffer, const WCHAR
282282
}
283283
}
284284

285+
#if defined(__GNUC__)
286+
# pragma GCC diagnostic push
287+
# pragma GCC diagnostic ignored "-Warray-bounds"
288+
#endif
289+
/* A bug in GCC/mingw gives:
290+
* error: array subscript 0 is outside array bounds of 'wchar_t *[0]' {aka 'short unsigned int *[]'} [-Werror=array-bounds]
291+
* | free(*error_buffer);
292+
* Which doesn't make sense in this context. */
293+
285294
static void register_string_error_to_buffer(wchar_t **error_buffer, const WCHAR *string_error)
286295
{
287296
free(*error_buffer);
@@ -292,6 +301,10 @@ static void register_string_error_to_buffer(wchar_t **error_buffer, const WCHAR
292301
}
293302
}
294303

304+
#if defined(__GNUC__)
305+
# pragma GCC diagnostic pop
306+
#endif
307+
295308
static void register_winapi_error(hid_device *dev, const WCHAR *op)
296309
{
297310
register_winapi_error_to_buffer(&dev->last_error_str, op);

0 commit comments

Comments
 (0)