PARI/GP


Main
  Download
  Packages
  GP in your browser
  Timeline
  Funding
  SEARCH

Help
  FAQ
  Documentation
  Tutorials
  Mailing Lists
  Contributed GP scripts

Development
  Ateliers PARI/GP
  Bugs
  Latest Changes
  Version Control
  Coding Guidelines
  PariDroid

Tests & benchmarks
  Buildlogs
  Coverage Report
  Doc Coverage
  Benchmarks

Miscellaneous
  WWW Stats
  Logo
  Fun!
  Links

PariDroid

PariDroid is a port of PARI/GP to Android, started by Charles Boyd and currently maintained by Andreas Enge. It is distributed under the GNU General Public License, either version 3 of the licence, or (at your option) any later version (GPLv3+).

Installing PariDroid

Ready to use packages in the .apk format can be found in the download section. They are also available via the F-Droid and the Google Play stores.

The remainder of this page describes how to compile the source code for yourself; there is no need to do so if you are happy with the provided binaries.

Installing the Android build environment

1. SDK

Download the Android SDK, for instance the Linux build r24.4.1, and unpack it into some location. In the following, we will assume that the resulting directory is /usr/local/android-sdk-r24.4.1. Add the android and emulator64-arm binaries to your path, for instance as symbolic links:

export SDK=/usr/local/android-sdk-r24.4.1
su
cd /usr/local/bin
ln -s $SDK/tools/android
ln -s $SDK/tools/emulator64-arm

or by extending the execution path:

export PATH=$SDK/tools:$PATH

Install an Android platform by running

android

and, in the window that opens, keep the selected Android SDK Platform-tools and Android SDK Build-tools. Click on Obsolete. Deselect Android 6.0 (API 23) and select Android 3.0 (API 11) instead. Click on Install packages, accept the non-free license and install.

The previous step has populated $SDK/platforms, $SDK/platform-tools and $SDK/build-tools. Add adb and zipalign to your execution path:

cd /usr/local/bin
ln -s $SDK/platform-tools/adb
ln -s $SDK/build-tools/24.0.0/zipalign

Some of the tools are 32 bit dynamically linked binaries (try running $SDK/build-tools/23.0.2/aapt, for instance). So you need to have suitable 32 bit libraries installed. Under Debian,

apt-get install libc6-i386 zlib1g:i386 libstdc++6:i386
appears to be enough to pull in all the needed dependencies.

2. Emulator

For the emulator to work, we need to create a virtual Android device (avd). First,

android list target

shows two possible targets. The first one, called android-11, corresponds to the basic Android environment; the second one appears to include additional libraries from Google.

android create avd -t android-11 -n android11

now creates a new virtual device with the name android11, which should be listed when executing

android list avd

To enable input from the computer keyboard as if it were typed on the telephone, add to the file ~/.android/avd/android11.avd/config.ini the line hw.keyboard=yes .

Start the Android emulator with

emulator64-arm -avd android11 &

A window opens in which (after a few minutes) a telephone screen is simulated. If for simpler testing purposes you can make do without a window, the command

emulator64-arm -avd android11 -no-audio -no-window &

starts the emulator faster in command line mode. To see whether the emulator is ready, call

adb get-state

which returns device when the emulator is ready (and unknown before). Or wait until

adb wait-for-device

returns. The emulator may be stopped with

adb -s emulator-5554 emu kill

3. NDK

To later compile and integrate the PARI C library into the project, download the Android NDK; for instance, Linux 64bit r10e. Rename the file to obtain the suffix 7z and unpack it with the command p7zip -d, for instance as /usr/local/android-ndk-r10e.

Setting up the PariDroid project

The following steps need to be executed only once. Download PariDroid from its git repository:

git clone http://pari.math.u-bordeaux.fr/git/paridroid.git
cd paridroid/PariDroid

Prepare the Android project:

android update project --target android-11 -s -p .
cd ..

It is not necessary any more to prepare by hand the PARI source code; it will be fetched automatically from the git server and placed into the ../srclib/pari directory, next to the PariDroid sources, when invoking make for the first time. The Makefile also contains the logic to check out the correct PARI version depending on the PariDroid version number: its first three fields specify the PARI version. If it corresponds to a released version, the corresponding git tag is checked out. Otherwise, the latest git master is fetched.

The Makefile is set up to create an apk in release mode, which is then signed with a debug key. On the first run, this key needs to be created by doing a debug build:

cd PariDroid
ant debug
cd ..

Building PariDroid

Set the environment variable NDK to contain the path to the Android NDK, which is used by the Makefile:

export NDK=/usr/local/android-ndk-r10e

A call to

make

configures and compiles the PARI library and compiles the PariDroid project into the package PariDroid-VERSION.apk, signed with a debug key and aligned.

The unsigned and unaligned package resides in PariDroid/bin/PariDroid-release-unsigned.apk, the signed and unaligned package in PariDroid/bin/PariDroid-release-unaligned.apk.

make distclean

removes the generated files. The final package can be tested by installing it in the emulator:

adb install PariDroid-VERSION.apk

After clicking on the application icon on the telephone screen, a click on the PariDroid icon should open the program. To simplify further tests, the icon can be dragged onto the home screen (it will always refer to the latest installed PariDroid instance).

The package can be uninstalled using

adb uninstall fr.ubordeaux.math.paridroid

or, more easily, an installed package can be overwritten with

adb install -r PariDroid-VERSION.apk

For debugging purposes, it may be useful to launch the command

adb logcat

in a separate terminal window.

Remarks for the maintainers

The configuration file pari.cfg for version PARI_VERSION of PARI is kept in the subdirectory config/PARI_VERSION. The version 2.10.0 is a synonym for the HEAD of git master, and as such is a moving target. After updating the PARI sources, it may thus be necessary to recreate the configuration file.

To do so, make sure that the emulator is running (with or without a window) and that adb is in your path. Then run

make pari-config-standalone

and retrieve the generated file srclib/pari/Oandroid-arm/pari.cfg.


PARI/GP Development
Last Modified: 2017-02-07 18:31:09
Copyleft © 2003-2016 the PARI group.