[[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. The openssl development librairies and headers are required too, in order to built OSCAM with support for SSL among others. For distributions based on Debian / Ubuntu, the openssl package to install is `libssl-dev`. 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]]. == Staying current == #updating To update the source code from SVN, run this: {{{ #!sh cd oscam-svn svn update # You'll see a list of the updated files }}} After the update is finished build the OSCAM like you normally do. '''NOTE:''' Do not use {{{svn checkout}}} to update the source tree, that is the wrong thing to do! {{{svn checkout}}} should be used only for getting the source for the first time, to '''update''' the source to latest version you must use {{{svn update}}}. == 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 # Update to revision 7400 svn update -r 7400 # Go to newest revision svn update -r HEAD # Get info about the currently checkout revision svn info . }}} == 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. == Build configuration == #build_config 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 }}} Other useful configuration targets are: {{{ #!sh # Disable everything in the config make allnoconfig # Enable everything in the config make allyesconfig # Restore default config values make defconfig }}} The above targets are shortcuts that are running {{{config.sh}}} tool which deals with OSCAM configuration. You can use the tool to control and view OSCAM build parameters from the command line. You can read [http://www.streamboard.tv/oscam/browser/trunk/README.config config.sh --help] to see what the tool offers. Here are some examples: {{{ #!sh # Enable WEBIF and SSL ./config.sh --enable WEBIF WITH_SSL # Disable WEBIF but enable WITH_SSL ./config.sh --disable WEBIF --enable WITH_SSL # Restore defaults and disable WEBIF and READER_NAGRA ./config.sh --restore --disable WEBIF READER_NAGRA # Use default config with only one enabled reader ./config.sh --restore --disable readers --enable READER_BULCRYPT # Disable everything and enable webif, one module and one card reader ./config.sh --disable all --enable WEBIF MODULE_NEWCAMD READER_BULCRYPT }}} == Testing patches == #patch Patches are 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 the patch is applied you'll see something like this: {{{ $ patch -p1 < test.diff patching file globals.h patching file module-camd35.c patching file module-cccam.c Hunk #1 succeeded at 3200 (offset -2 lines). Hunk #2 succeeded at 3251 (offset -2 lines). patching file module-gbox.c patching file module-lcd.c patching file module-serial.c }}} Once the patch is applied build OSCAM like you normally do, test it and post the results. == 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 https://github.com/libusb/libusb/releases/download/v1.0.22/libusb-1.0.22.tar.bz2 tar -xf libusb-1.0.22.tar.bz2 cd libusb-1.0.22 ./configure 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 LIBUSB_LIB variable to point to the static library make USE_LIBUSB=1 LIBUSB_LIB=/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" # If libusb is installed by macports or with different than the default prefix (for example /opt/local) make USE_LIBUSB=1 EXTRA_FLAGS="-I/opt/local/include -L/opt/local/lib" # Using predefined libusb target make libusb }}} === Building OSCAM with PCSC support === #pcsc To build OSCAM with PCSC support on you have to install pcsclite first. For example for Debian: {{{apt-get install libpcsclite-dev}}}. If your distribution do not have pcsclite installed you have to install it from source. To install PCSC from source, just download pcsclite from their site, unarchive it and build it without any options. These following commands would download, compile and install pcsclite in {{{/usr/local}}}. {{{ cd /tmp wget https://pcsclite.apdu.fr/files/pcsc-lite-1.8.25.tar.bz2 tar -xf pcsc-lite-1.8.25.tar.bz2 cd pcsc-lite-1.8.25 ./configure make sudo make install }}} Now to build OSCAM with PCSC support you need the following commands: {{{ #!sh make USE_PCSC=1 # build with smartreader and PCSC support make USE_PCSC=1 USE_LIBUSB=1 # Using predefined pcsc target make pcsc make pcsc-libusb }}} === 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: * gcc4 * gcc4-core * make * subversion (use latest version) * dialog * 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 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 environment 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. To build with PCSC support on cygwin copy the winscard.dll into the cygwin lib folder and compile with: {{{ make i386-pc-cygwin-pcsc USE_LIBUSB=1 CONF_DIR=./ EXTRA_LDFLAGS="-L/cygwin/lib/" }}}