summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2014-09-13 23:27:40 +0200
committerYves Fischer <yvesf-git@xapek.org>2014-09-15 01:38:33 +0200
commit8cff11d815a3c054d4f254931f8a14efab71aa3d (patch)
tree2c93a69530d7c7ad78ea1b8c027df39a4e102f34
downloadrtlsdr-flarm-android-8cff11d815a3c054d4f254931f8a14efab71aa3d.tar.gz
rtlsdr-flarm-android-8cff11d815a3c054d4f254931f8a14efab71aa3d.zip
rtlsdr-flarm buildscript for android
-rw-r--r--.gitignore4
-rw-r--r--Makefile105
-rw-r--r--Readme.md22
-rw-r--r--patches/jpeg-autoreconf.diff20
-rw-r--r--patches/libusb-timespec.diff18
-rw-r--r--patches/rtlsdr-flarm-android.diff47
6 files changed, 216 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c65781f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+distfiles/*
+work/*
+toolchain/*
+*~
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..a40f316
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,105 @@
+SYSPREFIX=$(shell pwd)/toolchain
+NDK=/home/yvesf/share/android-ndk-r10b
+
+export PATH := $(SYSPREFIX)/bin:$(PATH)
+export PKG_CONFIG_PATH := $(SYSPREFIX)/lib/pkgconfig
+export CFLAGS := -g
+export CPPFLAGS := -g
+
+all:
+ echo "Call target 'compile'"
+
+distfiles/fftw-3.3.4.tar.gz:
+ wget http://www.fftw.org/fftw-3.3.4.tar.gz -O $@
+distfiles/libconfig-1.4.9.tar.gz:
+ wget http://www.hyperrealm.com/libconfig/libconfig-1.4.9.tar.gz -O $@
+distfiles/jpegsrc.v8d.tar.gz:
+ wget http://ijg.org/files/jpegsrc.v8d.tar.gz -O $@
+distfiles/libusb-1.0.9.tar.bz2:
+ wget http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.9/libusb-1.0.9.tar.bz2 -O $@
+distfiles/librtlsdr-0.5.3.tar.gz:
+ wget https://github.com/steve-m/librtlsdr/archive/v0.5.3.tar.gz -O $@
+
+work:
+ mkdir work
+work/fftw-3.3.4: distfiles/fftw-3.3.4.tar.gz work
+ tar xvzf $< -C work
+ touch $@
+work/fftw-3.3.4f: distfiles/fftw-3.3.4.tar.gz work
+ mkdir -p $@
+ tar xvzf $< --strip-components=1 -C $@
+ touch $@
+work/libconfig-1.4.9: distfiles/libconfig-1.4.9.tar.gz work
+ tar xvzf $< -C work
+ touch $@
+work/jpeg-8d: distfiles/jpegsrc.v8d.tar.gz work
+ tar xvzf $< -C work
+ touch $@
+ patch -p0 < patches/jpeg-autoreconf.diff
+work/libusb-1.0.9: distfiles/libusb-1.0.9.tar.bz2 work
+ tar xvjf $< -C work
+ patch -p0 < patches/libusb-timespec.diff
+ touch $@
+work/librtlsdr-0.5.3: distfiles/librtlsdr-0.5.3.tar.gz work
+ tar xvzf $< -C work
+ touch $@
+
+toolchain:
+#$(NDK)/build/tools/make-standalone-toolchain.sh --platform=android-14 --toolchain=arm-linux-android-androideabi-4.8 --system=linux-x86_64 --install-dir=toolchain
+ $(NDK)/build/tools/make-standalone-toolchain.sh --platform=android-19 --install-dir=toolchain
+
+compile: compile-libfftw3
+compile: compile-libfftw3f
+compile: compile-libconfig
+compile: compile-libjpeg
+compile: compile-libusb
+compile: compile-librtlsdr
+
+compile-libfftw3: $(SYSPREFIX)/lib/libfftw3.a
+$(SYSPREFIX)/lib/libfftw3.a: work/fftw-3.3.4 toolchain
+ cd $< && autoreconf -i
+ cd $< && ./configure --prefix=$(SYSPREFIX) --host=arm-linux-androideabi && \
+ make -j4 && \
+ make install
+
+compile-libfftw3f: $(SYSPREFIX)/lib/libfftw3f.a
+$(SYSPREFIX)/lib/libfftw3f.a: work/fftw-3.3.4f toolchain
+ cd $< && autoreconf -i
+ cd $< && ./configure --prefix=$(SYSPREFIX) --host=arm-linux-androideabi --enable-single && \
+ make -j4 && \
+ make install
+
+compile-libconfig: $(SYSPREFIX)/lib/libconfig.a
+$(SYSPREFIX)/lib/libconfig.a: work/libconfig-1.4.9 toolchain
+ rm -rf $</aux-build
+ cd $< && autoreconf -i
+ cd $< && ./configure --prefix=$(SYSPREFIX) --host=arm-linux-androideabi && \
+ make -j4 && \
+ make install
+
+compile-libjpeg: $(SYSPREFIX)/lib/libjpeg.a
+$(SYSPREFIX)/lib/libjpeg.a: work/jpeg-8d toolchain
+ cd $< && autoreconf -i
+ cd $< && ./configure --prefix=$(SYSPREFIX) --host=arm-linux-androideabi && \
+ make -j4 && \
+ make install
+
+compile-libusb: $(SYSPREFIX)/lib/libusb-1.0.a
+$(SYSPREFIX)/lib/libusb-1.0.a: work/libusb-1.0.9 toolchain
+ cd $< && autoreconf -i
+ cd $< && ./configure --prefix=$(SYSPREFIX) --host=arm-linux-androideabi && \
+ make -j4 && \
+ make install
+
+
+compile-librtlsdr: $(SYSPREFIX)/lib/librtlsdr.a
+$(SYSPREFIX)/lib/librtlsdr.a: work/librtlsdr-0.5.3 toolchain $(SYSPREFIX)/lib/libusb-1.0.a
+ cd $< && autoreconf -i
+ cd $< && ./configure --prefix=$(SYSPREFIX) --host=arm-linux-androideabi && \
+ make -j4 AM_DEFAULT_VERBOSITY=1 && \
+ make install
+
+
+clean:
+ rm -r work
+ rm -r toolchain
diff --git a/Readme.md b/Readme.md
new file mode 100644
index 0000000..587479e
--- /dev/null
+++ b/Readme.md
@@ -0,0 +1,22 @@
+# compiling required libraries
+
+see makefile target 'compile'
+
+
+# compiling rtlsdr-flarm
+
+get the rtlsdr-flarm-0.1.2 source
+apply the patch rtlsdr-flarm-android.diff
+
+go to rtlsdr-flarm-0.1.2 directory
+create the android binary make -f Makefile.android rtlsdr-flarm-android
+
+
+# debug android binary
+
+see 'make debug' target in Makefile.android
+setup adb port-forward, e.g. 'adb forward tcp:5000 tcp:5000'
+
+run: ../toolchain/bin/arm-linux-androideabi-gdb rtlsdr-flarm-android
+call: target remote :5000
+
diff --git a/patches/jpeg-autoreconf.diff b/patches/jpeg-autoreconf.diff
new file mode 100644
index 0000000..3db5dfc
--- /dev/null
+++ b/patches/jpeg-autoreconf.diff
@@ -0,0 +1,20 @@
+--- work/jpeg-8d/configure.ac.old 2014-09-14 23:30:41.358102354 +0200
++++ work/jpeg-8d/configure.ac 2014-09-14 23:31:04.302216128 +0200
+@@ -21,15 +21,14 @@
+
+ # Initialize Automake
+ # Don't require all the GNU mandated files
+-AM_INIT_AUTOMAKE([-Wall -Werror -Wno-obsolete ansi2knr no-dist foreign])
++AM_INIT_AUTOMAKE([-Wall -Werror -Wno-obsolete no-dist foreign])
+
+ # Make --enable-silent-rules the default.
+ # To get verbose build output you may configure
+ # with --disable-silent-rules or use "make V=1".
+ AM_SILENT_RULES([yes])
+
+-# This is required when using the de-ANSI-fication feature.
+-AM_C_PROTOTYPES
++AM_PROG_AR
+
+ # Add configure option --enable-maintainer-mode which enables
+ # dependency checking and generation useful to package maintainers.
diff --git a/patches/libusb-timespec.diff b/patches/libusb-timespec.diff
new file mode 100644
index 0000000..709daf0
--- /dev/null
+++ b/patches/libusb-timespec.diff
@@ -0,0 +1,18 @@
+--- work/libusb-1.0.9-orig/libusb/io.c 2014-09-14 23:33:05.286816058 +0200
++++ work/libusb-1.0.9/libusb/io.c 2014-09-14 23:35:13.255450621 +0200
+@@ -1046,6 +1046,15 @@
+ * give up the events lock if instructed.
+ */
+
++/* Android workaround */
++#ifndef TIMESPEC_TO_TIMEVAL
++#define TIMESPEC_TO_TIMEVAL(tv, ts) \
++ do { \
++ (tv)->tv_sec = (ts)->tv_sec; \
++ (tv)->tv_usec = (ts)->tv_nsec / 1000; \
++ } while(0)
++#endif /* end of TIMESPEC_TO_TIMEVAL */
++
+ int usbi_io_init(struct libusb_context *ctx)
+ {
+ int r;
diff --git a/patches/rtlsdr-flarm-android.diff b/patches/rtlsdr-flarm-android.diff
new file mode 100644
index 0000000..65ee3a0
--- /dev/null
+++ b/patches/rtlsdr-flarm-android.diff
@@ -0,0 +1,47 @@
+--- /dev/null 2014-09-01 14:32:42.899820178 +0200
++++ rtlsdr-flarm-0.1.2/Makefile.android 2014-09-15 01:07:11.454813894 +0200
+@@ -0,0 +1,24 @@
++VERSION = 0.1.2
++
++CXX=../toolchain/arm-linux-androideabi/bin/g++
++FLAGS = -O2 -DRTLSDR_FLARM_VERSION=$(VERSION) -I../toolchain/include -D__MACH__
++FLAGS += -Wall
++FLAGS += -g
++
++rtlsdr-flarm-android: rtlsdr-flarm-android.o
++ $(CXX) -o $@ $< \
++ ../toolchain/lib/librtlsdr.a ../toolchain/lib/libfftw3.a ../toolchain/lib/libfftw3f.a \
++ ../toolchain/lib/libusb-1.0.a ../toolchain/lib/libjpeg.a ../toolchain/lib/libconfig.a
++
++rtlsdr-flarm-android.o: rtlsdr-flarm.cc rtlsdr.h thread.h fft.h buffer.h image.h aircraft.h flarmframe.h flarmdemod.h sysmon.h
++ $(CXX) $(FLAGS) -c rtlsdr-flarm.cc -o $@
++
++debug:
++ adb push rtlsdr-flarm-android /system/vendor/bin/
++ adb push Example.conf /system/vendor/bin/rtlsdr-flarm.conf
++ adb shell chmod 777 /system/vendor/bin/rtlsdr-flarm-android
++ adb shell gdbserver 0.0.0.0:5000 /system/vendor/bin/rtlsdr-flarm-android /system/vendor/bin/rtlsdr-flarm.conf
++
++
++clean:
++ rm -vf rtlsdr-flarm-android.o rtlsdr-flarm-android
+--- rtlsdr-flarm-0.1.2-orig/fft.h 2014-09-15 01:09:18.339443081 +0200
++++ rtlsdr-flarm-0.1.2/fft.h 2014-09-15 01:04:38.710056473 +0200
+@@ -32,7 +32,7 @@
+ { if( (Size==this->Size) && (Sign==this->Sign) ) return Size;
+ Free();
+ Buffer = (std::complex<Float> *)fftw_malloc(Size*sizeof(std::complex<Float>)); if(Buffer==0) return -1;
+- Plan = fftw_plan_dft_1d(Size, (fftw_complex *)Buffer, (fftw_complex *)Buffer, Sign, FFTW_MEASURE);
++ Plan = fftw_plan_dft_1d(Size, (fftw_complex *)Buffer, (fftw_complex *)Buffer, Sign, FFTW_ESTIMATE);
+ this->Size=Size; this->Sign=Sign; return Size; }
+
+ int PresetForward(int Size) { return Preset(Size, FFTW_FORWARD); }
+@@ -74,7 +74,7 @@
+ { if( (Size==this->Size) && (Sign==this->Sign) ) return Size;
+ Free();
+ Buffer = (std::complex<float> *)fftwf_malloc(Size*sizeof(std::complex<float>)); if(Buffer==0) return -1;
+- Plan = fftwf_plan_dft_1d(Size, (fftwf_complex *)Buffer, (fftwf_complex *)Buffer, Sign, FFTW_MEASURE);
++ Plan = fftwf_plan_dft_1d(Size, (fftwf_complex *)Buffer, (fftwf_complex *)Buffer, Sign, FFTW_ESTIMATE);
+ this->Size=Size; this->Sign=Sign; return Size; }
+
+ int PresetForward(int Size) { return Preset(Size, FFTW_FORWARD); }