Compiling ScummVM/Android (on Windows)

From ScummVM :: Wiki
Jump to navigation Jump to search

I've written this article, as it was quite a struggle to get the Android version compiled on a Windows machine, using the instructions on the main Android compilation page.

I have gone into a lot more detail than would perhaps normally be necessary, as Android developers are not necessarily familiar with the whole compilation process, being more used to Java-based programming within an IDE.

The instructions are based on my own experiences, and may contain errors or omissions - use them at your own risk! Please feel free to correct any mistakes or fill in any blanks.

I hope it's useful. Please feel free to incorporate this back into the main Android instructions, if appropriate.

--HappyDog 10:47, 4 May 2011 (UTC)

NOTE: This is currently a work-in-progress. Please be patient!

An important note about paths

The most important thing to understand, when coming to compile ScummVM, is that it really doesn't like spaces in directory/file names. This may or may not be something that could be fixed within the ScummVM source code (i.e. in the make files) but in the meantime it is a practical restriction that we have to live with.

In addition, these files really don't like the inclusion of a drive letter in the paths (e.g. D:\MyTools). The colon causes all kinds of confusion.

Therefore, any paths that need to be passed into the configure script should be on the same drive as the main ScummVM code, and not contain any spaces. I found it helpful to install them all into a single /ScummVM folder (the 'ScummVM project folder') and these instructions assume you have done the same, with sub-directories named as described. If you change any of these paths, don't forget to modify any references to them.

Note that this only applies to paths which are passed into configure (either directly or via environment variables). Other paths (e.g. the path to CygWin) do not have these restrictions. For example, on my machine CygWin is installed to C:\cygwin whilst all the other code is in D:\ScummVM. However, I had to copy my Android SDK (installed to C:\Program Files\Programming\Android SDK) to D:\ScummVM\AndroidSDK, in order to get things working.

Installing CygWin

CygWin is a collection of Unix utilities, compiled so that they run on Windows. We will use these tools in order to compile ScummVM on a Windows machine. There are no doubt other alternatives to CygWin, but this is the method I used.

Summary, for experienced users

  1. CygWin is available from cygwin.com (setup.exe)
  2. As well as the default packages, you need to install the following:
    • make: The GNU version of the 'make' utility
    • binutils: The GNU assembler, linker and binary utilities

Step-by-step

This summarises the setup process I used, but full instructions are also available on the CygWin site.

  1. Download the CygWin installer from cygwin.com (setup.exe). Place it in a sub-folder somewhere, as it will create some extra files when it runs. The CygWin installer in unlike normal Windows installers. It does not directly contain any of the files that will be installed - it is simply a mechanism to connect to the central server and download the packages you specify. The number of CygWin utilities is massive, so the installer is a method of downloading just the items you need. You may therefore want to keep it around in case you need to add new tools in the future.
  2. Run the installer, and download the package list:
    1. Click next on the first screen.
    2. Click next to accept the default ('Install from internet') on the second page.
    3. Set the path you want to install to (I used C:\cygwin) and whether you want to install it for all Windows users or just yourself. Click next.
    4. Set a package directory. This is the local store for any packages that you download during the store process. You can delete these once installed, but it may be useful to keep them around in case you need to re-install in the future. I think it automatically chooses to put them in a Packages sub-folder, relative to the installer, but if not then this is what I would recommend. Click next.
    5. Set your connection method. Normally 'Direct connection' (the default) should be fine. Click next.
    6. The software will now download the mirror list, and ask you to pick one. It doesn't really matter which one you pick, but if you can spot one that is geographically close to you (based on the country code) then that should make the downloads a bit quicker. Click next.
    7. You will now be presented with a list of packages to install, with the minimal set of base packages already selected. In addition to these base packages, you should add the following items. You can locate items using the 'search' box at the top of the window. You select them by clicking the 'skip' so that it changes to a version number (you can unselect something if you selected it accidentally, by clicking the same place until it goes back to 'skip'). Once you have selected the necessary packages, click next. Here is the list of additional items:
      • make: The GNU version of the 'make' utility
        The utility used to build the application.
      • binutils: The GNU assembler, linker and binary utilities
        Includes some utilities used by the configure script, e.g. strings
    8. The installer will then download and install the necessary packages. This may take some time!
    9. When done, you will finally be prompted whether to create shortcuts. It's up to you. Click finish when done.
  3. CygWin is now ready to use. You can add additional packages later (or upgrade/remove packages) by re-running setup.exe.

