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
-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
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 \
!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>
!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>
#
###########################################################################
-# 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")
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()
-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) \
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
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
$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)/) {