<?xml version="1.0" encoding="iso-8859-1"?>
<!--

    Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Public License v. 2.0, which is available at
    http://www.eclipse.org/legal/epl-2.0.

    This Source Code may also be made available under the following Secondary
    Licenses when the conditions for such availability set forth in the
    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
    version 2 with the GNU Classpath Exception, which is available at
    https://www.gnu.org/software/classpath/license.html.

    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0

-->

<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">
    <parent>
	<groupId>com.sun.mail</groupId>
	<artifactId>all</artifactId>
	<version>1.6.6-SNAPSHOT</version>
	<relativePath>../../pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.sun.mail</groupId>
    <artifactId>libmbox</artifactId>
    <packaging>so</packaging>
    <name>Jakarta Mail API mbox native library</name>
    <description>Jakarta Mail API mbox native library</description>
    <url>https://github.com/eclipse-ee4j/jakartamail</url>

    <properties>
	<m64>
	</m64>
	<compiler.name>
	    c89
	</compiler.name>
	<compiler.start.options>
	    ${m64} -Xa -xO2 -v -D_REENTRANT -KPIC
	    -I${env.JAVA_HOME}/include -I${env.JAVA_HOME}/include/solaris
	</compiler.start.options>
	<linker.name>
	    c89
	</linker.name>
	<linker.start.options>
	    -G ${m64} -KPIC -z text
	</linker.start.options>
	<linker.arch>
	    ${env.MACH}
	</linker.arch>
	<linker.end.options>
	    -L${env.JAVA_HOME}/jre/lib/${linker.arch} -lmail -ljava -lc
	</linker.end.options>
    </properties>

    <profiles>
	<profile>
	    <!--
		Override the settings necessary to build with JDK 1.8.
	    -->
	    <id>1.8</id>
	    <activation>
		<jdk>1.8</jdk>
	    </activation>
	    <properties>
		<m64>
		    -m64
		</m64>
		<linker.arch>
		    amd64
		</linker.arch>
	    </properties>
	</profile>
	<profile>
	    <!--
		Override the settings necessary to build on Linux.
	    -->
	    <id>linux</id>
	    <activation>
		<os>
		    <family>Linux</family>
		</os>
	    </activation>
	    <properties>
		<m64>
		    -m64
		</m64>
		<linker.arch>
		    ${env.MACH}
		</linker.arch>
		<compiler.start.options>
		    -fpic
		    -I${env.JAVA_HOME}/include -I${env.JAVA_HOME}/include/linux
		</compiler.start.options>
		<linker.start.options>
		    ${m64} -shared
		</linker.start.options>
		<linker.end.options>
		    -L${env.JAVA_HOME}/jre/lib/${linker.arch} -ljava -lc
		</linker.end.options>
		<linker.arch>
		    amd64
		</linker.arch>
	    </properties>
	</profile>
    </profiles>

    <build>
        <plugins>
	    <plugin>
		<groupId>org.codehaus.mojo</groupId>
		<artifactId>native-maven-plugin</artifactId>
		<version>1.0-alpha-7</version>
		<extensions>true</extensions>
		<configuration>
		    <compilerProvider>generic</compilerProvider>
		    <compilerExecutable>${compiler.name}</compilerExecutable>
		    <linkerExecutable>${linker.name}</linkerExecutable>
		    <compilerStartOptions>
			<compilerStartOption>
			    ${compiler.start.options}
			</compilerStartOption>
		    </compilerStartOptions>
		    <linkerStartOptions>
			<linkerStartOption>
			    ${linker.start.options}
			</linkerStartOption>
		    </linkerStartOptions>
		    <linkerEndOptions>
			<linkerEndOption>
			    ${linker.end.options}
			</linkerEndOption>
		    </linkerEndOptions>
		    <sources>
			<source>
			    <directory>../src/main/cpp</directory>
			    <includes>
				<include>**/*.c</include>
			    </includes>
			</source>
			<source>
			    <directory>target/native/javah</directory>
			    <dependencyAnalysisParticipation>
				false
			    </dependencyAnalysisParticipation>
			</source>
		    </sources>
		</configuration>
		<executions>
		    <execution>
			<id>javah</id>
			<phase>generate-sources</phase>
			<goals>
			    <goal>javah</goal>
			</goals>
			<configuration>
			    <classNames>
				<className>
				    com.sun.mail.mbox.UNIXFile
				</className>
				<className>
				    com.sun.mail.mbox.UNIXInbox
				</className>
			    </classNames>
			</configuration>
		    </execution>
		</executions>
	    </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>jakarta.mail</artifactId>
        </dependency>
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>mbox</artifactId>
        </dependency>
    </dependencies>
</project>
