From 11c211c33c0a4d4affedf640f15dda782c7bf22c Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 19 Jun 2025 17:14:47 +0200 Subject: [PATCH] build: sync curlx build variables and script Between src and tests, both in autotools and cmake. Closes #17675 --- src/Makefile.am | 13 +++++++------ tests/client/CMakeLists.txt | 11 +++++------ tests/client/Makefile.am | 10 +++++----- tests/client/Makefile.inc | 2 +- tests/libtest/CMakeLists.txt | 11 +++++------ tests/libtest/Makefile.am | 10 +++++----- tests/libtest/Makefile.inc | 2 +- tests/server/CMakeLists.txt | 6 +++--- tests/server/Makefile.am | 6 +++--- tests/server/Makefile.inc | 2 +- 10 files changed, 36 insertions(+), 37 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index a6a743a081..34cd2a8e65 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -76,12 +76,13 @@ CLEANFILES = if USE_UNITY if USE_CPPFLAG_CURL_STATICLIB -curl_CURLX = +curlx_src = else -curl_CURLX = $(CURLX_CFILES) +# These are part of the libcurl static lib. Add them here when linking shared. +curlx_src = $(CURLX_CFILES) endif -curltool_unity.c: $(top_srcdir)/scripts/mk-unity.pl $(CURL_CFILES) $(curl_cfiles_gen) $(curl_CURLX) - @PERL@ $(top_srcdir)/scripts/mk-unity.pl --srcdir $(srcdir) --include $(CURL_CFILES) $(curl_cfiles_gen) $(curl_CURLX) > curltool_unity.c +curltool_unity.c: $(top_srcdir)/scripts/mk-unity.pl $(CURL_CFILES) $(curl_cfiles_gen) $(curlx_src) + @PERL@ $(top_srcdir)/scripts/mk-unity.pl --srcdir $(srcdir) --include $(CURL_CFILES) $(curl_cfiles_gen) $(curlx_src) > curltool_unity.c nodist_curl_SOURCES = curltool_unity.c curl_SOURCES = @@ -112,8 +113,8 @@ libcurltool_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_STATICLIB -DUNITTESTS libcurltool_la_CFLAGS = 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 +libcurltool_unity.c: $(top_srcdir)/scripts/mk-unity.pl $(CURL_CFILES) $(curlx_src) + @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(CURL_CFILES) $(curlx_src) > libcurltool_unity.c nodist_libcurltool_la_SOURCES = libcurltool_unity.c libcurltool_la_SOURCES = diff --git a/tests/client/CMakeLists.txt b/tests/client/CMakeLists.txt index ed0db246d5..0a7d4652c4 100644 --- a/tests/client/CMakeLists.txt +++ b/tests/client/CMakeLists.txt @@ -22,22 +22,21 @@ # ########################################################################### -# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, CURLX_SRCS, TESTFILES variables +# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, CURLX_CFILES, TESTFILES variables curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") -set(_bundle_extra "") -if(LIB_SELECTED STREQUAL LIB_SHARED) - list(APPEND _bundle_extra ${CURLX_SRCS}) # Not exported from the libcurl shared build. Build a copy. +if(LIB_SELECTED STREQUAL LIB_STATIC) + set(CURLX_CFILES "") # Already exported from the libcurl static build. Skip them. endif() add_custom_command(OUTPUT "${BUNDLE_SRC}" COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" - --include ${_bundle_extra} --test ${TESTFILES} + --include ${CURLX_CFILES} --test ${TESTFILES} ${CURL_MK_UNITY_OPTION} --srcdir "${CMAKE_CURRENT_SOURCE_DIR}" > "${BUNDLE_SRC}" DEPENDS "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc" - ${FIRSTFILES} ${_bundle_extra} ${TESTFILES} + ${FIRSTFILES} ${CURLX_CFILES} ${TESTFILES} VERBATIM) add_executable(${BUNDLE} EXCLUDE_FROM_ALL "${BUNDLE_SRC}") diff --git a/tests/client/Makefile.am b/tests/client/Makefile.am index 54f8779046..27226a130d 100644 --- a/tests/client/Makefile.am +++ b/tests/client/Makefile.am @@ -39,7 +39,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include \ -I$(top_srcdir)/lib/curlx \ -I$(srcdir) -# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, CURLX_SRCS, TESTFILES variables +# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, CURLX_CFILES, TESTFILES variables include Makefile.inc EXTRA_DIST = CMakeLists.txt $(FIRSTFILES) $(TESTFILES) @@ -54,14 +54,14 @@ AM_CPPFLAGS += -DCURL_STATICLIB endif AM_CPPFLAGS += -DCURL_NO_OLDIES -bundle_extra = if USE_CPPFLAG_CURL_STATICLIB +curlx_src = else # These are part of the libcurl static lib. Add them here when linking shared. -bundle_extra += $(CURLX_SRCS) +curlx_src = $(CURLX_CFILES) endif -$(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(bundle_extra) $(TESTFILES) - @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(bundle_extra) --test $(TESTFILES) > $(BUNDLE_SRC) +$(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(curlx_src) $(TESTFILES) + @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(curlx_src) --test $(TESTFILES) > $(BUNDLE_SRC) noinst_PROGRAMS = $(BUNDLE) nodist_SOURCES = $(BUNDLE_SRC) diff --git a/tests/client/Makefile.inc b/tests/client/Makefile.inc index 5f44f12d05..2d9bcb5f53 100644 --- a/tests/client/Makefile.inc +++ b/tests/client/Makefile.inc @@ -29,7 +29,7 @@ BUNDLE_SRC = clients.c # Files referenced from the bundle source FIRSTFILES = first.c first.h -CURLX_SRCS = \ +CURLX_CFILES = \ ../../lib/curlx/multibyte.c \ ../../lib/curlx/timediff.c \ ../../lib/curlx/wait.c diff --git a/tests/libtest/CMakeLists.txt b/tests/libtest/CMakeLists.txt index 597f077313..f377d4626b 100644 --- a/tests/libtest/CMakeLists.txt +++ b/tests/libtest/CMakeLists.txt @@ -22,13 +22,12 @@ # ########################################################################### -# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, CURLX_SRCS, TESTFILES, STUB_GSS variables +# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, CURLX_CFILES, TESTFILES, STUB_GSS variables curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") -set(_bundle_extra "") -if(LIB_SELECTED STREQUAL LIB_SHARED) - list(APPEND _bundle_extra ${CURLX_SRCS}) # Not exported from the libcurl shared build. Build a copy. +if(LIB_SELECTED STREQUAL LIB_STATIC) + set(CURLX_CFILES "") # Already exported from the libcurl static build. Skip them. endif() add_custom_command(OUTPUT "lib1521.c" @@ -40,11 +39,11 @@ add_custom_command(OUTPUT "lib1521.c" add_custom_command(OUTPUT "${BUNDLE_SRC}" COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" - --include ${UTILS} ${_bundle_extra} --test ${TESTFILES} "lib1521.c" + --include ${UTILS} ${CURLX_CFILES} --test ${TESTFILES} "lib1521.c" ${CURL_MK_UNITY_OPTION} --srcdir "${CMAKE_CURRENT_SOURCE_DIR}" > "${BUNDLE_SRC}" DEPENDS "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc" - ${FIRSTFILES} ${UTILS} ${_bundle_extra} ${TESTFILES} "lib1521.c" + ${FIRSTFILES} ${UTILS} ${CURLX_CFILES} ${TESTFILES} "lib1521.c" VERBATIM) add_executable(${BUNDLE} EXCLUDE_FROM_ALL "${BUNDLE_SRC}") diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am index dced05a7bd..dd116f3550 100644 --- a/tests/libtest/Makefile.am +++ b/tests/libtest/Makefile.am @@ -40,7 +40,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include \ -I$(srcdir) \ -I$(top_srcdir)/tests/unit -# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, CURLX_SRCS, TESTFILES, STUB_GSS variables +# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, CURLX_CFILES, TESTFILES, STUB_GSS variables include Makefile.inc EXTRA_DIST = CMakeLists.txt .checksrc $(FIRSTFILES) $(UTILS) $(TESTFILES) \ @@ -84,14 +84,14 @@ libstubgss_la_LIBADD = libstubgss_la_DEPENDENCIES = endif -bundle_extra = if USE_CPPFLAG_CURL_STATICLIB +curlx_src = else # These are part of the libcurl static lib. Add them here when linking shared. -bundle_extra += $(CURLX_SRCS) +curlx_src = $(CURLX_CFILES) endif -$(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(UTILS) $(bundle_extra) $(TESTFILES) lib1521.c - @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(UTILS) $(bundle_extra) --test $(TESTFILES) lib1521.c > $(BUNDLE_SRC) +$(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(UTILS) $(curlx_src) $(TESTFILES) lib1521.c + @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(UTILS) $(curlx_src) --test $(TESTFILES) lib1521.c > $(BUNDLE_SRC) noinst_PROGRAMS = $(BUNDLE) nodist_SOURCES = $(BUNDLE_SRC) diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc index ed61bed29e..77c7cbdc27 100644 --- a/tests/libtest/Makefile.inc +++ b/tests/libtest/Makefile.inc @@ -32,7 +32,7 @@ FIRSTFILES = first.c first.h # Common files used by test programs UTILS = memptr.c testutil.c testutil.h testtrace.c testtrace.h test.h ../unit/curlcheck.h -CURLX_SRCS = \ +CURLX_CFILES = \ ../../lib/curlx/warnless.c \ ../../lib/curlx/multibyte.c \ ../../lib/curlx/timediff.c \ diff --git a/tests/server/CMakeLists.txt b/tests/server/CMakeLists.txt index 0cdf890e5c..5cb4179383 100644 --- a/tests/server/CMakeLists.txt +++ b/tests/server/CMakeLists.txt @@ -22,17 +22,17 @@ # ########################################################################### -# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, CURLX_SRCS, TESTFILES variables +# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, CURLX_CFILES, TESTFILES variables curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") add_custom_command(OUTPUT "${BUNDLE_SRC}" COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" - --include ${UTILS} ${CURLX_SRCS} --test ${TESTFILES} + --include ${UTILS} ${CURLX_CFILES} --test ${TESTFILES} ${CURL_MK_UNITY_OPTION} --srcdir "${CMAKE_CURRENT_SOURCE_DIR}" > "${BUNDLE_SRC}" DEPENDS "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc" - ${FIRSTFILES} ${UTILS} ${CURLX_SRCS} ${TESTFILES} + ${FIRSTFILES} ${UTILS} ${CURLX_CFILES} ${TESTFILES} VERBATIM) add_executable(${BUNDLE} EXCLUDE_FROM_ALL "${BUNDLE_SRC}") diff --git a/tests/server/Makefile.am b/tests/server/Makefile.am index 41b1c86d79..a8500e2069 100644 --- a/tests/server/Makefile.am +++ b/tests/server/Makefile.am @@ -39,7 +39,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include \ -I$(top_srcdir)/lib/curlx \ -I$(srcdir) -# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, CURLX_SRCS, TESTFILES variables +# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, CURLX_CFILES, TESTFILES variables include Makefile.inc EXTRA_DIST = CMakeLists.txt .checksrc $(FIRSTFILES) $(UTILS) $(TESTFILES) @@ -55,8 +55,8 @@ if DOING_NATIVE_WINDOWS AM_CPPFLAGS += -DCURL_STATICLIB endif -$(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) +$(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(UTILS) $(CURLX_CFILES) $(TESTFILES) + @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(UTILS) $(CURLX_CFILES) --test $(TESTFILES) > $(BUNDLE_SRC) noinst_PROGRAMS = $(BUNDLE) nodist_SOURCES = $(BUNDLE_SRC) diff --git a/tests/server/Makefile.inc b/tests/server/Makefile.inc index 062a503000..212c6f001d 100644 --- a/tests/server/Makefile.inc +++ b/tests/server/Makefile.inc @@ -32,7 +32,7 @@ FIRSTFILES = first.c first.h # Common files used by test programs UTILS = getpart.c getpart.h util.c -CURLX_SRCS = \ +CURLX_CFILES = \ ../../lib/curlx/base64.c \ ../../lib/curlx/inet_pton.c \ ../../lib/curlx/multibyte.c \ -- 2.47.2