build-svr4.xml revision 6715
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson<!--
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! CDDL HEADER START
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson !
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! The contents of this file are subject to the terms of the
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! Common Development and Distribution License, Version 1.0 only
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! (the "License"). You may not use this file except in compliance
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! with the License.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson !
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! You can obtain a copy of the license at
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! See the License for the specific language governing permissions
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! and limitations under the License.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson !
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! When distributing Covered Code, include this CDDL HEADER in each
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! file and include the License file at
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! add the following below this CDDL HEADER, with the fields enclosed
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! by brackets "[]" replaced with your own identifying information:
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! Portions Copyright [yyyy] [name of copyright owner]
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson !
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! CDDL HEADER END
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson !
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson !
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! Copyright 2006-2009 Sun Microsystems, Inc.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! Portions Copyright 2011-2013 ForgeRock AS
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson ! -->
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson<project name="SVR4 Packaging" basedir="." default="package-svr4">
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <description>
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson This is a build script that extends the OpenDJ build script by adding
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson SVR4 packaging functions.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson </description>
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <!-- By default will build OpenDJ package -->
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <property name="product" value="${SHORT_NAME}" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <!-- General properties -->
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <property name="svr4.src.dir" location="src/svr4/${product}" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <property name="build.dir" location="build" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <property name="package.dir" location="${build.dir}/package" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <property name="svr4.dir" location="${build.dir}/package/svr4" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <!-- Product specific properties: svr4.name / svr4.fullname / svr4.arch /
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson svr4.desc / svr4.vendor / svr4.basedir / svr4.prefix / svr4.type -->
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <property file="${svr4.src.dir}/pkg.properties" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <!-- Default values for product specific properties -->
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <property name="svr4.name" value="${product}" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <property name="svr4.fullname" value="${svr4.name}" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <property name="svr4.arch" value="all" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <property name="svr4.desc" value="${product}" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <property name="svr4.vendor" value="ForgeRock AS." />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <property name="svr4.basedir" value="/usr" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <!-- Some others general properties -->
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <property name="svr4.build.dir" location="${build.dir}/package/svr4/build/${svr4.name}" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <property name="svr4.meta.dir" location="${svr4.build.dir}/meta" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <property name="svr4.layout.dir" location="${svr4.build.dir}/layout" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <property name="svr4.layout.pkg.dir" location="${svr4.build.dir}/layout/${svr4.prefix}" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <!-- Must define layout/pkgversion target -->
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <import file="${svr4.src.dir}/layout.xml" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <!-- Check if OS is Solaris -->
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <target name="checkos">
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <condition property="isSunOS">
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <os name="SunOS"/>
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson </condition>
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson </target>
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <target name="wrongos" unless="isSunOS">
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <echo message="OS is ${os.name}. SVR4 package can only be built on a SunOS machine" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson </target>
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <!-- Construct SVR4 package -->
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <target name="svr4" depends="checkos,wrongos,cleansvr4,pkgversion,layout,metadata,pkgmk,zipsvr4" if="isSunOS"
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson description="Construct ${svr4.name} package for product ${product}.">
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <echo message="Package ${svr4.name} for product ${product} built in ${svr4.dir}" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson </target>
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <!-- Cleanup target -->
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <target name="cleansvr4" if="isSunOS"
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson description="Cleanup SVR4 files.">
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <delete dir="${svr4.build.dir}" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <delete dir="${svr4.dir}/${svr4.name}" />
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson </target>
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <!-- Construct metadata data -->
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <target name="metadata" depends="pkginfo,prototype,copyright,depend" if="isSunOS"
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson description="Construct metadata for ${svr4.name}.">
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson </target>
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <!-- Construct pkginfo file -->
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson <target name="pkginfo" if="isSunOS" depends="pkgversion"
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson 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>