From 075649e87cf424cbbe1d86a94b07ec1de2fb20ec Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Sun, 16 Oct 2022 00:40:29 +0800 Subject: [PATCH] huggle: init at 3.4.10 --- .../misc/huggle/00-remove-third-party.patch | 25 ++++++++ .../misc/huggle/01-extensions.patch | 13 ++++ pkgs/applications/misc/huggle/default.nix | 63 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 4 files changed, 103 insertions(+) create mode 100644 pkgs/applications/misc/huggle/00-remove-third-party.patch create mode 100644 pkgs/applications/misc/huggle/01-extensions.patch create mode 100644 pkgs/applications/misc/huggle/default.nix diff --git a/pkgs/applications/misc/huggle/00-remove-third-party.patch b/pkgs/applications/misc/huggle/00-remove-third-party.patch new file mode 100644 index 000000000000..e1295e5f54fa --- /dev/null +++ b/pkgs/applications/misc/huggle/00-remove-third-party.patch @@ -0,0 +1,25 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index a37976e..5669366 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -59,16 +59,12 @@ if(NOT MINGW AND WIN32) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}/Debug) + endif() + +-add_subdirectory(3rd/libirc/libirc libirc) +-add_subdirectory(3rd/libirc/libircclient libircclient) ++include_directories(@libirc_includes@) + + # YAML +-option(YAML_CPP_BUILD_TOOLS "Disable tests" OFF) +-option(YAML_CPP_BUILD_TESTS "Enable testing" OFF) +-option(YAML_CPP_BUILD_TOOLS "Enable parse tools" OFF) +-option(BUILD_SHARED_LIBS "Build as shared" ON) +-include_directories("3rd/yaml-cpp/include/") +-add_subdirectory(3rd/yaml-cpp) ++find_package(YAML-CPP 0.6.3 QUIET) ++include_directories(YAML_CPP_INCLUDE_DIR) ++ + if (HUGGLE_EXT) + if(NOT MINGW AND WIN32) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}/Release/extensions) diff --git a/pkgs/applications/misc/huggle/01-extensions.patch b/pkgs/applications/misc/huggle/01-extensions.patch new file mode 100644 index 000000000000..aa36bb0356f7 --- /dev/null +++ b/pkgs/applications/misc/huggle/01-extensions.patch @@ -0,0 +1,13 @@ +diff --git a/src/huggle_core/definitions_prod.hpp b/src/huggle_core/definitions_prod.hpp +index 1fc5b1fb..17881ade 100644 +--- a/src/huggle_core/definitions_prod.hpp ++++ b/src/huggle_core/definitions_prod.hpp +@@ -216,7 +216,7 @@ namespace std { typedef decltype(nullptr) nullptr_t; } + #define HUGGLE_GLOBAL_EXTENSION_PATH QCoreApplication::applicationDirPath() + "/extensions" + #elif defined __linux__ + #define HUGGLE_UPDATER_PLATFORM_TYPE "linux" +- #define HUGGLE_GLOBAL_EXTENSION_PATH "/usr/local/share/huggle/extensions" ++ #define HUGGLE_GLOBAL_EXTENSION_PATH "@out@/share/huggle/extensions" + #elif defined HUGGLE_WIN + // This is needed by yaml cpp library, otherwise it won't build with MSVC + #define YAML_CPP_DLL diff --git a/pkgs/applications/misc/huggle/default.nix b/pkgs/applications/misc/huggle/default.nix new file mode 100644 index 000000000000..85c65a0eeb4a --- /dev/null +++ b/pkgs/applications/misc/huggle/default.nix @@ -0,0 +1,63 @@ +{ lib +, stdenv +, fetchFromGitHub +, pkg-config +, ncurses +, which +, cmake +, unzip +, wrapQtAppsHook +, qtwebengine +, libyamlcpp +, libirc +}: + +stdenv.mkDerivation rec { + pname = "huggle"; + version = "3.4.10"; + + src = fetchFromGitHub { + owner = "huggle"; + repo = "huggle3-qt-lx"; + rev = version; + sha256 = "UzoX4kdzYU50W0MUhfpo0HaSfvG3eINNC8u5t/gKuqI="; + fetchSubmodules = true; + }; + + nativeBuildInputs = [ + wrapQtAppsHook + pkg-config + which + cmake + ]; + buildInputs = [ ncurses libyamlcpp qtwebengine libirc ]; + + patches = [ ./00-remove-third-party.patch ./01-extensions.patch ]; + postPatch = '' + rm -r src/3rd + echo ${version} > src/huggle_core/version.txt + substituteInPlace src/huggle_core/definitions_prod.hpp --subst-var out + substituteInPlace src/CMakeLists.txt --replace '@libirc_includes@' '${libirc.out}' + ''; + + cmakeFlags = [ + "-S" "/build/source/src" + "-DCMAKE_BUILD_TYPE=None" + "-DINSTALL_DATA_DIR=bin" + "-DQT5_BUILD=ON" + "-DWEB_ENGINE=ON" + "-DBUILD_SHARED_LIBS=OFF" + "-Wno-dev" + "-DHUGGLE_EXT=TRUE" + ]; + + installTargets = [ "install" ]; + + meta = with lib; { + description = "Anti-vandalism tool for use on MediaWiki-based projects"; + homepage = "https://github.com/huggle/huggle3-qt-lx"; + license = licenses.gpl3Only; + maintainers = [ maintainers.fee1-dead ]; + platforms = platforms.x86_64; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3a0d2c121076..3c454f058f6a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -28929,6 +28929,8 @@ with pkgs; haunt = callPackage ../applications/misc/haunt { }; + huggle = libsForQt5.callPackage ../applications/misc/huggle {}; + hugo = callPackage ../applications/misc/hugo { buildGoModule = buildGo119Module; };