Create GCC in podman

This commit is contained in:
Jaby 2025-01-02 19:47:47 +01:00
parent d0a60373ec
commit 09cb984f56
11 changed files with 57 additions and 19 deletions

16
podman/Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM "ubuntu:24.04"
ADD ["scripts/install_pop-fe.sh", "scripts/install_rust.sh", "scripts/make_gcc.sh", "scripts/prerequisites.sh", "/usr/scripts"]
RUN apt update && cd /usr/scripts && ./prerequisites.sh && ./install_rust.sh && cd /usr && ./scripts/make_gcc.sh
#RUN apt update && apt install -y nginx
#RUN mkdir /app
#WORKDIR /app
#VOLUME my_vol (Do not use)
#ADD install_pop-fe.sh install_pop-fe.sh
#CMD ["cp", "install_pop-fe.sh", "/my_vol"]
# TODO: Make a script that builds the image and then registers alias like `jaby-make` for the docker command

1
podman/install.sh Normal file
View File

@ -0,0 +1 @@
podman build -t jaby_engine .

5
podman/scripts/install_rust.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo "<<< Install Rust >>>"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
cargo install cargo-edit --locked

View File

@ -1,55 +1,64 @@
#!/bin/bash #!/bin/bash
GCC_VERSION=13.1.0
echo "<<< Build GCC >>>"
mkdir -p psx-gcc mkdir -p psx-gcc
cd psx-gcc cd psx-gcc
echo "clone binutils" echo "<<< clone binutils >>>"
git clone git://sourceware.org/git/binutils-gdb.git git clone git://sourceware.org/git/binutils-gdb.git
cd binutils-gdb cd binutils-gdb
mkdir -p build mkdir -p build
cd build cd build
echo "Configure binutils" echo "<<< Configure binutils >>>"
../configure --target=mipsel-linux-gnu --with-sysroot --disable-nls --disable-werror ../configure --target=mipsel-linux-gnu --with-sysroot --disable-nls --disable-werror
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
echo "Make binutils" echo "<<< Make binutils >>>"
make make
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
echo "Install binutils" echo "<<< Install binutils >>>"
sudo make install make install
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
cd ../.. cd ../..
echo "clone gcc" echo "<<< clone gcc >>>"
git clone --recurse-submodules git://gcc.gnu.org/git/gcc.git git clone --recurse-submodules git://gcc.gnu.org/git/gcc.git
cd gcc cd gcc
echo "checkout gcc 13.1.0" echo "<<< checkout gcc $GCC_VERSION >>>"
git checkout releases/gcc-13.1.0 git checkout releases/$GCC_VERSION
mkdir -p build mkdir -p build
cd build cd build
echo "configure gcc" echo "<<< configure gcc >>>"
../configure --target=mipsel-linux-gnu --disable-nls --enable-languages=c,c++ --without-headers ../configure --target=mipsel-linux-gnu --disable-nls --enable-languages=c,c++ --without-headers
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
echo "Make gcc" echo "<<< Make gcc >>>"
make all-gcc make all-gcc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
echo "Install gcc" echo "<<< Install gcc >>>"
sudo make install-gcc make install-gcc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
echo "<<< Delete GCC folder >>>"
cd /usr
rm -fr psx-gcc
# TODO: Remove gcc files after everything

View File

@ -0,0 +1,3 @@
#!/bin/bash
echo "<<< Install prerequisites >>>"
apt install -y curl make texinfo g++ gcc git libgmp3-dev libmpfr-dev libmpc-dev flex install-info info bison

View File

@ -1,5 +1,6 @@
- [JabyEngine](#jabyengine) - [JabyEngine](#jabyengine)
- [About](#about) - [About](#about)
- [Podman](#podman)
- [How to build](#how-to-build) - [How to build](#how-to-build)
- [Building `JabyEngine` (without VSCode)](#building-jabyengine-without-vscode) - [Building `JabyEngine` (without VSCode)](#building-jabyengine-without-vscode)
- [Building support library (without VSCode)](#building-support-library-without-vscode) - [Building support library (without VSCode)](#building-support-library-without-vscode)
@ -14,6 +15,15 @@
## About ## About
JabyEngine is my personal attempt to eventually make my own PS1 game from "ground up". Originally I didn't indented to release this code publicly but recently I decided to give it a try. If you read this, thank you! JabyEngine is my personal attempt to eventually make my own PS1 game from "ground up". Originally I didn't indented to release this code publicly but recently I decided to give it a try. If you read this, thank you!
## Podman
* `sudo apt install podman`
* `podman build -t jaby_engine <Folder of Dockerfile>`
* `podman images`: lists all images
* `podman image rm <COMMIT ID>`: removes an image
* `podman run -it <COMMIT ID> /bin/bash`: runs bash and interactive
* `podman run --rm <-v <local_folder>:<absolute docker_folder> <-e ENV_VAR=VALUE> jaby_engine`: clean up after run
* `podman image tree <TAG/ID>`: lists usefull information
## How to build ## How to build
JabyEngine relies on linux to be build. For Windows users it uses `wsl` instead but support for it might get dropped during further development. JabyEngine relies on linux to be build. For Windows users it uses `wsl` instead but support for it might get dropped during further development.

View File

@ -31,5 +31,4 @@ define cargo_unix_default
) )
endef endef
# Run `cargo install cargo-edit --locked`to support upgrade
# Windows build requires "rustup target add x86_64-pc-windows-gnu" and "sudo apt-get install mingw-w64" # Windows build requires "rustup target add x86_64-pc-windows-gnu" and "sudo apt-get install mingw-w64"

View File

@ -1,2 +0,0 @@
#!/bin/bash
sudo curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

View File

@ -1,3 +0,0 @@
#!/bin/bash
sudo apt update
sudo apt install make texinfo g++ gcc libgmp3-dev libmpfr-dev libmpc-dev flex install-info info bison