Skip to content
Merged
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
90 changes: 88 additions & 2 deletions .github/workflows/verify-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
BUILD_TYPE: ${{ matrix.build-type }}
CC: ${{ matrix.c-compiler }}
CXX: ${{ matrix.cc-compiler }}
defaults:
run:
shell: ${{ matrix.shell }}
strategy:
fail-fast: false
matrix:
Expand All @@ -33,6 +36,7 @@ jobs:
coverage: [coverage, nocoverage]
linking: [dynamic, static]
build-type: [classic]
shell: [bash]
exclude:
- os: ubuntu-latest
os-type: mac
Expand Down Expand Up @@ -62,6 +66,7 @@ jobs:
cc-compiler: clang++-18
debug: debug
coverage: nocoverage
shell: bash
# This test gives false positives on newer versions of clang
# and ubuntu-18.04 is not supported anymore on github
#- test-group: extra
Expand All @@ -82,6 +87,7 @@ jobs:
cc-compiler: clang++-18
debug: debug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -91,6 +97,7 @@ jobs:
cc-compiler: clang++-18
debug: debug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -100,6 +107,7 @@ jobs:
cc-compiler: clang++-18
debug: debug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -109,6 +117,7 @@ jobs:
cc-compiler: g++-9
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -118,6 +127,7 @@ jobs:
cc-compiler: g++-10
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -127,6 +137,7 @@ jobs:
cc-compiler: g++-11
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -136,6 +147,7 @@ jobs:
cc-compiler: g++-12
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -145,6 +157,7 @@ jobs:
cc-compiler: g++-13
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -154,6 +167,7 @@ jobs:
cc-compiler: g++-14
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-22.04
os-type: ubuntu
Expand All @@ -163,6 +177,7 @@ jobs:
cc-compiler: clang++-11
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-22.04
os-type: ubuntu
Expand All @@ -172,6 +187,7 @@ jobs:
cc-compiler: clang++-12
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-22.04
os-type: ubuntu
Expand All @@ -181,6 +197,7 @@ jobs:
cc-compiler: clang++-13
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -190,6 +207,7 @@ jobs:
cc-compiler: clang++-14
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -199,6 +217,7 @@ jobs:
cc-compiler: clang++-15
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -208,6 +227,7 @@ jobs:
cc-compiler: clang++-16
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -217,6 +237,7 @@ jobs:
cc-compiler: clang++-17
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -226,6 +247,7 @@ jobs:
cc-compiler: g++-14
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -235,6 +257,7 @@ jobs:
cc-compiler: clang++-18
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: performance
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -244,6 +267,7 @@ jobs:
cc-compiler: g++-10
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: performance
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -253,6 +277,7 @@ jobs:
cc-compiler: g++-10
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: performance
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -262,6 +287,7 @@ jobs:
cc-compiler: g++-10
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
Expand All @@ -271,6 +297,31 @@ jobs:
cc-compiler: g++-10
debug: debug
coverage: nocoverage
shell: bash
- test-group: basic
os: windows-latest
os-type: windows
msys-env: MINGW64
shell: 'msys2 {0}'
build-type: classic
compiler-family: none
c-compiler: gcc
cc-compiler: g++
debug: nodebug
coverage: nocoverage
linking: dynamic
- test-group: basic
os: windows-latest
os-type: windows
msys-env: MSYS
shell: 'msys2 {0}'
build-type: classic
compiler-family: none
c-compiler: gcc
cc-compiler: g++
debug: nodebug
coverage: nocoverage
linking: dynamic
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -282,8 +333,29 @@ jobs:
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
shell: bash
if: ${{ github.event_name == 'pull_request' }}


- name: Setup MSYS2
if: ${{ matrix.os-type == 'windows' }}
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msys-env }}
update: true
install: >-
autotools
base-devel

- name: Install MinGW64 packages
if: ${{ matrix.os-type == 'windows' && matrix.msys-env == 'MINGW64' }}
run: |
pacman --noconfirm -S --needed mingw-w64-x86_64-{toolchain,libtool,make,pkg-config,libsystre,doxygen,gnutls,graphviz,curl}

- name: Install MSYS packages
if: ${{ matrix.os-type == 'windows' && matrix.msys-env == 'MSYS' }}
run: |
pacman --noconfirm -S --needed msys2-devel gcc make libcurl-devel libgnutls-devel

- name: Install Ubuntu test sources
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test ;
Expand Down Expand Up @@ -395,6 +467,7 @@ jobs:
with:
path: libmicrohttpd-0.9.77
key: ${{ matrix.os }}-${{ matrix.c-compiler }}-libmicrohttpd-0.9.77-pre-built
if: ${{ matrix.os-type != 'windows' }}

