mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

chebrard
02.24.2008 71a34a13d9dc6064d3d467f1c8ba64c14ce2a10b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<!--
 ! 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-2008 Sun Microsystems, Inc.
 ! -->
 
<project name="SVR4 Packaging" basedir="." default="package-svr4">
  <description>
    This is a build script that extends the OpenDS build script by adding
    SVR4 packaging functions.
  </description>
  
 
  <!-- By default will build OpenDS 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="pkg.dir"           location="${build.dir}/package" />
  <property name="svr4.dir"          location="${build.dir}/package/svr4" />
 
  <!-- Product specific properties: pkg.name / pkg.fullname / pkg.arch / pkg.desc / pkg.vendor / pkg.basedir / pkg.prefix -->
  <property file="${svr4.src.dir}/pkg.properties" />
 
  <!-- Default values for product specific properties -->
  <property name="pkg.name"       value="${product}" />
  <property name="pkg.fullname"   value="${pkg.name}" />
  <property name="pkg.arch"       value="all" />
  <property name="pkg.desc"       value="${product}" />
  <property name="pkg.vendor"     value="Sun Microsystems, Inc." />
  <property name="pkg.basedir"    value="/opt" />
 
  <!-- Some others general properties -->
  <property name="svr4.build.dir"        location="${build.dir}/package/svr4/build/${pkg.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/${pkg.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 ${pkg.name} package for product ${product}.">
    <echo message="Package ${pkg.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}/${pkg.name}" />
  </target>
  
  <!-- Construct metadata data -->
  <target name="metadata" depends="pkginfo,prototype,copyright,depend" if="isSunOS" 
        description="Construct metadata for ${pkg.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 ${pkg.name}" />
    <tstamp>
      <format property="rev" pattern="yyyy.MM.dd"/>
    </tstamp>
    <mkdir dir="${svr4.meta.dir}"/>
        <echo file="${svr4.meta.dir}/pkginfo">
PKG=${pkg.name}
NAME=${pkg.fullname}
ARCH=${pkg.arch}
VERSION=${pkg.version},REV=${rev}
SUNW_PRODNAME=${pkg.desc}
SUNW_PRODVERS=${pkg.version}
SUNW_PKGVERS=1.0
MAXINST=1000
CATEGORY=application
DESC=${pkg.desc}
VENDOR=${pkg.vendor}
BASEDIR=${pkg.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 ${pkg.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 ${pkg.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 ${pkg.name} pkg" />
       <copy file="${svr4.src.dir}/depend" todir="${svr4.meta.dir}"/>
  </target>
 
  <!-- Make package -->
  <target name="pkgmk" if="isSunOS" 
        description="Build ${pkg.name} package" >
    <echo message="Building ${pkg.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 ${pkg.name} package" >
    <echo message="Zipping ${pkg.name} pkg" />
    <zip destfile="${svr4.dir}/${pkg.name}.zip">
      <zipfileset dir="${svr4.dir}" includes="${pkg.name}/**/*"/>
    </zip>
  </target>
 
</project>