summaryrefslogtreecommitdiff
blob: b1646530d2a5bba82e7d5651f95b5a92b097cc96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=5

inherit eutils perl-module

DESCRIPTION="A mesh slicer to generate gcode for 3D fused-filament-fabrication"
HOMEPAGE="http://www.slic3r.org/"
SRC_URI="https://github.com/alexrj/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64"
IUSE="+gui minimal test"

RDEPEND="
	dev-libs/boost[threads]:=
	>=dev-perl/Encode-Locale-1.50.0
	dev-perl/IO-stringy
	>=dev-perl/Math-PlanePath-53.0.0
	>=dev-perl/Moo-1.3.1
	virtual/perl-Carp
	virtual/perl-File-Spec
	virtual/perl-Getopt-Long
	virtual/perl-parent
	virtual/perl-Scalar-List-Utils
	virtual/perl-Thread-Semaphore
	>=virtual/perl-threads-1.960.0
	virtual/perl-Time-HiRes
	virtual/perl-XSLoader
	gui? (
		dev-perl/Class-Accessor
		virtual/perl-Math-Complex
		>=dev-perl/Wx-0.991.800
		dev-perl/Module-Pluggable
		>=virtual/perl-Socket-2.16.0
	)
	!minimal? (
		dev-perl/libwww-perl
		dev-perl/XML-SAX
		dev-perl/XML-SAX-Base
		gui? (
			dev-perl/Net-Bonjour
			dev-perl/OpenGL
			dev-perl/Wx-GLCanvas
		)
	)
"

DEPEND="${RDEPEND}
	>=dev-perl/ExtUtils-CppGuess-0.70.0
	>=dev-perl/ExtUtils-Typemaps-Default-1.50.0
	>=dev-perl/ExtUtils-XSpp-0.170.0
	>=dev-perl/Module-Build-WithXSpp-0.140.0
	>=virtual/perl-ExtUtils-ParseXS-3.220.0
	>=dev-perl/Module-Build-0.380.0
	test? (
		virtual/perl-Test-Harness
		virtual/perl-Test-Simple
	)
	"

# Optional but not yet packaged:
#		gui? (
#			dev-perl/Growl-GNTP
#				note, needs dev-perl/Net-DBus too
#		)

SRC_TEST="do"

src_prepare() {
	epatch "${FILESDIR}"/${P}-adjust_var_path.patch

	pushd xs &>/dev/null
	perl-module_src_prepare
	popd &>/dev/null
}

src_configure() {
	# This should provide info on possible missing deps but it doesnt work properly
	#SLIC3R_NO_AUTO=1 perl Build.PL --gui

	pushd xs &>/dev/null
	perl-module_src_configure
	popd &>/dev/null
}

src_compile() {
	pushd xs &>/dev/null
	perl-module_src_compile
	popd &>/dev/null
}

src_test() {
	pushd xs &>/dev/null
	perl-module_src_test
	popd &>/dev/null

	prove -Ixs/blib/arch -Ixs/blib/lib/ t/ || die "Tests failed on Slic3r"
}

src_install() {
	pushd xs &>/dev/null
	perl-module_src_install
	popd &>/dev/null

	insinto "${VENDOR_LIB}"
	doins -r lib/Slic3r.pm lib/Slic3r

	insinto "${VENDOR_LIB}"/Slic3r
	doins -r var

	exeinto "${VENDOR_LIB}"/Slic3r
	doexe slic3r.pl

	dosym "${VENDOR_LIB}"/Slic3r/slic3r.pl /usr/bin/slic3r.pl

	make_desktop_entry slic3r.pl \
		Slic3r \
		"${VENDOR_LIB}/Slic3r/var/Slic3r_128px.png" \
		"Graphics;3DGraphics;Engineering;Development"
}