diff --git a/deps/luaopenssl-unixbuild.sh b/deps/luaopenssl-unixbuild.sh index 895a4f362..ebfdcdb25 100755 --- a/deps/luaopenssl-unixbuild.sh +++ b/deps/luaopenssl-unixbuild.sh @@ -14,6 +14,20 @@ OPENSSL_INCLUDE_DIR=deps/openssl/openssl/include LIBCRYPTO=$OUT_DIR/libcrypto.a LIBSSL=$OUT_DIR/libssl.a +cleanup() { + echo "Reverting GCC 14 diagnostics patch (to make sure the build is idempotent)" + cd $SRC_DIR + git apply -R ../gcc14-diagnostics-workaround.diff + cd - +} + +trap cleanup EXIT + +echo "Applying GCC 14 diagnostics patch (this should hopefully be temporary)" +cd $SRC_DIR +git apply ../gcc14-diagnostics-workaround.diff +cd - + unset PKG_CONFIG_PATH # Prevent CMake from using the system OpenSSL (which may not necessarily be compatible) cmake -S $SRC_DIR -B $BUILD_DIR -G Ninja -DOPENSSL_LIBRARIES=$OUT_DIR -DBUILD_SHARED_LUA_OPENSSL=OFF -DOPENSSL_ROOT_DIR=$OPENSSL_DIR -DOPENSSL_INCLUDE_DIR=$OPENSSL_INCLUDE_DIR -DLUAJIT_INCLUDE_DIRS=$LUAJIT_SRC_DIR -DLUAJIT_LIBRARIES=$LUAJIT_SRC_DIR -DLUA_INCLUDE_DIR=$LUAJIT_SRC_DIR -DLUAJIT_LIBRARIES=$LUAJIT_LIBRARY_PATH -DCMAKE_C_COMPILER=gcc -DOPENSSL_CRYPTO_LIBRARY=$LIBCRYPTO -DOPENSSL_SSL_LIBRARY=$LIBSSL -DLUA_OPENSSL_LIBTYPE=STATIC -DOPENSSL_USE_STATIC_LIBS=ON diff --git a/deps/luaopenssl-windowsbuild.sh b/deps/luaopenssl-windowsbuild.sh index 983462db1..c09f88c42 100755 --- a/deps/luaopenssl-windowsbuild.sh +++ b/deps/luaopenssl-windowsbuild.sh @@ -14,6 +14,20 @@ OPENSSL_INCLUDE_DIR=deps/openssl/openssl/include LIBCRYPTO=$OUT_DIR/libcrypto.a LIBSSL=$OUT_DIR/libssl.a +cleanup() { + echo "Reverting GCC 14 diagnostics patch (to make sure the build is idempotent)" + cd $SRC_DIR + git apply -R ../gcc14-diagnostics-workaround.diff + cd - +} + +trap cleanup EXIT + +echo "Applying GCC 14 diagnostics patch (this should hopefully be temporary)" +cd $SRC_DIR +git apply ../gcc14-diagnostics-workaround.diff +cd - + cmake -S $SRC_DIR -B $BUILD_DIR -G Ninja -DOPENSSL_LIBRARIES=$OUT_DIR -DBUILD_SHARED_LUA_OPENSSL=OFF -DOPENSSL_ROOT_DIR=$OPENSSL_DIR -DOPENSSL_INCLUDE_DIR=$OPENSSL_INCLUDE_DIR -DLUAJIT_INCLUDE_DIRS=$LUAJIT_SRC_DIR -DLUAJIT_LIBRARIES=$LUAJIT_SRC_DIR -DLUA_INCLUDE_DIR=$LUAJIT_SRC_DIR -DLUAJIT_LIBRARIES=$LUAJIT_LIBRARY_PATH -DCMAKE_C_COMPILER=gcc -DOPENSSL_CRYPTO_LIBRARY=$LIBCRYPTO -DOPENSSL_SSL_LIBRARY=$LIBSSL -DLUA_OPENSSL_LIBTYPE=STATIC -DOPENSSL_USE_STATIC_LIBS=ON cmake --build $BUILD_DIR --clean-first diff --git a/deps/zhaog/gcc14-diagnostics-workaround.diff b/deps/zhaog/gcc14-diagnostics-workaround.diff new file mode 100644 index 000000000..61eb6c31b --- /dev/null +++ b/deps/zhaog/gcc14-diagnostics-workaround.diff @@ -0,0 +1,50 @@ +diff --git a/src/ocsp.c b/src/ocsp.c +index 57ec6a59..02bd4ebb 100644 +--- a/src/ocsp.c ++++ b/src/ocsp.c +@@ -104,12 +104,22 @@ static int openssl_ocsp_request_read(lua_State *L) + BIO *bio = load_bio_object(L, 1); + int pem = lua_gettop(L) > 1 ? auxiliar_checkboolean(L, 2) : 0; + ++#if defined(__GNUC__) ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wincompatible-pointer-types" ++#endif ++ + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wincompatible-pointer-types" + #endif + OCSP_REQUEST *req = pem ? PEM_read_bio_OCSP_REQUEST(bio, NULL, NULL) + : d2i_OCSP_REQUEST_bio(bio, NULL); ++ ++#if defined(__GNUC__) ++#pragma GCC diagnostic pop ++#endif ++ + #if defined(__clang__) + #pragma clang diagnostic pop + #endif +@@ -137,12 +147,22 @@ static int openssl_ocsp_response_read(lua_State *L) + int pem = lua_gettop(L) > 1 ? auxiliar_checkboolean(L, 2) : 0; + int ret = 0; + ++#if defined(__GNUC__) ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wincompatible-pointer-types" ++#endif ++ + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wincompatible-pointer-types" + #endif + OCSP_RESPONSE *res = pem ? PEM_read_bio_OCSP_RESPONSE(bio, NULL, NULL) + : d2i_OCSP_RESPONSE_bio(bio, NULL); ++ ++#if defined(__GNUC__) ++#pragma GCC diagnostic pop ++#endif ++ + #if defined(__clang__) + #pragma clang diagnostic pop + #endif