Skip to content

Commit ab72a98

Browse files
etrclaude
andcommitted
fix(dist,build): make the release tarball self-contained and link gnutls on mingw
The 2.0.0 release workflow is the first to build the `make dist` tarball and verify it on Linux/macOS/Windows, which surfaced several latent packaging gaps plus a Windows-only link failure. All fixes below; none change library behavior. Dist packaging (verify-dist failed at configure/build/check from the tarball): - Add `doc` to SUBDIRS/DIST_SUBDIRS so doc/Makefile.in ships (config.status could not find it -> the original CI failure on all three platforms). - Add the internal headers detail/http_field_validation.hpp, detail/method_utils.hpp and detail/path_normalize.hpp to src noinst_HEADERS (build-from-tarball missed them). - Add test/integ/log_capture.hpp to test noinst_HEADERS. - Ship the cmake module via dist_cmakemodule_DATA (plain _DATA is installed but not distributed). - Ship LICENSE, RELEASE_NOTES.md, CONTRIBUTING.md and CODE_OF_CONDUCT.md in EXTRA_DIST. - Gate the README / release-notes / hooks-doc / doxygen check-local gates on the presence of specs/ so `make check` from an unpacked tarball runs the test suite plus the header/example/lint gates but skips the source-only doc gates (README links into specs/ and docs/architecture/, which stay dev-only and are not shipped). Windows / mingw link fix: - Link -lgnutls when HAVE_GNUTLS is set. The library calls gnutls_* directly in http_request_impl_tls.cpp; Linux/macOS resolve it transitively through libmicrohttpd, but the mingw microhttpd import lib does not re-export those symbols, so the DLL link failed with undefined references once MSYS2 started shipping gnutls and configure enabled it. Verified: `make distcheck` green end-to-end (all 113 tests pass from the tarball, install/uninstall clean, archives ready for distribution). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015tAodxYJMEY4VxCX4dk62e
1 parent ded4203 commit ab72a98

3 files changed

Lines changed: 26 additions & 7 deletions

File tree

Makefile.am

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ LIBTOOL_DEPS = @LIBTOOL_DEPS@
2424
AUTOMAKE_OPTIONS = foreign 1.4
2525
ACLOCAL_AMFLAGS = -I m4
2626

27-
SUBDIRS = src
28-
DIST_SUBDIRS = src
27+
SUBDIRS = src doc
28+
DIST_SUBDIRS = src doc
2929

3030
if !COND_CROSS_COMPILE
3131
SUBDIRS += test
@@ -65,7 +65,8 @@ EXTRA_DIST = libhttpserver.pc.in $(DX_CONFIG) scripts/extract-release-notes.sh s
6565
test/headers/consumer_direct.cpp test/headers/consumer_detail.cpp test/headers/consumer_detail_connection_context.cpp \
6666
test/headers/consumer_umbrella.cpp \
6767
test/headers/consumer_post_umbrella.cpp \
68-
test/headers/consumer_umbrella_no_backend.cpp
68+
test/headers/consumer_umbrella_no_backend.cpp \
69+
LICENSE RELEASE_NOTES.md CONTRIBUTING.md CODE_OF_CONDUCT.md
6970

