Home

Awesome

jitsi-sctp

The jitsi-sctp project creates a JNI wrapper around the usrsctp lib and provides a set of Java classes to further flesh out a convenient Java SCTP API, which can be used on Linux, MacOS X, FreeBSD and Windows.

Project organization

Because JNI has a complex build process multiplied by being platform dependent, this project has multiple Maven modules to try and separate each of the phases necessary from start to finish. The maven modules are laid out as follows:

`-- jitsi-sctp
    |-- jniwrapper
    |   |-- java
    |   |-- jnilib
    |   `-- native (produces platform specific artifact classified by OS & CPU architecture)
    |-- sctp
    `-- usrsctp (produces platform specific artifact classified by OS & CPU architecture)
$ tree usrsctp-1.0-SNAPSHOT-7a8bc9a-linux-x86_64 --noreport
usrsctp-1.0-SNAPSHOT-7a8bc9a-linux-x86_64
|-- META-INF
|   |-- MANIFEST.MF
|   `-- maven
|       `-- org.jitsi
|           `-- usrsctp
|               `-- pom.xml
|-- git.properties
|-- include
|   `-- usrsctp.h
`-- lib
    `-- libusrsctp.a

Pre-required software to build

CMake is required to build native libraries. Native compilers GCC/Clang/Visual C++ required to build native libraries.

Building the jar files

(Re)Building a new JNI lib

The JNI lib will need to be rebuilt if there is a change in the usrsctp version or a change in the JNI wrapper C file. Changes in usrsctp handled by re-compiling usrsctp artifact from corresponding Maven module. Changes in JNI wrapper C code are handled by recompiling jniwrapper-native artifact from corresponding maven module. To re-build native libraries cross-platform CMake build tool, C compiler and linker and JDK must be installed on system used to build.

The following steps can be done to produce an updated version of jitsi-sctp artifact with newer version of usrsctp or jniwrapper-native:

  1. Clone the project with git clone --recurse-submodules https://github.com/jitsi/jitsi-sctp.git.

  2. [Optional] initialize the usrsctp submodule with git submodule update --init --recursive:

    jitsi-sctp/usrsctp/usrsctp>
    (check out whatever hash/version you want in case it distinct from what is defined by git submodule)
    
  3. Produce an updated platform specific usrsctp artifact

    jitsi-sctp> mvn clean package install -Pbuild-usrsctp -f pom.xml -pl org.jitsi:usrsctp
    
  4. [Optional] Update <usrsctp_commit_id> property in jniwrapper/pom.xml to specify desired version of usrsctp to use.

  5. Produce an updated platform specific jniwrapper-native artifact and publish it to Maven.

    jitsi-sctp> mvn clean package install -Pbuild-jnisctp -f pom.xml -pl org.jitsi:jniwrapper-native 
    
  6. [Optional] Repeat steps 1 - 5 on each of supported platforms: Linux, Mac OSX, FreeBSD, Windows.

  7. Once usrsctp and jniwrapper-native artifacts built and published to Maven repository for each supported platform (Windows, Linux, Mac, FreeBSD) with steps 1 - 6, an updated fat jar could be build and installed with following command:

    jitsi-sctp> mvn clean package install -Pbuild-x-plat-jar -f pom.xml
    
  8. To produce jitsi-sctp artifact usable only on current platform steps 3 - 7 can be skipped and following command could be used instead:

    jitsi-sctp> mvn clean package install -Pbuild-usrsctp -Pbuild-jnisctp -f pom.xml