Skip to content

Commit 5572d90

Browse files
Add pnut-exe step to manifest
1 parent 876bc3f commit 5572d90

5 files changed

Lines changed: 92 additions & 0 deletions

File tree

seed/seed.kaem

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ M2LIBC_PATH=/M2libc
6161
# mes envars
6262
NYACC_PKG=nyacc-1.00.2
6363
MES_PKG=mes-0.27.1
64+
PNUT_PKG=pnut-1.0
6465
MES_PREFIX=${SRCDIR}/${MES_PKG}/build/${MES_PKG}
6566
GUILE_LOAD_PATH=${MES_PREFIX}/mes/module:${MES_PREFIX}/module:${SRCDIR}/${MES_PKG}/build/${NYACC_PKG}/module
6667

steps/manifest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
build: checksum-transcriber-1.0
3535
build: simple-patch-1.0
3636
build: mes-0.27.1
37+
build: pnut-exe-1.0
3738
build: tcc-0.9.26
3839
build: tcc-0.9.27
3940
define: BUILD_FIWIX = ( KERNEL_BOOTSTRAP == True || BUILD_KERNELS == True )

steps/pnut-exe-1.0/pass1.kaem

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/bin/sh
2+
3+
# SPDX-FileCopyrightText: 2025 Laurent Huberdeau
4+
#
5+
# SPDX-License-Identifier: GPL-3.0-or-later
6+
7+
set -ex
8+
9+
# Variables
10+
M2LIB="../../../M2-Planet/M2libc/"
11+
PNUT_BRANCH="laurent-small-fixes-for-TCC"
12+
PNUT_DIR="pnut-${PNUT_BRANCH}"
13+
14+
# Check tarball checksums
15+
checksum-transcriber sources
16+
sha256sum -c sources.SHA256SUM
17+
18+
# Unpack
19+
mkdir build
20+
cd build
21+
# ungz --file ${DISTFILES}/${PNUT_PKG}.tar.gz --output ${PNUT_PKG}.tar
22+
untar --file ${DISTFILES}/${PNUT_PKG}.tar
23+
24+
M2-Planet \
25+
--architecture x86 \
26+
--debug \
27+
--expand-includes \
28+
-I ${M2LIB} \
29+
--file ${PNUT_DIR}/pnut.c \
30+
-D target_i386_linux=1 \
31+
-D NO_TERNARY_SUPPORT=1 \
32+
-D ONE_PASS_GENERATOR=1 \
33+
-D SMALL_HEAP=1 \
34+
-o pnut-exe.M1
35+
36+
# Generate basic DWARF debug info (optional)
37+
blood-elf \
38+
--file pnut-exe.M1 \
39+
--little-endian \
40+
--entry _start \
41+
--output pnut-exe-footer.M1
42+
43+
# Compile to hex2 (for debug: -f pnut-footer.M1)
44+
M1 \
45+
--file ${M2LIB}/x86/x86_defs.M1 \
46+
--file ${M2LIB}/x86/libc-full.M1 \
47+
--file pnut-exe.M1 \
48+
--file pnut-exe-footer.M1 \
49+
--architecture x86 \
50+
--little-endian \
51+
--output pnut-exe.hex2
52+
53+
# Assemble
54+
mkdir -p bin
55+
56+
hex2 \
57+
--architecture x86 \
58+
--little-endian \
59+
--file ${M2LIB}/x86/ELF-x86-debug.hex2 \
60+
--file pnut-exe.hex2 \
61+
--base-address 0x8048000 \
62+
--output bin/pnut-exe
63+
64+
# Recompile pnut with itself, this time
65+
./bin/pnut-exe \
66+
-D target_i386_linux=1 \
67+
-D ONE_PASS_GENERATOR=1 \
68+
-D BOOTSTRAP_TCC=1 \
69+
${PNUT_DIR}/pnut.c \
70+
-o bin/pnut-exe-for-tcc
71+
72+
# Install pnut-exe
73+
cp bin/pnut-exe-for-tcc ${BINDIR}/pnut
74+
chmod 755 ${BINDIR}/pnut
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
62895fcf68b21961e018c797b3144fc86f9dbd5a535776e9e68a01b3fd33de08 /usr/bin/mes-m2
2+
761fe4fbbee5bfd45506ea8dbd0aeecfe8855159bd794e07fca1988109510170 /usr/bin/mescc.scm
3+
234c264965116a24583dd569050adc766d7cc2da83b1db38085210f26031b70c /usr/lib/x86-mes/crt1.s
4+
494f184a87175abc485a898c250c3831b2b5dcf5aead46591e00b39d1c5529fc /usr/lib/x86-mes/crt1.o
5+
8afe05c3e1e8848b6f3e8de751524de5f69818eb8524659827918e3fddde3e1e /usr/lib/x86-mes/x86.M1
6+
06c6e43ab7f09e7779df786c57ba5b8775468ae8a47a0426278e9adc52d675c8 /usr/lib/x86-mes/libmescc.s
7+
ef79bc2c59768c172ff4806c6eff9c5e1373d5660c51b33ee4a513f9dda726bd /usr/lib/x86-mes/libc+tcc.s
8+
69050424c9bd83cea8d9b878d5a7cbca01fd4a43b3722a34145843d80f4c8e40 /usr/lib/x86-mes/libc.s
9+
bfb362848fc83a8a58421636a51b1514d1915b58a5a2354c703dfec64c899cad /usr/lib/x86-mes/libmescc.a
10+
b00e8579329bf011bfccebaeb96c1fedb160a38cad63fd628d6b9110b6fb268a /usr/lib/x86-mes/libc+tcc.a
11+
b31c6a0fe5feb53d2d8ba1989c936fd94f43967b8e655ae1c36392723dc8ae3d /usr/lib/x86-mes/libc.a
12+
82cac4353375a52efecc6fda1f8b37373988fe41ed197b63d8e906321b105d77 /usr/lib/linux/x86-mes/elf32-header.hex2
13+
f9873d9aab12e70f24d97f8319e17a1e698ca60779ae9a6ab3ede648cd60fc61 /usr/lib/linux/x86-mes/elf32-footer-single-main.hex2

steps/pnut-exe-1.0/sources

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
f https://github.com/udem-dlteam/pnut/archive/refs/heads/laurent/small-fixes-for-TCC.tar.gz 6e662dbf450c8ec2b3be0bfd5db6e198c566f430e63c29edd7225dbdf09de17b pnut-1.0.tar.gz
2+
f https://github.com/udem-dlteam/pnut/archive/refs/heads/laurent/small-fixes-for-TCC.tar.gz 66df0ebd8e2507cbab63c253b1911c5cbb9ba90635f88e9017a4adc83c90ecb0 pnut-1.0.tar
3+
f https://mirrors.kernel.org/gnu/mes/mes-0.27.1.tar.gz 183a40ea47ea49f8a1e3bd1b9d12e676374d64d63bc79e7bc1ae7d673dfdf25d

0 commit comments

Comments
 (0)