7071
# ---------------------------------------------------------------------------
7172
# Header-hygiene checks (TASK-002)
@@ -374,7 +375,18 @@ check-hygiene:
374375
# staged the install; sub-check skips the install step to avoid double cost.
375376
# This knob is set only by check-local; do not set it when invoking sub-checks
376377
# standalone.
377-
check-local: check-headers check-examples check-readme check-release-notes check-doxygen check-hooks-doc-spotcheck lint-warning-suppressions lint-server-ready-helper lint-server-ready-helper-selftest lint-no-tautological-asserts lint-deprecated-cookie-overload lint-littletest-skip-exit-code lint-parallel-install-skip-contract lint-fence-balance
378+
# The README / release-notes / hooks-doc / doxygen gates validate source-tree
379+
# documentation: README.md links into specs/ and docs/architecture/, which are
380+
# dev-facing and intentionally NOT shipped in the distributed tarball. Gate them
381+
# on the presence of specs/ so that `make check` from an unpacked release tarball
382+
# still runs the full test suite plus the header / example / lint gates, but
383+
# skips the source-only doc gates whose inputs it cannot satisfy.
384+
check-local: check-headers check-examples lint-warning-suppressions lint-server-ready-helper lint-server-ready-helper-selftest lint-no-tautological-asserts lint-deprecated-cookie-overload lint-littletest-skip-exit-code lint-parallel-install-skip-contract lint-fence-balance
385+
@if test -d "$(top_srcdir)/specs"; then \
386+
$(MAKE) $(AM_MAKEFLAGS) check-readme check-release-notes check-doxygen check-hooks-doc-spotcheck; \
387+
else \
388+
echo "check-local: skipping README/release-notes/hooks-doc/doxygen gates (source-only; specs/ absent in distributed tarball)"; \
389+
fi
378390
@echo "=== Shared staged install for check-install-layout and check-hygiene ==="
379391
@rm -rf "$(abs_top_builddir)/.shared-check-stage"
380392
@$(MAKE) $(AM_MAKEFLAGS) install DESTDIR="$(abs_top_builddir)/.shared-check-stage" >check-shared-install.log 2>&1 || { \
@@ -634,7 +646,7 @@ pkgconfigdir = $(libdir)/pkgconfig
634646
pkgconfig_DATA = libhttpserver.pc
635647

636648
cmakemoduledir = $(datadir)/cmake/Modules
637-
cmakemodule_DATA = cmakemodule/FindLibHttpServer.cmake
649+
dist_cmakemodule_DATA = cmakemodule/FindLibHttpServer.cmake
638650

639651
include $(top_srcdir)/aminclude.am
640652

src/Makefile.am

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ libhttpserver_la_SOURCES = string_utilities.cpp webserver.cpp http_utils.cpp fil
2929
# noinst_HEADERS: shipped in the tarball but NEVER installed under $prefix/include.
3030
# Detail headers (httpserver/detail/*.hpp) live here so they cannot leak to
3131
# downstream consumers — the public surface comes in through <httpserver.hpp>.
32-
noinst_HEADERS = httpserver/string_utilities.hpp httpserver/detail/connection_context.hpp httpserver/detail/http_endpoint.hpp httpserver/detail/response_body.hpp httpserver/detail/webserver_impl.hpp httpserver/detail/webserver_impl_dispatch.hpp httpserver/detail/connection_state.hpp httpserver/detail/ip_access_control.hpp httpserver/detail/ws_registry.hpp httpserver/detail/hook_bus.hpp httpserver/detail/route_table.hpp httpserver/detail/daemon_lifecycle.hpp httpserver/detail/dispatch_util.hpp httpserver/detail/error_pages.hpp httpserver/detail/hook_dispatcher.hpp httpserver/detail/request_dispatcher.hpp httpserver/detail/request_pipeline.hpp httpserver/detail/response_materializer.hpp httpserver/detail/upload_pipeline.hpp httpserver/detail/websocket_upgrader.hpp httpserver/detail/secure_zero.hpp httpserver/detail/http_request_impl.hpp httpserver/detail/resource_hook_table.hpp httpserver/detail/route_entry.hpp httpserver/detail/lambda_resource.hpp httpserver/detail/segment_trie.hpp httpserver/detail/route_cache.hpp httpserver/detail/route_tier.hpp httpserver/detail/unescape_helpers.hpp gettext.h
32+
noinst_HEADERS = httpserver/string_utilities.hpp httpserver/detail/connection_context.hpp httpserver/detail/http_endpoint.hpp httpserver/detail/response_body.hpp httpserver/detail/webserver_impl.hpp httpserver/detail/webserver_impl_dispatch.hpp httpserver/detail/connection_state.hpp httpserver/detail/ip_access_control.hpp httpserver/detail/ws_registry.hpp httpserver/detail/hook_bus.hpp httpserver/detail/route_table.hpp httpserver/detail/daemon_lifecycle.hpp httpserver/detail/dispatch_util.hpp httpserver/detail/error_pages.hpp httpserver/detail/hook_dispatcher.hpp httpserver/detail/request_dispatcher.hpp httpserver/detail/request_pipeline.hpp httpserver/detail/response_materializer.hpp httpserver/detail/upload_pipeline.hpp httpserver/detail/websocket_upgrader.hpp httpserver/detail/secure_zero.hpp httpserver/detail/http_request_impl.hpp httpserver/detail/resource_hook_table.hpp httpserver/detail/route_entry.hpp httpserver/detail/lambda_resource.hpp httpserver/detail/segment_trie.hpp httpserver/detail/route_cache.hpp httpserver/detail/route_tier.hpp httpserver/detail/unescape_helpers.hpp httpserver/detail/http_field_validation.hpp httpserver/detail/method_utils.hpp httpserver/detail/path_normalize.hpp gettext.h
3333
nobase_include_HEADERS = httpserver.hpp httpserver/body_kind.hpp httpserver/cookie.hpp httpserver/constants.hpp httpserver/create_webserver.hpp httpserver/create_webserver_setters.hpp httpserver/create_test_request.hpp httpserver/webserver.hpp httpserver/webserver_routes.hpp httpserver/webserver_runtime.hpp httpserver/webserver_websocket.hpp httpserver/webserver_hooks.hpp httpserver/websocket_handler.hpp httpserver/http_utils.hpp httpserver/http_utils_helpers.hpp httpserver/ip_representation.hpp httpserver/file_info.hpp httpserver/http_request.hpp httpserver/http_response.hpp httpserver/http_resource.hpp httpserver/feature_unavailable.hpp httpserver/iovec_entry.hpp httpserver/http_arg_value.hpp httpserver/http_method.hpp httpserver/hook_phase.hpp httpserver/hook_action.hpp httpserver/hook_handle.hpp httpserver/hook_context.hpp
3434

3535
AM_CXXFLAGS += -fPIC -Wall
@@ -45,6 +45,13 @@ libhttpserver_la_LIBADD = -lmicrohttpd
4545
if HAVE_WEBSOCKET
4646
libhttpserver_la_LIBADD += -lmicrohttpd_ws
4747
endif
48+
# When TLS is enabled the library calls gnutls_* directly (http_request_impl_tls.cpp),
49+
# so it must link gnutls. Linux/macOS resolve it transitively through libmicrohttpd,
50+
# but mingw does not export those symbols from the microhttpd import lib -- link it
51+
# explicitly so the shared library builds on every platform.
52+
if HAVE_GNUTLS
53+
libhttpserver_la_LIBADD += -lgnutls
54+
endif
4855
endif
4956

5057
libhttpserver_la_CFLAGS = $(AM_CFLAGS)

test/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ littletest_skip_semantics_LDADD =
718718
digest_client_self_test_SOURCES = unit/digest_client_self_test.cpp
719719
digest_client_self_test_LDADD =
720720

721-
noinst_HEADERS = littletest.hpp integ/test_utils.hpp integ/curl_helpers.hpp integ/server_ready.hpp integ/digest_client.hpp integ/stream_capture_helpers.hpp unit/throw_probe.hpp
721+
noinst_HEADERS = littletest.hpp integ/test_utils.hpp integ/curl_helpers.hpp integ/server_ready.hpp integ/digest_client.hpp integ/stream_capture_helpers.hpp integ/log_capture.hpp unit/throw_probe.hpp
722722
AM_CXXFLAGS += -Wall -fPIC -Wno-overloaded-virtual
723723

724724
if COND_GCOV

0 commit comments

Comments
 (0)