<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.mobicents.protocols.ss7.hardware</groupId>
		<artifactId>mobicents-dialogic-native</artifactId>
		<version>1.0.0.BETA9</version>
	</parent>

	<artifactId>libmobicents-dialogic-linux</artifactId>

	<properties>
		<include.dialogic>/opt/dpklnx/INC</include.dialogic>
		<include.dialogic.gctlib>/opt/dpklnx/lib32</include.dialogic.gctlib>
	</properties>
	<name>Mobicents SS7 :: Hardware :: ${pom.artifactId}</name>
	<packaging>so</packaging>

	<dependencies>
		<dependency>
			<groupId>org.mobicents.protocols.ss7.hardware</groupId>
			<artifactId>mobicents-dialogic</artifactId>
			<version>${pom.version}</version>
		</dependency>
	</dependencies>

	<build>
		<finalName>${artifactId}</finalName>

		<testSourceDirectory>../src/test/java</testSourceDirectory>

		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>native-maven-plugin</artifactId>
				<extensions>true</extensions>
				<configuration>

					<compilerProvider>generic</compilerProvider>
					<compilerStartOptions>
						<compilerStartOption>
							-fPIC -O
						</compilerStartOption>
					</compilerStartOptions>

					<javahOS>linux</javahOS>

					<sources>
						<source>
							<directory>../src/main/native</directory>
							<fileNames>
								<fileName>ipc.c</fileName>
							</fileNames>
						</source>
						<source>
							<directory>${include.dialogic}</directory>
						</source>
					</sources>

					<linkerStartOptions>
						<linkerStartOption>
							-shared -lc -ldl -L${include.dialogic.gctlib} -lgctlib 
						</linkerStartOption>
					</linkerStartOptions>

				</configuration>

				<executions>
					<execution>
						<id>javah</id>
						<phase>generate-sources</phase>
						<configuration>
							<classNames>
								<className>
									org.mobicents.ss7.hardware.dialogic.InterProcessCommunicator
								</className>
							</classNames>
						</configuration>
						<goals>
							<goal>javah</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<forkMode>once</forkMode>
					<environmentVariables>
						<LD_LIBRARY_PATH>
							${project.build.directory}
						</LD_LIBRARY_PATH>
						<systemProperties>
							<property>
								<name>lib_schannel</name>
								<value>
									${project.build.directory}
								</value>
							</property>
						</systemProperties>
					</environmentVariables>
				</configuration>
			</plugin>
		</plugins>

	</build>

	<profiles>
		<!-- to build debug artifact, run maven install -Ddebug -->
		<profile>
			<id>debug</id>
			<activation>
				<property>
					<name>debug</name>
				</property>
			</activation>
			<properties>
				<compiler.debug.options>-MDd</compiler.debug.options>
				<linker.debug.options>/DEBUG</linker.debug.options>
				<classifier>debug</classifier>
			</properties>
		</profile>
		<profile>
			<id>release</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<properties>
				<compiler.debug.options>-MD</compiler.debug.options>
				<linker.debug.options />
				<classifier />
			</properties>
		</profile>
	</profiles>
</project>
