first
This commit is contained in:
parent
8a97b330f2
commit
6c652ea22b
29
build.sh
Executable file
29
build.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
CC=cc
|
||||
RTFS=$(pwd)/rootfs
|
||||
mu_repo="https://git.macaw.me/8nl/micro-utils"
|
||||
ml_repo="git://git.musl-libc.org/musl"
|
||||
cc_repo="git://repo.or.cz/tinycc.git"
|
||||
|
||||
#Tests
|
||||
for i in tests/*; do
|
||||
if ! env CC=$CC $i; then
|
||||
echo "Build failed"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
#Clean
|
||||
./clean.sh
|
||||
|
||||
#Make rootfs
|
||||
mkdir rootfs
|
||||
|
||||
#Build system
|
||||
for i in stages/*; do
|
||||
if ! env mu_repo=$mu_repo ml_repo=$ml_repo cc_repo=$cc_repo RTFS=$RTFS $i; then
|
||||
echo "Build failed"
|
||||
exit 1
|
||||
fi
|
||||
done
|
10
stages/0-download-src.sh
Executable file
10
stages/0-download-src.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "* Download micro-utils sources..."
|
||||
git clone $mu_repo src
|
||||
|
||||
echo "* Download musl sources..."
|
||||
git clone $ml_repo libc
|
||||
|
||||
echo "* Download tcc sources..."
|
||||
git clone $cc_repo tcc
|
11
stages/1-libc.sh
Executable file
11
stages/1-libc.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
echo "* Build musl libc"
|
||||
|
||||
cd libc
|
||||
|
||||
make clean
|
||||
./configure CC=cc CFLAGS="-Os -s -pipe" --disable-warnings --disable-static --prefix=$RTFS
|
||||
make -j $(nproc)
|
||||
make install
|
||||
|
||||
cd ..
|
11
stages/2-cross-compiler.sh
Executable file
11
stages/2-cross-compiler.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
echo "* Build cross compiler"
|
||||
|
||||
cd tcc
|
||||
|
||||
make clean
|
||||
./configure --extra-cflags="-Os -s" --prefix=$RTFS/ --elfinterp=/lib/libc.so --config-musl --config-bcheck=no --enable-static
|
||||
make -j $(nproc)
|
||||
make install
|
||||
|
||||
cd ..
|
9
stages/3-micro-utils.sh
Executable file
9
stages/3-micro-utils.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
echo " * Build micro-utils"
|
||||
|
||||
cd src
|
||||
|
||||
env CC="$RTFS/bin/tcc" CFLAGS="-pedantic -Os -s -Wall -I $RTFS/include -L $RTFS/lib/tcc -L $RTFS/lib" ./build.sh
|
||||
mv bin/* $RTFS/bin
|
||||
|
||||
cd ..
|
10
stages/4-host-compiler.sh
Executable file
10
stages/4-host-compiler.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
echo "* Build host compiler"
|
||||
|
||||
cd tcc
|
||||
|
||||
./configure --extra-cflags="-Os -s" --prefix=$RTFS/ --elfinterp=/lib/libc.so --config-musl --config-bcheck=no --enable-static --cc=$RTFS/bin/tcc
|
||||
make -j $(nproc)
|
||||
make install
|
||||
|
||||
cd ..
|
20
tests/c.sh
Executable file
20
tests/c.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
out_name=$(mktemp XXXXXX)
|
||||
|
||||
echo "#include <stdio.h>" >> test.c
|
||||
echo "int main(void){return 0;}" >> test.c
|
||||
|
||||
$CC test.c -o $out_name
|
||||
rm test.c
|
||||
|
||||
if ./$out_name; then
|
||||
echo "[OK] C compiler work..."
|
||||
rm $out_name
|
||||
exit 0
|
||||
|
||||
else
|
||||
echo "[FAILED] Fix c compiler or headers..."
|
||||
rm $out_name
|
||||
exit 1
|
||||
|
||||
fi
|
12
tests/git.sh
Executable file
12
tests/git.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
if ! git > /dev/null; then
|
||||
echo "[OK] Git installed..."
|
||||
exit 0;
|
||||
|
||||
else
|
||||
echo "[FAILED] Git is not installed..."
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
12
tests/make.sh
Executable file
12
tests/make.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
if make -h > /dev/null; then
|
||||
echo "[OK] Make installed..."
|
||||
exit 0;
|
||||
|
||||
else
|
||||
echo "[FAILED] Make is not installed..."
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
12
tests/texinfo.sh
Executable file
12
tests/texinfo.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
if makeinfo -h > /dev/null; then
|
||||
echo "[OK] Texinfo installed..."
|
||||
exit 0;
|
||||
|
||||
else
|
||||
echo "[FAILED] Texinfo is not installed..."
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user