]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
autotools: simplify configuration in tests, examples
authorViktor Szakats <commit@vsz.me>
Wed, 18 Jun 2025 08:33:15 +0000 (10:33 +0200)
committerViktor Szakats <commit@vsz.me>
Thu, 19 Jun 2025 07:06:56 +0000 (09:06 +0200)
- GHA/windows: make a mingw autotools build static only.
- GHA/windows: fix a CI script issue with the build above.
- src: fix to pass `LIBCURL_PC_LIBS_PRIVATE` instead of `LINKFLAGS`.
  This makes the libs propagate to tunits, making the local hack there
  unnecessary. `LINKFLAGS` had this single use in the repo, and it was
  empty in local tests.
- tests: drop passing redundant `LIBCURL_PC_LDFLAGS_PRIVATE`.
- tests: drop redundant target name from config variables.
- examples, tests/client: drop `LIBDIR` temp variables with single uses.
- examples, tests: formatting to sync `Makefile.am` scripts with each
  other.

Closes #17661

.github/workflows/windows.yml
docs/examples/Makefile.am
src/Makefile.am
tests/client/Makefile.am
tests/libtest/Makefile.am
tests/server/Makefile.am
tests/tunit/Makefile.am
tests/unit/Makefile.am

index 4ddcae54e6cefcb8fdafb7b6248909bb10a04cc0..83b941b9c0abb0dcb3515f406a8b96dd817bec57 100644 (file)
@@ -202,7 +202,7 @@ jobs:
           - { build: 'autotools', sys: 'msys'      , env: 'x86_64'       , tflags: ''       , config: '--with-openssl', install: 'openssl-devel libssh2-devel', name: 'default R' }
           # MinGW
           - { build: 'autotools', sys: 'mingw64'   , env: 'x86_64'       , tflags: 'skiprun', config: '--enable-debug --with-openssl --disable-threaded-resolver --disable-curldebug --enable-static=no --without-zlib', install: 'mingw-w64-x86_64-openssl mingw-w64-x86_64-libssh2', name: 'default' }
-          - { build: 'autotools', sys: 'mingw64'   , env: 'x86_64'       , tflags: ''       , config: '--enable-debug --with-openssl --enable-windows-unicode --enable-ares --with-openssl-quic', install: 'mingw-w64-x86_64-openssl mingw-w64-x86_64-nghttp3 mingw-w64-x86_64-libssh2', name: 'c-ares U' }
+          - { build: 'autotools', sys: 'mingw64'   , env: 'x86_64'       , tflags: ''       , config: '--enable-debug --with-openssl --enable-windows-unicode --enable-ares --with-openssl-quic --enable-shared=no', install: 'mingw-w64-x86_64-openssl mingw-w64-x86_64-nghttp3 mingw-w64-x86_64-libssh2', name: 'c-ares U' }
           - { build: 'cmake'    , sys: 'mingw64'   , env: 'x86_64'       , tflags: ''       , config: '-DENABLE_DEBUG=ON  -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON -DENABLE_ARES=ON', install: 'mingw-w64-x86_64-libssh2', type: 'Debug', name: 'schannel c-ares U' }
           # WARNING: libssh uses hard-coded world-writable paths (/etc/..., ~/.ssh/) to
           #          read its configuration from, making it vulnerable to attacks on
@@ -334,8 +334,8 @@ jobs:
             PATH="$PWD/bld/lib:$PATH"
           else
             PATH="$PWD/bld/lib/.libs:$PATH"
-            # avoid libtool's curl.exe wrapper
-            mv bld/src/.libs/curl.exe bld/src/curl.exe
+            # avoid libtool's curl.exe wrapper for shared builds
+            mv bld/src/.libs/curl.exe bld/src/curl.exe || true
           fi
           find . \( -name '*.exe' -o -name '*.dll' -o -name '*.a' \) -exec file '{}' \;
           if [ "${MATRIX_TEST}" != 'uwp' ]; then  # curl: error initializing curl library
@@ -352,10 +352,10 @@ jobs:
             make -C bld V=1 -C tests
           fi
           if [ "${MATRIX_BUILD}" != 'cmake' ]; then
