Skip to content

Commit

Permalink
add 3ds-sdl2, remove sdl1 (pc, 3ds)
Browse files Browse the repository at this point in the history
  • Loading branch information
vgmoose committed Jun 11, 2024
1 parent 7200380 commit ce7d8e1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# sealeo
A docker image to facilitate building homebrew apps across multi-platforms. Based on [Spheal](https://gitlab.com/4tu/spheal), but has support for both amd64 and arm64 architectures.
A docker image to facilitate building homebrew apps across multi-platforms. Based on [Spheal](https://gitlab.com/4tu/spheal), but has support for both arm64 and amd64 architectures.

<img src="https://user-images.githubusercontent.com/2467473/186280808-80ce15d7-f6d7-454a-82cb-21226a598a31.png" alt="baby" width="200" />

Expand All @@ -11,7 +11,7 @@ Building is deterministic since the deps are locked into the image, and also pot
Can be executed from the root of your [chesto](https://github.com/fortheusers/chesto) git project. Export the PLATFORM env variable to point to the target that you want to build for.

```
export PLATFORM=switch # or wiiu, 3ds, wii, pc, pc-sdl1
export PLATFORM=switch # or wiiu, 3ds, wii, pc
docker run -v $(pwd):/code -it ghcr.io/fortheusers/sealeo "make $PLATFORM"
```

Expand All @@ -26,12 +26,10 @@ This can be useful for non-Chesto projects or to debug code interactively.

## what's inside
The image is based on `debian`, inside is the following:
- sdl1 deps/portlibs for PC, 3ds, wii
- sdl2 deps/portlibs for PC, wiiu, switch
- dkp-pacman configured with dkP's repos
- sdl2 and curl for PC, wiiu, switch, wii, 3ds
- dkP toolchains: devkitA64, devkitARM, devkitPPC
- platform libs: libnx, libctru, libogc, wut
- platform libs: wut, libnx, libogc, libctru

If you don't need all of the above in one image, you're better off trying out one of [dkP's own containers](https://hub.docker.com/u/devkitpro/) and using that as a base. Sealeo does not use this approach in favor of working across multiple architectures, having all toolchains in one image, and being able to control more about what makes it into the image in the future.
If you don't need all of the above in one image, you're better off trying out one of [dkP's own containers](https://hub.docker.com/u/devkitpro/) and using that as a base. Sealeo does not use this approach in favor of working across multiple architectures, having all toolchains in one image, and being able to control which versions make it into the image.

The homebrew targets are only possible thanks to dkP's toolchains, you can [support them on Patreon](https://www.patreon.com/devkitPro) for their efforts.
35 changes: 26 additions & 9 deletions dependency_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# but is also useful when setting up a new env

# Before running it, you should export the desired PLATFORM environment
# variable ( one of pc, pc-sdl1, switch, 3ds, wii, wiiu, all )
# variable ( one of pc, switch, 3ds, wii, wiiu, all )
# eg. PLATFORM=switch ./dependency_helper.sh

# It may be easier to follow the README.md instructions for the
Expand All @@ -18,16 +18,17 @@ main_platform_logic () {
pc)
setup_deb_sdl_deps
;;
pc-sdl1)
setup_deb_sdl_deps
;;
# html5)
# apt-get -y install emscripten
# ;;
switch) # uses libnx
setup_dkp_repo
${DKP}pacman --noconfirm -S devkitA64 libnx switch-tools switch-curl switch-bzip2 switch-freetype switch-libjpeg-turbo switch-libwebp switch-sdl2 switch-sdl2_gfx switch-sdl2_image switch-sdl2_ttf switch-zlib switch-libpng switch-mesa switch-sdl2_mixer
;;
3ds) # uses libctru
setup_dkp_repo
${DKP}pacman --noconfirm -S devkitARM 3ds-sdl 3ds-sdl_image 3ds-sdl_mixer 3ds-sdl_gfx 3ds-sdl_ttf libctru citro3d 3dstools 3ds-curl 3ds-mbedtls
${DKP}pacman --noconfirm -S devkitARM libctru citro3d 3dstools 3ds-curl 3ds-mbedtls 3ds-cmake 3ds-mpg123 3ds-opusfile 3ds-libogg 3ds-libopus
install_3ds_sdl2
;;
wii) # uses libogc
setup_dkp_repo
Expand Down Expand Up @@ -71,18 +72,34 @@ install_wii_curl () {
rm -rf wii-packages
}

install_3ds_sdl2 () {
# https://wiki.libsdl.org/SDL2/README/n3ds

libs=("SDL" "SDL_ttf" "SDL_image")
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=/opt/devkitpro/devkitARM

for lib in "${libs[@]}"; do
git clone --recursive https://github.com/libsdl-org/${lib}.git -b SDL2
cd ${lib}
cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE="$DEVKITPRO/cmake/3DS.cmake" -DCMAKE_BUILD_TYPE=Release
cmake --build build
cmake --install build
cd ..
done
}

install_container_deps () {
apt-get update && apt-get -y install wget libxml2 xz-utils lzma build-essential haveged curl libbz2-dev
haveged &
touch /trustdb.gpg
}

setup_deb_sdl_deps () {
# Sets up both sdl1 and sdl2 requirements for ubuntu
apt-get -y install libsdl2-dev libsdl2-mixer-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-gfx-dev zlib1g-dev gcc g++ libcurl4-openssl-dev wget git libsdl1.2-dev libsdl-ttf2.0-dev libsdl-image1.2-dev libsdl-gfx1.2-dev libfreetype-dev libsdl-mixer1.2-dev libmpg123-dev
apt-get -y install libsdl2-dev libsdl2-mixer-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-gfx-dev zlib1g-dev gcc g++ libcurl4-openssl-dev wget git

# FYI for archlinux systems:
# pacman --noconfirm -S sdl2 sdl2_image sdl2_gfx sdl2_ttf sdl sdl_image sdl_gfx sdl_ttf
# pacman --noconfirm -S sdl2 sdl2_image sdl2_gfx sdl2_ttf
}

export DKP=""
Expand Down Expand Up @@ -118,7 +135,7 @@ install_container_deps
main_platform_logic

# handle the "all" target by looping through all platforms
all_plats=( pc pc-sdl1 wiiu switch 3ds wii )
all_plats=( pc wiiu switch 3ds wii )
if [[ $PLATFORM == "all" ]]; then
for plat in "${all_plats[@]}"
do
Expand Down

0 comments on commit ce7d8e1

Please sign in to comment.