Skip to content
gtoubassi edited this page Jul 26, 2021 · 1 revision

How to Build FemtoZip

The following builds femtozip and runs the unit tests. For a more detailed usage of the tools, see the Tutorial

Prerequisites

A Mac with iPhone or XCode developer tools, or Linux with: gcc/g++, jdk, make, git, zlib-devel, ant, junit, ant-junit

1. Get the source code:

% git clone https://github.com/gtoubassi/femtozip.git

2. Build the C++ version

% cd femtozip/cpp
% ./configure
% make

3. Run Unit Tests

% fztests/src/fztests

The unit tests will take several seconds to run and should complete with 0 failures.

4. Install FemtoZip (optional)

% sudo make install

At this point you have the femtozip library in /usr/local/lib and the fzip command line tool in /usr/local/bin. You may uninstall with sudo make uninstall. For a quick taste of FemtoZip on the command line, see the Tutorial.

How To Build the Pure Java FemtoZip

1. Get the source code per step 1 above

2. Make sure your $JAVA_HOME environment variable is set

3. Build the Java version

% cd femtozip/java/femtozip
% ant jar

4. Run Unit Tests

% ant test

The unit tests will take several seconds to run and should complete with 0 failures. To double check that there are no failures, the following command should return no input:

% ant test | grep Failures: | grep -v 'Failures: 0, Errors: 0,'

How to Build the JNI based Java version

1. Get the source code per above and perform all steps above (build both native and java versions). Make sure you have installed the FemtoZip library (make install above)

2. Build the JNI FemtoZip shared library

% cd femtozip/java/jnifzip
% ./configure
% make

3. Install the JNI library. You can uninstall with sudo make uninstall

% sudo make install

4. Set your environment so the shared libraries for the JNI interface and FemtoZip are accessible. The following is for a Mac. On Linux set LD_LIBRARY_PATH instead of DYLD_LIBRARY_PATH:

% setenv DYLD_LIBRARY_PATH /usr/local/lib

5. Run the JNI unit test

% cd ../femtozip
% ant test-jni

The unit test should complete with 0 failures. To double check that there are no failures, the following command should return no input:

% ant test-jni | grep Failures: | grep -v 'Failures: 0, Errors: 0,'