-            # avoid libtool's .exe wrappers
-            mv bld/tests/client/.libs/*.exe bld/tests/client
-            mv bld/tests/libtest/.libs/*.exe bld/tests/libtest
-            mv bld/tests/server/.libs/*.exe bld/tests/server
+            # avoid libtool's .exe wrappers for shared builds
+            mv bld/tests/client/.libs/*.exe bld/tests/client || true
+            mv bld/tests/libtest/.libs/*.exe bld/tests/libtest || true
+            mv bld/tests/server/.libs/*.exe bld/tests/server || true
             mv bld/tests/tunit/.libs/*.exe bld/tests/tunit || true
             mv bld/tests/unit/.libs/*.exe bld/tests/unit || true
           fi
index 6abbe956cbd69409b6f7a10f91aee6850c7162f4..86010f3f3ea3dbaab2618bf657aaaa804c8d97db 100644 (file)
@@ -36,23 +36,20 @@ EXTRA_DIST = README.md Makefile.example CMakeLists.txt \
 
 AM_CPPFLAGS = -I$(top_srcdir)/include
 
-LIBDIR = $(top_builddir)/lib
-
-# Avoid libcurl obsolete stuff
-AM_CPPFLAGS += -DCURL_NO_OLDIES
-
 if USE_CPPFLAG_CURL_STATICLIB
 AM_CPPFLAGS += -DCURL_STATICLIB
 endif
 if DOING_NATIVE_WINDOWS
 AM_CPPFLAGS += -DWIN32_LEAN_AND_MEAN
 endif
+# Avoid libcurl obsolete stuff
+AM_CPPFLAGS += -DCURL_NO_OLDIES
 
 # Prevent LIBS from being used for all link targets
 LIBS = $(BLANK_AT_MAKETIME)
 
 # Dependencies
-LDADD = $(LIBDIR)/libcurl.la @LIBCURL_PC_LIBS_PRIVATE@
+LDADD = $(top_builddir)/lib/libcurl.la
 
 # This might hold -Werror
 CFLAGS += @CURL_CFLAG_EXTRAS@
index bb927680d34ebdd18eb410ae5964c15f11e7936c..a2a9968ea05338abe695acdcc519e2a82c78ceef 100644 (file)
@@ -110,7 +110,7 @@ if BUILD_UNITTESTS
 noinst_LTLIBRARIES = libcurltool.la
 libcurltool_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_STATICLIB -DUNITTESTS
 libcurltool_la_CFLAGS =
-libcurltool_la_LDFLAGS = -static $(LINKFLAGS)
+libcurltool_la_LDFLAGS = -static $(LIBCURL_PC_LIBS_PRIVATE)
 if USE_UNITY
 libcurltool_unity.c: $(top_srcdir)/scripts/mk-unity.pl $(CURL_CFILES) $(curl_CURLX)
        @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(CURL_CFILES) $(curl_CURLX) > libcurltool_unity.c
index b9d2e5e141c19343715e5f424e2cd731e15d679c..ea8033a2c6ce495ea8d7f5cb63a5ff2e52d7555b 100644 (file)
@@ -48,15 +48,12 @@ CFLAGS += @CURL_CFLAG_EXTRAS@
 # Prevent LIBS from being used for all link targets
 LIBS = $(BLANK_AT_MAKETIME)
 
-LIBDIR = $(top_builddir)/lib
-
 if USE_CPPFLAG_CURL_STATICLIB
 AM_CPPFLAGS += -DCURL_STATICLIB
 endif
 if DOING_NATIVE_WINDOWS
 AM_CPPFLAGS += -DWIN32_LEAN_AND_MEAN
 endif
-
 AM_CPPFLAGS += -DCURL_NO_OLDIES
 
 bundle_extra =
@@ -69,10 +66,8 @@ $(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(bu
        @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(bundle_extra) --test $(TESTFILES) > $(BUNDLE_SRC)
 
 noinst_PROGRAMS = $(BUNDLE)
-nodist_clients_SOURCES = $(BUNDLE_SRC)
-clients_SOURCES =
-clients_LDADD = $(LIBDIR)/libcurl.la @LIBCURL_PC_LIBS_PRIVATE@
-clients_CFLAGS = $(AM_CFLAGS)
+nodist_SOURCES = $(BUNDLE_SRC)
+LDADD = $(top_builddir)/lib/libcurl.la
 CLEANFILES = $(BUNDLE_SRC)
 
 CHECKSRC = $(CS_$(V))
index 0a2ef70a0fffd00f9f49d16b1172cff0e0c547dc..1047937617366f314816551a0cb7e989d5ef1746 100644 (file)
@@ -53,9 +53,6 @@ CFLAGS += @CURL_CFLAG_EXTRAS@
 # Prevent LIBS from being used for all link targets
 LIBS = $(BLANK_AT_MAKETIME)
 
-# Dependencies (may need to be overridden)
-LDADD = $(top_builddir)/lib/libcurl.la @LIBCURL_PC_LIBS_PRIVATE@
-
 noinst_LTLIBRARIES =
 
 if USE_CPPFLAG_CURL_STATICLIB
@@ -67,7 +64,6 @@ endif
 if CURLDEBUG
 AM_CPPFLAGS += -DCURLDEBUG
 endif
-
 AM_CPPFLAGS += -DCURL_NO_OLDIES -DCURL_DISABLE_DEPRECATION
 
 AM_LDFLAGS =
@@ -98,7 +94,8 @@ $(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(UT
        @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(UTILS) $(bundle_extra) --test $(TESTFILES) lib1521.c > $(BUNDLE_SRC)
 
 noinst_PROGRAMS = $(BUNDLE)
-nodist_libtests_SOURCES = $(BUNDLE_SRC)
+nodist_SOURCES = $(BUNDLE_SRC)
+LDADD = $(top_builddir)/lib/libcurl.la
 CLEANFILES = $(BUNDLE_SRC) lib1521.c
 
 lib1521.c: $(top_srcdir)/tests/libtest/mk-lib1521.pl $(top_srcdir)/include/curl/curl.h
index f4cc7648e75fc418fbb04e0087dc5a89b0b68f42..8b7d5f29d8bc3adf99bf1307de1ebd321df17f2b 100644 (file)
@@ -53,16 +53,14 @@ LIBS = $(BLANK_AT_MAKETIME)
 if DOING_NATIVE_WINDOWS
 AM_CPPFLAGS += -DCURL_STATICLIB
 endif
-
 AM_CPPFLAGS += -DWITHOUT_LIBCURL -DCURL_NO_OLDIES
 
 $(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(UTILS) $(CURLX_SRCS) $(TESTFILES)
        @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(UTILS) $(CURLX_SRCS) --test $(TESTFILES) > $(BUNDLE_SRC)
 
 noinst_PROGRAMS = $(BUNDLE)
-nodist_servers_SOURCES = $(BUNDLE_SRC)
-servers_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-servers_CFLAGS = $(AM_CFLAGS)
+nodist_SOURCES = $(BUNDLE_SRC)
+LDADD = @CURL_NETWORK_AND_TIME_LIBS@
 CLEANFILES = $(BUNDLE_SRC)
 
 CHECKSRC = $(CS_$(V))
index f4b176bf331ee4a0b4c5a85e6cd92579b0c819af..53ea0d7b9d4f3ca8e537bd7c33fd248c875485b8 100644 (file)
@@ -51,10 +51,6 @@ CFLAGS += @CURL_CFLAG_EXTRAS@
 # Prevent LIBS from being used for all link targets
 LIBS = $(BLANK_AT_MAKETIME)
 
-LDADD = $(top_builddir)/src/libcurltool.la   \
-        $(top_builddir)/lib/libcurl.la       \
-        @LIBCURL_PC_LDFLAGS_PRIVATE@ @LIBCURL_PC_LIBS_PRIVATE@
-
 AM_CPPFLAGS += -DCURL_STATICLIB -DUNITTESTS
 if DEBUGBUILD
 AM_CPPFLAGS += -DDEBUGBUILD
@@ -62,7 +58,6 @@ endif
 if CURLDEBUG
 AM_CPPFLAGS += -DCURLDEBUG
 endif
-
 AM_CPPFLAGS += -DCURL_NO_OLDIES -DCURL_DISABLE_DEPRECATION
 
 if BUILD_UNITTESTS
@@ -71,6 +66,7 @@ $(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(UT
 
 noinst_PROGRAMS = $(BUNDLE)
 nodist_tunits_SOURCES = $(BUNDLE_SRC)
+LDADD = $(top_builddir)/src/libcurltool.la $(top_builddir)/lib/libcurl.la
 CLEANFILES = $(BUNDLE_SRC)
 else
 noinst_PROGRAMS =
index af54fdfac461a2c4bfabf4ebc6c41290070d1600..8dd3f42fea8181b77ae0370d47acc8515763d2d7 100644 (file)
@@ -50,9 +50,6 @@ CFLAGS += @CURL_CFLAG_EXTRAS@
 # Prevent LIBS from being used for all link targets
 LIBS = $(BLANK_AT_MAKETIME)
 
-LDADD = $(top_builddir)/lib/libcurlu.la      \
-        @LIBCURL_PC_LDFLAGS_PRIVATE@ @LIBCURL_PC_LIBS_PRIVATE@
-
 AM_CPPFLAGS += -DCURL_STATICLIB -DUNITTESTS -DBUILDING_LIBCURL
 if DEBUGBUILD
 AM_CPPFLAGS += -DDEBUGBUILD
@@ -60,7 +57,6 @@ endif
 if CURLDEBUG
 AM_CPPFLAGS += -DCURLDEBUG
 endif
-
 AM_CPPFLAGS += -DCURL_NO_OLDIES -DCURL_DISABLE_DEPRECATION
 
 if BUILD_UNITTESTS
@@ -69,6 +65,7 @@ $(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(UT
 
 noinst_PROGRAMS = $(BUNDLE)
 nodist_units_SOURCES = $(BUNDLE_SRC)
+LDADD = $(top_builddir)/lib/libcurlu.la
 CLEANFILES = $(BUNDLE_SRC)
 else
 noinst_PROGRAMS =