-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.chariot
427 lines (384 loc) · 13.4 KB
/
config.chariot
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
// // // // // //
// Source Recipes
source/support {
url: support
type: local
}
source/kernel {
url: kernel
type: local
}
source/tartarus {
url: ../tartarus-bootloader
type: local
}
source/mlibc_sysdeps {
url: mlibc-sysdeps
type: local
}
source/rdsk {
url: rdsk
type: local
}
source/init {
url: init
type: local
}
source/elib {
url: elib
type: local
}
source/mkimg {
url: https://git.thenest.dev/wux/mkimg/-/archive/main/mkimg-main.tar.gz
b2sum: 653ee4d9516d24c906646cbfe69ae4f02369143c2ddb3207f9bb357666385f4a28d9ab009efe827b874b7478c2f50fb30231b0ba19b4c60a3d4618734308b99b
type: tar.gz
}
source/cross_binutils {
url: https://ftp.gnu.org/gnu/binutils/binutils-2.41.tar.gz
b2sum: 5a4c2bc5e4dfcb9902732d8393c58e8b435dbc91db974672a4d2fd6f6c5ae6d7651ccbcb7faf8915bb2405ff11c0788a5994ea717f929b76ca86dbcb567f7029
type: tar.gz
}
source/cross_gcc {
url: https://ftp.gnu.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.gz
b2sum: 749671e29fb8bcd35e5bb9d1f8a5a4b815d1764c48f996ce406ef198731962d58b86d69db7b04a75a4ebcaf5d9f80d0715fe6b14139a60da5b4d2445388efa58
type: tar.gz
patch: cross-gcc.diff
}
source/autoconf {
url: https://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
b2sum: 7e8a513bbfcabadad1577919c048cc05ca0a084788850b42570f88afc2fa9c25fb32277412f135b81ba1c0d8079465a6b581d2d78662c991d2183b739fac407c
type: tar.gz
}
source/automake {
url: https://ftp.gnu.org/gnu/automake/automake-1.16.5.tar.gz
b2sum: 5ccdcbe2d3deb2b0baed4a8590b07714cd7098fbda251afebe83232ed03f4db84abbe023cf0544622dbc5137254347273247428eb5420564a167b86de95d113e
type: tar.gz
patch: automake.diff
}
source/libtool {
url: https://ftp.gnu.org/gnu/libtool/libtool-2.4.7.tar.gz
b2sum: 3b7c66050237931443008d6be9c0c30f4938402bf68576cdf02f2248b216bb68c6b797bbfdb8a92caa5e12cb10208cd19771cdcb6b0d83572ad60bfc03e67e98
type: tar.gz
patch: libtool.diff
dependencies [ host/automake ]
strap { ./bootstrap --force }
}
source/pkgconf {
url: https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.0.3.tar.gz
b2sum: 2f305e102913dbd6e45acb4e008afea879f95aab010f1ebc7a83c218d27f2079eb6fac51be811dad9a62057928ce270fe4e8cb6db24070d8f900956af5a67249
type: tar.gz
patch: pkgconf.diff
dependencies [ host/automake host/libtool ]
strap { libtoolize -cfvi && autoreconf -fvi }
}
source/binutils {
url: https://ftp.gnu.org/gnu/binutils/binutils-2.41.tar.gz
b2sum: 5a4c2bc5e4dfcb9902732d8393c58e8b435dbc91db974672a4d2fd6f6c5ae6d7651ccbcb7faf8915bb2405ff11c0788a5994ea717f929b76ca86dbcb567f7029
type: tar.gz
patch: binutils.diff
dependencies [ host/automake host/libtool host/pkgconf ]
strap {
( cd libiberty && libtoolize -cfvi && autoreconf -fvi -I$(realpath ./config) -I$(realpath ../config) )
( cd intl && libtoolize -cfvi && autoreconf -fvi -I$(realpath ../config) )
( cd zlib/contrib/minizip && libtoolize -cfvi && autoreconf -fvi -I$(realpath ../../../config) )
( cd zlib && libtoolize -cfvi && autoreconf -fvi -I$(realpath ../config) )
( cd bfd && libtoolize -cfvi && autoreconf -fvi -I$(realpath ../config) )
( cd opcodes && libtoolize -cfvi && autoreconf -fvi -I$(realpath ../config) )
( cd gas && libtoolize -cfvi && autoreconf -fvi -I$(realpath ../config) )
( cd gold && libtoolize -cfvi && autoreconf -fvi -I$(realpath ../config) )
( cd libctf && libtoolize -cfvi && autoreconf -fvi -I$(realpath ../config) )
( cd binutils && libtoolize -cfvi && autoreconf -fvi -I$(realpath ../config) )
( cd libsframe && libtoolize -cfvi && autoreconf -fvi -I$(realpath ../config) )
( cd gprof && libtoolize -cfvi && autoreconf -fvi -I$(realpath ../config) )
( cd gprofng/libcollector && libtoolize -cfvi && autoreconf -fvi -I$(realpath ../../config) )
( cd gprofng && libtoolize -cfvi && autoreconf -fvi -I$(realpath ../config) )
( cd ld && libtoolize -cfvi && autoreconf -fvi -I$(realpath ../config) )
libtoolize -cfvi && autoreconf -fvi -I$(realpath ./config)
}
}
source/gcc {
url: https://ftp.gnu.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.gz
b2sum: 749671e29fb8bcd35e5bb9d1f8a5a4b815d1764c48f996ce406ef198731962d58b86d69db7b04a75a4ebcaf5d9f80d0715fe6b14139a60da5b4d2445388efa58
type: tar.gz
patch: gcc.diff
dependencies [ host/automake host/libtool host/pkgconf ]
strap {
CFG=$(realpath ./config)
for f in $(find . -name configure.ac); do \
( cd "$(dirname "$f")" && libtoolize -cfvi && autoreconf -fvi -I"$CFG" ); \
done
}
}
source/mlibc {
url: https://github.com/managarm/mlibc/archive/5ea203152ce7b4423dfbe6999e66434c0800ffbe.tar.gz
b2sum: c91c182edfdc933fdd9f8a48ed9bcfeaab5eecdc2d77e6ae073aac05bd11791f8b01eb568983f6e2abb1f6249328666cb35b04a866d9b321b3c900772ba26a6a
type: tar.gz
patch: mlibc.diff
dependencies [ source/mlibc_sysdeps ]
strap { mv @(sources_dir)/mlibc_sysdeps/sysdeps/elysium ./sysdeps/ }
}
// // // // // //
// Host Recipes
host/cross_binutils {
source: cross_binutils
configure {
@(source_dir)/configure \
--target=x86_64-elf \
--prefix=@(prefix) \
--disable-nls \
--disable-werror \
--with-sysroot
}
build { make -j@(thread_count) all }
install { DESTDIR=@(install_dir) make install }
}
host/cross_gcc {
source: cross_gcc
dependencies [ *host/cross_binutils ]
configure {
@(source_dir)/configure \
--target=x86_64-elf \
--prefix=@(prefix) \
--disable-nls \
--enable-languages=c \
--without-headers
}
build { make -j@(thread_count) all-gcc all-target-libgcc }
install { DESTDIR=@(install_dir) make install-gcc install-target-libgcc }
}
host/autoconf {
source: autoconf
configure { @(source_dir)/configure --prefix=@(prefix) }
build { make -j@(thread_count) }
install { DESTDIR=@(install_dir) make install }
}
host/automake {
source: automake
dependencies [ *host/autoconf ]
configure { @(source_dir)/configure --prefix=@(prefix) }
build { make -j@(thread_count) }
install { DESTDIR=@(install_dir) make install-strip }
}
host/libtool {
source: libtool
dependencies [ *host/autoconf host/automake ]
configure { @(source_dir)/configure --prefix=@(prefix) }
build { make -j@(thread_count) }
install { DESTDIR=@(install_dir) make install-strip }
}
host/pkgconf {
source: pkgconf
dependencies [ host/automake host/libtool ]
configure { @(source_dir)/configure --prefix=@(prefix) }
build { make -j@(thread_count) }
install {
DESTDIR=@(install_dir) make install-strip
mkdir -p @(install_dir)@(prefix)/share/pkgconfig/personality.d
PERSONALITY_FILE="@(install_dir)@(prefix)/share/pkgconfig/personality.d/x86_64-elysium.personality"
echo "Triplet: x86_64-elysium" >> $PERSONALITY_FILE
echo "SysrootDir: @(sysroot_dir)" >> $PERSONALITY_FILE
echo "DefaultSearchPaths: @(sysroot_dir)/usr/lib/pkgconfig:@(sysroot_dir)/usr/share/pkgconfig" >> $PERSONALITY_FILE
echo "SystemIncludePaths: @(sysroot_dir)/usr/include" >> $PERSONALITY_FILE
echo "SystemLibraryPaths: @(sysroot_dir)/usr/lib" >> $PERSONALITY_FILE
ln -s pkgconf @(install_dir)@(prefix)/bin/x86_64-elysium-pkg-config
}
}
host/binutils {
source: binutils
configure {
@(source_dir)/configure \
--with-sysroot=@(sysroot_dir) \
--prefix=@(prefix) \
--target=x86_64-elysium \
--enable-targets=x86_64-elf,x86_64-pe \
--disable-nls \
--disable-werror \
--disable-dependency-tracking
}
build { make -j@(thread_count) all }
install { DESTDIR=@(install_dir) make install-strip }
}
host/bootstrap_gcc {
source: gcc
dependencies [ *host/binutils target/mlibc_headers ]
configure {
CFLAGS="-O2" CXXFLAGS="-O2" @(source_dir)/configure \
--prefix=@(prefix) \
--target=x86_64-elysium \
--with-sysroot=@(sysroot_dir) \
--enable-languages=c,c++ \
--disable-nls \
--disable-multilib \
--disable-shared \
--enable-initfini-array
}
build {
make -j@(thread_count) inhibit_libc=true all-gcc
make -j@(thread_count) inhibit_libc=true all-target-libgcc
}
install {
DESTDIR=@(install_dir) make install-gcc
DESTDIR=@(install_dir) make install-target-libgcc
}
}
host/gcc {
source: gcc
dependencies [ *host/binutils *target/mlibc_headers *target/mlibc ]
configure {
CFLAGS="-O2" CXXFLAGS="-O2" @(source_dir)/configure \
--prefix=@(prefix) \
--target=x86_64-elysium \
--with-sysroot=@(sysroot_dir) \
--enable-languages=c,c++ \
--disable-nls \
--disable-multilib \
--enable-initfini-array
}
build {
make -j@(thread_count) all-gcc
make -j@(thread_count) all-target-libgcc
}
install {
DESTDIR=@(install_dir) make install-gcc
DESTDIR=@(install_dir) make install-target-libgcc
}
}
// TODO: Possibly implement a configure esque build system for rdsk.. if not autotools
host/rdsk {
source: rdsk
configure {
cp -r @(source_dir)/src .
cp @(source_dir)/Makefile .
}
build { make -j@(thread_count) all }
install { DESTDIR=@(install_dir) PREFIX=@(prefix) make install }
}
host/mkimg {
source: mkimg
configure { cp @(source_dir)/go.mod @(source_dir)/go.sum @(source_dir)/main.go . }
build { go build }
install {
mkdir -p @(install_dir)@(prefix)/bin
cp mkimg @(install_dir)@(prefix)/bin
}
}
// // // // // //
// Target Recipes
target/mlibc_headers {
source: mlibc
dependencies [ source/support ]
configure {
meson setup \
--cross-file @(sources_dir)/support/elysium.cross-file \
--prefix=@(prefix) \
-Dheaders_only=true \
-Ddisable_iconv_option=true \
-Ddisable_intl_option=true \
-Ddisable_crypt_option=true \
-Ddisable_linux_option=true \
--buildtype=release \
@(source_dir)
}
build { ninja }
install { DESTDIR=@(install_dir) ninja install }
}
target/mlibc {
source: mlibc
dependencies [ target/mlibc_headers host/bootstrap_gcc source/support ]
configure {
meson setup \
--cross-file @(sources_dir)/support/elysium.cross-file \
--prefix=@(prefix) \
--libdir=lib \
-Dmlibc_no_headers=true \
-Ddisable_iconv_option=true \
-Ddisable_intl_option=true \
-Ddisable_crypt_option=true \
-Ddisable_linux_option=true \
--buildtype=debug \
-Ddefault_library=both \
@(source_dir)
}
build { ninja }
install { DESTDIR=@(install_dir) ninja install }
}
target/tartarus {
source: tartarus
dependencies [ host/cross_gcc source/support ]
configure {
@(source_dir)/conf.sh \
--prefix=@(prefix) \
--target=x86_64-bios \
--libgcc-dir=@(sources_dir)/support/libgcc
}
build { make -j@(thread_count) all }
install { DESTDIR=@(install_dir) make install }
}
target/kernel_headers {
dependencies [ target/mlibc_headers target/tartarus ]
configure { cp -r @(sysroot_dir)/usr/include/* . }
install {
mkdir -p @(install_dir)/usr/include
cp -r . @(install_dir)/usr/include
}
}
target/kernel {
source: kernel
dependencies [ host/gcc target/kernel_headers source/support ]
configure {
@(source_dir)/conf.sh \
--prefix=@(prefix) \
--target=x86_64 \
--libgcc=@(sources_dir)/support/libgcc/x86_64.a
}
build { make all SYSROOT=@(sysroot_dir) }
install { DESTDIR=@(install_dir) make install }
}
target/elib {
source: elib
dependencies [ host/gcc target/mlibc_headers ]
configure { cp -r @(source_dir)/* . }
build { make libelib.a }
install {
mkdir -p @(install_dir)@(prefix)/lib
cp libelib.a @(install_dir)@(prefix)/lib
mkdir -p @(install_dir)@(prefix)/include
cp elib.h @(install_dir)@(prefix)/include
}
}
target/init {
source: init
dependencies [ host/gcc target/mlibc_headers target/elib ]
configure { cp -r @(source_dir)/* . }
build { make init }
install {
mkdir -p @(install_dir)@(prefix)/bin
cp init @(install_dir)@(prefix)/bin
}
}
target/root {
dependencies [ host/rdsk target/mlibc target/init ]
configure {
mkdir ./rootdir
cp -r @(sysroot_dir)/* ./rootdir
mkdir ./rootdir/modules
mkdir ./rootdir/tmp
}
build { rdsk -c ./rootdir -o root.rdk }
install {
mkdir -p @(install_dir)@(prefix)/share
cp root.rdk @(install_dir)@(prefix)/share/root.rdk
}
}
target/image {
dependencies [ host/mkimg target/root source/support target/tartarus target/kernel ]
build {
cp @(sysroot_dir)@(prefix)/share/root.rdk .
cp @(sysroot_dir)@(prefix)/share/tartarus/* .
cp @(sysroot_dir)@(prefix)/share/kernel.elf .
cp @(sources_dir)/support/tartarus.cfg .
nm kernel.elf -n > kernelsymbols.txt
mkimg --config=@(sources_dir)/support/mkimg.toml
}
install { cp elysium.img @(install_dir) }
}