Last active
          June 7, 2016 23:05 
        
      - 
      
 - 
        
Save sheck/475e0c8f2d9f618f1eca to your computer and use it in GitHub Desktop.  
    Using Zbar (with JPEG patch) with Circle CI
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | machine: | |
| environment: | |
| ZBAR_LIB: vendor/lib/libzbar.so | |
| dependencies: | |
| cache_directories: | |
| - vendor/lib | |
| pre: | |
| - bash ./setup-ci.sh | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | set -x | |
| set -e | |
| BUILD_DIR=$PWD | |
| if [ ! -e vendor/lib/libzbar.so ]; then | |
| zbar_url="http://freefr.dl.sourceforge.net/project/zbar/zbar/0.10/zbar-0.10.tar.bz2" | |
| curl $zbar_url -s -o - | tar jxf - -C $BUILD_DIR | |
| cd $BUILD_DIR/zbar-0.10/ | |
| patch -p1 <<EOF | |
| diff --git a/zbar/jpeg.c b/zbar/jpeg.c | |
| index fb566f4..d1c1fb2 100644 | |
| --- a/zbar/jpeg.c | |
| +++ b/zbar/jpeg.c | |
| @@ -79,8 +79,15 @@ int fill_input_buffer (j_decompress_ptr cinfo) | |
| void skip_input_data (j_decompress_ptr cinfo, | |
| long num_bytes) | |
| { | |
| - cinfo->src->next_input_byte = NULL; | |
| - cinfo->src->bytes_in_buffer = 0; | |
| + if (num_bytes > 0) { | |
| + if (num_bytes < cinfo->src->bytes_in_buffer) { | |
| + cinfo->src->next_input_byte += num_bytes; | |
| + cinfo->src->bytes_in_buffer -= num_bytes; | |
| + } | |
| + else { | |
| + fill_input_buffer(cinfo); | |
| + } | |
| + } | |
| } | |
| void term_source (j_decompress_ptr cinfo) | |
| EOF | |
| CFLAGS="" ./configure --disable-video --without-gtk --without-qt --prefix=$BUILD_DIR/vendor | |
| make | |
| make install | |
| rm -r $BUILD_DIR/zbar-0.10 | |
| fi | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment