Skip to content

Commit

Permalink
[misc] add MinGW CI builds
Browse files Browse the repository at this point in the history
  • Loading branch information
pbatard committed Sep 3, 2021
1 parent abff9b2 commit e52b6bf
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 30 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/mingw.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: MinGW

on:
push:
paths-ignore:
- '.gitignore'
- '.gitattributes'
- '**.cmd'
- '**.md'
- 'AUTHORS'
- 'NEWS'
- 'ChangeLog'
pull_request:
paths-ignore:
- '.gitignore'
- '.gitattributes'
- '**.cmd'
- '**.md'
- 'AUTHORS'
- 'NEWS'
- 'ChangeLog'

env:
BUILD_OPTIONS: '--enable-toggable-debug --enable-examples-build --disable-debug --disable-shared'
DRIVERS_PATHS: '--with-wdkdir="wdk/Windows Kits/8.0" --with-wdfver=1011 --with-libusb0="libusb0" --with-libusbk="libusbk/bin"'

jobs:
build:
runs-on: windows-latest

strategy:
matrix:
include:
- { sys: mingw64, env: x86_64 }
- { sys: mingw32, env: i686 }

defaults:
run:
shell: msys2 {0}

steps:
- name: Install MinGW
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
update: true
install: >-
mingw-w64-${{ matrix.env }}-toolchain
base-devel
git
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Download support files
shell: cmd
run: |
curl -L https://go.microsoft.com/fwlink/p/?LinkID=253170 -o wdk-redist.msi
curl -L https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip/download -o libusb0-redist.zip
curl -L https://github.com/mcuee/libusbk/releases/download/V3.1.0.0/libusbK-3.1.0.0-bin.7z -o libusbk-redist.7z
msiexec /a wdk-redist.msi /qn TARGETDIR=%CD%\wdk
7z x libusb0-redist.zip
7z x libusbk-redist.7z
del *.zip
del *.7z
move libusb-win32* libusb0
move libusbK* libusbk
- name: Build
run: |
./bootstrap.sh
[ "${{ matrix.env }}" == "x86_64" ] && EXTRA_OPTION=--disable-32bit
./configure --build=${{ matrix.env }}-w64-mingw32 --host=${{ matrix.env }}-w64-mingw32 ${{ env.BUILD_OPTIONS }} $EXTRA_OPTION ${{ env.DRIVERS_PATHS }}
make
mkdir -p artifacts/${{ matrix.env }}
mv examples/*.exe artifacts/${{ matrix.env }}
- name: Display SHA-256
if: ${{ github.event_name == 'push' }}
run: sha256sum artifacts/${{ matrix.env }}/*.exe
- name: Upload artifacts
uses: actions/upload-artifact@v2
if: ${{ github.event_name == 'push' }}
with:
name: MinGW
path: ./artifacts/*/*.exe
20 changes: 8 additions & 12 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
AC_INIT([libwdi], [1.3.1], [[email protected]], [libwdi], [http://libwdi.akeo.ie])
AC_INIT([libwdi],[1.3.1],[[email protected]],[libwdi],[http://libwdi.akeo.ie])
AM_INIT_AUTOMAKE([-Wno-portability 1.11 foreign])
AC_CONFIG_SRCDIR([libwdi/libwdi.c])
AC_CONFIG_MACRO_DIR([m4])
AM_CONFIG_HEADER([config.h])
AC_CONFIG_HEADERS(config.h)
# Enable silent build rules by default (Automake v1.11 or later).
# Disable by either passing --disable-silent-rules to configure or passing V=1 to make
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])

AC_PREREQ([2.50])
AC_PREREQ([2.71])
AC_PROG_CC
AC_PROG_LIBTOOL
LT_INIT
LT_LANG([Windows Resource])
AC_C_INLINE
AM_PROG_CC_C_O
Expand Down Expand Up @@ -108,19 +108,17 @@ CFLAGS="${saved_CFLAGS}"
LDFLAGS="${saved_LDFLAGS}"
cross_compiling=$saved_cross_compiling
if test "x$cc_for_build_ok" != "xyes"; then
AC_ERROR([The build compiler cannot produce executables for this
AC_MSG_ERROR(The build compiler cannot produce executables for this
platform. You might have to define the CC_FOR_BUILD environment variable.
For instance, on 32 bit Windows, if using a multilib MinGW-w64 that defaults
to 64 bit executables, you would need: export CC_FOR_BUILD="gcc -m32"])
to 64 bit executables, you would need: export CC_FOR_BUILD="gcc -m32")
fi

# 32 bit support
saved_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} -m32"
AC_MSG_CHECKING([whether the compiler can produce 32 bit binaries])
AC_TRY_COMPILE([], [;],
[compiler_has_m32=yes],
[compiler_has_m32=no])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])],[compiler_has_m32=yes],[compiler_has_m32=no])
if test "x$compiler_has_m32" == "xyes"; then
AC_MSG_RESULT([yes])
else
Expand All @@ -132,9 +130,7 @@ CFLAGS="${saved_CFLAGS}"
saved_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} -m64"
AC_MSG_CHECKING([whether the compiler can produce 64 bit binaries])
AC_TRY_COMPILE([], [;],
[compiler_has_m64=yes],
[compiler_has_m64=no])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])],[compiler_has_m64=yes],[compiler_has_m64=no])
if test "x$compiler_has_m64" == "xyes"; then
AC_MSG_RESULT([yes])
else
Expand Down
8 changes: 4 additions & 4 deletions examples/wdi-simple.rc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#endif

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,745,0
PRODUCTVERSION 1,3,745,0
FILEVERSION 1,3,746,0
PRODUCTVERSION 1,3,746,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -25,13 +25,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "akeo.ie"
VALUE "FileDescription", "WDI-Simple"
VALUE "FileVersion", "1.3.745"
VALUE "FileVersion", "1.3.746"
VALUE "InternalName", "WDI-Simple"
VALUE "LegalCopyright", "� 2010-2018 Pete Batard (LGPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/lesser.html"
VALUE "OriginalFilename", "wdi-simple.exe"
VALUE "ProductName", "WDI-Simple"
VALUE "ProductVersion", "1.3.745"
VALUE "ProductVersion", "1.3.746"
VALUE "Comments", "http://libwdi.akeo.ie"
END
END
Expand Down
8 changes: 4 additions & 4 deletions examples/zadic.rc
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,745,0
PRODUCTVERSION 1,3,745,0
FILEVERSION 1,3,746,0
PRODUCTVERSION 1,3,746,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -74,13 +74,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "akeo.ie"
VALUE "FileDescription", "Zadic"
VALUE "FileVersion", "1.3.745"
VALUE "FileVersion", "1.3.746"
VALUE "InternalName", "Zadic"
VALUE "LegalCopyright", "� 2010-2018 Pete Batard (LGPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/lesser.html"
VALUE "OriginalFilename", "zadic.exe"
VALUE "ProductName", "Zadic"
VALUE "ProductVersion", "1.3.745"
VALUE "ProductVersion", "1.3.746"
VALUE "Comments", "http://libwdi.akeo.ie"
END
END
Expand Down
2 changes: 1 addition & 1 deletion examples/zadig.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
#define FIELD_ORANGE RGB(255,240,200)
#define ARROW_GREEN RGB(92,228,65)
#define ARROW_ORANGE RGB(253,143,56)
#define APP_VERSION "Zadig 2.5.745"
#define APP_VERSION "Zadig 2.5.746"

