Commit 99bb6622 authored by cjshearer's avatar cjshearer
Browse files

ideamaker: attempt using bundled qt libs

parent b64acec9
Loading
Loading
Loading
Loading
+17 −128
Original line number Diff line number Diff line
{
  autoPatchelfHook,
  boost,
  c-blosc,
  common-updater-scripts,
  copyDesktopItems,
  curl,
  dpkg,
  fetchFromGitHub,
  e2fsprogs,
  fetchurl,
  ilmbase,
  jemalloc,
  gnutls,
  gtk3,
  jq,
  lib,
  libcork,
  libGLU,
  libpsl,
  libsForQt5,
  lz4,
  makeDesktopItem,
  nlopt,
  opencascade-occt_7_6,
  openssl_1_1,
  openvdb,
  poly2tri-c,
  nghttp2,
  shared-mime-info,
  stdenv,
  tbb,
  unzip,
  writeShellApplication,
  automake,
  libtool,
  pkgconf,
  autoconf,
  zlib,
}:
let
  pname = "ideamaker";
  version = "5.1.4.8480";
  semver = lib.strings.concatStringsSep "." (lib.lists.init (builtins.splitVersion version));
  description = "Raise3D's 3D slicer software";
  openexr_2_2_1 = stdenv.mkDerivation rec {
    name = "openexr-2.2.1";

    src = fetchurl {
      url = "http://download.savannah.nongnu.org/releases/openexr/${name}.tar.gz";
      sha256 = "1kdf2gqznsdinbd5vcmqnif442nyhdf9l7ckc51410qm2gv5m6lg";
    };

    patches = [
      ./bootstrap.patch
    ];

    outputs = [
      "bin"
      "dev"
      "out"
      "doc"
    ];

    preConfigure = ''
      ./bootstrap
    '';

    nativeBuildInputs = [ pkgconf ];
    buildInputs = [
      autoconf
      automake
      libtool
    ];
    propagatedBuildInputs = [
      ilmbase
      zlib
    ];

    enableParallelBuilding = true;

    meta = {
      homepage = "http://www.openexr.com/";
      license = lib.licenses.bsd3;
      platforms = lib.platforms.all;
      maintainers = with lib.maintainers; [ wkennington ];
    };
  };

  openvdb_5_0_0 = (
    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_2_2_1
        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_2_2_1.dev}/include/OpenEXR -I${ilmbase.dev}/include/OpenEXR/";
      NIX_LDFLAGS = "-lboost_iostreams";
    }
  );
in
stdenv.mkDerivation {
  inherit pname version;
@@ -151,16 +42,15 @@ stdenv.mkDerivation {
  ];

  buildInputs = [
    curl
    libcork
    libGLU
    libsForQt5.quazip
    nlopt
    opencascade-occt_7_6
    openssl_1_1
    openvdb_5_0_0
    poly2tri-c
    tbb
    lz4
    e2fsprogs
    gnutls
    gtk3
    nghttp2
    libpsl
    # libsForQt5.qtbase
    # libsForQt5.qt5.qtwayland
  ];

  installPhase = ''
@@ -170,10 +60,9 @@ stdenv.mkDerivation {
      $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/*
    # shopt -s extglob
    # cp -a usr/lib/x86_64-linux-gnu/ideamaker/!(libQt5*) $out/lib
    cp -a usr/lib/x86_64-linux-gnu/ideamaker/* $out/lib

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