Compilation on Linux and BSD does not have many surprises, as its foundation is Unix-based.
- At least one libretro implementation
- Working OpenGL headers (should be included by default, but you might need to install libgl/mesa development packages)
- libxml2-devel - For XML shaders and cheat support.
- freetype-devel - TTF font rendering
- ffmpeg/libavcodec - FFmpeg recording
- nvidia-cg-toolkit - Cg shaders
Some other libraries can be built support for as well, please refer to:
Satisfying dependencies under Fedora 20
sudo yum install make automake gcc gcc-c++ kernel-devel mesa-libEGL-devel libv4l-devel libxkbcommon-devel mesa-libgbm-devel Cg libCg zlib-devel freetype-devel libxml2-devel ffmpeg-devel SDL2-devel SDL-devel
This list of packages may not be complete.
Satisfying dependencies under Ubuntu 14.04
sudo apt-get install pkg-config libc6-dev libpulse-dev libsdl2-dev libxml2-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libv4l-dev x11proto-xext-dev libxxf86vm-dev libxinerama-dev libudev-dev libasound2-dev libxv-dev libopenal-dev libfreetype6-dev libgbm-dev libdrm-dev libegl1-mesa-dev libopenvg1-mesa-dev python3-dev zlib1g-dev nvidia-cg-dev fonts-dejavu-core python3 nvidia-cg-toolkit
There is no nvidia-cg-dev and nvidia-cg-toolkit packages for ubuntu ARMhf. You may want to install debhelper if you are using debuild to build the .deb package.
Mac OS X
Compilation on Mac OS X should require minimal dependencies.
- At least one libretro implementation
- Xcode installed (3.0 or higher)
- Nvidia Cg toolkit framework installed.
- Mac OS X should be version 10.6 or higher
- Cygwin (on Windows)
- Android SDK
- Eclipse with appropriate plugins (included)
- Android NDK
- To compile the shaders, you will need:
In the Android SDK, install the SDK for the targeted API level (currently, "Android 4.2.2 (API 17)" -> "SDK Platform").
Set up your environment accordingly:
- ANDROID_HOME should point to the location where the SDK was installed.
- NDK_ROOT and ANDROID_NDK should point to the location where the NDK was installed.
- Add NDK_ROOT and the path to the SDK "tools" subdirectory to your PATH.
For example, edit your .bashrc to add these lines:
export ANDROID_HOME=/cygdrive/d/Dev/Libs/Android/android-sdk-windows export NDK_ROOT=/cygdrive/d/Dev/Libs/Android/android-ndk-r8e export ANDROID_NDK=$NDK_ROOT export PATH=$NDK_ROOT:$ANDROID_HOME/tools:$PATH
Building libretro cores
git clone https://github.com/libretro/libretro-super.git cd libretro-super ./libretro-fetch.sh # can fail on fork() calls, repeat until all are up to date ./libretro-build-android-mk.sh # some cores may fail to compile (g++ "Argument list too long" error) # see https://github.com/libretro/libretro-super/issues/10
# convert shaders cd retroarch make -f Makefile.griffin shaders-convert-glsl # On Windows, you will need to specify the path to Python 3 explicitly, e.g.: #make -f Makefile.griffin PYTHON3=C:\\Soft\\Python34\\python.exe shaders-convert-glsl # build native libs cd android/phoenix ndk-build clean && ndk-build # copy libretro cores mkdir -p assets/cores/ cp -R ../../../dist/android/armeabi-v7a/* assets/cores/ # copy core info cp -R ../../../dist/info assets/ # copy overlays mkdir -p assets/overlays cp -R ../../media/overlays/* assets/overlays/ # copy shaders mkdir -p assets/shaders_glsl cp -R ../../media/shaders_glsl assets/
When you need to rebuild the native code, run this from retroarch/android/phoenix:
From here, you have two options to build the Android Java application: from the command-line, of from Eclipse.
Building from the command line
android update project --path . ant debug
The first two commands need to only be run once. To rebuild the APK from the command line, you'll only need to run "ant debug" again.
Building from Eclipse
In Eclipse, set your workspace root to …/RetroArch/android. Then do “Import… – General – Existing Projects into Workspace” to get the native and phoenix projects in your workspace. I also copied the project.properties from phoenix to native, and created a src directory in native, to stop Eclipse from complaining, but that may just be because I’m using a really old version.
Then, when you want to deploy to your device (make sure USB debugging is enabled) right-click on the phoenix project and select “Run As – Android Application” or use Debug to attach the debugger. When the native libs change I will tend to Clean before doing Run, to make sure the libs were repackaged in the apk. Google for more info about running and debugging Android apps in Eclipse.
See also: docs/Building in Eclipse.md