| 1 |
libsmacker |
| 2 |
http://libsmacker.sourceforge.net |
| 3 |
|
| 4 |
Compilation and Install Notes |
| 5 |
--- |
| 6 |
|
| 7 |
There are two ways to compile libsmacker for use in your own programs. |
| 8 |
|
| 9 |
1. DIRECT COMPILATION |
| 10 |
|
| 11 |
This method is preferred when you can't (or don't want to) build a system |
| 12 |
library. Simply take the various smk_* and smacker.* files, add them to your |
| 13 |
project, and compile them in as usual. |
| 14 |
|
| 15 |
All external functions (those you, a user, would care about) are contained in |
| 16 |
smacker.h - so, in your main program, just |
| 17 |
|
| 18 |
#include "smacker.h" |
| 19 |
|
| 20 |
and you're ready to decode smk files. |
| 21 |
|
| 22 |
To ease the process of managing libsmacker compilation, and to keep your source |
| 23 |
tree uncluttered, you may wish to use libsmacker as a compiled static library |
| 24 |
instead. This allows you to redistribute it, or compile once / separately from |
| 25 |
your project, but with the advantage that linking against it does not create a |
| 26 |
run-time dependency. See the next section. |
| 27 |
|
| 28 |
2. LIBRARY COMPILATION |
| 29 |
|
| 30 |
libsmacker is distributed as a standard autotools-based package. The build |
| 31 |
requires a GNU- or BSD-compatible "make" program. Optionally, you may need |
| 32 |
autotools development packages installed to regenerate some distribution |
| 33 |
files if you wish to provide your own distribution. |
| 34 |
|
| 35 |
From the root directory, run "./configure" - this will perform some checks on |
| 36 |
your system to find the name of your C compiler, desired compilation flags, |
| 37 |
etc. At the end of the configure process, there will be a generated Makefile. |
| 38 |
Simply run "make" to build your files. |
| 39 |
|
| 40 |
Compilation via autotools results in these files - though depending on your |
| 41 |
system, compilation output may go into a .libs/ subfolder: |
| 42 |
|
| 43 |
* libsmacker.a |
| 44 |
* libsmacker.so (and several versioned symlinks) |
| 45 |
* driver |
| 46 |
* smk2avi |
| 47 |
|
| 48 |
The "libsmacker.a" is a static library file which can be compiled in with an |
| 49 |
existing codebase: |
| 50 |
|
| 51 |
cc main.c extra.c libsmacker.a |
| 52 |
|
| 53 |
or (better) |
| 54 |
|
| 55 |
cc main.c -lsmacker |
| 56 |
|
| 57 |
The "libsmacker.so" is a shared object file. Compiling with this means it |
| 58 |
needs to be distributed along with your application; this might be useful to |
| 59 |
save space if you have multiple programs that use libsmacker. |
| 60 |
|
| 61 |
"driver" and "smk2avi" are example programs that show how to use libsmacker. |
| 62 |
They can also test a successful build. |
| 63 |
|
| 64 |
3. INSTALLATION |
| 65 |
|
| 66 |
The makefile from "configure" can be used to install the .so and corresponding |
| 67 |
.h file to correct locations - simply run "make install". This will copy the |
| 68 |
files to $PREFIX and make them available system-wide to other developers or |
| 69 |
applications. |
| 70 |
|
| 71 |
4. CONTROLLING BUILD PARAMETERS |
| 72 |
Altering build parameters is done by different flags to "configure". The |
| 73 |
default is to build both a static AND shared library, as well as the two demo |
| 74 |
programs. Also by default, CFLAGS is set to "-O2 -g". To change this, for |
| 75 |
example making a debug build, use something like: |
| 76 |
|
| 77 |
./configure CFLAGS="-O0" |
| 78 |
|
| 79 |
or an optimized release build: |
| 80 |
|
| 81 |
./configure CFLAGS="-march=i686 -O2 -DNDEBUG" |
| 82 |
|
| 83 |
Once reconfigured, running "make" will apply CFLAGS to calls to the C compiler, |
| 84 |
passing your options on to the underlying build system. |