2019-10-10 23:57:51 +02:00
|
|
|
{ mkDerivation, lib, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, libGLU
|
|
|
|
, qtbase
|
|
|
|
, qtscript
|
|
|
|
, qtxmlpatterns
|
|
|
|
, lib3ds
|
|
|
|
, bzip2
|
|
|
|
, muparser
|
|
|
|
, levmar
|
|
|
|
}:
|
2009-05-13 12:21:29 +02:00
|
|
|
|
2017-12-04 14:59:25 +01:00
|
|
|
let
|
2019-10-10 23:57:51 +02:00
|
|
|
meshlabRev = "25f3d17b1d1d47ddc51179cb955f3027b7638745";
|
|
|
|
vcglibRev = "910da4c3e310f2e6557bd7a39c4f1529e61573e5";
|
2018-08-14 10:50:28 +02:00
|
|
|
# ^ this should be the latest commit in the vcglib devel branch at the time of the meshlab revision
|
2019-10-10 23:57:51 +02:00
|
|
|
# We keep it separate here instead of using the `vcg` nix package because
|
|
|
|
# as of writing, meshlab upstream does not seem to follow a proper
|
|
|
|
# release process, and the other dependencies of `vcg` may no longer
|
|
|
|
# work when we upgrade it for the purpose of meshlab.
|
2018-08-14 10:50:28 +02:00
|
|
|
|
2019-10-10 23:57:51 +02:00
|
|
|
# Unfixed upstream compile error; see
|
|
|
|
# https://github.com/cnr-isti-vclab/meshlab/issues/188#issuecomment-364785362
|
|
|
|
# that has with fixed line endings.
|
|
|
|
import_bundle_out_patch = fetchpatch {
|
|
|
|
name = "import_bundle_out.patch";
|
|
|
|
url = "https://aur.archlinux.org/cgit/aur.git/plain/import_bundle_out.patch?h=meshlab-git&id=f7250ea818470f07dc9b86726407091d39c0be6f";
|
|
|
|
sha256 = "1g6nli15i3fjd6jsgkxvb33kzbcv67xjkc3jv9r51lrwlm1ifzxi";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Reduces amount of vendored libraries, fixes `/linux` vs `linux-g++`
|
|
|
|
# directory name linker errors.
|
|
|
|
external_patch = fetchpatch {
|
|
|
|
name = "external.patch";
|
|
|
|
url = "https://aur.archlinux.org/cgit/aur.git/plain/external.patch?h=meshlab-git&id=f7250ea818470f07dc9b86726407091d39c0be6f";
|
|
|
|
sha256 = "1rxwkxhmxis1420rc1w7dg89gkmym68lpszsq6snl6dzpl3ingsb";
|
|
|
|
};
|
|
|
|
_3ds_patch = fetchpatch {
|
|
|
|
name = "3ds.patch";
|
|
|
|
url = "https://aur.archlinux.org/cgit/aur.git/plain/3ds.patch?h=meshlab-git&id=f7250ea818470f07dc9b86726407091d39c0be6f";
|
|
|
|
sha256 = "1w435b7p1ggi2bzib4yyszmk54drjgpbn8n9mnsk1slsxnp2vmg8";
|
|
|
|
};
|
|
|
|
muparser_patch = fetchpatch {
|
|
|
|
name = "muparser.patch";
|
|
|
|
url = "https://aur.archlinux.org/cgit/aur.git/plain/muparser.patch?h=meshlab-git&id=f7250ea818470f07dc9b86726407091d39c0be6f";
|
|
|
|
sha256 = "1sf7xqwc2j8xxdx2yklwifii9qqgknvx6ahk2hq76mg78ry1nzhq";
|
|
|
|
};
|
|
|
|
|
|
|
|
in mkDerivation {
|
|
|
|
name = "meshlab-20190129-beta";
|
2009-05-13 12:21:29 +02:00
|
|
|
|
2017-12-04 14:59:25 +01:00
|
|
|
srcs =
|
|
|
|
[
|
|
|
|
(fetchFromGitHub {
|
|
|
|
owner = "cnr-isti-vclab";
|
|
|
|
repo = "meshlab";
|
|
|
|
rev = meshlabRev;
|
2019-10-10 23:57:51 +02:00
|
|
|
sha256 = "16d2i91hrxvrr5p0k33g3fzis9zp4gsy3n5y2nhafvsgdmaidiij";
|
2017-12-04 14:59:25 +01:00
|
|
|
name = "meshlab-${meshlabRev}";
|
|
|
|
})
|
|
|
|
(fetchFromGitHub {
|
|
|
|
owner = "cnr-isti-vclab";
|
|
|
|
repo = "vcglib";
|
|
|
|
rev = vcglibRev;
|
2019-10-10 23:57:51 +02:00
|
|
|
sha256 = "0xpnjpwpj57hgai184rzyk9lbq6d9vbjzr477dvl5nplpwa420m1";
|
2017-12-04 14:59:25 +01:00
|
|
|
name = "vcglib-${vcglibRev}";
|
|
|
|
})
|
|
|
|
];
|
2009-05-13 12:21:29 +02:00
|
|
|
|
2017-12-04 14:59:25 +01:00
|
|
|
sourceRoot = "meshlab-${meshlabRev}";
|
2009-05-13 12:21:29 +02:00
|
|
|
|
2019-10-10 23:57:51 +02:00
|
|
|
# Meshlab is not format-security clean; without disabling hardening, we get:
|
|
|
|
# ../../external/qhull-2003.1/src/io.c:2169:3: error: format not a string literal and no format arguments [-Werror=format-security]
|
|
|
|
# fprintf(fp, endfmt);
|
|
|
|
# ^~~~~~~
|
2016-02-26 18:38:15 +01:00
|
|
|
hardeningDisable = [ "format" ];
|
2019-10-10 23:57:51 +02:00
|
|
|
|
2017-12-04 14:59:25 +01:00
|
|
|
enableParallelBuilding = true;
|
2016-02-12 13:50:38 +01:00
|
|
|
|
2019-10-10 23:57:51 +02:00
|
|
|
prePatch =
|
|
|
|
''
|
|
|
|
# MeshLab has ../vcglib hardcoded everywhere, so move the source dir
|
|
|
|
mv ../vcglib-${vcglibRev} ../vcglib
|
2018-08-14 10:50:28 +02:00
|
|
|
|
2019-10-10 23:57:51 +02:00
|
|
|
# Make all source files writable so that patches can be applied.
|
|
|
|
chmod -R u+w ..
|
|
|
|
|
|
|
|
patch -Np1 --directory=../vcglib -i ${import_bundle_out_patch}
|
2017-12-04 14:59:25 +01:00
|
|
|
|
2019-10-10 23:57:51 +02:00
|
|
|
patch -Np1 -i ${external_patch}
|
|
|
|
# Individual libraries
|
|
|
|
patch -Np1 -i ${_3ds_patch}
|
|
|
|
patch -Np1 -i ${muparser_patch}
|
|
|
|
''
|
|
|
|
;
|
|
|
|
|
|
|
|
buildPhase = ''
|
2017-12-04 14:59:25 +01:00
|
|
|
cd src
|
2010-07-07 17:10:05 +02:00
|
|
|
export NIX_LDFLAGS="-rpath $out/opt/meshlab $NIX_LDFLAGS"
|
2017-12-04 14:59:25 +01:00
|
|
|
|
2009-05-13 12:21:29 +02:00
|
|
|
pushd external
|
2019-10-10 23:57:51 +02:00
|
|
|
qmake -recursive $QMAKE_FLAGS external.pro
|
2017-12-04 14:59:25 +01:00
|
|
|
buildPhase
|
2009-05-13 12:21:29 +02:00
|
|
|
popd
|
2019-10-10 23:57:51 +02:00
|
|
|
qmake -recursive $QMAKE_FLAGS meshlab_full.pro
|
2017-12-04 14:59:25 +01:00
|
|
|
buildPhase
|
2009-05-13 12:21:29 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2017-12-04 14:59:25 +01:00
|
|
|
mkdir -p $out/opt/meshlab $out/bin
|
|
|
|
cp -Rv distrib/* $out/opt/meshlab
|
2009-05-13 12:21:29 +02:00
|
|
|
ln -s $out/opt/meshlab/meshlab $out/bin/meshlab
|
2017-12-04 14:59:25 +01:00
|
|
|
ln -s $out/opt/meshlab/meshlabserver $out/bin/meshlabserver
|
2009-05-13 12:21:29 +02:00
|
|
|
'';
|
|
|
|
|
2019-10-10 23:57:51 +02:00
|
|
|
buildInputs = [
|
|
|
|
libGLU
|
|
|
|
qtbase
|
|
|
|
qtscript
|
|
|
|
qtxmlpatterns
|
|
|
|
lib3ds
|
|
|
|
bzip2
|
|
|
|
muparser
|
|
|
|
levmar
|
|
|
|
];
|
2009-05-13 12:21:29 +02:00
|
|
|
|
|
|
|
meta = {
|
2017-12-04 14:59:25 +01:00
|
|
|
description = "A system for processing and editing 3D triangular meshes.";
|
|
|
|
homepage = http://www.meshlab.net/;
|
2019-10-10 23:57:51 +02:00
|
|
|
license = lib.licenses.gpl3;
|
|
|
|
maintainers = with lib.maintainers; [viric];
|
|
|
|
platforms = with lib.platforms; linux;
|
2009-05-13 12:21:29 +02:00
|
|
|
};
|
|
|
|
}
|