Skip to content

Commit e0e8fa8

Browse files
committed
ci: Add CI build for Windows
1 parent c6ea54c commit e0e8fa8

File tree

4 files changed

+156
-3
lines changed

4 files changed

+156
-3
lines changed

.github/workflows/ccpp.yml

Lines changed: 149 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919
SLEEP=no
2020
2121
jobs:
22-
build:
22+
ix-build:
2323

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

@@ -59,7 +59,7 @@ jobs:
5959

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

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

94+
- name: 'dist tarball content'
95+
run: for tarball in *.tar.*; do tar tf "$tarball" | sort; break; done
96+
9497
- name: 'make install'
9598
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" install
9699

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

103+
- name: 'Show installed PC files'
104+
run: find $PWD/__prefix -type f -name '*.pc' -exec printf '======== %s ========\n' {} \; -exec cat {} \;
105+
100106
- name: 'find ldd replacement (MacOS)'
101107
if: runner.os == 'macOS'
102108
run: echo 'LDD=otool -L' >> $GITHUB_ENV
@@ -110,7 +116,148 @@ jobs:
110116
set -x
111117
exec 2>&1
112118
abs_top_builddir="$PWD"
119+
pkg-config --version
120+
pkg-config --help
121+
pkg-config --about ||:
122+
pkg-config --path libexif ||:
123+
pkg-config --path libgphoto2 ||:
124+
export PKG_CONFIG_PATH="${abs_top_builddir}/__prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
125+
pkg-config --path libexif ||:
126+
pkg-config --path libgphoto2 ||:
127+
export PKG_CONFIG_PATH="${abs_top_builddir}/__prefix/lib/pkgconfig:"
128+
pkg-config --path libexif ||:
129+
pkg-config --path libgphoto2 ||:
130+
export PKG_CONFIG_PATH="${abs_top_builddir}/__prefix/lib/pkgconfig"
131+
pkg-config --path libexif ||:
132+
pkg-config --path libgphoto2 ||:
133+
export LD_LIBRARY_PATH="${abs_top_builddir}/__prefix/lib"
134+
cd examples/ambs-lgp2-frontend
135+
autoreconf -vis
136+
./configure --prefix="$PWD/__pref"
137+
make
138+
${LDD-false} ambs-lgp2-frontend
139+
./ambs-lgp2-frontend
140+
make install
141+
${LDD-false} __pref/bin/ambs-lgp2-frontend
142+
__pref/bin/ambs-lgp2-frontend
143+
144+
msys2-build:
145+
needs: ix-build
146+
147+
runs-on: ${{ matrix.os }}
148+
149+
name: '${{ matrix.os }} ${{ matrix.sys }}'
150+
151+
strategy:
152+
fail-fast: false
153+
matrix:
154+
os: [windows-latest]
155+
# FIXME: mingw32 cannot find WSAStartup() in -lws2_32
156+
sys: [mingw64, ucrt64, clang64]
157+
158+
defaults:
159+
run:
160+
shell: 'msys2 {0}'
161+
162+
steps:
163+
- name: 'git config core.autocrlf (Windows)'
164+
run: git config --global core.autocrlf input
165+
shell: bash
166+
167+
- uses: actions/checkout@v3
168+
169+
- name: 'Set MINGW_ARCH (Windows)'
170+
shell: bash
171+
run: echo MINGW_ARCH="${{ matrix.sys }}" >> $GITHUB_ENV
172+
173+
# See https://github.com/msys2/setup-msys2
174+
- name: 'Set up MSYS2 and install build requirements (Windows)'
175+
uses: msys2/setup-msys2@v2
176+
with:
177+
msystem: ${{ matrix.sys }}
178+
update: true
179+
install: >-
180+
git
181+
autoconf
182+
automake
183+
gettext-devel
184+
libtool
185+
make
186+
pkgconf
187+
msys2-w32api-headers
188+
msys2-w32api-runtime
189+
pacboy:
190+
gcc:p
191+
curl:p
192+
libexif:p
193+
libgd:p
194+
libltdl:p
195+
libusb:p
196+
libxml2:p
197+
198+
- name: 'Determine number of cores to build on (Windows)'
199+
run: echo NPROC="${NUMBER_OF_PROCESSORS}" >> $GITHUB_ENV
200+
201+
# Setting MAKE interferes with Makefile{,.in,.am} using $(MAKE) internally
202+
- name: 'Prepare concurrent make'
203+
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
204+
205+
- name: 'Work around broken C++ test cases (Windows)'
206+
run: echo CXX="no" >> $GITHUB_ENV
207+
208+
- name: 'OS specific build flags'
209+
run: >-
210+
echo OS_SPECIFIC_CPPFLAGS="" >> $GITHUB_ENV
211+
212+
- name: 'autoreconf'
213+
run: autoreconf -i -f
214+
215+
- name: 'configure'
216+
run: ./configure ${COMMON_CONFIGURE_FLAGS} --prefix=$PWD/__prefix
217+
218+
- name: 'make'
219+
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}"
220+
221+
- name: 'make check'
222+
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" check
223+
224+
- name: 'make distcheck'
225+
if: false
226+
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" DISTCHECK_CONFIGURE_FLAGS="${COMMON_CONFIGURE_FLAGS}" distcheck
227+
228+
- name: 'dist tarball content'
229+
if: false
230+
run: for tarball in *.tar.*; do tar tf "$tarball" | sort; break; done
231+
232+
- name: 'make install'
233+
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" install
234+
235+
- name: 'make installcheck'
236+
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" installcheck
237+
238+
- name: 'Show installed PC files'
239+
run: find $PWD/__prefix -type f -name '*.pc' -exec printf '======== %s ========\n' {} \; -exec cat {} \;
240+
241+
- name: 'Build and run example libgphoto2 frontend (ambs-lgp2-frontend)'
242+
if: false # FIXME: We this build should work.
243+
run: |
244+
set -x
245+
exec 2>&1
246+
abs_top_builddir="$PWD"
247+
pkg-config --version
248+
pkg-config --help
249+
pkg-config --about ||:
250+
pkg-config --path libexif ||:
251+
pkg-config --path libgphoto2 ||:
252+
export PKG_CONFIG_PATH="${abs_top_builddir}/__prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
253+
pkg-config --path libexif ||:
254+
pkg-config --path libgphoto2 ||:
255+
export PKG_CONFIG_PATH="${abs_top_builddir}/__prefix/lib/pkgconfig:"
256+
pkg-config --path libexif ||:
257+
pkg-config --path libgphoto2 ||:
113258
export PKG_CONFIG_PATH="${abs_top_builddir}/__prefix/lib/pkgconfig"
259+
pkg-config --path libexif ||:
260+
pkg-config --path libgphoto2 ||:
114261
export LD_LIBRARY_PATH="${abs_top_builddir}/__prefix/lib"
115262
cd examples/ambs-lgp2-frontend
116263
autoreconf -vis

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ GP_CAMLIB([largan],[outdated])dnl
535535
GP_CAMLIB([lg_gsm],[outdated])dnl
536536
AM_COND_IF([HAVE_LIBCURL], [dnl
537537
AM_COND_IF([HAVE_LIBXML2], [dnl
538+
dnl TODO: Make this conditional on availability of (Winsock ws2_32 or Unix sockets)
538539
GP_CAMLIB([lumix])dnl
539540
])
540541
])

examples/ambs-lgp2-frontend/configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ AC_PROG_CC
2121

2222

2323
m4_pattern_forbid([^PKG_CHECK_MODULES])dnl
24+
PKG_CHECK_MODULES([LIBEXIF], [libexif])
2425
PKG_CHECK_MODULES([LIBGPHOTO2], [libgphoto2])
2526

2627

libgphoto2_port/configure.ac

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,11 @@ GP_CHECK_LIBRARY([LIBUSB],[libusb],[>= 0.1.5],
395395
case "$host" in
396396
*-*-mingw* | *-*-cygwin* | *-*-msvc* )
397397
dnl Windows itself has usb.h we mis-detect, in that case remove access to the other usb.h
398-
IOLIB_LIST="$IOLIB_LIST usb"
398+
if test "x$have_LIBUSB1" = xyes; then
399+
GP_CONFIG_MSG([libusb0 support], [detected, but disabled (using libusb1 instead)])
400+
else
401+
IOLIB_LIST="$IOLIB_LIST usb"
402+
fi
399403
;;
400404
*-linux*)
401405
if test "x$have_LIBUSB1" != xyes; then

0 commit comments

Comments
 (0)