PARI/GP

Main
  Download
  Packages
  GP in your browser
  Funding
  SEARCH

Help / Community
  FAQ
  Documentation
  Tutorials
  Mailing Lists
  Bugs
  Timeline
  Ateliers PARI/GP

Library
  Publications
  Contributed GP scripts
  Links
  Fun!

Development
  Latest Changes
  Version Control
  Coding Guidelines
  PariDroid
  Logo

Tests & benchmarks
  Buildlogs
  Coverage Report
  Doc Coverage
  Refcards test
  Benchmarks

  WWW Stats

PariDroid

PariDroid is a port of PARI/GP to Android, started by Charles Boyd and currently maintained by Andreas Enge and Laurent Facq. 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 (which appears to be the last version containing the tools/ subdirectory and to be independent of Android Studio), and unpack it into /usr/local/android-sdk-r24.4.1:

cd /tmp
wget http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
tar xvf android-sdk_r24.4.1-linux.tgz
su
mv android-sdk-linux /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

Install Android platform tools by downloading and unpacking a software archive as follows:

cd /tmp
wget http://dl.google.com/android/repository/platform-tools_r29.0.1-linux.zip
unzip platform-tools_r29.0.1-linux.zip
mv platform-tools $SDK/

Install Android build tools by downloading and unpacking a software archive as follows:

cd /tmp
wget http://dl.google.com/android/repository/build-tools_r29.0.1-linux.zip
unzip build-tools_r29.0.1-linux.zip
mkdir $SDK/build-tools
mv android-10 $SDK/build-tools/

The previous steps have populated $SDK/platform-tools and $SDK/build-tools. Add adb and zipalign to your execution path:

su
cd /usr/local/bin
ln -s $SDK/platform-tools/adb
ln -s $SDK/build-tools/android-10/zipalign

Install an Android platform by downloading and unpacking a software archive as follows:

cd /tmp
wget http://dl.google.com/android/repository/android-3.0_r02.zip
unzip android-3.0_r02.zip
mv android-3.0_r02-linux $SDK/platforms/

2. Emulator

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

android list target

shows one possible target, android-11, which we have installed previously into $SDK/platforms.

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 r13b. (This is the last version where the include files are still contained in the platforms/ subdirectory, instead of in sysroot/. Version r17c is the last version that ships the GCC cross compiler. Version r18b contains a compiler named gcc, but which in reality is clang.) Unpack it and move it, for instance, to /usr/local/android-ndk-r13b.

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

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

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 ..

The PARI source code 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

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.12.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: 2019-07-12 20:52:32
Copyleft © 2003-2018 the PARI group.