Giter VIP home page Giter VIP logo

unverbraucht / bionic-jpeg Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 2.16 MB

A sample (based on the IJG JPEG code) which demonstrates how libHybris can be used to mix bionic linked libraries with glibc linked programs. Shows one way to use an Android binary on an Ubuntu system. Imported from https://launchpad.net/bionic-jpeg

License: Apache License 2.0

C 54.11% Makefile 4.50% Shell 35.13% C++ 2.45% Roff 1.20% M4 0.50% SAS 0.50% Smalltalk 0.09% WebAssembly 0.49% Assembly 0.29% HTML 0.26% Module Management System 0.48%

bionic-jpeg's Introduction

bionic-jpeg, an example of using libhybris to access Android

libraries from Ubuntu

Imported from this launchpad of John McAleely and adapted to current libhybris changes.

Original README

A port of the Independent JPEG Group's JPEG library, such that the core library is an Android binary, and the client utilities are Ubuntu binaries. Uses libHybris as a bridge between the two worlds.

Hybris is a library that provides dynamic symbol loading, patterned after dlopen() and peers.

Hybris assumes the calling code is linked to glibc, and built as part of the conventional ubuntu image. The library loaded is assumed to be linked to bionic, and therefore built for use on Android systems.

Hybris therefore allows an Ubuntu executable to link to a binary Android library.

The API's required by Ubuntu from Android are managed as part of the libhybris package, so most people will never need to use hybris directly, and can instead use the provided ubuntu libraries.

This example is intended to clarify what libhybris is, and to provide model for the contingency of a handset needing to extend libhybris.

There is no attempt made to modify the IJG code, which is re-used verbatim.

What's included

  • jpeg-9: The current IJG source (from http://www.ijg.org/files/jpegsrc.v9.tar.gz) This directory is read-only in this example - no need to build from here.

  • include: A suitable jconfig.h for Android and Ubuntu

  • jpeg-library: Build files to create libjpeg for Android, using the NDK

  • jpeg-client: Build files to create the IJG clients (cjpeg, djpeg, jpegtran, rdjpgcom, wrjpgcom) for Ubuntu

  • jpeg-bridge: Source for a library to wrap libhybris into a jpeglib.h compatible API

Install

Note that libjpeg has been renamed to libjpeg2 in the build scripts, to avoid a collision with existing libjpeg installs

  • Get an Android NDK install, and build the android library
    $ cd jpeg-library
    $ <path-to-ndk>/ndk-build
  • Get an Ubuntu ARMHF build environment (eg a pbuilder for saucy/armhf)
    • Install libhybris' source, and the tools needed to build it
    # apt-get install automake autoconf libtool pkg-config
    # apt-get source libhybris
    # cd <eg libhybris-0.1.0+git20130606+c5d897a>/hybris
    # autoreconf --install --prefix=/opt/libhybris
    # ./configure
    # make
    # make install
  • Now configure and make the samples
    # cd jpeg-bridge
    # ./configure --with-hybris-internal-include-path=/path/to/libhybris/source/hybris/include/
    # make

    # cd jpeg-client
    # ./configure --with-hybris-common-lib-path=/opt/libhybris/lib
    # make
  • copy the binaries to your device

    • Put the jpeg-library/libs/armeabi/libjpeg2.so into the android zip

    • copy jpeg-bridge/libjpeg-bridge.so to somewhere in ubuntu

    • copy jpeg-client/cjpeg to somewhere in ubuntu

    • launch a shell on the ubuntu device, and setup the load library path

    $ export LD_LIBRARY_PATH=/path/to/libjpeg-bridge.so
    $ cjpeg (enjoy!)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.