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
|
package rosa
import (
"strings"
"hakurei.app/internal/pkg"
)
// NewPython returns a [pkg.Artifact] containing an installation of Python.
func (t Toolchain) NewPython() pkg.Artifact {
const (
version = "3.14.2"
checksum = "7nZunVMGj0viB-CnxpcRego2C90X5wFsMTgsoewd5z-KSZY2zLuqaBwG-14zmKys"
)
skipTests := []string{
// requires internet access (http://www.pythontest.net/)
"test_asyncio",
"test_socket",
"test_urllib2",
"test_urllibnet",
"test_urllib2net",
// makes assumptions about uid_map/gid_map
"test_os",
"test_subprocess",
// somehow picks up mtime of source code
"test_zipfile",
// requires gcc
"test_ctypes",
// breaks on llvm
"test_dbm_gnu",
}
return t.New("python-"+version, []pkg.Artifact{
t.NewMake(),
t.NewZlib(),
t.NewLibffi(),
}, nil, []string{
"EXTRATESTOPTS=-j0 -x " + strings.Join(skipTests, " -x "),
// _ctypes appears to infer something from the linker name
"LDFLAGS=-Wl,--dynamic-linker=/system/lib/" +
"ld-musl-" + linuxArch() + ".so.1",
}, `
# test_synopsis_sourceless assumes this is writable and checks __pycache__
chmod -R +w /usr/src/python/
export HOME="$(mktemp -d)"
cd "$(mktemp -d)"
/usr/src/python/configure \
--prefix=/system \
--build="${ROSA_TRIPLE}"
make "-j$(nproc)"
make test
make DESTDIR=/work install
`, pkg.Path(AbsUsrSrc.Append("python"), true,
pkg.NewHTTPGetTar(
nil, "https://www.python.org/ftp/python/"+version+
"/Python-"+version+".tgz",
mustDecode(checksum),
pkg.TarGzip,
)))
}
|