build-svr4.xml revision 4103
3860N/A<!--
3860N/A ! CDDL HEADER START
3860N/A !
3860N/A ! The contents of this file are subject to the terms of the
3860N/A ! Common Development and Distribution License, Version 1.0 only
3860N/A ! (the "License"). You may not use this file except in compliance
3860N/A ! with the License.
3860N/A !
3860N/A ! You can obtain a copy of the license at
3860N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
3860N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
3860N/A ! See the License for the specific language governing permissions
3860N/A ! and limitations under the License.
3860N/A !
3860N/A ! When distributing Covered Code, include this CDDL HEADER in each
3860N/A ! file and include the License file at
3860N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
3860N/A ! add the following below this CDDL HEADER, with the fields enclosed
3860N/A ! by brackets "[]" replaced with your own identifying information:
3860N/A ! Portions Copyright [yyyy] [name of copyright owner]
3860N/A !
3860N/A ! CDDL HEADER END
3860N/A !
3860N/A !
4103N/A ! Copyright 2006-2009 Sun Microsystems, Inc.
3860N/A ! -->
3860N/A
3860N/A<project name="SVR4 Packaging" basedir="." default="package-svr4">
3860N/A <description>
3860N/A This is a build script that extends the OpenDS build script by adding
3860N/A SVR4 packaging functions.
3860N/A </description>
3860N/A
3860N/A
3860N/A <!-- By default will build OpenDS package -->
3860N/A <property name="product" value="${SHORT_NAME}" />
3860N/A
3860N/A
3860N/A <!-- General properties -->
3860N/A <property name="svr4.src.dir" location="src/svr4/${product}" />
3860N/A <property name="build.dir" location="build" />
3860N/A <property name="pkg.dir" location="${build.dir}/package" />
3860N/A <property name="svr4.dir" location="${build.dir}/package/svr4" />
3860N/A
4103N/A <!-- Product specific properties: pkg.name / pkg.fullname / pkg.arch /
4103N/A pkg.desc / pkg.vendor / pkg.basedir / pkg.prefix / pkg.type -->
3860N/A <property file="${svr4.src.dir}/pkg.properties" />
3860N/A
3860N/A <!-- Default values for product specific properties -->
3860N/A <property name="pkg.name" value="${product}" />
3860N/A <property name="pkg.fullname" value="${pkg.name}" />
3860N/A <property name="pkg.arch" value="all" />
3860N/A <property name="pkg.desc" value="${product}" />
3860N/A <property name="pkg.vendor" value="Sun Microsystems, Inc." />
3972N/A <property name="pkg.basedir" value="/usr" />
3860N/A
3860N/A <!-- Some others general properties -->
3860N/A <property name="svr4.build.dir" location="${build.dir}/package/svr4/build/${pkg.name}" />
3860N/A <property name="svr4.meta.dir" location="${svr4.build.dir}/meta" />
3860N/A <property name="svr4.layout.dir" location="${svr4.build.dir}/layout" />
3968N/A <property name="svr4.layout.pkg.dir" location="${svr4.build.dir}/layout/${pkg.prefix}" />
3860N/A
3860N/A <!-- Must define layout/pkgversion target -->
3860N/A <import file="${svr4.src.dir}/layout.xml" />
3860N/A
3860N/A <!-- Check if OS is Solaris -->
3860N/A <target name="checkos">
3860N/A <condition property="isSunOS">
3860N/A <os name="SunOS"/>
3860N/A </condition>
3860N/A </target>
3860N/A
3860N/A <target name="wrongos" unless="isSunOS">
3860N/A <echo message="OS is ${os.name}. SVR4 package can only be built on a SunOS machine" />
3860N/A </target>
3860N/A
3860N/A
3860N/A <!-- Construct SVR4 package -->
3914N/A <target name="svr4" depends="checkos,wrongos,cleansvr4,pkgversion,layout,metadata,pkgmk,zipsvr4" if="isSunOS"
3860N/A description="Construct ${pkg.name} package for product ${product}.">
3860N/A <echo message="Package ${pkg.name} for product ${product} built in ${svr4.dir}" />
3860N/A </target>
3860N/A
3860N/A <!-- Cleanup target -->
3860N/A <target name="cleansvr4" if="isSunOS"
3860N/A description="Cleanup SVR4 files.">
3860N/A <delete dir="${svr4.build.dir}" />
3860N/A <delete dir="${svr4.dir}/${pkg.name}" />
3860N/A </target>
3860N/A
3860N/A <!-- Construct metadata data -->
3968N/A <target name="metadata" depends="pkginfo,prototype,copyright,depend" if="isSunOS"
3860N/A description="Construct metadata for ${pkg.name}.">
3860N/A </target>
3860N/A
3860N/A <!-- Construct pkginfo file -->
3860N/A <target name="pkginfo" if="isSunOS" depends="pkgversion"
3860N/A description="Create pkginfo file based on ${svr4.src.dir}/info.properties" >
3860N/A <echo message="Building pkginfo for ${pkg.name}" />
3860N/A <tstamp>
3860N/A <format property="rev" pattern="yyyy.MM.dd"/>
3860N/A </tstamp>
3860N/A <mkdir dir="${svr4.meta.dir}"/>
3860N/A <echo file="${svr4.meta.dir}/pkginfo">
3860N/APKG=${pkg.name}
3860N/ANAME=${pkg.fullname}
3860N/AARCH=${pkg.arch}
3860N/AVERSION=${pkg.version},REV=${rev}
3860N/ASUNW_PRODNAME=${pkg.desc}
4103N/ASUNW_PRODVERS=${pkg.fullversion}
3860N/ASUNW_PKGVERS=1.0
4103N/ASUNW_PKGTYPE=${pkg.type}
3860N/AMAXINST=1000
3860N/ACATEGORY=application
3860N/ADESC=${pkg.desc}
3860N/AVENDOR=${pkg.vendor}
3860N/ABASEDIR=${pkg.basedir}
3860N/ACLASSES=none
3860N/AHOTLINE=Please contact your local service provider
3860N/AEMAIL=
3860N/A </echo>
3860N/A </target>
3860N/A
3860N/A <!-- Construct prototype file -->
3860N/A <target name="prototype" depends="layout" if="isSunOS"
3860N/A description="Create prototype file based on ${svr4.layout.dir}" >
3860N/A <echo message="Building prototype for ${pkg.name} pkg" />
3860N/A <exec executable="pkgproto" dir="${svr4.layout.dir}" output="${svr4.meta.dir}/prototype">
3860N/A <arg value="."/>
3860N/A </exec>
3860N/A <exec executable="groups" dir="${svr4.layout.dir}" outputproperty="user.group" />
3860N/A <echo file="${svr4.meta.dir}/prototype" append="true">i pkginfo
3860N/Ai copyright</echo>
3860N/A <replaceregexp file="${svr4.meta.dir}/prototype"
3860N/A match="${user.name}"
3860N/A replace="root"
3860N/A byline="true"/>
3860N/A <replaceregexp file="${svr4.meta.dir}/prototype"
3860N/A match="${user.group}"
3860N/A replace="sys"
3860N/A byline="true"/>
3860N/A
3860N/A </target>
3860N/A
3860N/A <!-- Construct copyright file -->
3860N/A <target name="copyright" if="isSunOS"
3860N/A description="Create copyright file based on ${svr4.src.dir}/copyright" >
3860N/A <echo message="Building copyright for ${pkg.name} pkg" />
3860N/A <copy file="${svr4.src.dir}/copyright" todir="${svr4.meta.dir}"/>
3860N/A </target>
3860N/A
3968N/A <!-- Construct depend file -->
3968N/A <target name="depend.init" if="isSunOS">
3968N/A <available property="present" file="${svr4.src.dir}/depend"/>
3968N/A </target>
3968N/A
3968N/A <target name="depend" depends="depend.init" if="present"
3968N/A description="Create depend file based on ${svr4.src.dir}/depend" >
3968N/A <echo message="Building depend for ${pkg.name} pkg" />
3968N/A <copy file="${svr4.src.dir}/depend" todir="${svr4.meta.dir}"/>
3968N/A </target>
3968N/A
3860N/A <!-- Make package -->
3860N/A <target name="pkgmk" if="isSunOS"
3860N/A description="Build ${pkg.name} package" >
3860N/A <echo message="Building ${pkg.name} pkg" />
3860N/A <echo message="Executing pkgmk -o -d ${svr4.dir} -r ${svr4.layout.dir} -f ${svr4.meta.dir}/prototype in ${svr4.layout.dir}" />
3860N/A <exec executable="pkgmk" dir="${svr4.layout.dir}">
3860N/A <arg value="-o"/>
3860N/A <arg value="-d"/>
3860N/A <arg value="${svr4.dir}"/>
3860N/A <arg value="-r"/>
3860N/A <arg value="${svr4.layout.dir}"/>
3860N/A <arg value="-f"/>
3860N/A <arg value="${svr4.meta.dir}/prototype"/>
3860N/A </exec>
3860N/A </target>
3914N/A
3914N/A <!-- ZIP package -->
3914N/A <target name="zipsvr4" if="isSunOS"
3914N/A description="ZIP ${pkg.name} package" >
3914N/A <echo message="Zipping ${pkg.name} pkg" />
3914N/A <zip destfile="${svr4.dir}/${pkg.name}.zip">
3914N/A <zipfileset dir="${svr4.dir}" includes="${pkg.name}/**/*"/>
3914N/A </zip>
3914N/A </target>
3860N/A
3860N/A</project>