Commit 48cddb1e authored by cjshearer's avatar cjshearer
Browse files

ideamaker: 4.3.3.6560 -> 5.1.4.8480

parent b8247463
Loading
Loading
Loading
Loading
+83 −101
Original line number Diff line number Diff line
{
  stdenv,
  autoPatchelfHook,
  cacert,
  boost,
  c-blosc,
  common-updater-scripts,
  curl,
  dpkg,
  fetchFromGitHub,
  fetchurl,
  fetchzip,
  ilmbase,
  jemalloc,
  lib,
  libcork,
  libGLU,
  libsForQt5,
  makeDesktopItem,
  openssl,
  nlopt,
  opencascade-occt_7_6,
  openexr,
  openssl_1_1,
  openvdb,
  poly2tri-c,
  shared-mime-info,
  stdenv,
  tbb,
  unzip,
  writeShellApplication,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "ideamaker";
  version = "4.3.3.6560";
  version = "5.1.4.8480";
  src =
    let
      semver = lib.strings.concatStringsSep "." (
@@ -27,7 +37,7 @@ stdenv.mkDerivation (finalAttrs: {
    in
    fetchurl {
      url = "https://downcdn.raise3d.com/ideamaker/release/${semver}/ideaMaker_${finalAttrs.version}-ubuntu_amd64.deb";
      hash = "sha256-aTVWCTgnVKD16uhJUVz0vR7KPGJqCVj0xoL53Qi3IKM=";
      hash = "sha256-vOiHqdegFHqA1PYYvtXBQSIl+OVq2oyAT80ZFtaIxl8=";
    };

  nativeBuildInputs = [
@@ -37,98 +47,67 @@ stdenv.mkDerivation (finalAttrs: {
    libsForQt5.wrapQtAppsHook
  ];

  buildInputs =
    let
      # we need curl 7.47.0, as the app segfaults on launch in 7.47.1 and beyond
      # (tested with 7.47.1, 7.50.3, 7.62, 7.79.1, and 8.7.1)
      curl_7_47_0 =
        let
          openssl_1_0_1u = openssl.overrideAttrs (previous: {
            version = "1.0.1u";
            src = fetchurl {
              url = "https://www.openssl.org/source/openssl-1.0.1u.tar.gz";
              hash = "sha256-QxK0yhIVtvLJcAdQPYDbgNUVf3b499P+u+a0xW/yZzk=";
            };
            patches = [ ];
            withDocs = false;
            outputs = lib.lists.remove "doc" previous.outputs;
            meta.knownVulnerabilities = [
              "OpenSSL 1.0.1 reached its end of life 2016-12-31, see https://endoflife.software/applications/security-libraries/openssl."
              "CVE-2021-4044"
              "CVE-2016-7056"
            ];
          });
        in
        (curl.override {
          gnutlsSupport = true;
          gssSupport = false;
          http2Support = false;
          # while we use openssl, the configureFlag has since changed, so we manually set it below
          opensslSupport = false;
          pslSupport = false;
          scpSupport = false;
        }).overrideAttrs
          (previous: {
            version = "7.47.0";
            src = fetchzip {
              url = "https://curl.se/download/curl-7.47.0.tar.lzma";
              hash = "sha256-XlZk1nJbSmiQp7jMSE2QRCY4C9w2us8BgosBSzlD4dE=";
            };
            configureFlags = previous.configureFlags ++ [
              "--with-ca-bundle=${cacert}/etc/ssl/certs/ca-bundle.crt"
              "--with-ssl=${lib.getLib openssl_1_0_1u}"
            ];
            patches = [ ];
            # curl https://curl.se/docs/vuln-7.74.0.json | jq -r '.[].id' | sed 's/^/"/;s/$/"/'
            meta.knownVulnerabilities = [
              "CURL-CVE-2024-2398"
              "CURL-CVE-2023-46218"
              "CURL-CVE-2023-38546"
              "CURL-CVE-2023-38545"
              "CURL-CVE-2023-28322"
              "CURL-CVE-2023-28321"
              "CURL-CVE-2023-28320"
              "CURL-CVE-2023-27538"
              "CURL-CVE-2023-27536"
              "CURL-CVE-2023-27535"
              "CURL-CVE-2023-27534"
              "CURL-CVE-2023-27533"
              "CURL-CVE-2023-23916"
              "CURL-CVE-2022-43552"
              "CURL-CVE-2022-32221"
              "CURL-CVE-2022-35252"
              "CURL-CVE-2022-32208"
              "CURL-CVE-2022-32207"
              "CURL-CVE-2022-32206"
              "CURL-CVE-2022-32205"
              "CURL-CVE-2022-27782"
              "CURL-CVE-2022-27781"
              "CURL-CVE-2022-27776"
              "CURL-CVE-2022-27775"
              "CURL-CVE-2022-27774"
              "CURL-CVE-2022-22576"
              "CURL-CVE-2021-22947"
              "CURL-CVE-2021-22946"
              "CURL-CVE-2021-22945"
              "CURL-CVE-2021-22926"
              "CURL-CVE-2021-22925"
              "CURL-CVE-2021-22924"
              "CURL-CVE-2021-22923"
              "CURL-CVE-2021-22922"
              "CURL-CVE-2021-22898"
              "CURL-CVE-2021-22897"
              "CURL-CVE-2021-22890"
              "CURL-CVE-2021-22876"
            ];
          });
    in
    [
      (lib.getLib curl_7_47_0)
  buildInputs = [
    curl
    libcork
    libGLU
      libsForQt5.qtbase
      libsForQt5.qtserialport
    libsForQt5.quazip
    nlopt
    opencascade-occt_7_6
    openssl_1_1
    (openvdb.overrideAttrs {
      # attempting to build https://github.com/NixOS/nixpkgs/commit/7053b097de9334b07f6b74476b6b206542695731
      version = "5.0.0";
      outputs = [ "out" ];
      src = fetchFromGitHub {
        owner = "AcademySoftwareFoundation";
        repo = "openvdb";
        rev = "v5.0.0";
        sha256 = "sha256-OzttcC8QfGirBI4Yb0EBCxDK4gvCsP5WOMX59vINVJg=";
      };

      nativeBuildInputs = [ ];

      buildInputs = [
        unzip
        openexr
        boost
        tbb
        jemalloc
        c-blosc
        ilmbase
      ];

      cmakeFlags = [ ];

      postFixup = "";

      setSourceRoot = ''
        sourceRoot=$(echo */openvdb)
      '';

      installTargets = "install_lib";

      enableParallelBuilding = true;

      buildFlags = ''
        lib
        DESTDIR=$(out)
        HALF_LIB=-lHalf
        TBB_LIB=-ltbb
        BLOSC_LIB=-lblosc
        LOG4CPLUS_LIB=
        BLOSC_INCLUDE_DIR=${c-blosc}/include/
        BLOSC_LIB_DIR=${c-blosc}/lib/
      '';

      installFlags = ''DESTDIR=$(out)'';

      NIX_CFLAGS_COMPILE = "-I${openexr.dev}/include/OpenEXR -I${ilmbase.dev}/include/OpenEXR/";
      NIX_LDFLAGS = "-lboost_iostreams";
    })
    poly2tri-c
    tbb
  ];

  installPhase = ''
@@ -137,8 +116,11 @@ stdenv.mkDerivation (finalAttrs: {
    install -D usr/lib/x86_64-linux-gnu/ideamaker/ideamaker \
      $out/bin/ideamaker

    patchelf --replace-needed libquazip.so.1 libquazip1-qt5.so \
      $out/bin/ideamaker
    mkdir $out/lib
    cp -a usr/lib/x86_64-linux-gnu/ideamaker/libIM* $out/lib

    patchelf --replace-needed libquazip.so.1 libquazip1-qt5.so $out/lib/*
    patchelf --replace-needed libpoly2tri.so.1 libpoly2tri-c-0.1.so $out/lib/*

    mimetypeDir=$out/share/icons/hicolor/128x128/mimetypes
    mkdir -p ''$mimetypeDir