<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.github.fommil.netlib</groupId>
        <artifactId>native_ref-xbuilds</artifactId>
        <version>1.1</version>
    </parent>

    <artifactId>netlib-native_ref-linux-i686</artifactId>
    <packaging>so</packaging>

    <!--
    This is built for Linux i686 on an x86_64 architecture.

      sudo apt-get install libc6-dev-i386 gfortran-multilib

    get the 32 bit JDK from

      http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

    and install into

      /opt/linux-i686/jdk7

    It is impossible to compile a library on Ubuntu that has static
    references to the fortran libraries, as the static fortran library
    has not been compiled with -fPIC. The only workaround would be
    to compile gcc from scratch, with the flags added, and then compile
    these natives. That is not a wise move.
    -->
    <properties>
        <netlib.src>../../../netlib</netlib.src>
    </properties>

    <dependencies>
        <dependency>
            <groupId>${project.parent.groupId}</groupId>
            <artifactId>native_ref-java</artifactId>
            <version>${project.parent.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.github.fommil.netlib</groupId>
                <artifactId>generator</artifactId>
                <executions>
                    <execution>
                        <id>blas</id>
                    </execution>
                    <execution>
                        <id>lapack</id>
                    </execution>
                    <execution>
                        <id>arpack</id>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>native-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <javahOS>linux</javahOS>
                    <jdkIncludePath>/opt/linux-i686/jdk7/include</jdkIncludePath>
                    <compilerEndOptions>
                        <compilerEndOption>-m32</compilerEndOption>
                    </compilerEndOptions>
                    <linkerEndOptions>
                        <linkerEndOption>-m32</linkerEndOption>
                    </linkerEndOptions>
                    <linkerMiddleOptions>
                        <linkerMiddleOption>-shared</linkerMiddleOption>
                        <linkerMiddleOption>-lgfortran</linkerMiddleOption>
                        <linkerMiddleOption>-Wl,-s</linkerMiddleOption>
                        <linkerMiddleOption>-Wl,--version-script=${netlib.src}/symbol.map</linkerMiddleOption>
                        <linkerMiddleOption>-Wl,--gc-sections</linkerMiddleOption>
                    </linkerMiddleOptions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>runtime</id>
                    </execution>
                    <execution>
                        <id>source</id>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
