<!--
|
! CDDL HEADER START
|
!
|
! The contents of this file are subject to the terms of the
|
! Common Development and Distribution License, Version 1.0 only
|
! (the "License"). You may not use this file except in compliance
|
! with the License.
|
!
|
! You can obtain a copy of the license at
|
! trunk/opends/resource/legal-notices/OpenDS.LICENSE
|
! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
|
! See the License for the specific language governing permissions
|
! and limitations under the License.
|
!
|
! When distributing Covered Code, include this CDDL HEADER in each
|
! file and include the License file at
|
! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
|
! add the following below this CDDL HEADER, with the fields enclosed
|
! by brackets "[]" replaced with your own identifying information:
|
! Portions Copyright [yyyy] [name of copyright owner]
|
!
|
! CDDL HEADER END
|
!
|
!
|
! Copyright 2006-2009 Sun Microsystems, Inc.
|
! Portions Copyright 2011 ForgeRock AS
|
! -->
|
|
<project name="SVR4 Packaging" basedir="." default="package-svr4">
|
<description>
|
This is a build script that extends the OpenDJ build script by adding
|
SVR4 packaging functions.
|
</description>
|
|
|
<!-- By default will build OpenDJ package -->
|
<property name="product" value="${SHORT_NAME}" />
|
|
|
<!-- General properties -->
|
<property name="svr4.src.dir" location="src/svr4/${product}" />
|
<property name="build.dir" location="build" />
|
<property name="package.dir" location="${build.dir}/package" />
|
<property name="svr4.dir" location="${build.dir}/package/svr4" />
|
|
<!-- Product specific properties: svr4.name / svr4.fullname / svr4.arch /
|
svr4.desc / svr4.vendor / svr4.basedir / svr4.prefix / svr4.type -->
|
<property file="${svr4.src.dir}/pkg.properties" />
|
|
<!-- Default values for product specific properties -->
|
<property name="svr4.name" value="${product}" />
|
<property name="svr4.fullname" value="${svr4.name}" />
|
<property name="svr4.arch" value="all" />
|
<property name="svr4.desc" value="${product}" />
|
<property name="svr4.vendor" value="Sun Microsystems, Inc." />
|
<property name="svr4.basedir" value="/usr" />
|
|
<!-- 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>
|