Packaging Native Libraries

Sometimes there is a need to include some native libraries in contribution. Fabric3 offers easy and efficient way how to do it. All it needs to be done is include them in sca-contribution.xml file:

sca-contribution.xml
<?xml version="1.0" encoding="UTF-8"?>
<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:f3="urn:fabric3.org">

    <f3:library path="META-INF/native/sigar-x86-winnt.lib">
    	<os name="Windows" processor="x86"/>
    </f3:library>
	<f3:library path="META-INF/native/sigar-x86-winnt.dll">
    	<os name="Windows" processor="x86"/>
    </f3:library>
	<f3:library path="META-INF/native/sigar-amd64-winnt.dll">
    	<os name="Windows" processor="x86-64"/>
    </f3:library>
	<f3:library path="META-INF/native/libsigar-amd64-linux.so">
    	<os name="Linux" processor="x86-64"/>
    </f3:library>
	<f3:library path="META-INF/native/libsigar-universal64-macosx.dylib">
    	<os name="Mac OS X" processor="x86-64"/>
    </f3:library>

</contribution>

Libraries needs to be in respective directories (e.g. META-INF/native). When runtime is booted, fabric3 copy the respective libraries (depending on os, architecture, ...) to tmp/native dir in runtime directory and set the JVM library path to include those libraries.

Possible processor attribute values:

  • x86_64
  • x86
  • 68k
  • arm
  • alpha
  • ignite
  • mips
  • parisc
  • powerpc
  • sparc

Possible name attribute values:

  • Windows
  • Linux
  • Mac OS
  • Mac OS X
  • AIX
  • Digital Unix
  • FreeBSD
  • HP UX
  • Irix
  • MPE/iX
  • Netware 4.11
  • OS/2
  • Solaris
  • Windows 2000
  • Windows 95
  • Windows 98
  • Windows NT
  • Windows Vista
  • Windows XP
  • Windows 7
  • Windows 8