]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: build `stubgss` library for libtests to match autotools
authorViktor Szakats <commit@vsz.me>
Tue, 17 Jun 2025 18:10:28 +0000 (20:10 +0200)
committerViktor Szakats <commit@vsz.me>
Thu, 19 Jun 2025 18:41:54 +0000 (20:41 +0200)
Used by test 2056 and 2057, in a way that's Linux- & autotools-specific.
This patch builds it for all Unix, syncing cmake with autotools.

Adapt the two tests to find the library in CMake builds as well.

Tested OK on Linux. (CI does not test this. The corresponding jobs build
in debug mode, while the `LD_PRELOAD` feature is locked to non-debug.)

On macOS it didn't load without building everything for aarch64e arch:
"../bld/tests/libtest/libstubgss.dylib' (mach-o file, but is
an incompatible architecture (have 'arm64', need 'arm64e'))"
With that fixed it still did not load correctly and/or the tests did not
pass. So, for macOS these tests remain disabled.

Also:
- GHA/macos: build for aarch64e. (recognized by Apple clang as of this
  patch. llvm and gcc fall back to aarch64.)

Follow-up to 56d949d31ad182a22bd3bad25b1a902b635d549d #1687

Closes #17653

.github/workflows/macos.yml
tests/data/test2056
tests/data/test2057
tests/libtest/CMakeLists.txt
tests/libtest/Makefile.am
tests/libtest/Makefile.inc
tests/runtests.pl

index 88ebd647ded15fbe3df0a29395907ecdb234b9d9..2c8ffc9e91d366ac58432960b28213a837748c19 100644 (file)
@@ -238,7 +238,7 @@ jobs:
                 -DCMAKE_INSTALL_PREFIX="$HOME"/curl-install \
                 -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON \
                 -DCMAKE_OSX_SYSROOT="${sysroot}" \
-                -DCMAKE_C_COMPILER_TARGET="$(uname -m | sed 's/arm64/aarch64/')-apple-darwin$(uname -r)" \
+                -DCMAKE_C_COMPILER_TARGET="$(uname -m | sed 's/arm64/aarch64e/')-apple-darwin$(uname -r)" \
                 ${MATRIX_GENERATE} ${options}
             done
             if [ -d bld_chkprefill ] && ! diff -u bld/lib/curl_config.h bld_chkprefill/lib/curl_config.h; then
@@ -460,7 +460,7 @@ jobs:
             cmake -B bld -G Ninja -D_CURL_PREFILL=ON \
               -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON \
               -DCMAKE_OSX_SYSROOT="${sysroot}" \
-              -DCMAKE_C_COMPILER_TARGET="$(uname -m | sed 's/arm64/aarch64/')-apple-darwin$(uname -r)" \
+              -DCMAKE_C_COMPILER_TARGET="$(uname -m | sed 's/arm64/aarch64e/')-apple-darwin$(uname -r)" \
               -DCMAKE_IGNORE_PREFIX_PATH="$(brew --prefix)" \
               -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF \
               -DCURL_USE_OPENSSL=ON \
index 80e592025d46c996f8b1eb354af04d45865860b2..9d9d9db5e25386dd500124dfa7562e90d379f20f 100644 (file)
@@ -43,7 +43,8 @@ ld_preload
 !Debug
 </features>
 <setenv>
-LD_PRELOAD=%PWD/libtest/.libs/libstubgss.so
+LD_PRELOAD=libstubgss.so
+LD_LIBRARY_PATH=%PWD/libtest/.libs:%PWD/libtest
 CURL_STUB_GSS_CREDS="KRB5_Alice"
 </setenv>
 <command>
index 5cbb94590195c8d3587fb6ee4144da15c1f6b576..e86cb0f89cdacc66273e96eb6ae0651042a2cc63 100644 (file)
@@ -59,7 +59,8 @@ ld_preload
 !Debug
 </features>
 <setenv>
-LD_PRELOAD=%PWD/libtest/.libs/libstubgss.so
+LD_PRELOAD=libstubgss.so
+LD_LIBRARY_PATH=%PWD/libtest/.libs:%PWD/libtest
 CURL_STUB_GSS_CREDS="NTLM_Alice"
 </setenv>
 <command>
index f8dedc5c43648eb3a9b28b49c1d8f09237084f11..597f077313356fb3a9ea798da774d40c7d34bd14 100644 (file)
@@ -22,7 +22,7 @@
 #
 ###########################################################################
 
-# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, CURLX_SRCS, TESTFILES variables
+# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, CURLX_SRCS, 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")
 
@@ -60,3 +60,9 @@ target_include_directories(${BUNDLE} PRIVATE
 set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
 set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_NO_OLDIES" "CURL_DISABLE_DEPRECATION")
 set_target_properties(${BUNDLE} PROPERTIES OUTPUT_NAME "${BUNDLE}" PROJECT_LABEL "Test ${BUNDLE}" UNITY_BUILD OFF)
+
+if(HAVE_GSSAPI AND UNIX)
+  add_library(stubgss SHARED EXCLUDE_FROM_ALL ${STUB_GSS})
+  set_target_properties(stubgss PROPERTIES UNITY_BUILD OFF)
+  add_dependencies(testdeps stubgss)
+endif()
index 46e3ccce79aee1f62510061289951bb94a9d6953..dced05a7bdb3dfce13166324a9474c850cc335ff 100644 (file)
@@ -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 variables
+# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, CURLX_SRCS, TESTFILES, STUB_GSS variables
 include Makefile.inc
 
 EXTRA_DIST = CMakeLists.txt .checksrc $(FIRSTFILES) $(UTILS) $(TESTFILES) \
@@ -79,7 +79,7 @@ if CURL_LT_SHLIB_USE_NO_UNDEFINED
 libstubgss_la_LDFLAGS += -no-undefined
 endif
 libstubgss_la_CFLAGS = $(AM_CFLAGS) -g
-libstubgss_la_SOURCES = stub_gssapi.c stub_gssapi.h
+libstubgss_la_SOURCES = $(STUB_GSS)
 libstubgss_la_LIBADD =
 libstubgss_la_DEPENDENCIES =
 endif
index db91fe7c2d8876bbaa922bb585dfff62389c5aae..ed61bed29ef900c0b94cf1b27939a73cfec4898d 100644 (file)
@@ -86,3 +86,5 @@ TESTFILES = \
   lib2700.c \
   lib3010.c lib3025.c lib3026.c lib3027.c \
   lib3100.c lib3101.c lib3102.c lib3103.c lib3104.c lib3105.c lib3207.c lib3208.c
+
+STUB_GSS = stub_gssapi.c stub_gssapi.h
index 3f9f80fc2093fe3bce200283068fd401f9eced72..d644a5e90834eb79c3ffcc40e619a6ce8a3b0e28 100755 (executable)
@@ -546,7 +546,7 @@ sub checksystemfeatures {
 
             $libcurl = $2;
             if($curl =~ /linux|bsd|solaris/) {
-                # system support LD_PRELOAD; may be disabled later
+                # system supports LD_PRELOAD/LD_LIBRARY_PATH; may be disabled later
                 $feature{"ld_preload"} = 1;
             }
             if($curl =~ /win32|Windows|windows|mingw(32|64)/) {