- name: Build libmicrohttpd dependency (if not cached)
run: |
Expand All @@ -403,10 +476,21 @@ jobs:
cd libmicrohttpd-0.9.77 ;
./configure --disable-examples ;
make ;
if: steps.cache-libmicrohttpd.outputs.cache-hit != 'true'
if: ${{ matrix.os-type != 'windows' && steps.cache-libmicrohttpd.outputs.cache-hit != 'true' }}

- name: Install libmicrohttpd
run: cd libmicrohttpd-0.9.77 ; sudo make install ;
if: ${{ matrix.os-type != 'windows' }}

- name: Build and install libmicrohttpd (Windows)
if: ${{ matrix.os-type == 'windows' }}
run: |
curl https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-0.9.77.tar.gz -o libmicrohttpd-0.9.77.tar.gz
tar -xzf libmicrohttpd-0.9.77.tar.gz
cd libmicrohttpd-0.9.77
./configure --disable-examples --enable-poll=no
make
make install

- name: Refresh links to shared libs
run: sudo ldconfig ;
Expand Down Expand Up @@ -449,6 +533,7 @@ jobs:
fi

- name: Print config.log
shell: bash
run: |
cd build ;
cat config.log ;
Expand Down Expand Up @@ -486,6 +571,7 @@ jobs:
if: ${{ matrix.build-type != 'iwyu' }}

- name: Print tests results
shell: bash
run: |
cd build ;
cat test/test-suite.log ;
Expand Down
48 changes: 47 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Copyright (C) 2011-2019 Sebastiano Merlino.

# The libhttpserver reference manual
![GA: Build Status](https://github.com/etr/libhttpserver/actions/workflows/verify-build.yml/badge.svg)
[![Build status](https://ci.appveyor.com/api/projects/status/ktoy6ewkrf0q1hw6/branch/master?svg=true)](https://ci.appveyor.com/project/etr/libhttpserver/branch/master)
[![codecov](https://codecov.io/gh/etr/libhttpserver/branch/master/graph/badge.svg)](https://codecov.io/gh/etr/libhttpserver)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/1bd1e8c21f66400fb70e5a5ce357b525)](https://www.codacy.com/gh/etr/libhttpserver/dashboard?utm_source=github.com&utm_medium=referral&utm_content=etr/libhttpserver&utm_campaign=Badge_Grade)
[![Gitter chat](https://badges.gitter.im/etr/libhttpserver.png)](https://gitter.im/libhttpserver/community)
Expand Down Expand Up @@ -119,6 +118,53 @@ Here are listed the libhttpserver specific options (the canonical configure opti

[Back to TOC](#table-of-contents)

### Building on Windows (MSYS2)

MSYS2 provides multiple shell environments with different purposes. Understanding which shell to use is important:

| Shell | Host Triplet | Runtime Dependency | Use Case |
|-------|--------------|-------------------|----------|
| **MinGW64** | `x86_64-w64-mingw32` | Native Windows | **Recommended** for native Windows apps |
| **MSYS** | `x86_64-pc-msys` | msys-2.0.dll | POSIX-style apps, build tools |

**Recommended: Use the MinGW64 shell** for building libhttpserver to produce native Windows binaries without additional runtime dependencies.

#### Step-by-step build instructions

1. Install [MSYS2](https://www.msys2.org/)

2. Open the **MINGW64** shell (not the MSYS shell) from the Start Menu

3. Install dependencies:
```bash
pacman -S --needed mingw-w64-x86_64-{gcc,libtool,make,pkg-config,doxygen,gnutls,curl} autotools
```

4. Build and install [libmicrohttpd](https://www.gnu.org/software/libmicrohttpd/) (>= 0.9.64)

5. Build libhttpserver:
```bash
./bootstrap
mkdir build && cd build
../configure --disable-fastopen
make
make check # run tests
```

**Important:** The `--disable-fastopen` flag is required on Windows as TCP_FASTOPEN is not supported.

#### If you use the MSYS shell

Building from the MSYS shell also works but the resulting binaries will depend on `msys-2.0.dll`. The configure script will display a warning when building in this environment. If you see:

```
configure: WARNING: Building from MSYS environment. Binaries will depend on msys-2.0.dll.
```

Consider switching to the MinGW64 shell for native Windows binaries.

[Back to TOC](#table-of-contents)

## Getting Started
The most basic example of creating a server and handling a requests for the path `/hello`:
```cpp
Expand Down
27 changes: 0 additions & 27 deletions appveyor.yml

This file was deleted.

Loading
Loading