Open main menu

Difference between revisions of "Compiling ScummVM/Nintendo 3DS"

no edit summary
m
Line 2: Line 2:


=== Prerequisites ===
=== Prerequisites ===
* Latest version of devkitPro, which comes with devkitARM and <code>libctru</code>
* Latest version of devkitPro, which comes with devkitARM and <code>libctru</code>
* <code>citro3d</code> thorugh devkitPro's pacman
* <code>citro3d</code> thorugh devkitPro's pacman
* Optional: You should compile third-party libraries for the 3ds (commonly referred to as portlibs in the devkitPRO community). Some games requires these to operate properly.
* Optional: You should compile third-party libraries for the 3ds (commonly referred to as portlibs in the devkitPRO community). Some games requires these to operate properly.


=== Compiling third-party libraries ===
=== Compiling third-party libraries ===
It is strongly recommended that you use devkitPro's pacman in order to get the most recent
It is strongly recommended that you use devkitPro's pacman in order to get the most recent
portlibs for your build.
portlibs for your build. Instructions for accessing these binaries can be found here:
https://devkitpro.org/wiki/devkitPro_pacman


The following libraries can be downloaded with pacman:
The following libraries can be downloaded with pacman:
{|class="wikitable"
{|class="wikitable"
!  Library      ||  Package
!  Library      ||  Package
Line 30: Line 32:
|-
|-
|  flac        ||  3ds-flac
|  flac        ||  3ds-flac
|-
|  curl        ||  3ds-curl
|-
|-
|  libtheora    ||  3ds-libtheora
|  libtheora    ||  3ds-libtheora
|-
|  curl        ||  3ds-curl
|}
|}


Line 47: Line 49:
The following pacman packages are also recommended:
The following pacman packages are also recommended:
* <code>3ds-dev</code>
* <code>3ds-dev</code>
* <code>devkitpro-pkgbuild-helpers</code>
* <code>dkp-toolchain-vars</code>


Once you have the <code>devkitpro-pkgbuild-helpers</code> package, you should be able to find
Once you have the <code>dkp-toolchain-vars</code> package, you should be able to find the following
the following scripts in your <code>/opt/devkitpro</code> folder:
scripts in your <code>/opt/devkitpro</code> folder:
* <code>devkitarm.sh</code>
* <code>devkitarm.sh</code>
* <code>3dsvars.sh</code>
* <code>3dsvars.sh</code>


Run them one after the other with `source` in order to setup your environment variables
Run them one after the other with <code>source</code> in order to setup your environment variables
for cross-compiling:
for cross-compiling:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 64: Line 66:
scripts that they may have, and then they can usually be built with the following steps
scripts that they may have, and then they can usually be built with the following steps
from their source directory:
from their source directory:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
mkdir -p $PORTLIBS_PREFIX
mkdir -p $PORTLIBS
./configure --prefix=$PORTLIBS_PREFIX --host=arm-none-eabi --disable-shared --enable-static
./configure --prefix=$PORTLIBS --host=arm-none-eabi --disable-shared --enable-static
make
make
make install
make install
</syntaxhighlight>
</syntaxhighlight>
Most libraries used can be compiled with same commands and configuration flags.
Most libraries used can be compiled with same commands and configuration flags.


=== Manually setting up the environment ===
=== Manually setting up the environment ===
In case you don't have the helpers package downloaded, you can use the following to set-up
In case you don't have the <code>dkp-toolchain-vars</code> package downloaded, you can use the
your environment variables.
following to set-up your environment variables.


It is assumed that you have these variables already set up. If not, then do so:
It is assumed that you have these variables already set up. If not, then do so:
{|class="wikitable"
{|class="wikitable"
|  DEVKITPRO    ||  Your root devkitPro directory
|  DEVKITPRO    ||  Your root devkitPro directory (usually /opt/devkitpro)
|-
|-
|  DEVKITARM    ||  Your root devkitARM directory (probably same as $DEVKITPRO/devkitARM)
|  DEVKITARM    ||  Your root devkitARM directory (probably same as $DEVKITPRO/devkitARM)
|-
|-
|  CTRULIB      ||  Your root libctru directory (probably same as $DEVKITPRO/libctru)  
|  CTRULIB      ||  Your root libctru directory (probably same as $DEVKITPRO/libctru)
|}
|}


In the source directory of the library:
In the source directory of the library:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
export PORTLIBS_PREFIX=$DEVKITPRO/portlibs/3ds
export PORTLIBS=$DEVKITPRO/portlibs/3ds
export PATH=$DEVKITARM/bin:$PATH
export PATH=$DEVKITPRO/tools/bin:$PORTLIBS/bin:$DEVKITARM/bin:$PATH
export PKG_CONFIG_PATH=$PORTLIBS_PREFIX/lib/pkgconfig
export PKG_CONFIG_PATH=$PORTLIBS/lib/pkgconfig
export PKG_CONFIG_LIBDIR=$PORTLIBS_PREFIX/lib/pkgconfig
export PKG_CONFIG_LIBDIR=$PORTLIBS/lib/pkgconfig
export CFLAGS="-g -march=armv6k -mtune=mpcore -mfloat-abi=hard -O2
export CFLAGS="-g -march=armv6k -mtune=mpcore -mfloat-abi=hard -O2
                     -mword-relocations -ffunction-sections -fdata-sections"
                     -mword-relocations -ffunction-sections -fdata-sections"
export CPPFLAGS="-I$PORTLIBS_PREFIX/include -I$CTRULIB/include"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-L$PORTLIBS_PREFIX/lib"
export CPPFLAGS="-D_3DS -D__3DS__ -I$PORTLIBS/include -I$CTRULIB/include"
export LDFLAGS="-L$PORTLIBS/lib -L$CTRULIB/lib"
export TOOL_PREFIX=arm-none-eabi-
export CC=${TOOL_PREFIX}gcc
export CXX=${TOOL_PREFIX}g++
export AR=${TOOL_PREFIX}gcc-ar
export RANLIB=${TOOL_PREFIX}gcc-ranlib
export LIBS="-lctru"
</syntaxhighlight>
</syntaxhighlight>


Line 105: Line 112:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
export PATH=$DEVKITARM/bin:$PATH
export PATH=$DEVKITARM/bin:$PATH
</syntaxhighlight>
In case you get an error about "namespace _3DS", edit the line in /opt/devkitpro/3dsvars.sh that reads
<syntaxhighlight lang="bash">
export CPPFLAGS="-D_3DS -I${PORTLIBS_PREFIX}/include -I${DEVKITPRO}/libctru/include"
</syntaxhighlight>
and remove the "-D_3DS" part so that it reads
<syntaxhighlight lang="bash">
export CPPFLAGS="-I${PORTLIBS_PREFIX}/include -I${DEVKITPRO}/libctru/include"
</syntaxhighlight>
</syntaxhighlight>


Note: In more recent codebases of ScummVM, you may or may not need to set the following beforehand:
Note: In more recent codebases of ScummVM, you may or may not need to set the following beforehand:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
export PKG_CONFIG_LIBDIR=$PORTLIBS_PREFIX/lib/pkgconfig
export PKG_CONFIG_LIBDIR=$PORTLIBS/lib/pkgconfig
</syntaxhighlight>
</syntaxhighlight>
See above for <code>$PORTLIBS_PREFIX</code>.
See above for $PORTLIBS.


ScummVM doesn't provide the CA certificates bundle required by the cloud synchronization features.
ScummVM doesn't provide the CA certificates bundle required by the cloud synchronization features.
271

edits