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