There are a variety of ways this could be achieved.
This is currently a Work In Progress
You can download a copt of rtl_fm (and the other tools from http://sdr.osmocom.org/trac/attachment/wiki/rtl-sdr/RelWithDebInfo.zip)
Precompiled binaries for windows (WIP)
====== Cross Compile from Raspbian ======
Create a folder to keep the compiled libraries in.
mkdir ${HOME}/mingw
mkdir ${HOME}/mingw/pkgconfig
===== Install Toolchain =====
On Jessie use:
sudo apt-get install mingw-w64
On Wheezy you may need to downgrade the binutils package so use
sudo apt-get install mingw-w64 binutils=2.22-8+deb7u2
===== Compile required libs =====
==== Zlib ====
Zlib is required by curl, This will build a static lib only (the .dll requires some extra stuff)
Download and extract
wget http://zlib.net/zlib-1.2.8.tar.gz
tar xzf zlib-1.2.8.tar.gz
cd zlib-1.2.8
Configure (this isn't standard autoconf)
CC=i686-w64-mingw32-gcc \
AR=i686-w64-mingw32-ar \
RANLIB=i686-w64-mingw32-ranlib \
CFLAGS=-O2 \
./configure --prefix=${HOME}/mingw/zlib
Build and Install
make LDSHAREDLIBC=
make install
//NB: The LDSHAREDLIBC= option on make removed -lc on some parts of the compilation that causes issues.//
Create symlinks for pkg-config (not currently used)
ln -s ../zlib/lib/pkgconfig/zlib.pc ${HOME}/mingw/pkgconfig
==== OpenSSL ====
OpenSSL is required by Curl.
TODO: Consider using openssl-1.0.2h.tar.gz as this should have longer support than the 1.0.1 series.
Download and extract
wget http://www.openssl.org/source/openssl-1.0.1t.tar.gz
tar xzf openssl-1.0.1t.tar.gz
cd openssl-1.0.1t
Configure (this isn't standard autoconf)
./Configure mingw --prefix=${HOME}/mingw/openssl --cross-compile-prefix=i686-w64-mingw32-
Build and install
make DIRS='crypto ssl engines' depend
make DIRS='crypto ssl engines' all
make DIRS='crypto ssl engines' install_sw
Create symlinks for pkg-config (not currently used)
ln -s ../openssl/lib/pkgconfig/openssl.pc ${HOME}/mingw/pkgconfig
ln -s ../openssl/lib/pkgconfig/libssl.pc ${HOME}/mingw/pkgconfig
ln -s ../openssl/lib/pkgconfig/libcrypto.pc ${HOME}/mingw/pkgconfig
==== Curl ====
Download and extract
wget http://curl.haxx.se/download/curl-7.49.0.tar.gz
tar xzf curl-7.49.0.tar.gz
cd curl-7.49.0/
Configure
./configure --prefix=${HOME}/mingw/curl \
--with-zlib=${HOME}/mingw/zlib \
--with-ssl=${HOME}/mingw/openssl \
--without-ldap-lib --disable-manual --enable-ipv6 \
--build=i686-pc-linux-gnu --host=i686-w64-mingw32 \
--enable-static --disable-shared
Build and Install
make
make install
Create symlinks for pkg-config (not currently used)
ln -s ../curl/lib/pkgconfig/libcurl.pc ${HOME}/mingw/pkgconfig
===== Compile Decoder =====
i686-w64-mingw32-gcc -std=gnu99 -o UKHASnet-decoder.exe UKHASnet-decoder.c -DGATEWAY_ID=\"UKHASGW\" \
-DCURL_STATICLIB -static \
-I../libs/curl/include -L../libs/curl/lib \
-L../libs/openssl/lib -L../libs/zlib/lib \
-lcurl -lssl -lcrypto -lz -lws2_32 -lgdi32
===== Cross Compile rtl-sdr =====
==== pthreads-w32 ====
wget ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.tar.gz
tar xzf pthreads-w32-2-9-1-release.tar.gz
cd pthreads-w32-2-9-1-release
make CROSS=i686-w64-mingw32- clean GC-inlined
mkdir -p ${HOME}/mingw/pthreadsw32/{include,lib}
cp {pthread.h,sched.h,semaphore.h} ${HOME}/mingw/pthreadsw32/include
cp {libpthreadGC2.a,pthreadGC2.dll} ${HOME}/mingw/pthreadsw32/lib
ln -s libpthreadGC2.a ${HOME}/mingw/pthreadsw32/lib/libpthread.a
==== libusb ====
wgt http://downloads.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.20/libusb-1.0.20.tar.bz2
tar xjf libusb-1.0.20.tar.bz2
cd libusb-1.0.20/
./configure --prefix=${HOME}/mingw/libusb \
--build=i686-pc-linux-gnu --host=i686-w64-mingw32
make
make install
ln -s ../libusb/lib/pkgconfig/libusb-1.0.pc ${HOME}/mingw/pkgconfig
==== rtl-sdr ====
sudo apt-get install autoconf libtool
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr
autoreconf -i
mkdir build-win32
cd build-win32
CFLAGS=-I${HOME}/mingw/pthreadsw32/include \
LDFLAGS=-L${HOME}/mingw/pthreadsw32/lib \
LIBUSB_CFLAGS=-I${HOME}/mingw/libusb/include/libusb-1.0 \
LIBUSB_LIBS='-L${HOME}/mingw/libusb/lib -lusb-1.0' \
../configure --prefix=${HOME}/mingw/rtl-sdr \
--build=i686-pc-linux-gnu --host=i686-w64-mingw32
make
make install
====== Compile on Windows ======