Merge pull request #1748 from nghttp2/cross-build

Cross build
This commit is contained in:
Tatsuhiro Tsujikawa 2022-07-05 19:10:28 +09:00 committed by GitHub
commit d38cf2d11c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 2 deletions

View File

@ -229,6 +229,50 @@ jobs:
cd $NGHTTP2_CMAKE_DIR/integration-tests cd $NGHTTP2_CMAKE_DIR/integration-tests
make itprep it make itprep it
build-cross:
strategy:
matrix:
host: [x86_64-w64-mingw32, i686-w64-mingw32]
runs-on: ubuntu-22.04
env:
HOST: ${{ matrix.host }}
steps:
- uses: actions/checkout@v3
- name: Linux setup
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install \
gcc-mingw-w64 \
autoconf \
automake \
autotools-dev \
libtool \
pkg-config \
wine
- name: Build CUnit
run: |
curl -LO https://jaist.dl.sourceforge.net/project/cunit/CUnit/2.1-3/CUnit-2.1-3.tar.bz2
tar xf CUnit-2.1-3.tar.bz2
cd CUnit-2.1-3
./bootstrap
./configure --disable-shared --host="$HOST" --prefix="$PWD/build"
make -j$(nproc) install
- name: Configure autotools
run: |
autoreconf -i && \
./configure --enable-werror --enable-lib-only --with-cunit \
--host="$HOST" PKG_CONFIG_PATH="$PWD/CUnit-2.1-3/build/lib/pkgconfig"
- name: Build nghttp2
run: |
make -j$(nproc)
make -j$(nproc) check TESTS=""
cd tests
wine main.exe
build-windows: build-windows:
runs-on: windows-latest runs-on: windows-latest

View File

@ -53,7 +53,7 @@
STIN uint32_t htonl(uint32_t hostlong) { STIN uint32_t htonl(uint32_t hostlong) {
uint32_t res; uint32_t res;
unsigned char *p = (unsigned char *)&res; unsigned char *p = (unsigned char *)&res;
*p++ = hostlong >> 24; *p++ = (unsigned char)(hostlong >> 24);
*p++ = (hostlong >> 16) & 0xffu; *p++ = (hostlong >> 16) & 0xffu;
*p++ = (hostlong >> 8) & 0xffu; *p++ = (hostlong >> 8) & 0xffu;
*p = hostlong & 0xffu; *p = hostlong & 0xffu;
@ -63,7 +63,7 @@ STIN uint32_t htonl(uint32_t hostlong) {
STIN uint16_t htons(uint16_t hostshort) { STIN uint16_t htons(uint16_t hostshort) {
uint16_t res; uint16_t res;
unsigned char *p = (unsigned char *)&res; unsigned char *p = (unsigned char *)&res;
*p++ = hostshort >> 8; *p++ = (unsigned char)(hostshort >> 8);
*p = hostshort & 0xffu; *p = hostshort & 0xffu;
return res; return res;
} }

View File

@ -78,6 +78,7 @@ AM_CFLAGS = $(WARNCFLAGS) \
-I${top_srcdir}/lib \ -I${top_srcdir}/lib \
-I${top_srcdir}/lib/includes \ -I${top_srcdir}/lib/includes \
-I${top_builddir}/lib/includes \ -I${top_builddir}/lib/includes \
-DBUILDING_NGHTTP2 \
@CUNIT_CFLAGS@ @DEFS@ @CUNIT_CFLAGS@ @DEFS@
TESTS = main TESTS = main