Permalink
Browse files

Add TuxMath source

This is adding TuxMath source to Pelya's framework for his port of the
SDL library to Android.

The TuxMath source was gotten by doing "apt-get source tuxmath" on a
Ubuntu 12.04 machine.

Several modifications were made to get the source to compile for Android.

Those modifications are:

*  Four files were moved from the src subdirectory to a new subdirectory
   called reacclimate.  Those four files are:
   generate_lesson.c, servermain.c, testclient.c and tuxmathadmin.c

*  A config.h file was created and put in the src subdirectory.  The defines
   in the file are not verified at all and are to some extent wild guesses.
   The defines in this file must be gone over more carefully, or at least
   must be dealt with in some manner (removing dependency on config.h in the
   program, or dealing with this in another way).

*  DATA_PREFIX is defined to local directory in globals.h

*  TUXLOCALE is defined the same as for WIN32 in tuxmath.c.  All ifdef cases
   other than Android have been commented out for now.  The other cases can
   be dealt with in a future fix.

This is all that has been changed within the tuxmath source thus far. Other
work was done to make the program ready for the framework Pelya created to
get projects using his port of the SDL library to Android working.

One of these changes is a new directory needs to be created:
project/jni/application/mathgame/AndroidData
then everything in project/jni/application/mathgame/mathgame/data must be
zipped up (within the data directory, something like: zip -r data.zip *),
and moved to AndroidData.  Then the zip file must be split up
(split -b 1000000 -d data.zip data.zip) within AndroidData, and then
the data.zip file erased.

The file project/jni/application/mathgame/icon.png is needed for use as
the default Android homescreen icon for this program.

The file project/jni/application/mathgame/AndroidAppSettings.cfg shows all
the configuration settings needed for Pelya's framework for builds on
Android using the SDL library.  Video depth is set to 16, although higher
depths can be tested.  We are set to Software video mode for now, we can
see how Hardware video mode works in the future.

Aside from the base SDL libraries, we are compiling four SDL extensions in:
sdl_mixer, sdl_image, sdl_ttf, and sdl_net.  We also compile the intl
library.

With the directories with the Android SDK's tools and platform-tools in our
path, as well as the Android NDK directory, we can compile this software
via Pelya's framework for Android SDL ports.  We compile by:

./ChangeAppSettings.sh -a
android update project -p project -t android-15
sh build.sh

Note we are targeting Android API 15 with this.  You can target lower
Android APIs if you want (android update project -p project -t android-12),
and will surely be able to target newer API versions as they come out.

This should result in a compiled Android APK file.
  • Loading branch information...