Installing a Java Development Kit

The Java Development Kit is required in order to compile the Java parts of the Android code. Note that the JDK is a different thing to the JRE (Java Runtime Environment) which you may well already have installed.

You need to download and install the Java Development Kit (JDK) from http://www.oracle.com/technetwork/java/javase/downloads/index.html

Notes:

  • Select 'Download JDK' not 'Download JRE'!
  • You will need to accept the Oracle license agreement before you can start the download.
  • You will need to select the appropriate download from the list, which is 'Windows x86'. (Note that the Windows x64 version is probably required for 64-bit versions of Windows, but this is untested - you may or may not be able to compile with this version. Please update these notes if you have tried this.)

Installing Android SDK/NDK

The Android SDK (Software Development Kit) provides the tools and libraries required to create Android applications, written in Java. This is needed to build the main ScummVM Android application.

However, ScummVM is written in C++, and the SDK is a Java-based tool. Therefore, in order to compile the bulk of the ScummVM code you will also need the Android NDK (Native Development Kit), which allows code written in C or C++ to be compiled for the Android platform.

Summary, for experienced users

  1. Download the NDK from http://developer.android.com/sdk/ndk and unzip it into an 'AndroidNDK' folder within your ScummVM project folder.
  2. Download the SDK (zip version) from http://developer.android.com/sdk and unzip it into an 'AndroidSDK' folder within your ScummVM project folder.
  3. Run the SDK Manager and install the following packages:
    • Android SDK Tools
    • Android SDK Platform-tools
    • SDK Platform Android 1.6, API 4
    • SDK Platform Android 2.2, API 8
  4. You don't need to install Eclipse or the ADT plugin.

Installing the Android NDK

  1. Download the NDK from http://developer.android.com/sdk/ndk
  2. Create a folder called 'AndroidNDK', within your ScummVM project folder.
  3. Unzip the downloaded file and place the contents in this new folder.

You don't need to do anything further to configure the NDK. You will need to set some environment variables so that ScummVM knows where to find the necessary files, but this will be covered in a later step.

Installing the Android SDK

  1. Download the SDK from http://developer.android.com/sdk. Use the .zip version rather than the .exe file - I found that the .exe file failed to detect that Java was installed and so refused to allow me to continue.
  2. Create a folder called 'AndroidSDK', within your ScummVM project folder.
  3. Unzip the downloaded file and place the contents in this new folder.
  4. Run the 'SDK Manager.exe' file in the AndroidSDK folder.
  5. When it starts it will show a recommended list of packages to install. Click Cancel, as you do not need all of these packages.
  6. Go to the 'Available Packages' page and tick the following items in the Android Repository section (note that the Android SDK Tools are also required, but they should be installed already).
    • Android SDK Platform-tools
    • SDK Platform Android 1.6, API 4
    • SDK Platform Android 2.2, API 8
  7. Click 'Install Selected' to install them and on the pop-up window (which allows you to review your selection) click 'Install' to finalise the process.
  8. The selected packages will now be downloaded and installed, which may take a little while. At the end, you may be prompted to restart ADB (the Android Development Bridge) - if so, click Yes. Close the progress window and the SDK manager.

The main Android instructions also include notes about setting up Eclipse (a general purposes programming environment) and installing the ADT (Android Development Tools) plugin for it. These are not required in order to compile ScummVM, so it is outside the scope of this page. However, if you are planning to do any development work on the java side of things (as opposed to the c++ side) then you may find it useful to install these items, in which case please see the main Android SDK installation instructions provided by Google.

Compiling

To come... once I've got it working!