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+).
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
for instance the
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
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
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
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/
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
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
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
device when the emulator is ready
unknown before). Or wait until
returns. The emulator may be stopped with
adb -s emulator-5554 emu kill
To later compile and integrate the PARI C library
into the project, download the
NDK; for instance,
(This is the last version where the include files are still contained in
platforms/ subdirectory, instead of in
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
Set the environment variable
NDK to contain the path
to the Android NDK, which is used by our
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,
make for the first time.
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.
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 ..
A call to
configures and compiles the PARI library
and compiles the PariDroid project into
signed with a debug key and aligned.
The unsigned and unaligned package resides in
the signed and unaligned package in
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
in a separate terminal window.
Remarks for the maintainers
The configuration file
pari.cfg for version
PARI_VERSION of PARI is kept in the
config/PARI_VERSION. The version
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)
adb is in your path.
and retrieve the generated file