Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI build for Windows #862

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 145 additions & 2 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
SLEEP=no

jobs:
build:
ix-build:

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:

- name: 'Install build requirements (Linux)'
if: runner.os == 'Linux'
run: sudo apt-get install -y autopoint gettext libusb-1.0-0-dev libcurl4-openssl-dev libgd-dev
run: sudo apt-get install -y autopoint gettext pkgconf libusb-1.0-0-dev libcurl4-openssl-dev libgd-dev

- name: 'Install build requirements (macOS)'
if: runner.os == 'macOS'
Expand Down Expand Up @@ -91,12 +91,18 @@ jobs:
if: runner.os != 'macOS'
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" DISTCHECK_CONFIGURE_FLAGS="${COMMON_CONFIGURE_FLAGS}" distcheck

- name: 'dist tarball content'
run: for tarball in *.tar.*; do tar tf "$tarball" | sort; break; done

- name: 'make install'
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" install

- name: 'make installcheck'
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" installcheck

- name: 'Show installed PC files'
run: find $PWD/__prefix -type f -name '*.pc' -exec printf '======== %s ========\n' {} \; -exec cat {} \;

- name: 'find ldd replacement (MacOS)'
if: runner.os == 'macOS'
run: echo 'LDD=otool -L' >> $GITHUB_ENV
Expand All @@ -110,7 +116,144 @@ jobs:
set -x
exec 2>&1
abs_top_builddir="$PWD"
pkg-config --version
pkg-config --help
pkg-config --about ||:
pkg-config --path libexif ||:
pkg-config --path libgphoto2 ||:
export PKG_CONFIG_PATH="${abs_top_builddir}/__prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
pkg-config --path libexif ||:
pkg-config --path libgphoto2 ||:
export PKG_CONFIG_PATH="${abs_top_builddir}/__prefix/lib/pkgconfig:"
pkg-config --path libexif ||:
pkg-config --path libgphoto2 ||:
export PKG_CONFIG_PATH="${abs_top_builddir}/__prefix/lib/pkgconfig"
pkg-config --path libexif ||:
pkg-config --path libgphoto2 ||:
export LD_LIBRARY_PATH="${abs_top_builddir}/__prefix/lib"
cd examples/ambs-lgp2-frontend
autoreconf -vis
./configure --prefix="$PWD/__pref"
make
${LDD-false} ambs-lgp2-frontend
./ambs-lgp2-frontend
make install
${LDD-false} __pref/bin/ambs-lgp2-frontend
__pref/bin/ambs-lgp2-frontend

msys2-build:
needs: ix-build

runs-on: ${{ matrix.os }}

name: '${{ matrix.os }} ${{ matrix.sys }}'

strategy:
fail-fast: false
matrix:
os: [windows-latest]
# FIXME: mingw32 cannot find WSAStartup() in -lws2_32
sys: [mingw64, ucrt64, clang64]

defaults:
run:
shell: 'msys2 {0}'

steps:
- name: 'git config core.autocrlf (Windows)'
run: git config --global core.autocrlf input
shell: bash

- uses: actions/checkout@v3

- name: 'Set MINGW_ARCH (Windows)'
shell: bash
run: echo MINGW_ARCH="${{ matrix.sys }}" >> $GITHUB_ENV

# See https://github.com/msys2/setup-msys2
- name: 'Set up MSYS2 and install build requirements (Windows)'
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
update: true
install: >-
git
pacboy:
autotools:p
cc:p
curl:p
libexif:p
libgd:p
libiconv:p
libjpeg:p
libltdl:p
libsystre:p
libusb:p
libxml2:p

- name: 'Determine number of cores to build on (Windows)'
run: echo NPROC="${NUMBER_OF_PROCESSORS}" >> $GITHUB_ENV

