From 675e083b695eb52c4dbfbabd95fd61a8524acdae Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Thu, 7 Mar 2024 17:18:49 +0100 Subject: [PATCH] mysql-workbench: fix build --- .../misc/mysql-workbench/default.nix | 18 +++++------ .../dont-search-for-antlr-jar.patch | 30 +++++++++++++++++++ 2 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 pkgs/applications/misc/mysql-workbench/dont-search-for-antlr-jar.patch diff --git a/pkgs/applications/misc/mysql-workbench/default.nix b/pkgs/applications/misc/mysql-workbench/default.nix index feda79ed8846..92574896bbd9 100644 --- a/pkgs/applications/misc/mysql-workbench/default.nix +++ b/pkgs/applications/misc/mysql-workbench/default.nix @@ -80,14 +80,16 @@ stdenv.mkDerivation (finalAttrs: { # a newer libxml2 version has changed some interfaces ./fix-xml2.patch + + # Don't try to override the ANTLR_JAR_PATH specified in cmakeFlags + ./dont-search-for-antlr-jar.patch ]; - # 1. have it look for 4.12.0 instead of 4.11.1 - # 2. for some reason CMakeCache.txt is part of source code - preConfigure = '' - substituteInPlace CMakeLists.txt \ - --replace "antlr-4.11.1-complete.jar" "antlr-4.12.0-complete.jar" + postPatch = '' + # For some reason CMakeCache.txt is part of source code, remove it rm -f build/CMakeCache.txt + + patchShebangs tools/get_wb_version.sh ''; nativeBuildInputs = [ @@ -139,10 +141,6 @@ stdenv.mkDerivation (finalAttrs: { zstd ]; - postPatch = '' - patchShebangs tools/get_wb_version.sh - ''; - # GCC 13: error: 'int64_t' in namespace 'std' does not name a type # when updating the version make sure this is still needed env.CXXFLAGS = "-include cstdint"; @@ -164,7 +162,7 @@ stdenv.mkDerivation (finalAttrs: { # mysql-workbench 8.0.21 depends on libmysqlconnectorcpp 1.1.8. # Newer versions of connector still provide the legacy library when enabled # but the headers are in a different location. - "-DWITH_ANTLR_JAR=${antlr4_12.jarLocation}" + "-DANTLR_JAR_PATH=${antlr4_12.jarLocation}" "-DMySQLCppConn_INCLUDE_DIR=${libmysqlconnectorcpp}/include/jdbc" ]; diff --git a/pkgs/applications/misc/mysql-workbench/dont-search-for-antlr-jar.patch b/pkgs/applications/misc/mysql-workbench/dont-search-for-antlr-jar.patch new file mode 100644 index 000000000000..80e4a7620173 --- /dev/null +++ b/pkgs/applications/misc/mysql-workbench/dont-search-for-antlr-jar.patch @@ -0,0 +1,30 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b7320bb..d7169da 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -143,25 +143,6 @@ check_function_exists (strtoull HAVE_STRTOULL) + check_function_exists (strtoimax HAVE_STRTOIMAX) + check_function_exists (strtoumax HAVE_STRTOUMAX) + +-set(ANTLR_JAR_FILENAME "antlr-4.11.1-complete.jar") +-get_filename_component(SOURCE_PARENT_DIR ${CMAKE_SOURCE_DIR} DIRECTORY) +-set(LINUX_RES_BIN_DIR ${SOURCE_PARENT_DIR}/linux-res/bin) +-message("WITH_ANTLR_JAR: ${WITH_ANTLR_JAR}") +-if(WITH_ANTLR_JAR) +- get_filename_component(ANTLR_JAR_USER_DIR ${WITH_ANTLR_JAR} DIRECTORY) +- find_path(ANTLR_JAR_PATH ${ANTLR_JAR_FILENAME} ${LINUX_RES_BIN_DIR} ${ANTLR_JAR_USER_DIR}) +-else(WITH_ANTLR_JAR) +- find_path(ANTLR_JAR_PATH ${ANTLR_JAR_FILENAME} ${LINUX_RES_BIN_DIR}) +-endif(WITH_ANTLR_JAR) +- +-if(ANTLR_JAR_PATH AND Java_JAVA_EXECUTABLE) +- set(ANTLR_JAR_PATH ${ANTLR_JAR_PATH}/${ANTLR_JAR_FILENAME}) +- message(STATUS "ANTLR jar: " ${ANTLR_JAR_PATH}) +-else() +- message(WARNING ${ANTLR_JAR_FILENAME} " or java runtime wasn't found which is required if you'd like to rebuild Lexer and Parser files") +-endif() +- +- + if (UNIX) + if (NOT LIB_INSTALL_DIR) + set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib")