blob: b8bd64dab326d3c21562c8a5d67297326e6b3732 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="PORTLIB Build" default="build" basedir=".">
<description>Build for PORTLIB component</description>
<!-- import common properties -->
<property name="hy.hdk" location="${basedir}/../../deploy" />
<import file="${hy.hdk}/build/ant/properties.xml" />
<!-- set global properties for this build. -->
<xmlproperty file="make/hyproperties.xml" semanticAttributes="true" />
<property file="../../make/depends.properties" />
<property name="fdlibm.zip" location="${depends.oss}/fdlibm_5.2.zip" />
<condition property="test.portlib">
<and>
<isset property="is.32bit" />
<not><isset property="is.windows" /></not>
<equals arg1="${hy.no.thr}" arg2="false" />
</and>
</condition>
<target name="build" /> <!-- depends="compile-java, copy-resources, build-jar" -->
<target name="test" depends="-test-module">
<fail message="Some tests failed">
<condition>
<or>
<isset property="test.errors" />
</or>
</condition>
</fail>
</target>
<target name="-test-module"
depends="-compile-native-tests,-run-native-tests" />
<target name="copy-native-includes"
depends="-copy-thread-include,-copy-thread-stub-include" >
<copy todir="${hy.hdk}/include" overwrite="yes">
<fileset dir="${hy.portlib.src.main.native}/include/shared">
<include name="hyport.h" />
<include name="hycomp.h" />
<include name="hyporterror.h" />
<include name="hypool.h" />
</fileset>
</copy>
<copy todir="${hy.hdk}/include" overwrite="yes">
<fileset dir="${hy.portlib.src.main.native}/include/${hy.os.family}">
<include name="hymutex.h" />
<include name="hysock.h" />
<include name="hyportpg.h" />
</fileset>
</copy>
</target>
<target name="-copy-thread-include" unless="hy.skip.thr" >
<copy todir="${hy.hdk}/include" overwrite="yes">
<fileset dir="${hy.portlib.src.main.native}/include/shared">
<include name="hythread.h" />
</fileset>
</copy>
</target>
<target name="-copy-thread-stub-include" if="hy.skip.thr" >
<copy todir="${hy.hdk}/include" overwrite="yes">
<fileset dir="${hy.portlib.src.main.native}/thrstub/shared">
<include name="hythread.h" />
</fileset>
</copy>
</target>
<!-- Build the portlib native components -->
<target name="build-native"
depends="-build-native,-build-native-sig,-build-native-thread,-build-native-thrstub,-build-native-port" />
<target name="-build-native">
<!-- Build common lib -->
<make dir="${hy.portlib.src.main.native}/common/${hy.os.family}" />
<!-- Build pool lib -->
<make dir="${hy.portlib.src.main.native}/pool/${hy.os.family}" />
</target>
<target name="-build-native-sig" unless="hy.skip.sig">
<!-- Build sig dll -->
<make dir="${hy.portlib.src.main.native}/sig/${hy.os.family}" />
<copy todir="${hy.jdk}/jre/bin" overwrite="yes">
<fileset dir="${hy.portlib.src.main.native}/sig">
<include name="*${shlib.suffix}*" />
<include name="*${progdb.suffix}*" if="is.windows" />
<exclude name="*${manifest.suffix}"/>
</fileset>
</copy>
</target>
<target name="-build-native-thread" unless="hy.skip.thr">
<!-- Build thread dll -->
<make dir="${hy.portlib.src.main.native}/thread/${hy.os.family}" />
<copy todir="${hy.jdk}/jre/bin" overwrite="yes">
<fileset dir="${hy.portlib.src.main.native}/thread">
<include name="*${shlib.suffix}*" />
<include name="*${progdb.suffix}*" if="is.windows" />
<exclude name="*${manifest.suffix}"/>
</fileset>
</copy>
</target>
<target name="-build-native-thrstub" if="hy.skip.thr">
<!-- Build thread dll -->
<make dir="${hy.portlib.src.main.native}/thrstub/${hy.os.family}" />
<copy todir="${hy.hdk}/lib" overwrite="yes">
<fileset dir="${hy.portlib.src.main.native}/thrstub">
<include name="*${shlib.suffix}*" />
<include name="*${progdb.suffix}*" if="is.windows" />
<exclude name="*${manifest.suffix}"/>
</fileset>
</copy>
</target>
<target name="-build-native-port">
<!-- Build port dll -->
<make dir="${hy.portlib.src.main.native}/port/${hy.os.family}" />
<copy todir="${hy.jdk}/jre/bin" overwrite="yes">
<fileset dir="${hy.portlib.src.main.native}/port">
<include name="*${shlib.suffix}*" />
<include name="*${progdb.suffix}*" if="is.windows" />
<exclude name="*${manifest.suffix}"/>
</fileset>
</copy>
</target>
<!-- Clean natives -->
<target name="clean-native" depends="-clean-native-tests">
<make dir="${hy.portlib.src.main.native}/sig/${hy.os.family}" target="clean" />
<make dir="${hy.portlib.src.main.native}/thread/${hy.os.family}" target="clean" />
<make dir="${hy.portlib.src.main.native}/thrstub/${hy.os.family}" target="clean" />
<make dir="${hy.portlib.src.main.native}/port/${hy.os.family}" target="clean" />
<make dir="${hy.portlib.src.main.native}/common/${hy.os.family}" target="clean" />
<make dir="${hy.portlib.src.main.native}/pool/${hy.os.family}" target="clean" />
</target>
<target name="clean" depends="clean-native-includes" />
<target name="clean-native-includes">
<delete failonerror="false">
<fileset dir="${hy.hdk}/include">
<include name="hyport.h" />
<include name="hythread.h" />
<include name="hymutex.h" />
<include name="hycomp.h" />
<include name="hyporterror.h" />
<include name="hysock.h" />
<include name="hyportpg.h" />
<include name="hypool.h" />
</fileset>
</delete>
</target>
<target name="-compile-native-tests" if="test.portlib" >
<make dir="${hy.portlib.src.test.native}/init/${hy.os.family}" />
<make dir="${hy.portlib.src.test.native}/hyerror/${hy.os.family}" />
<make dir="${hy.portlib.src.test.native}/hytime/${hy.os.family}" />
<make dir="${hy.portlib.src.test.native}/hyfile/${hy.os.family}" />
</target>
<target name="-run-native-tests" if="test.portlib" >
<mkdir dir="${hy.tests.reports}" />
<property environment="env"/>
<exec-native test="init" />
<exec-native test="hyerror" />
<exec-native test="hytime" />
<exec-native test="hyfile" />
<antcall target="touch-errors-file" />
</target>
<target name="-clean-native-tests" if="test.portlib" >
<make dir="${hy.portlib.src.test.native}/init/${hy.os.family}"
target="clean" />
<make dir="${hy.portlib.src.test.native}/hyerror/${hy.os.family}"
target="clean" />
<make dir="${hy.portlib.src.test.native}/hytime/${hy.os.family}"
target="clean" />
<make dir="${hy.portlib.src.test.native}/hyfile/${hy.os.family}"
target="clean" />
</target>
<target name="touch-errors-file" if="test.errors">
<echo file="${hy.tests.reports}/test.errors"
append="true">portlib${line.separator}</echo>
</target>
<macrodef name="exec-native">
<attribute name="test" />
<sequential>
<property name="@{test}.name"
value="native.portlib.@{test}" />
<exec executable="${hy.portlib.src.test.native}/@{test}/@{test}${exe.suffix}"
failonerror="false"
outputproperty="@{test}.output"
resultproperty="@{test}.resultcode" >
<env key="PATH"
path="${env.Path}:${env.PATH}:${hy.jdk}/jre/bin" />
<env key="Path"
path="${env.Path}:${env.PATH}:${hy.jdk}/jre/bin" />
<env key="LD_LIBRARY_PATH"
path="${env.LD_LIBRARY_PATH}:${hy.jdk}/jre/bin" />
</exec>
<condition property="@{test}.result" value="passed" else="FAILED">
<equals arg1="${@{test}.resultcode}" arg2="0" />
</condition>
<condition property="@{test}.errorcount" value="0" else="1">
<equals arg1="${@{test}.resultcode}" arg2="0" />
</condition>
<condition property="test.errors" value="1">
<not>
<equals arg1="${@{test}.resultcode}" arg2="0" />
</not>
</condition>
<echo>@{test}: ${@{test}.result}${line.separator}</echo>
<echo file="${hy.tests.reports}/TEST-${@{test}.name}.xml"
>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
&lt;testsuite tests="1" errors='${@{test}.errorcount}' failures='0'
name='${@{test}.name}' time='0'&gt;
&lt;testcase classname='${@{test}.name}' name='${@{test}.name}'
time='0.0' /&gt;
&lt;system-out&gt;&lt;![CDATA[${@{test}.output}]]&gt;&lt;/system-out&gt;
&lt;/testsuite&gt;${line.separator}</echo>
</sequential>
</macrodef>
</project>