# Setting MAKE interferes with Makefile{,.in,.am} using $(MAKE) internally
- name: 'Prepare concurrent make'
run: if test "x$NPROC" = x; then echo ci_MAKE="make" >> $GITHUB_ENV; echo "NPROC must be set"; exit 1; else echo ci_MAKE="make -j${NPROC} -l${NPROC}" >> $GITHUB_ENV; fi

- name: 'Work around broken C++ test cases (Windows)'
run: echo CXX="no" >> $GITHUB_ENV

- name: 'OS specific build flags'
run: >-
echo OS_SPECIFIC_CPPFLAGS="" >> $GITHUB_ENV

- name: 'autoreconf'
run: autoreconf -i -f

- name: 'configure'
run: ./configure ${COMMON_CONFIGURE_FLAGS} --prefix=$PWD/__prefix

- name: 'make'
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}"

- name: 'make check'
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" check

- name: 'make distcheck'
if: false
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" DISTCHECK_CONFIGURE_FLAGS="${COMMON_CONFIGURE_FLAGS}" distcheck

- name: 'dist tarball content'
if: false
run: for tarball in *.tar.*; do tar tf "$tarball" | sort; break; done

- name: 'make install'
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" install

- name: 'make installcheck'
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" installcheck

- name: 'Show installed PC files'
run: find $PWD/__prefix -type f -name '*.pc' -exec printf '======== %s ========\n' {} \; -exec cat {} \;

- name: 'Build and run example libgphoto2 frontend (ambs-lgp2-frontend)'
if: false # FIXME: We this build should work.
run: |
set -x
exec 2>&1
abs_top_builddir="$PWD"
pkg-config --version
pkg-config --help
pkg-config --about ||:
pkg-config --path libexif ||:
pkg-config --path libgphoto2 ||:
export PKG_CONFIG_PATH="${abs_top_builddir}/__prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
pkg-config --path libexif ||:
pkg-config --path libgphoto2 ||:
export PKG_CONFIG_PATH="${abs_top_builddir}/__prefix/lib/pkgconfig:"
pkg-config --path libexif ||:
pkg-config --path libgphoto2 ||:
export PKG_CONFIG_PATH="${abs_top_builddir}/__prefix/lib/pkgconfig"
pkg-config --path libexif ||:
pkg-config --path libgphoto2 ||:
export LD_LIBRARY_PATH="${abs_top_builddir}/__prefix/lib"
cd examples/ambs-lgp2-frontend
autoreconf -vis
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ GP_CAMLIB([largan],[outdated])dnl
GP_CAMLIB([lg_gsm],[outdated])dnl
AM_COND_IF([HAVE_LIBCURL], [dnl
AM_COND_IF([HAVE_LIBXML2], [dnl
dnl TODO: Make this conditional on availability of (Winsock ws2_32 or Unix sockets)
GP_CAMLIB([lumix])dnl
])
])
Expand Down
1 change: 1 addition & 0 deletions examples/ambs-lgp2-frontend/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ AC_PROG_CC


m4_pattern_forbid([^PKG_CHECK_MODULES])dnl
PKG_CHECK_MODULES([LIBEXIF], [libexif])
PKG_CHECK_MODULES([LIBGPHOTO2], [libgphoto2])


Expand Down
6 changes: 5 additions & 1 deletion libgphoto2_port/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,11 @@ GP_CHECK_LIBRARY([LIBUSB],[libusb],[>= 0.1.5],
case "$host" in
*-*-mingw* | *-*-cygwin* | *-*-msvc* )
dnl Windows itself has usb.h we mis-detect, in that case remove access to the other usb.h
IOLIB_LIST="$IOLIB_LIST usb"
if test "x$have_LIBUSB1" = xyes; then
GP_CONFIG_MSG([libusb0 support], [detected, but disabled (using libusb1 instead)])
else
IOLIB_LIST="$IOLIB_LIST usb"
fi
;;
*-linux*)
if test "x$have_LIBUSB1" != xyes; then
Expand Down