1 parent 8593012 commit f4ee995b801cd27e6fc8c82c47bdc2aaeb3c7e16 @dennis-sheil committed May 20, 2012
Showing 731 changed files with 213,959 additions and 23 deletions.
@@ -0,0 +1,46 @@
+# The application settings for Android libSDL port
+AppSettingVersion=17
+LibSdlVersion=1.2
+AppName="Math Games"
+AppFullName=com.panaceasupplies.android.games.math
+ScreenOrientation=h
+InhibitSuspend=y
+AppDataDownloadUrl="data|data.zip"
+VideoDepthBpp=16
+NeedDepthBuffer=n
+NeedStencilBuffer=n
+NeedGles2=n
+SwVideoMode=y
+SdlVideoResize=y
+SdlVideoResizeKeepAspect=y
+CompatibilityHacks=y
+CompatibilityHacksStaticInit=y
+AppUsesMouse=y
+AppNeedsTwoButtonMouse=n
+ShowMouseCursor=n
+ForceRelativeMouseMode=n
+AppNeedsArrowKeys=n
+AppNeedsTextInput=y
+AppUsesJoystick=n
+AppHandlesJoystickSensitivity=y
+AppUsesMultitouch=n
+NonBlockingSwapBuffers=y
+RedefinedKeys=" "
+AppTouchscreenKeyboardKeysAmount=0
+AppTouchscreenKeyboardKeysAmountAutoFire=0
+RedefinedKeysScreenKb=" "
+StartupMenuButtonTimeout=0
+HiddenMenuOptions=''
+FirstStartMenuOptions=''
+MultiABI=n
+AppVersionCode=1
+AppVersionName="1.0"
+ResetSdlConfigForThisVersion=y
+DeleteFilesOnUpgrade=" "
+CompiledLibraries="sdl_mixer sdl_image sdl_ttf sdl_net intl"
+CustomBuildScript=n
+AppCflags=''
+AppLdflags=''
+AppSubdirsBuild='mathgame/src mathgame/linebreak mathgame/linebreak/unistr mathgame/linebreak/uniwidth'
+AppCmdline=''
+ReadmeText=' '
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
@@ -0,0 +1 @@
+For now, see doc/ChangeLog for changes and their contributors.
@@ -0,0 +1,158 @@
+# This file implements a build for TuxMath using CMake
+# License information can be found in doc/COPYING.txt
+#
+# Copyright 2008 by Timothy E. Holy
+#
+# This was based on many examples, but a particular debt is owed to
+# Peter K�mmel of the LyX project.
+
+project(TuxMath)
+
+set(TUXMATH_VERSION "1.7.1")
+set(TUXMATHADMIN_VERSION "0.1.1")
+message("Building TuxMath version ${TUXMATH_VERSION}")
+
+## Setting up CMake itself
+cmake_minimum_required(VERSION 2.6)
+set(CMAKE_MODULE_PATH "${TuxMath_SOURCE_DIR}/cmake-modules")
+set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
+
+#message("CMP: ${CMAKE_MODULE_PATH}")
+
+## Choose a debug build set
+set(CMAKE_BUILD_TYPE Debug)
+
+## Decide on our build-type: installed or relocatable
+## Linux (& Windows?) would be installed, Mac relocatable
+## Someday we might supply a Linux relocatable package; this would be
+## specified by executing cmake -DTUXMATH_BUILD_TYPE=relocatable
+if (NOT TUXMATH_BUILD_TYPE)
+ if (APPLE)
+ set(TUXMATH_BUILD_TYPE relocatable)
+ else (APPLE)
+ set(TUXMATH_BUILD_TYPE installed)
+ endif (APPLE)
+endif (NOT TUXMATH_BUILD_TYPE)
+if (TUXMATH_BUILD_TYPE MATCHES installed)
+ message("The installation location is ${CMAKE_INSTALL_PREFIX}")
+endif (TUXMATH_BUILD_TYPE MATCHES installed)
+
+## Define the extra paths
+#set (DATA_TUXMATH ${tuxmath_SOURCE_DIR}/data)
+#set (DOC_TUXMATH ${tuxmath_SOURCE_DIR}/doc)
+#set (PO_TUXMATH ${tuxmath_SOURCE_DIR}/po)
+
+## Set up OS-specific path & build information
+if (APPLE)
+ set(TUXMATH_MACOSX_BUNDLE_NAME tuxmath)
+ set(MACOSX_BUNDLE_BUNDLE_VERSION ${TUXMATH_VERSION})
+ set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${TUXMATH_VERSION})
+ set(MACOSX_BUNDLE_LONG_VERSION_STRING ${TUXMATH_VERSION})
+ set(MACOSX_BUNDLE_ICON_FILE tuxmath.icns)
+ set(TUXMATH_DATA_PREFIX ${TUXMATH_MACOSX_BUNDLE_NAME}.app/Contents/Resources)
+ set(LOCALE_DIR ${TUXMATH_MACOSX_BUNDLE_NAME}.app/Contents/Resources/locale)
+ # OS X SDL Framework does not have a pre-built libSDLmain, so we
+ # instead include SDLmain.m as a source file
+ set (TUXMATH_EXTRA_INCLUDE ${TuxMath_SOURCE_DIR}/macosx)
+ set (TUXMATH_EXTRA_SRC ${TuxMath_SOURCE_DIR}/macosx/SDLMain.m)
+elseif (UNIX)
+ # A non-apple Unix (Linux, Solaris, etc.)
+ # This is where one would test for installed/relocatable, if that
+ # choice is implemented. For now we just provide installed.
+ set (TUXMATH_DATA_PREFIX ${CMAKE_INSTALL_PREFIX}/share/tuxmath)
+ set (LOCALE_DIR ${CMAKE_INSTALL_PREFIX}/share/locale)
+endif (APPLE)
+#message("TDP ${TUXMATH_DATA_PREFIX}")
+
+## OS X
+# Build universal binaries on OSX
+set(CMAKE_OSX_ARCHITECTURES ppc i386)
+
+## Decide on whether we're going to build with internationalization
+# We can't build with internationalization unless the build computer
+# supports msgfmt
+find_package(MSGFMT)
+if (NOT DEFINED ENABLE_NLS OR NOT MSGFMT_FOUND)
+ # You can disable NLS with -DENABLE_NLS=false
+ set(ENABLE_NLS ${MSGFMT_FOUND})
+endif (NOT DEFINED ENABLE_NLS OR NOT MSGFMT_FOUND)
+if (NOT ENABLE_NLS)
+ message("Internationalization disabled")
+endif (NOT ENABLE_NLS)
+# Even if the build computer supports gettext/msgfmt, we may not be
+# able to guarantee that the computers on which it is installed provides
+# runtime support for gettext. So we may have to build gettext.
+if (ENABLE_NLS)
+ if (APPLE)
+ set(TUXMATH_BUILD_INTL true)
+ endif (APPLE)
+else (ENABLE_NLS)
+ set(TUXMATH_BUILD_INTL false) # No point in building intl if no NLS
+endif (ENABLE_NLS)
+message("ENABLE_NLS ${ENABLE_NLS}")
+set(HAVE_GETTEXT ENABLE_NLS)
+# Check to see if we have SDL_Pango support for the right-to-left languages
+if (ENABLE_NLS)
+ find_package(SDL_Pango)
+ set(SDL_Pango ${SDLPANGO_FOUND}) # For the config.h file
+endif (ENABLE_NLS)
+
+# Line wrapping
+set(TUXMATH_BUILD_LINEBREAK true)
+set(LINEBREAK true)
+
+## Don't think we need SDL_gfx anymore:
+##FIND_PACKAGE(SDL_gfx REQUIRED)
+
+# Check for libRSVG for SVG support
+
+include(FindPkgConfig OPTIONAL)
+
+if(PKG_CONFIG_FOUND)
+ include(FindPkgConfig)
+ PKG_CHECK_MODULES(RSVG librsvg-2.0)
+ if(RSVG_FOUND)
+ PKG_CHECK_MODULES(CAIRO cairo)
+ if(CAIRO_FOUND)
+ set(HAVE_RSVG 1) # For the config.h file
+ endif(CAIRO_FOUND)
+ endif(RSVG_FOUND)
+endif(PKG_CONFIG_FOUND)
+
+
+## Run configure checks
+if (TUXMATH_BUILD_INTL)
+ include(ConfigureChecksIntl)
+endif (TUXMATH_BUILD_INTL)
+include(ConfigureChecks)
+
+## Add subdirectories
+if (TUXMATH_BUILD_INTL)
+ set(INTL_BINARY_DIR ${CMAKE_BINARY_DIR}/intl)
+ set(INTL_SOURCE_DIR ${CMAKE_SOURCE_DIR}/intl)
+ set(TOP_SRC_DIR ${CMAKE_BINARY_DIR})
+ set(PREFIX ${CMAKE_BINARY_DIR})
+ add_subdirectory(intl)
+endif (TUXMATH_BUILD_INTL)
+if (TUXMATH_BUILD_LINEBREAK)
+ set(LINEBREAK_BINARY_DIR ${CMAKE_BINARY_DIR}/linebreak)
+ set(LINEBREAK_SOURCE_DIR ${CMAKE_SOURCE_DIR}/linebreak)
+ set(TOP_SRC_DIR ${CMAKE_BINARY_DIR})
+ set(PREFIX ${CMAKE_BINARY_DIR})
+ add_subdirectory(linebreak)
+endif (TUXMATH_BUILD_LINEBREAK)
+add_subdirectory(src)
+add_subdirectory(data)
+add_subdirectory(doc)
+if (ENABLE_NLS)
+ set(LOCALE_INSTALL_DIR ${CMAKE_BINARY_DIR}/src/${LOCALE_DIR})
+ add_subdirectory(po)
+endif (ENABLE_NLS)
+
+#message("TMBD ${TuxMath_BINARY_DIR}")
+#message("TMBN ${TUXMATH_MACOSX_BUNDLE_NAME}")
+
+if (APPLE)
+ add_subdirectory(macosx)
+endif (APPLE)
+
@@ -0,0 +1,2 @@
+See doc/COPYING_GPL2 and doc/COPYING_GPL3 for the licenses for the source files
+ in this project.
@@ -0,0 +1,17 @@
+2007-10-18 gettextize <bug-gnu-gettext@gnu.org>
+
+ * configure.ac (AC_CONFIG_FILES): Add intl/Makefile.
+
+2007-10-18 gettextize <bug-gnu-gettext@gnu.org>
+
+ * Makefile.am (SUBDIRS): Remove intl.
+ * configure.ac (AC_CONFIG_FILES): Remove intl/Makefile.
+
+2007-10-15 gettextize <bug-gnu-gettext@gnu.org>
+
+ * Makefile.am (SUBDIRS): Add intl, po.
+ (ACLOCAL_AMFLAGS): New variable.
+ (EXTRA_DIST): New variable.
+ * configure.ac (AC_CONFIG_FILES): Add intl/Makefile, po/Makefile.in.
+
+For now, see doc/changelog for changes and their contributors.
@@ -0,0 +1 @@
+For now, see doc/INSTALL.txt for this information.
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>tuxmath</string>
+ <key>CFBundleGetInfoString</key>
+ <string></string>
+ <key>CFBundleIconFile</key>
+ <string>tuxmath.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.debian.alioth.tux4kids.TuxMath</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleLongVersionString</key>
+ <string>1.7.2</string>
+ <key>CFBundleName</key>
+ <string>TuxMath</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.7.2</string>
+ <key>CFBundleSignature</key>
+ <string>TXPT</string>
+ <key>CFBundleVersion</key>
+ <string>1.7.2</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
+ <key>LSRequiresCarbon</key>
+ <true/>
+ <key>NSHumanReadableCopyright</key>
+ <string></string>
+</dict>
+</plist>
Oops, something went wrong.

0 comments on commit f4ee995

Please sign in to comment.