Ethatron / libbsa

A free software library for reading and writing BSA files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libbsa
======

libbsa is a free software library for reading and writing BSA files.

Please see the HTML readme file at libbsa-readme.html for
more information.


Build Instructions
==================

Note: These build instructions are a work in progress, as I have
recently switched from Windows 7 to Ubuntu. Sorry about that. Currently
my knowledge is limited to compiling for 64 bit Linux on 64 bit Linux.

Note: All paths are given relative to the top directory of the
libbsa source (ie. where this README is).


Requirements:

  * CMake
    - <http://cmake.org/>
    - Tested with v2.8.9.
  * Boost C++ Libraries
    - <http://sourceforge.net/projects/boost/files/boost/>
    - Download the latest 7-zipped source code.
    - Tested with v1.51.0.
  * UTF8-CPP
    - <http://sourceforge.net/projects/utfcpp/>
    - Download the latest zipped v2.x source code.
    - Tested with v2.3.2.
  * zlib
    - <http://zlib.net>
    - Download the latest source code.
    - Tested with v1.2.7.
  * A native build system of your choice.
    - Tested with GNU Make on Ubuntu Linux 12.10.


Preparing UTF8-CPP:
  1. Create a 'utf8' folder inside the 'externals' folder.
  2. Place the folders inside the UTF8-CPP archive you downloaded (should be
     'source', 'doc') into the 'utf8' folder.


Preparing Boost:
  1. Create a 'boost' folder inside the 'externals' folder.
  2. Extract the downloaded Boost archive to your 'boost' folder, so that
     (for example) 'b2.exe' is at 'externals/boost/b2.exe'.


Preparing zlib:
  1. Create a 'zlib' folder inside the 'externals' folder.
  2. Extract the downloaded zlib archive to your 'zlib' folder, so that
     (for example) 'zlib.h' is at 'externals/zlib/zlib.h'.


Building libbsa
---------------

Open a Terminal window and navigate to the root of the libbsa source.

    cd externals/zlib
    cmake . -DCMAKE_C_FLAGS=-m32
    make
    cd ../boost
    ./bootstrap.sh
    echo "" > tools/build/v2/user-config.jam
    ./b2 toolset=gcc link=static variant=release address-model=32 --with-filesystem --with-locale --with-regex --with-program_options --with-system --stagedir=stage-32
    mkdir ../../build
    cd ../../build
    cmake .. -DLIBBSA_ARCH=32 -DLIBBSA_LINK=STATIC
    make


For cross-compiling to Windows:

    cd externals/zlib
    cmake . -DCMAKE_C_FLAGS=-m32 -DLIBBSA_ARCH=32 -DCMAKE_TOOLCHAIN_FILE=../../mingw32-toolchain.cmake
    make
    cd ../boost
    ./bootstrap.sh
    echo "using gcc : 4.6.3 : i586-mingw32msvc-g++ : <rc>i586-mingw32msvc-windres <archiver>i586-mingw32msvc-ar <ranlib>i586-mingw32msvc-ranlib ;" > tools/build/v2/user-config.jam
    ./b2 toolset=gcc-4.6.3 target-os=windows link=static variant=release address-model=32 cxxflags=-fPIC --with-filesystem --with-locale --with-regex --with-program_options --with-system --stagedir=stage-mingw-32
    mkdir ../../build
    cd ../../build
    cmake .. -DLIBBSA_ARCH=32 -DLIBBSA_LINK=STATIC -DCMAKE_TOOLCHAIN_FILE=mingw32-toolchain.cmake
    make

If both native and cross-compiling, you'll need to delete the 'build'
folder otherwise CMake will get confused and only build one of them (it
doesn't seem to overwrite all the necessary config files when it
generates the build system the second time). You'll also probably have
to rebuild zlib for each configuration, as it outputs all the files to
the same directory.

To compile a shared library, swap -DLIBSTR_LINK=STATIC with
-DLIBSTR_LINK=SHARED

To compile a 64 bit library, replace all instances of "32" in the above
commands with "64". Also replace all instances of "i586-mingw32msvc"
in the echo command with "x86_64-w64-mingw32".

About

A free software library for reading and writing BSA files.

License:GNU General Public License v3.0