Unverified Commit 5158c635 authored by Arne Keller's avatar Arne Keller Committed by GitHub
Browse files

supercell-wx: init at 0.4.8 (#316266)

parents 2c14d8af e05745ad
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2487,6 +2487,11 @@
    githubId = 206242;
    name = "Andreas Wiese";
  };
  aware70 = {
    name = "aware70";
    github = "aware70";
    githubId = 7832566;
  };
  awwpotato = {
    email = "awwpotato@voidq.com";
    github = "awwpotato";
+167 −0
Original line number Diff line number Diff line
{
  stdenv,
  lib,
  fetchFromGitHub,
  fetchpatch,
  aws-sdk-cpp,
  bzip2,
  cmake,
  ninja,
  zlib,
  openssl,
  curl,
  glew,
  geos,
  boost,
  spdlog,
  stb,
  libcpr,
  libpng,
  libSM,
  geographiclib,
  howard-hinnant-date,
  re2,
  gtest,
  glm,
  qt6,
  tbb_2021_11,
  tracy,
  substituteAll,
  python3,
}:
let
  gtestSkip = [
    # Skip tests requiring network access
    "AwsLevel*DataProvider.FindKeyNow"
    "AwsLevel*DataProvider.FindKeyFixed"
    "AwsLevel*DataProvider.LoadObjectByKey"
    "AwsLevel*DataProvider.Refresh"
    "AwsLevel*DataProvider.GetAvailableProducts"
    "AwsLevel*DataProvider.GetTimePointsByDate"
    "AwsLevel*DataProvider.Prune"
    "UpdateManagerTest.CheckForUpdates"
    "WarningsProvider*\"https"

    # These tests are failing (seemingly can't overwrite a file created by earlier test).
    "SettingsManager/DefaultSettingsTest*"
    "SettingsManager/BadSettingsTest*"
    "MarkerModelTest.*"
  ];
in
stdenv.mkDerivation (finalAttrs: {
  pname = "supercell-wx";
  version = "0.4.8";
  src = fetchFromGitHub {
    owner = "dpaulat";
    repo = "supercell-wx";
    rev = "refs/tags/v${finalAttrs.version}-release";
    sha256 = "sha256-gKR5Mfzw5B4f4/dWintlbDHX3q+d1RmFE+MNp5uSSuc=";
    fetchSubmodules = true;
  };

  meta = {
    homepage = "https://supercell-wx.rtfd.io";
    downloadPage = "https://github.com/dpaulat/supercell-wx/releases";
    description = "Live visualization of NEXRAD weather data and alerts";
    longDescription = ''
      Supercell Wx is a free, open source application to visualize live and
      archive NEXRAD Level 2 and Level 3 data, and severe weather alerts.
      It displays continuously updating weather data on top of a responsive
      map, providing the capability to monitor weather events using
      reflectivity, velocity, and other products.
    '';
    license = lib.licenses.mit;
    mainProgram = "supercell-wx";
    platforms = [
      "x86_64-linux"
      #     "aarch64-linux"
    ];
    maintainers = with lib.maintainers; [ aware70 ];
  };

  env.CXXFLAGS = "-Wno-error=restrict -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=stringop-overflow";
  env.GTEST_FILTER = "-${lib.concatStringsSep ":" gtestSkip}";

  doCheck = true;

  # These tests aren't built by 'all', but ctest still tries to run them.
  cmakeFlags = [
    "-DCMAKE_CTEST_ARGUMENTS=-E;'test_mln_core|test_mln_widgets'"
    "-DSTB_INCLUDE_DIR=${stb}/include/stb"
    "-DFETCHCONTENT_SOURCE_DIR_TRACY=${tracy.src}"
  ];

  patches = [
    # These are for Nix compatibility {{{
    ./patches/use-find-package.patch # Replace some vendored dependencies with Nix provided versions
    (substituteAll {
      # Skip tagging build with git version, and substitute it with the src revision (still uses current year timestamp)
      src = ./patches/skip-git-versioning.patch;
      rev = finalAttrs.src.rev;
    })
    # Prevents using some Qt scripts that seemed to break the install step. Fixes missing link to some targets.
    ./patches/fix-cmake-install.patch
    # }}}

    # These may be or already are submitted upstream {{{
    ./patches/explicit-link-aws-crt.patch # fix missing symbols from aws-crt-cpp
    # }}}
  ];

  # This also may be submitted upstream to maplibre-native-qt, which is currently vendored
  postPatch = ''
    substituteInPlace external/maplibre-native-qt/src/core/CMakeLists.txt \
      --replace-fail "CMAKE_SOURCE_DIR" "PROJECT_SOURCE_DIR"
  '';

  nativeBuildInputs = [
    cmake
    ninja
    qt6.wrapQtAppsHook
  ];

  buildInputs = [
    zlib
    openssl
    qt6.qtbase
    qt6.qttools
    qt6.qtmultimedia
    qt6.qtpositioning
    qt6.qtimageformats
    aws-sdk-cpp
    howard-hinnant-date
    boost
    tbb_2021_11
    glew
    geos
    spdlog
    stb
    libcpr
    libpng
    libSM
    re2
    openssl
    # FIXME: split outputs aren't working with find_package. Possibly related to nixpkgs/issues/144170 ?
    (geographiclib.overrideAttrs {
      outputs = [ "out" ];
    })
    gtest
    glm
    bzip2
    (python3.withPackages (ps: [
      ps.geopandas
    ]))
  ];

  # Currently crashes on wayland; must force X11
  qtWrapperArgs = [
    "--set QT_QPA_PLATFORM xcb"
  ];

  # Install .desktop file and icons
  postInstall = ''
    install -m0644 -D "$src/scwx-qt/res/linux/supercell-wx.desktop" "$out/share/applications/supercell-wx.desktop"
    install -m0644 -D "$src/scwx-qt/res/icons/scwx-256.png"  "$out/share/icons/hicolor/256x256/apps/supercell-wx.png"
    install -m0644 -D "$src/scwx-qt/res/icons/scwx-64.png"  "$out/share/icons/hicolor/64x64/apps/supercell-wx.png"
  '';
})
+12 −0
Original line number Diff line number Diff line
diff --git a/wxdata/wxdata.cmake b/wxdata/wxdata.cmake
index 47ada181..a1beea15 100644
--- a/wxdata/wxdata.cmake
+++ b/wxdata/wxdata.cmake
@@ -280,6 +280,7 @@ endif()
 
 target_link_libraries(wxdata PUBLIC aws-cpp-sdk-core
                                     aws-cpp-sdk-s3
+                                    aws-crt-cpp
                                     cpr::cpr
                                     LibXml2::LibXml2
                                     re2::re2
+53 −0
Original line number Diff line number Diff line
diff --git a/scwx-qt/scwx-qt.cmake b/scwx-qt/scwx-qt.cmake
index cda6c7f..32d807a 100644
--- a/scwx-qt/scwx-qt.cmake
+++ b/scwx-qt/scwx-qt.cmake
@@ -601,6 +601,7 @@ target_link_libraries(scwx-qt PUBLIC Qt${QT_VERSION_MAJOR}::Widgets
                                      Boost::json
                                      Boost::timer
                                      QMapLibre::Core
+                                     QMapLibre::Widgets
                                      $<$<CXX_COMPILER_ID:MSVC>:opengl32>
                                      Fontconfig::Fontconfig
                                      GeographicLib::GeographicLib
@@ -615,40 +616,13 @@ target_link_libraries(scwx-qt PUBLIC Qt${QT_VERSION_MAJOR}::Widgets
 target_link_libraries(supercell-wx PRIVATE scwx-qt
                                            wxdata)
 
-# Set DT_RUNPATH for Linux targets
-set_target_properties(MLNQtCore    PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") # QMapLibre::Core
-set_target_properties(supercell-wx PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib")
-
 install(TARGETS supercell-wx
-                MLNQtCore # QMapLibre::Core
-        RUNTIME_DEPENDENCIES
-          PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-" "qt6"
-          POST_EXCLUDE_REGEXES ".*system32/.*\\.dll"
-                               "^(/usr)?/lib/.*\\.so(\\..*)?"
         RUNTIME
           COMPONENT supercell-wx
         LIBRARY
           COMPONENT supercell-wx
           OPTIONAL)
 
-# NO_TRANSLATIONS is needed for Qt 6.5.0 (will be fixed in 6.5.1)
-# https://bugreports.qt.io/browse/QTBUG-112204
-qt_generate_deploy_app_script(TARGET MLNQtCore # QMapLibre::Core
-                              OUTPUT_SCRIPT deploy_script_qmaplibre_core
-                              NO_TRANSLATIONS
-                              NO_UNSUPPORTED_PLATFORM_ERROR)
-
-qt_generate_deploy_app_script(TARGET supercell-wx
-                              OUTPUT_SCRIPT deploy_script_scwx
-                              NO_TRANSLATIONS
-                              NO_UNSUPPORTED_PLATFORM_ERROR)
-
-install(SCRIPT ${deploy_script_qmaplibre_core}
-        COMPONENT supercell-wx)
-
-install(SCRIPT ${deploy_script_scwx}
-        COMPONENT supercell-wx)
-
 if (MSVC)
     set(CPACK_PACKAGE_NAME                "Supercell Wx")
     set(CPACK_PACKAGE_VENDOR              "Dan Paulat")
+50 −0
Original line number Diff line number Diff line
diff --git a/scwx-qt/tools/generate_versions.py b/scwx-qt/tools/generate_versions.py
index c6c94020..3fcdcf08 100644
--- a/scwx-qt/tools/generate_versions.py
+++ b/scwx-qt/tools/generate_versions.py
@@ -1,6 +1,5 @@
 import argparse
 import datetime
-import git
 import json
 import os
 import pathlib
@@ -110,27 +109,22 @@ def ParseArguments():
                         required = True)
     return parser.parse_args()
 
+def GetYearFromLicense(license_file: pathlib.Path):
+    import re
+    for line in license_file.read_text().splitlines():
+        m = re.search(r'^\s*Copyright \(c\) 2021-(\d{4,})', line)
+        if m is not None:
+            return int(m.group(1))
+    raise RuntimeError(f"Could not find copyright year in {license_file}")
+
 def CollectVersionInfo(args):
     print("Collecting version info")
 
     versionInfo = VersionInfo()
-
-    repo = git.Repo(args.gitRepo_, search_parent_directories = True)
-
-    commitString = str(repo.head.commit)[:10]
-
-    if not repo.is_dirty(submodules = False):
-        copyrightYear = datetime.datetime.fromtimestamp(repo.head.commit.committed_date).year
-    else:
-        commitString  = commitString + "+dirty"
-        copyrightYear = datetime.date.today().year
-
-    resourceDir = str(args.gitRepo_).replace("\\", "\\\\")
-
     versionInfo.buildNumber_   = args.buildNumber_
-    versionInfo.commitString_  = commitString
-    versionInfo.copyrightYear_ = copyrightYear
-    versionInfo.resourceDir_   = resourceDir
+    versionInfo.commitString_  = "@rev@"
+    versionInfo.copyrightYear_ = GetYearFromLicense(args.gitRepo_ / 'LICENSE.txt')
+    versionInfo.resourceDir_   = str(args.gitRepo_).replace("\\", "\\\\")
     versionInfo.versionString_ = args.version_
 
     versionInfo.Calculate()
Loading