// These are used to flag end users about the driver they are going to replace
enum driver_type {
Expand Down
8 changes: 4 additions & 4 deletions examples/zadig.rc
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,5,745,0
PRODUCTVERSION 2,5,745,0
FILEVERSION 2,5,746,0
PRODUCTVERSION 2,5,746,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -264,13 +264,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "akeo.ie"
VALUE "FileDescription", "Zadig"
VALUE "FileVersion", "2.5.745"
VALUE "FileVersion", "2.5.746"
VALUE "InternalName", "Zadig"
VALUE "LegalCopyright", "� 2010-2018 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "zadig.exe"
VALUE "ProductName", "Zadig"
VALUE "ProductVersion", "2.5.745"
VALUE "ProductVersion", "2.5.746"
VALUE "Comments", "http://libwdi.akeo.ie"
END
END
Expand Down
2 changes: 1 addition & 1 deletion libwdi/embedder.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ main (int argc, char *argv[])
}
#if defined(_WIN32)
MultiByteToWideChar(CP_UTF8, 0, fullpath, -1, wfullpath, MAX_PATH);
wprintf(L" EMBED %s ", wfullpath);
printf(" EMBED %S ", wfullpath);
fd = _wfopen(wfullpath, L"rb");
#else
printf(" EMBED %s ", fullpath);
Expand Down
8 changes: 4 additions & 4 deletions libwdi/libwdi.rc
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,745,0
PRODUCTVERSION 1,3,745,0
FILEVERSION 1,3,746,0
PRODUCTVERSION 1,3,746,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -68,13 +68,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "akeo.ie"
VALUE "FileDescription", "libwdi: Windows Driver Installer Library"
VALUE "FileVersion", "1.3.745"
VALUE "FileVersion", "1.3.746"
VALUE "InternalName", "libwdi"
VALUE "LegalCopyright", "� 2010-2017 Pete Batard (LGPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/lesser.html"
VALUE "OriginalFilename", "libwdi"
VALUE "ProductName", "libwdi"
VALUE "ProductVersion", "1.3.745"
VALUE "ProductVersion", "1.3.746"
VALUE "Comments", "http://libwdi.akeo.ie"
END
END
Expand Down

0 comments on commit e52b6bf

Please sign in to comment.