-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Branch: jrobinson/configure-for-cross - this was going to be just the initial Configure changes, but now it holds all the current changes.
To run:
make distclean
PATH=/usr/src/android/android-sdk-linux/platform-tools:/usr/src/android/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin:$PATH ./Configure -des -Dusedevel -Dusecrosscompile -Dprefix=/data/data/uk.me.jandj.runPerl/files/perl -Dtargethost="emulator-5554" -Dtargetdir=/data/data/test -Dsysroot=/usr/src/android/android-ndk-r8/platforms/android-8/arch-arm/ -Dcc=arm-linux-androideabi-gcc
(or similar!)
- Set PATH to include your actual cross-compiling binaries, and "adb" from the android sdk tools.
- Set sysroot to the path in your cross-compiler tree that contains usr/include, usr/lib etc. This is a gcc-ism.
- Set cc to the gcc filename
- Set targethost to a previously created and running Android emulator (see developer.android.com)
- set targetdir to a dir on the emulator under /data/data
- Set prefix to a /data/data directory to install into (the above is used with the RunPerl app)
During Configure a miniperl and generate_uudmap are built in a host/ subdirectory, these are used later for building extensions etc.
PATH=/usr/src/android/android-sdk-linux/platform-tools:/usr/src/android/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin:$PATH make DESTDIR=$PWD/install install
This will build the Perl binary and all the extensions. It will install the result, which has a relocatable @INC, into the install/ subdir. To use, transfer install/data/data/uk.me.jandj.runPerl/files/perl onto the Android device.
Install cross-compiler tools:
git clone https://github.com/raspberrypi/tools.git
Setup Raspberry Pi emulation (or use a real one!):
http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/
Copy your ssh public key to the emulator/pi:
scp -p 2222 ~/.ssh/id_rsa.pub pi@localhost:.ssh/authorized_keys
To run:
make distclean
PATH=/usr/src/extern/raspberrypi/tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin:$PATH ./Configure -des -Dusedevel -Dusecrosscompile -Dtargethost="localhost" -Dtargetport=2222 -Dtargetuser=pi -Dsysroot=/usr/src/extern/raspberrypi/tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/arm-bcm2708-linux-gnueabi/sysroot -Dcc=arm-bcm2708-linux-gnueabi-gcc 2>&1
- PATH is the path to the pi tools cloned above, I'm using the arm-bcm2708 set.
- targethost, targetport and targetuser are the emulated or real Pi.
- sysroot is the provided sysroot in the pi tools, which contains usr/include and usr/lib
- cc is the actual compiler from the tools, full name
Local install:
PATH=/usr/src/extern/raspberrypi/tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin:$PATH make DESTDIR=$PWD/install install
Branch: jrobinson/cross-compile
To run:
make clean
PATH=/usr/src/android/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin:$PATH ./Configure -Dusecrosscompile -Dcrosscompileprefix=arm-linux-androideabi- -Dcc="arm-linux-androideabi-gcc --sysroot=/usr/src/android/android-ndk-r8/platforms/android-8/arch-arm" -Dsysroot=/usr/src/android/android-ndk-r8/platforms/android-8/arch-arm -Dtargetarch=android -Dusedevel -Des -d 2>&1 | tee compile.log
(or similar!)
-
Set PATH to include your actual cross-compiling binaries
-
set crosscompileprefix to the prefix your binaries use for gcc, eg arm-linux-androideabi-gcc (I have no idea if this will work currently if the binaries are named plain "gcc" etc).
-
Set cc to the gcc name and pass the --sysroot path
-
Set sysroot itself to the path that contains /usr/lib and /usr/include for your compiler ** (Yes, one of these is a bit redundant)
-
Set targetarch to the system you are compiling for, if this is a new one, you will need to copy hints/android.sh and adjust as necessary.
-
If you run it multiple times, you may want to rm config.sh inbetween to avoid it collecting old/incorrect answers
-
mkdir host
-
cd host/
-
../Configure -des -Dusedevel -Dmksymlinks
-
make miniperl
-
make generate_uudmap
-
make git_version.h
-
cd ..
-
cp host/miniperl .
-
ln -s generate_uudmap .
-
export HOST_PATH=$PWD/host
-
cp -f $HOST_PATH/git_version.h .
-
cp -f $HOST_PATH/uudmap.h .
-
cp -f $HOST_PATH/bitcount.h .
-
cp -f $HOST_PATH/mg_data.h .
PATH=/usr/src/android/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin:$PATH make perl
The result, for android-8, can be found here:
Installable test (writes a perl-test.txt log in /mnt/sdcard/)
This is a copy of http://code.google.com/p/perl-android-apk with a modified hello.pl and using the 5.17.4 build from above.