build: sync curlx build variables and script

Between src and tests, both in autotools and cmake.

Closes #17675
This commit is contained in:
Viktor Szakats 2025-06-19 17:14:47 +02:00
parent 614febca51
commit 11c211c33c
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
10 changed files with 36 additions and 37 deletions

View file

@ -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}")

View file

@ -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)

View file

@ -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