#!/bin/bash -x #create an object file (extension .o) for each file to bundle objcopy -I binary -O elf32-i386 -B i386 --redefine-sym _binary_greenstone3_jar_start=greenstone3jar --readonly-text greenstone3.jar build/greenstone3.jar.o #create a header file declaring the bundled files and their sizes rm build/mywrapper.h size=`du -b greenstone3.jar | sed 's/[^0-9].*//g'` echo "extern const char greenstone3jar[$size];" >> build/mywrapper.h #compile the wrapper program g++ -Wall -c -o build/mywrapper.o mywrapper.c #link, bundling the files to be bundled g++ -o greenstone3 build/mywrapper.o build/greenstone3.jar.o