Porting snappy/libspicec.so onto Android-ARM

   This is my instructions and patches for porting snappy/libspicec-glib.so extracted from spicec-gtk-0.5 onto Android-ARM.
   It's still nascent and raw though, more hacking is needed!
   These are my steps, suppose you're familiar with cross compiling.

1.I use the NDK r4c and agcc built and setup as previous blogs
2. Then I cross compile glib2.28.1 onto Android in this order:
1)libiconv-1.13.1.tar.gz:
configured by:
CC=agcc CXX=agcc LD=arm-eabi-ld RANLIB=arm-eabi-ranlib /
PKG_CONFIG_LIBDIR=/data/local/lib/pkgconfig:/data/local/share/pkgconfig/ /
    ./configure /
    --prefix=/data/local /
    --host=arm-eabi-linux /

    --enable-shared /

 2)gettext-0.18.1.1.tar.gz
configured by:
CC=agcc CPPFLAGS="-I/data/local/ include" LDFLAGS="-L/data/local/lib" CXX=agcc LD=arm-eabi-ld RANLIB=arm-eabi-ranlib /
PKG_CONFIG_LIBDIR=/data/local/
lib/pkgconfig:/data/local/ share/pkgconfig/ /
    ./configure /
    --prefix=/data/local /
    --host=arm-eabi-linux /
    --enable-shared /
    --cache-file=arm.cache /
    --without-included-regex /
    --disable-java --disable-openmp --without-libiconv-prefix --without-libintl-prefix --without-libglib-2.0-prefix --without-libcroco-0.6-prefix --with-included-libxml --without-libncurses-prefix --without-libtermcap-prefix --without-libcurses-prefix --without-libexpat-prefix --without-emacs

  
But the build of gettext will not fully succeed,never mind, I need only libintl.so so just make install.

3)  glib-2.28.1.tar.gz
1st, do patching with my attached file in the blog:


http://blog.csdn.net/rozenix/archive/2011/03/25/6277742.aspx


#patch -p0 < glib-android.patch
2nd, write this into the cache file arm.cache:
#cat > arm.cache
ac_cv_android_arm=yes
glib_cv_stack_grows=no
glib_cv_uscore=no
ac_cv_func_posix_getpwuid_r=no
ac_cv_func_posix_getgrgid_r=no

ctrl-D
3rd,make sure you have the tools such as glib-genmarshaller of right vision in your host machine(you may need to first install glib on your host machine)

4th, autoconf; then configured  the same as libiconv.
5td, make;make install

3. Also I have to port pixman and openssl and jpeg onto android.
1)pixman-0.20.0,jpeg-6b: config. make;make install same as libiconv

(you may should change

/* TLS */
#if defined(PIXMAN_NO_TLS)
into
/* TLS */
#define PIXMAN_NO_TLS
#if defined(PIXMAN_NO_TLS)

in /pixman/piman-compiler.c)

  and add this onto pixman/pixman-cpu.c:

typedef struct
{
    uint32_t a_type;              /* Entry type */
    union
    {
    uint32_t a_val;           /* Integer value */
    } a_un;
} elf_aux_entry;
typedef elf_aux_entry Elf32_auxv_t ;
)

 

2)openssl-1.0.0: config by:
./Configure linux-generic32 no-asm shared --prefix=/data/local
then modify the Makefile:

gcc-->agcc

change ar/nm/ranlib to their arm-eabi- peers,

set CFLAGS as

CFLAG= -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -UDSO_DLFCN -UHAVE_DLFCN_H -UTERMIO -O3 -fomit-frame-pointer -Wall

etc.
make;make install

4. for snappy and libspicec-glib.so
1).tar xf spice-gtk-0.5.tar.gz
2).#patch -p0 < snappy-android.patch ;

patch file is in the blog:


http://blog.csdn.net/rozenix/archive/2011/03/25/6277742.aspx

 

3).ensure to succeed in the normal ./configure and make on the current host machine to generate config.h and some other files.

#CC=gcc /
./configure /
--prefix=/usr/local/mylocal /
--enable-shared /
--cache-file=arm.cache /
--with-coroutine=gthread
#make

4).#cd gtk/
5). you make use or reference my attached file :amakfile

in:

http://blog.csdn.net/rozenix/archive/2011/03/25/6277742.aspx
  #make clean -f amakefile
  #make -f amakefile

6) put the lib*.so files and exec. file snappy onto android device and run.
#LD_LIBRARY_PATH=/system/lib:/data/local/lib ./snappy -h 192.168.1.31 -p 5900 -o ahoo.ppm

 This the run-log:

 

http://blog.csdn.net/rozenix/archive/2011/03/25/6277742.aspx

 

 This is the snapped image:


That's it! Mail me if you've got any problems!
Happy hacking!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
void sl_notify_gap_evt_to_porting_layer(sl_bt_msg_t *evt) { sl_status_t sc; bd_addr address; uint8_t address_type; struct ble_gap_event event; memset(&event, 0, sizeof(event)); switch (SL_BT_MSG_ID(evt->header)) { // ------------------------------- // This event is generated when an advertisement packet or a scan response // is received from a responder case sl_bt_evt_scanner_legacy_advertisement_report_id: memset(&event, 0, sizeof(event)); event.type = BLE_GAP_EVENT_DISC; event.disc.event_type = convert_to_nimble_adv_type(evt->data.evt_scanner_legacy_advertisement_report.event_flags); event.disc.length_data = evt->data.evt_scanner_legacy_advertisement_report.data.len; event.disc.data = evt->data.evt_scanner_legacy_advertisement_report.data.data; event.disc.addr.type = evt->data.evt_scanner_legacy_advertisement_report.address_type; memcpy(event.disc.addr.val, evt->data.evt_scanner_legacy_advertisement_report.address.addr, 6); event.disc.rssi = evt->data.evt_scanner_legacy_advertisement_report.rssi; notify_ble_event_to_listeners(&event); break; // ------------------------------- // This event indicates that a new connection was opened. case sl_bt_evt_connection_opened_id: event.type = BLE_GAP_EVENT_CONNECT; event.connect.conn_handle = evt->data.evt_connection_opened.connection; app_log_info("BLE connected, conn_id:%d\n", event.connect.conn_handle); notify_ble_event_to_listeners(&event); break; // ------------------------------- // This event indicates that a connection was closed. case sl_bt_evt_connection_closed_id: event.type = BLE_GAP_EVENT_DISCONNECT; event.disconnect.conn.conn_handle = evt->data.evt_connection_closed.connection; event.disconnect.reason = evt->data.evt_connection_closed.reason; app_log_info("BLE disconnected, conn_id:%d, reason:0x%02x\n", event.disconnect.conn.conn_handle, event.disconnect.reason); notify_ble_event_to_listeners(&event); break; case sl_bt_evt_gatt_mtu_exchanged_id: event.type = BLE_GAP_EVENT_MTU; event.mtu.conn_handle = evt->data.evt_gatt_mtu_exchanged.connection; event.mtu.value = evt->data.evt_gatt_mtu_exchanged.mtu; app_log_info("exchange mtu req: %d\n", event.mtu.value); notify_ble_event_to_listeners(&event); break; default: break; } }
06-10

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值