You are on page 1of 3

[[PageOutline]]

= Building OSCAM =
The OSCAM building (compilation) process is fairly straight forward. You get OSCAM
from
subversion (svn) then go to the directory where the OSCAM source code is and
compile
it by running `make`. In the usual case no extra programs and libraries are
required,
except `gcc` (or `clang`), `make`, libc and subversion to get the source code.

Here are the basic commands to compile your own OSCAM:


{{{
#!sh
svn checkout http://www.streamboard.tv/svn/oscam/trunk oscam-svn
cd oscam-svn
make
}}}

The full documentation of the build system and lots of examples is available
at [[http://www.streamboard.tv/oscam/browser/trunk/README.build]].

== Build configuration == #configuration


OSCAM contains a lot of features that can be removed from the final binary
in order to save space. To configure the OSCAM features that you want, start
the graphical configuration utility (`dialog` program must be installed in
order for this to work) and select/unselect options:
{{{
#!sh
make config
}}}

== Cross compiling == #cross_compiling


If you want to build OSCAM for different system than yours, you probably should
take look at [wiki:crosscompiling OSCAM cross compilation] page.

== Testing patches == #patch


Patches files that contain code changes and are often posted in trouble tickets
or forum threads from developers. Usually users are asked to test them in order
to confirm that certain bug is fixed. Once the patch is saved in `oscam-svn`
directory you have to ''apply it''' by running `patch` program:
{{{
patch -p1 < file.patch
# or
patch -p0 < file.patch
}}}
The `-p1` instruct `patch` program how much directories to cut from file names
in the patch description. If you see an error like this:
{{{
can't find file to patch at input line 15
Perhaps you used the wrong -p or --strip option?
}}}
you need to try with different `-p` parameter. Once the patch is applied run
{{{make clean}}} and then build the OSCAM like you normally do.

== Staying current == #updating


To update the source code from SVN, run this:
{{{
#!sh
cd oscam-svn
svn update
# You'll see a list of updated files
}}}
After the update is finished, run {{{make clean}}} and then build OSCAM like you
normally do.

== Building specific revisions == #specific_revision


Sometimes a certain svn revision is not working or you want to test something
specific. In that case you can use svn to switch to the revision you want by
running the following:
{{{
#!sh
cd oscam-svn
# Checkout revision 7400
svn checkout -r 7400 http://www.streamboard.tv/svn/oscam/trunk .
# Return to latest revision
svn checkout -r HEAD http://www.streamboard.tv/svn/oscam/trunk .
# Get info about the currently checkout revision
svn info .
}}}

== Special OSCAM builds ==

=== Building OSCAM with support for smartreader (libusb) === #libusb
To build OSCAM with libusb (smartreader) support on you have to
install libusb first. If your distribution do not have libusb
or libusb-dev package installed you have to install them or
install libusb from source.

To install libusb from source, just download libusb (or libusbx)


from their site, unarchive it and build it without any options.
These following commands would download, compile and install
libusb in {{{/usr/local}}}.
{{{
cd /tmp
wget http://downloads.sourceforge.net/project/libusb/libusb-1.0/libusb-
1.0.9/libusb-1.0.9.tar.bz2
tar -xf libusb-1.0.9.tar.bz2
cd libusb-1.0.9
make
sudo make install
}}}

Now to build OSCAM with libusb support you need the following commands:
{{{
#!sh
make USE_LIBUSB=1

# To build OSCAM with static libusb you have to change LIB_LIBUSB variable to point
to the static library
make USR_LIBUSB=1 LIB_USBLIB=/usr/local/lib/libusb-1.0.a

# Since OS X is kind of special to build with static libusb you have to use the
following command
make USE_LIBUSB=1 LIBUSB_LIB="/usr/local/lib/libusb-1.0.a -lobjc -framework IOKit
-framework CoreFoundation"
}}}
=== Building OSCAM with PCSC support === #pcsc

=== Building OSCAM with SH4 with STAPI support === #sh4_stapi

=== Building OSCAM on OS X === #osx


You can build OSCAM on OS X just like you build it on Linux. The build
system detects that you are building on OS X and finds the SDK versions
automatically.

All of the examples posted in this page should work just fine. If there
is a special OS X case it'll be pointed out (libusb static build require
listing of additional libraries, see [#libusb].

=== Building OSCAM on Windows with cygwin/Eclipse === #windows


* Download Eclipse e.g. Eclipse Indigo CDT
* Install Cygwin
* Download cygwin setup http://www.cygwin.com/setup.exe
* Start cygwin setup
* Install the following packages:
* cmake (not sure if really required)
* gcc4
* gcc4-core
* gcc4-g++ (If you want C++ support, not required for normal compile)
* libusb1.0 (not sure if really required)
* libust1.0-devel (not sure if really required)
* make
* openssl-devel
* subversion (use version 1.6.x)
* subversion-tools (not sure if really required)
* Add cygwin install directory (e.g. C:\cygwin) and bin directory (e.g.
c:\cygwin\bin) to path environment variable
* Start Cygwin terminal and add some required links
{{{
#!/sh
cd /usr/bin
ln -s ar.exe i686-pc-cygwin-ar.exe
ln -s ranlib.exe i686-pc-cygwin-ranlib.exe
ln -s strip.exe i686-pc-cygwin-strip.exe
}}}
* Start Eclipse
* Add new C or C++ project
* Select a proper project name
* Disable "Use default location" and select the trunk folder of the checked out
OScam sources
* Select Makefile Project\Empty Project, afterwards select Cygwin GCC toolchain
* Nothing else to change during the project creation
* To avoid cygwin dos file warnings, you can set an environement variable in the
project settings. Variable name: CYGWIN, value: nodosfilewarning
* Create a make target for the OScam project, called "cross-i386-pc-cygwin"
* Build the make target
* That's all folks.

You might also like