<!-- This build.xml file is designed to be used for building COE SOFTWARE Segments. --> <!-- SOFTWARE segments include source code than may need to be extracted --> <!-- and then compiled. --> <project name="COE" default="build" basedir="../../.."> <!-- Segment Name --> <property name="name" value="COE"/> <!-- Segment Type --> <property name="type" value="SOFTWARE"/> <!-- Segment Version --> <property name="version" value="1.1.4.1"/> <!-- Segment Full Name --> <property name="fullname" value="COE Kernel"/> <!-- Segment Architecture --> <property name="os" value="COE"/> <!-- property name="os" value="LINUX"/ --> <!-- property name="os" value="MS"/ --> <!-- property name="os" value="SOL"/ --> <!-- Segment Architecture --> <property name="cpu" value="ALL"/> <!-- property name="cpu" value="I586"/ --> <!-- property name="cpu" value="SPARC"/ --> <!-- Segment Architecture --> <property name="arch" value="${os}_${cpu}"/> <!-- Segment Name Seperator --> <property name="sep" value="-"/> <!-- Long Segment Name --> <property name="segname" value="${name}${sep}${type}${sep}${version}${sep}${arch}"/> <!-- COE Enviroment --> <property name="coe.home" value="/h/COE"/> <property name="coe.comp" value="/h/COE/Comp"/> <property name="coe.cots" value="/h/COTS"/> <property name="coe.apps" value="/h"/> <property name="coe.user" value="/h/USERS"/> <property name="coe.data" value="/h/DATA"/> <!-- Install Directory --> <property name="install.dir" value="${coe.home}"/> <!-- Build Directory --> <property name="build.dir" value="src/OpenCOE/build/${name}"/> <!-- Build Temporary Directory --> <property name="tmp.dir" value="src/OpenCOE/build/tmp"/> <!-- Distribution Directory --> <property name="dist.dir" value="src/OpenCOE/build/dist"/> <!-- ========== COE SDK Targets ======================================== --> <target name="ArchUpdate" depends="build" description="(public) Updates Architecture type in SegInfo file."> <filter token="CPU" value="${cpu}"/> <filter token="OS" value="${os}"/> <copy todir="${tmp.dir}/SegDescrip" overwrite="true" filtering="true"> <fileset dir="${build.dir}/SegDescrip"> <include name="SegInfo"/> </fileset> </copy> <copy todir="${build.dir}/SegDescrip" overwrite="true"> <fileset dir="${tmp.dir}/SegDescrip"> <include name="SegInfo"/> </fileset> </copy> </target> <target name="CalcSpace" depends="build" description="(public) Calculates disk space used by segment."> <exec executable="/usr/bin/du" os="Linux" output="${tmp.dir}/seg.size"> <arg value="-sk"/> <arg value="${build.dir}"/> </exec> <exec executable="/usr/bin/cut" os="Linux" outputproperty="seg.size"> <arg value="-f1"/> <arg value="${tmp.dir}/seg.size"/> </exec> <filter token="SIZE" value="${seg.size}"/> <copy todir="${tmp.dir}/SegDescrip" overwrite="true" filtering="true"> <fileset dir="${build.dir}/SegDescrip"> <include name="SegInfo"/> </fileset> </copy> <copy todir="${build.dir}/SegDescrip" overwrite="true"> <fileset dir="${tmp.dir}/SegDescrip"> <include name="SegInfo"/> </fileset> </copy> </target> <target name="CanInstall" depends="build" description="(public) Runs checks used by COEInstaller."> </target> <target name="MakeAttribs" depends="build" description="(public) Creates the FileAttribs file."> </target> <target name="MakeSegment" depends="clean, VerifySeg" description="(public) Creates basic segment file."> <antcall target="segtar"/> </target> <target name="MakeInstall" description="(public) Packages segment for distribution."> <antcall target="insttar"/> </target> <target name="TestInstall" depends="build" description="(public) Installs the segment from the build directory."> </target> <target name="TestRemove" depends="TestInstall" description="(public) Deinstalls segment without removing it."> </target> <target name="TimeStamp" depends="build" description="(public) Puts current time and date into VERSION file."> <tstamp> <format property="seg.time" pattern="MM/dd/yyyy : hh:mm"/> </tstamp> <filter token="TIMESTAMP" value="${seg.time}"/> <copy todir="${tmp.dir}/SegDescrip" overwrite="true" filtering="true"> <fileset dir="${build.dir}/SegDescrip"> <include name="VERSION"/> </fileset> </copy> <copy todir="${build.dir}/SegDescrip" overwrite="true"> <fileset dir="${tmp.dir}/SegDescrip"> <include name="VERSION"/> </fileset> </copy> </target> <target name="VerUpdate" depends="build" description="(public) Puts current version into VERSION file."> <filter token="VERSION" value="${version}"/> <copy todir="${tmp.dir}/SegDescrip" overwrite="true" filtering="true"> <fileset dir="${build.dir}/SegDescrip"> <include name="VERSION"/> </fileset> </copy> <copy todir="${build.dir}/SegDescrip" overwrite="true"> <fileset dir="${tmp.dir}/SegDescrip"> <include name="VERSION"/> </fileset> </copy> </target> <target name="VerifySeg" depends="ArchUpdate, CalcSpace, TimeStamp, VerUpdate" description="(public) Verifies Segment Compliance,validates with MD5 checksum"> <antcall target="checksum"/> </target> <target name="checksum" description="(private) Generates MD5 checksum for segment"> <antcall target="tmptar"/> <checksum file="${tmp.dir}/${segname}.tar" property="seg.sum" /> <echo file="${build.dir}/SegDescrip/Validated" message="${seg.sum}"/> </target> <!-- ========== Utility Targets ======================================== --> <target name="clean" description="(public) Clean build directories"> <!-- Delete build directories --> <delete dir="src/OpenCOE/build/classes"/> <delete dir="src/OpenCOE/build/${name}"/> <delete dir="src/OpenCOE/build/tmp"/> </target> <target name="prepare" description="(private) Create build directories"> <!-- Create build directories --> <mkdir dir="src/OpenCOE/build/classes"/> <mkdir dir="src/OpenCOE/build/dist"/> <mkdir dir="src/OpenCOE/build/${name}"/> <mkdir dir="src/OpenCOE/build/tmp"/> </target> <target name="clean-extract" description="(public) Clean extraction directories"> <!-- Delete build directories --> <!-- delete dir="src/${name}/*"/ --> </target> <target name="clean-dist" description="(public) Clean Distribution directories"> <!-- Delete build directories --> <delete dir="src/OpenCOE/build/dist"/> </target> <target name="clean-all" description="(public) Clean ALL directories"> <antcall target="clean"/> <antcall target="clean-dist"/> <antcall target="clean-extract"/> <ant dir="${basedir}" antfile="src/${name}/build/build.xml" target="clean" inheritAll="false"/> </target> <!-- ========== Build SOFTWARE ======================================== --> <target name="prebuild" description="(private) Builds COE SegDescrip files" depends="prepare"> <!-- copy the SegDescrip files --> <copy todir="${build.dir}/SegDescrip"> <fileset dir="src/OpenCOE/SEGROOT/SegDescrip"> <include name="*"/> </fileset> </copy> <!-- update the SegName file --> <filter token="FULLNAME" value="${fullname}"/> <filter token="PREFIX" value="${name}"/> <filter token="TYPE" value="${type}"/> <copy todir="${build.dir}/SegDescrip" overwrite="true" filtering="true"> <fileset dir="src/OpenCOE/SEGROOT/SegDescrip"> <include name="SegName"/> </fileset> </copy> <!-- overwrite default scripts with architecture specific files --> <move file="${build.dir}/SegDescrip/DEINSTALL.${arch}" failonerror="false" tofile="${build.dir}/SegDescrip/DEINSTALL"/> <move file="${build.dir}/SegDescrip/PostInstall.${arch}" failonerror="false" tofile="${build.dir}/SegDescrip/PostInstall"/> <move file="${build.dir}/SegDescrip/PreInstall.${arch}" failonerror="false" tofile="${build.dir}/SegDescrip/PreInstall"/> <!-- delete remaing architecture specific scripts --> <delete> <fileset dir="${build.dir}/SegDescrip" includes="DEINSTALL.*"/> <fileset dir="${build.dir}/SegDescrip" includes="PostInstall.*"/> <fileset dir="${build.dir}/SegDescrip" includes="PreInstall.*"/> </delete> <!-- for windows move default scripts to *.bat to execute --> <exec executable="move" os="Windows"> <arg value="${build.dir}/SegDescrip/DEINSTALL"/> <arg value="${build.dir}/SegDescrip/DEINSTALL.bat"/> </exec> <exec executable="move" os="Windows"> <arg value="${build.dir}/SegDescrip/PreInstall"/> <arg value="${build.dir}/SegDescrip/PreInstall.bat"/> </exec> <exec executable="move" os="Windows"> <arg value="${build.dir}/SegDescrip/PostInstall"/> <arg value="${build.dir}/SegDescrip/PostInstall.bat"/> </exec> <!-- change ownership for SegDescrip --> <!-- must be root or COE --> <chmod dir="${build.dir}/SegDescrip" perm="744" includes="**"/> <exec executable="/bin/chown" os="Linux"> <arg value="-R"/> <arg value="COE:COE"/> <arg value="${build.dir}/"/> </exec> </target> <target name="extract" description="(private) Extracts the archived COTS file."> </target> <target name="compile" description="(private) Compiles source code."> <ant dir="${basedir}" antfile="src/${name}/build/build.xml" target="clean" inheritAll="false"/> <ant dir="${basedir}" antfile="src/${name}/build/build.xml" target="jars" inheritAll="false"/> </target> <target name="import" description="(private) Imports compiled source code."> <property name="import.dir" value="src/${name}"/> <filter token="VERSION" value="${version}"/> <copy todir="${build.dir}/bin" failonerror="false" filtering="true"> <fileset dir="${import.dir}/bin"> <include name="**"/> </fileset> </copy> <copy todir="${build.dir}/data" failonerror="false"> <fileset dir="${import.dir}/data"> <include name="**"/> </fileset> </copy> <copy todir="${build.dir}/lib" failonerror="false"> <fileset dir="${import.dir}/lib"> <include name="**"/> </fileset> </copy> <copy todir="${build.dir}/docs" failonerror="false"> <fileset dir="${import.dir}/docs"> <include name="**"/> </fileset> </copy> </target> <target name="build" description="(private) Builds the segment in the build directory"> <antcall target="prebuild"/> <antcall target="extract"/> <antcall target="compile"/> <antcall target="import"/> </target> <target name="toc" description="(private) Creates toc file from segment info"> <property name="toc.str" value="1:0:1:${arch}:${name}:${fullname}:${name}:${type}:${version}:UNCLASS:${seg.size}"/> <mkdir dir="${tmp.dir}/toc"/> <echo message="${toc.str}" file="${tmp.dir}/toc/toc"/> </target> <!-- ========== Make Segment ======================================== --> <target name="tmptar" description="(private) Makes tmp tar for MD5 Checksum." depends="prepare"> <tar longfile="gnu" tarfile="${tmp.dir}/${segname}.tar"> <tarfileset dir="${build.dir}/.." id="seg.tar.bin" username="COE" group="COE" mode="755"> <exclude name="${name}/bin/COEInstaller"/> <exclude name="${name}/bin/COESegInstall"/> <exclude name="${name}/bin/secbanner.pl"/> <include name="${name}/bin/**"/> </tarfileset> <tarfileset dir="${build.dir}/.." id="seg.tar.bin.SA" username="COE" group="SA" mode="754"> <include name="${name}/bin/COEInstaller"/> <include name="${name}/bin/COESegInstall"/> <include name="${name}/bin/secbanner.pl"/> </tarfileset> <tarfileset dir="${build.dir}/.." id="seg.tar.lib" username="COE" group="COE" mode="444"> <include name="${name}/lib/**"/> </tarfileset> <tarfileset dir="${build.dir}/.." id="seg.tar.data" username="COE" group="COE" mode="444"> <include name="${name}/data/**"/> </tarfileset> <tarfileset dir="${build.dir}/.." id="seg.tar.docs" username="COE" group="COE" mode="444"> <include name="${name}/docs/**"/> </tarfileset> <tarfileset dir="${build.dir}/.." id="seg.tar.SegDescrip" username="COE" group="COE" mode="644"> <exclude name="${name}/SegDescrip/DEINSTALL"/> <exclude name="${name}/SegDescrip/PreInstall"/> <exclude name="${name}/SegDescrip/PostInstall"/> <include name="${name}/SegDescrip/**"/> </tarfileset> <tarfileset dir="${build.dir}/.." id="seg.tar.SegDescrip.Scripts" username="COE" group="COE" mode="744"> <include name="${name}/SegDescrip/DEINSTALL"/> <include name="${name}/SegDescrip/PreInstall"/> <include name="${name}/SegDescrip/PostInstall"/> </tarfileset> </tar> </target> <target name="segtar" description="(private) Makes segment tar."> <!-- Checksum has been called, so now repeat tmptar with Validated file included --> <delete file="${tmp.dir}/${segname}.tar"/> <antcall target="tmptar"/> <gzip zipfile="${dist.dir}/${segname}.tar.gz" src="${tmp.dir}/${segname}.tar"/> <delete file="${tmp.dir}/${segname}.tar"/> </target> <target name="insttar" description="(private) Makes segment installation bundle"> <mkdir dir="${tmp.dir}/TOC/${segname}/SegDescrip"/> <copy todir="${tmp.dir}/TOC/${segname}/SegDescrip"> <fileset dir="${build.dir}/SegDescrip"/> </copy> <copy file="${dist.dir}/${segname}.tar.gz" todir="${tmp.dir}"/> <antcall target="toc"/> <touch file="${tmp.dir}/DIIHeader"/> <touch file="${tmp.dir}/distrib"/> <tar longfile="gnu" tarfile="${dist.dir}/${name}.tar"> <tarfileset dir="${tmp.dir}" username="COE" group="COE" mode="444"> <include name="DIIHeader"/> <include name="distrib"/> <include name="TOC/${segname}/**"/> <include name="toc/toc"/> <include name="${segname}.tar.gz"/> </tarfileset> </tar> </target> <!-- ========== Source ======================================== --> <target name="MakeSource" description="(public) Make segment source file." depends="clean-all"> <property name="srcname" value="${name}${sep}${type}${sep}${version}${sep}SRC"/> <mkdir dir="src/OpenCOE/build/dist"/> <tar longfile="gnu" tarfile="${dist.dir}/${srcname}.tar" > <tarfileset dir=".." username="COE" group="COE" mode="644"> <include name="${name}/src/OpenCOE/**"/> <include name="${name}/src/archive/**"/> <include name="${name}/src/${name}/*"/> </tarfileset> </tar> <gzip zipfile="${dist.dir}/${srcname}.tar.gz" src="${dist.dir}/${srcname}.tar"/> <delete file="${dist.dir}/${srcname}.tar"/> <delete file="${tmp.dir}/${srcname}.tar"/> </target> </project> |