aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/perl.go
blob: a828609b2a69f456b485fb742081026e5d1969ad (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
package rosa

var _perl = H("perl")

// MakeMakerHelper builds projects using the included MakeMaker script.
type MakeMakerHelper struct {
	// Whether to skip the check target.
	SkipCheck bool
}

// extra returns perl.
func (*MakeMakerHelper) extra() P { return P{_perl, _make} }

// wantsChmod returns true.
func (*MakeMakerHelper) wantsChmod() bool { return true }

// wantsWrite returns true.
func (*MakeMakerHelper) wantsWrite() bool { return true }

// scriptEarly is a noop.
func (*MakeMakerHelper) scriptEarly() string { return "" }

// wantsDir requests the source directory.
func (*MakeMakerHelper) wantsDir() (string, bool) { return "", false }

// script generates Makefile.PL-based build and test commands.
func (attr *MakeMakerHelper) script(t Toolchain, _ string) string {
	if attr == nil {
		attr = new(MakeMakerHelper)
	}

	script := `perl Makefile.PL \
	PREFIX=/system
make \
	` + jobsFlagE + ` \
	` + loadFlagE
	if !attr.SkipCheck && t.opts&OptSkipCheck == 0 {
		script += `
make \
	` + jobsFlagE + ` \
	` + loadFlagE + ` \
	test
`
	}
	script += "make DESTDIR=/work install\n"
	return script
}