2018-11-19 13:09:52 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, makeWrapper, which, cmake, perl, perlPackages,
|
2018-07-21 01:44:44 +01:00
|
|
|
boost, tbb, wxGTK30, pkgconfig, gtk3, fetchurl, gtk2, libGLU,
|
2019-01-19 01:45:57 +00:00
|
|
|
glew, eigen, curl, gtest, nlopt, pcre, xorg, makeDesktopItem }:
|
2018-02-06 10:50:37 +00:00
|
|
|
let
|
|
|
|
AlienWxWidgets = perlPackages.buildPerlPackage rec {
|
|
|
|
name = "Alien-wxWidgets-0.69";
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://cpan/authors/id/M/MD/MDOOTSON/${name}.tar.gz";
|
|
|
|
sha256 = "075m880klf66pbcfk0la2nl60vd37jljizqndrklh5y4zvzdy1nr";
|
|
|
|
};
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
pkgconfig perlPackages.ModulePluggable perlPackages.ModuleBuild
|
|
|
|
gtk2 gtk3 wxGTK30
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
Wx = perlPackages.Wx.overrideAttrs (oldAttrs: {
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
perlPackages.ExtUtilsXSpp
|
|
|
|
AlienWxWidgets
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
|
|
|
WxGLCanvas = perlPackages.buildPerlPackage rec {
|
|
|
|
name = "Wx-GLCanvas-0.09";
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://cpan/authors/id/M/MB/MBARBON/${name}.tar.gz";
|
|
|
|
sha256 = "1q4gvj4gdx4l8k4mkgiix24p9mdfy1miv7abidf0my3gy2gw5lka";
|
|
|
|
};
|
2018-02-24 12:59:47 +00:00
|
|
|
propagatedBuildInputs = [ Wx perlPackages.OpenGL libGLU ];
|
2018-02-06 10:50:37 +00:00
|
|
|
doCheck = false;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "slic3r-prusa-edition-${version}";
|
2018-11-29 04:14:32 +00:00
|
|
|
version = "1.41.2";
|
2018-02-06 10:50:37 +00:00
|
|
|
|
2018-02-16 21:24:21 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2018-10-02 08:23:14 +01:00
|
|
|
nativeBuildInputs = [
|
2018-02-06 10:50:37 +00:00
|
|
|
cmake
|
|
|
|
makeWrapper
|
2018-10-02 08:23:14 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
curl
|
2018-02-16 21:20:22 +00:00
|
|
|
eigen
|
|
|
|
glew
|
2018-10-02 08:23:14 +01:00
|
|
|
pcre
|
|
|
|
perl
|
2018-02-06 10:50:37 +00:00
|
|
|
tbb
|
|
|
|
which
|
|
|
|
Wx
|
|
|
|
WxGLCanvas
|
2018-10-02 08:23:14 +01:00
|
|
|
xorg.libXdmcp
|
|
|
|
xorg.libpthreadstubs
|
|
|
|
] ++ checkInputs ++ (with perlPackages; [
|
2018-02-06 10:50:37 +00:00
|
|
|
boost
|
|
|
|
ClassXSAccessor
|
|
|
|
EncodeLocale
|
|
|
|
ExtUtilsMakeMaker
|
2018-04-15 13:58:45 +01:00
|
|
|
ExtUtilsTypemapsDefault
|
2018-02-06 10:50:37 +00:00
|
|
|
ExtUtilsXSpp
|
|
|
|
GrowlGNTP
|
|
|
|
ImportInto
|
|
|
|
IOStringy
|
|
|
|
locallib
|
|
|
|
LWP
|
|
|
|
MathClipper
|
|
|
|
MathConvexHullMonotoneChain
|
|
|
|
MathGeometryVoronoi
|
|
|
|
MathPlanePath
|
2018-04-15 13:58:45 +01:00
|
|
|
ModuleBuildWithXSpp
|
2018-02-06 10:50:37 +00:00
|
|
|
Moo
|
|
|
|
NetDBus
|
|
|
|
OpenGL
|
|
|
|
XMLSAX
|
|
|
|
]);
|
|
|
|
|
2018-10-02 08:23:14 +01:00
|
|
|
checkInputs = [ gtest ];
|
|
|
|
|
|
|
|
# The build system uses custom logic - defined in
|
|
|
|
# xs/src/libnest2d/cmake_modules/FindNLopt.cmake in the package source -
|
|
|
|
# for finding the nlopt library, which doesn't pick up the package in the nix store.
|
|
|
|
# We need to set the path via the NLOPT environment variable instead.
|
|
|
|
NLOPT = "${nlopt}";
|
|
|
|
|
2018-03-17 23:52:46 +00:00
|
|
|
prePatch = ''
|
2018-10-02 08:22:57 +01:00
|
|
|
# In nix ioctls.h isn't available from the standard kernel-headers package
|
|
|
|
# on other distributions. As the copy in glibc seems to be identical to the
|
|
|
|
# one in the kernel, we use that one instead.
|
2018-03-17 23:52:46 +00:00
|
|
|
sed -i 's|"/usr/include/asm-generic/ioctls.h"|<asm-generic/ioctls.h>|g' xs/src/libslic3r/GCodeSender.cpp
|
2018-10-02 08:22:57 +01:00
|
|
|
|
2018-10-02 08:23:14 +01:00
|
|
|
# PERL_VENDORARCH and PERL_VENDORLIB aren't set correctly by the build
|
2018-10-02 08:22:57 +01:00
|
|
|
# system, so we have to override them. Setting them as environment variables
|
2018-10-02 08:23:14 +01:00
|
|
|
# doesn't work though, so substituting the paths directly in CMakeLists.txt
|
|
|
|
# seems to be the easiest way.
|
2018-06-16 00:37:45 +01:00
|
|
|
sed -i "s|\''${PERL_VENDORARCH}|$out/lib/slic3r-prusa3d|g" xs/CMakeLists.txt
|
|
|
|
sed -i "s|\''${PERL_VENDORLIB}|$out/lib/slic3r-prusa3d|g" xs/CMakeLists.txt
|
2018-11-19 13:09:52 +00:00
|
|
|
'' + lib.optionalString (lib.versionOlder "2.5" nlopt.version) ''
|
|
|
|
# Since version 2.5.0 of nlopt we need to link to libnlopt, as libnlopt_cxx
|
|
|
|
# now seems to be integrated into the main lib.
|
|
|
|
sed -i 's|nlopt_cxx|nlopt|g' xs/src/libnest2d/cmake_modules/FindNLopt.cmake
|
2018-03-17 23:52:46 +00:00
|
|
|
'';
|
|
|
|
|
2018-02-06 10:50:37 +00:00
|
|
|
postInstall = ''
|
|
|
|
echo 'postInstall'
|
|
|
|
wrapProgram "$out/bin/slic3r-prusa3d" \
|
|
|
|
--prefix PERL5LIB : "$out/lib/slic3r-prusa3d:$PERL5LIB"
|
|
|
|
|
|
|
|
# it seems we need to copy the icons...
|
|
|
|
mkdir -p $out/bin/var
|
2018-06-16 00:37:45 +01:00
|
|
|
cp -r ../resources/icons/* $out/bin/var/
|
2018-02-06 10:50:37 +00:00
|
|
|
cp -r ../resources $out/bin/
|
2019-01-19 01:45:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
mkdir -p "$out/share/pixmaps/"
|
|
|
|
ln -s "$out/bin/var/Slic3r.png" "$out/share/pixmaps/slic3r-prusa.png"
|
|
|
|
mkdir -p "$out/share/applications"
|
|
|
|
cp "$desktopItem"/share/applications/* "$out/share/applications/"
|
2018-02-06 10:50:37 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "prusa3d";
|
|
|
|
repo = "Slic3r";
|
2018-11-29 04:14:32 +00:00
|
|
|
sha256 = "046ircwc0wr586v7106ys557ypslmyq9p4qgi34ads1d6bgxhlyy";
|
2018-02-06 10:50:37 +00:00
|
|
|
rev = "version_${version}";
|
|
|
|
};
|
|
|
|
|
2019-01-19 01:45:57 +00:00
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "slic3r-Prusa-Edition";
|
|
|
|
exec = "slic3r-prusa3d";
|
|
|
|
icon = "slic3r-prusa";
|
|
|
|
comment = "G-code generator for 3D printers";
|
|
|
|
desktopName = "Slic3r Prusa Edition";
|
|
|
|
genericName = "3D printer tool";
|
|
|
|
categories = "Application;Development;";
|
|
|
|
};
|
|
|
|
|
2018-02-06 10:50:37 +00:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "G-code generator for 3D printer";
|
|
|
|
homepage = https://github.com/prusa3d/Slic3r;
|
|
|
|
license = licenses.agpl3;
|
|
|
|
maintainers = with maintainers; [ tweber ];
|
2018-10-08 21:42:31 +01:00
|
|
|
broken = stdenv.hostPlatform.isAarch64;
|
2018-02-06 10:50:37 +00:00
|
|
|
};
|
|
|
|
}
|