From 8168a0b883fcf14b74b603c97db20389eef828ac Mon Sep 17 00:00:00 2001 From: Lee Yunjin Date: Mon, 5 Oct 2026 20:23:54 +0900 Subject: [PATCH] fix(install): list libusrsctp in cwist.pc when WebRTC is built make install copies libusrsctp.a into the deps directory, but cwist.pc never named it, so a program using the WebRTC API through pkg-config failed to link (undefined usrsctp_* from sctp.o). Programs that do not touch WebRTC were unaffected: the archive member is never pulled in. Also remove libusrsctp.a on uninstall. --- Makefile | 9 +++++++-- cwist.pc.in | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8015292c3..90d08e79d 100644 --- a/Makefile +++ b/Makefile @@ -1292,13 +1292,18 @@ install: $(LIB_NAME) $(PC_FILE) install -m 755 tools/cli/cwist $(DESTDIR)$(BINDIR)/cwist @echo "Installation complete. Compile with: pkg-config --cflags --libs cwist" +# libusrsctp.a is installed with the other external archives when +# CWIST_WEBRTC=1; list it in Libs so programs using the WebRTC API link. +PC_WEBRTC_LIBS = $(if $(filter 1,$(CWIST_WEBRTC)),-lusrsctp,) + $(PC_FILE): cwist.pc.in - sed -e 's|@PREFIX@|$(PREFIX)|g' -e 's|@VERSION@|$(VERSION)|g' cwist.pc.in > $@ + sed -e 's|@PREFIX@|$(PREFIX)|g' -e 's|@VERSION@|$(VERSION)|g' \ + -e 's|@WEBRTC_LIBS@ |$(if $(PC_WEBRTC_LIBS),$(PC_WEBRTC_LIBS) ,)|g' cwist.pc.in > $@ uninstall: @echo "Uninstalling cwist..." rm -f $(DESTDIR)$(LIBDIR)/$(LIB_NAME) - rm -f $(DESTDIR)$(DEPSDIR)/liburiparser.a $(DESTDIR)$(DEPSDIR)/libcjson.a $(DESTDIR)$(DEPSDIR)/libttak.a $(DESTDIR)$(DEPSDIR)/libnats_static.a $(DESTDIR)$(DEPSDIR)/liblsquic.a $(DESTDIR)$(DEPSDIR)/libssl.a $(DESTDIR)$(DEPSDIR)/libcrypto.a + rm -f $(DESTDIR)$(DEPSDIR)/liburiparser.a $(DESTDIR)$(DEPSDIR)/libcjson.a $(DESTDIR)$(DEPSDIR)/libttak.a $(DESTDIR)$(DEPSDIR)/libnats_static.a $(DESTDIR)$(DEPSDIR)/liblsquic.a $(DESTDIR)$(DEPSDIR)/libssl.a $(DESTDIR)$(DEPSDIR)/libcrypto.a $(DESTDIR)$(DEPSDIR)/libusrsctp.a rmdir $(DESTDIR)$(DEPSDIR) 2>/dev/null || true rm -rf $(DESTDIR)$(INCLUDEDIR)/cwist rm -f $(INSTALL_PCDIR)/$(PC_FILE) diff --git a/cwist.pc.in b/cwist.pc.in index ecbcaa3a5..d456cef1b 100644 --- a/cwist.pc.in +++ b/cwist.pc.in @@ -8,6 +8,6 @@ Name: cwist Description: C17 web framework and application server (HTTP/1.1, HTTP/2, HTTP/3, WebSocket, PQC TLS) URL: https://github.com/c4punks/CWIST Version: @VERSION@ -Libs: -L${libdir} -L${depsdir} -lcwist -lnats_static -lttak -lcjson -luriparser -llsquic -lssl -lcrypto -lz -lzstd -lbrotlienc -lbrotlicommon -lbrotlidec -ldl -lpthread -lm -lstdc++ +Libs: -L${libdir} -L${depsdir} -lcwist @WEBRTC_LIBS@ -lnats_static -lttak -lcjson -luriparser -llsquic -lssl -lcrypto -lz -lzstd -lbrotlienc -lbrotlicommon -lbrotlidec -ldl -lpthread -lm -lstdc++ Libs.private: -lcurl -lnghttp2 Cflags: -I${includedir} -I${includedir}/cwist/vendor