aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/gnu.go
blob: b2087187b762a5e4e68f70e19afd3fb155fce636 (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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
package rosa

import "hakurei.app/internal/pkg"

// NewMake returns a [pkg.Artifact] containing an installation of GNU Make.
func (t Toolchain) NewMake() pkg.Artifact {
	const (
		version  = "4.4.1"
		checksum = "YS_B07ZcAy9PbaK5_vKGj64SrxO2VMpnMKfc9I0Q9IC1rn0RwOH7802pJoj2Mq4a"
	)
	return t.New("make-"+version, nil, nil, nil, `
cd "$(mktemp -d)"
/usr/src/make/configure \
	--prefix=/system \
	--build="${ROSA_TRIPLE}" \
	--disable-dependency-tracking
./build.sh
./make DESTDIR=/work install check
`, pkg.Path(AbsUsrSrc.Append("make"), false, pkg.NewHTTPGetTar(
		nil,
		"https://ftp.gnu.org/gnu/make/make-"+version+".tar.gz",
		mustDecode(checksum),
		pkg.TarGzip,
	)))
}

// NewM4 returns a [pkg.Artifact] containing an installation of GNU M4.
func (t Toolchain) NewM4() pkg.Artifact {
	const (
		version  = "1.4.20"
		checksum = "RT0_L3m4Co86bVBY3lCFAEs040yI1WdeNmRylFpah8IZovTm6O4wI7qiHJN3qsW9"
	)
	return t.New("m4-"+version, []pkg.Artifact{
		t.NewMake(),
	}, nil, nil, `
cd /usr/src/m4
chmod +w tests/test-c32ispunct.sh && echo '#!/bin/sh' > tests/test-c32ispunct.sh

cd "$(mktemp -d)"
/usr/src/m4/configure \
	--prefix=/system \
	--build="${ROSA_TRIPLE}"
make "-j$(nproc)" check
make DESTDIR=/work install
`, pkg.Path(AbsUsrSrc.Append("m4"), true, pkg.NewHTTPGetTar(
		nil,
		"https://ftp.gnu.org/gnu/m4/m4-"+version+".tar.bz2",
		mustDecode(checksum),
		pkg.TarBzip2,
	)))
}

// NewAutoconf returns a [pkg.Artifact] containing an installation of GNU Autoconf.
func (t Toolchain) NewAutoconf() pkg.Artifact {
	const (
		version  = "2.72"
		checksum = "-c5blYkC-xLDer3TWEqJTyh1RLbOd1c5dnRLKsDnIrg_wWNOLBpaqMY8FvmUFJ33"
	)
	return t.New("autoconf-"+version, []pkg.Artifact{
		t.NewMake(),
		t.NewM4(),
		t.NewPerl(),
	}, nil, nil, `
cd "$(mktemp -d)"
/usr/src/autoconf/configure \
	--prefix=/system \
	--build="${ROSA_TRIPLE}"
make "-j$(nproc)" check
make DESTDIR=/work install
`, pkg.Path(AbsUsrSrc.Append("autoconf"), false, pkg.NewHTTPGetTar(
		nil,
		"https://ftp.gnu.org/gnu/autoconf/autoconf-"+version+".tar.gz",
		mustDecode(checksum),
		pkg.TarGzip,
	)))
}

// NewGettext returns a [pkg.Artifact] containing an installation of GNU gettext.
func (t Toolchain) NewGettext() pkg.Artifact {
	const (
		version  = "0.26"
		checksum = "IMu7yDZX7xL5UO1ZxXc-iBMbY9LLEUlOroyuSlHMZwg9MKtxG7HIm8F2LheDua0y"
	)
	return t.New("gettext-"+version, []pkg.Artifact{
		t.NewMake(),
	}, nil, nil, `
cd /usr/src/gettext
test_disable() { chmod +w "$2" && echo "$1" > "$2"; }

test_disable '#!/bin/sh' gettext-tools/tests/msgcat-22
test_disable '#!/bin/sh' gettext-tools/tests/msgconv-2
test_disable '#!/bin/sh' gettext-tools/tests/msgconv-8
test_disable '#!/bin/sh' gettext-tools/tests/xgettext-python-3
test_disable '#!/bin/sh' gettext-tools/tests/msgmerge-compendium-6
test_disable '#!/bin/sh' gettext-tools/tests/gettextpo-1
test_disable '#!/bin/sh' gettext-tools/tests/format-c-5
test_disable '#!/bin/sh' gettext-tools/gnulib-tests/test-c32ispunct.sh
test_disable 'int main(){return 0;}' gettext-tools/gnulib-tests/test-stdcountof-h.c

cd "$(mktemp -d)"
/usr/src/gettext/configure \
	--prefix=/system \
	--build="${ROSA_TRIPLE}"
make "-j$(nproc)" check
make DESTDIR=/work install
`, pkg.Path(AbsUsrSrc.Append("gettext"), true, pkg.NewHTTPGetTar(
		nil,
		"https://ftp.gnu.org/pub/gnu/gettext/gettext-"+version+".tar.gz",
		mustDecode(checksum),
		pkg.TarGzip,
	)))
}

// NewDiffutils returns a [pkg.Artifact] containing an installation of GNU diffutils.
func (t Toolchain) NewDiffutils() pkg.Artifact {
	const (
		version  = "3.12"
		checksum = "9J5VAq5oA7eqwzS1Yvw-l3G5o-TccUrNQR3PvyB_lgdryOFAfxtvQfKfhdpquE44"
	)
	return t.New("diffutils-"+version, []pkg.Artifact{
		t.NewMake(),
	}, nil, nil, `
cd /usr/src/diffutils
test_disable() { chmod +w "$2" && echo "$1" > "$2"; }

test_disable '#!/bin/sh' gnulib-tests/test-c32ispunct.sh
test_disable 'int main(){return 0;}' gnulib-tests/test-c32ispunct.c

cd "$(mktemp -d)"
/usr/src/diffutils/configure \
	--prefix=/system \
	--build="${ROSA_TRIPLE}"
make "-j$(nproc)" check
make DESTDIR=/work install
`, pkg.Path(AbsUsrSrc.Append("diffutils"), true, pkg.NewHTTPGetTar(
		nil,
		"https://ftp.gnu.org/gnu/diffutils/diffutils-"+version+".tar.gz",
		mustDecode(checksum),
		pkg.TarGzip,
	)))
}

// NewBash returns a [pkg.Artifact] containing an installation of GNU Bash.
func (t Toolchain) NewBash() pkg.Artifact {
	const (
		version  = "5.3"
		checksum = "4LQ_GRoB_ko-Ih8QPf_xRKA02xAm_TOxQgcJLmFDT6udUPxTAWrsj-ZNeuTusyDq"
	)
	return t.New("bash-"+version, []pkg.Artifact{
		t.NewMake(),
	}, nil, nil, `
cd /usr/src/bash
test_disable() { chmod +w "$2" && echo "$1" > "$2"; }

cd "$(mktemp -d)"
/usr/src/bash/configure \
	--prefix=/system \
	--build="${ROSA_TRIPLE}" \
	--without-bash-malloc
make "-j$(nproc)" check
make DESTDIR=/work install
`, pkg.Path(AbsUsrSrc.Append("bash"), true, pkg.NewHTTPGetTar(
		nil,
		"https://ftp.gnu.org/gnu/bash/bash-"+version+".tar.gz",
		mustDecode(checksum),
		pkg.TarGzip,
	)))
}