From 2b61c4f6aef7b99fa794eb2b47b96ab8a0c65b79 Mon Sep 17 00:00:00 2001
From: Chris Ridd <chris.ridd@forgerock.com>
Date: Fri, 02 Aug 2013 13:30:59 +0000
Subject: [PATCH] CR-2100 Fix OPENDJ-1108 Provide native packaging for Windows
---
opends/build.xml | 74 ++++++++++++++++++++++++
opends/resource/msi/package.wxs | 65 +++++++++++++++++++++
opends/build.bat | 3
3 files changed, 141 insertions(+), 1 deletions(-)
diff --git a/opends/build.bat b/opends/build.bat
index 9fb31d5..4a8661d 100644
--- a/opends/build.bat
+++ b/opends/build.bat
@@ -24,6 +24,7 @@
rem
rem
rem Copyright 2008-2010 Sun Microsystems, Inc.
+rem Portions Copyright 2013 ForgeRock AS.
setlocal
@@ -34,7 +35,7 @@
:noJavaHome
echo Error: JAVA_HOME environment variable is not set.
-echo Please set it to a valid Java 5 installation.
+echo Please set it to a valid Java 6 installation.
goto end
diff --git a/opends/build.xml b/opends/build.xml
index ecbfc0b..a784cbc 100644
--- a/opends/build.xml
+++ b/opends/build.xml
@@ -1320,6 +1320,80 @@
<echo message="Package Built: ${package.built.ts}"/>
</target>
+ <!-- Package the Directory Server for the MSI distribution. -->
+ <target name="package-MSI"
+ description="Package the Directory Server for MSI distribution.">
+ <taskdef name="getversionnumber"
+ classname="org.opends.build.tools.CreateVersionString">
+ <classpath>
+ <fileset dir="${build.dir}/build-tools">
+ <include name="*.jar" />
+ </fileset>
+ </classpath>
+ </taskdef>
+
+ <getversionnumber property="VERSION_NUMBER_STRING" />
+
+ <mkdir dir="${build.dir}/msi/files" />
+ <copy toDir="${build.dir}/msi/files">
+ <fileset dir="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}">
+ <!-- Exclude Mac apps -->
+ <exclude name="QuickSetup.app/**"/>
+ <exclude name="Uninstall.app/**"/>
+ <!-- Exclude shell scripts -->
+ <exclude name="bin/**"/>
+ <exclude name="setup"/>
+ <exclude name="uninstall"/>
+ <exclude name="upgrade"/>
+ <exclude name="**/*.sh"/>
+ </fileset>
+ </copy>
+
+ <property name="wix.dir" location="C:\Program Files (x86)\WiX Toolset v3.7\bin"/>
+
+ <mkdir dir="${build.dir}/msi/build" />
+ <copy file="${resource.dir}/msi/package.wxs" toDir="${build.dir}/msi/build"/>
+ <mkdir dir="${build.dir}/msi/dist" />
+
+ <!-- Construct a .wxs file from the directory structure -->
+ <exec executable="${wix.dir}/heat.exe" dir="${build.dir}/msi/files">
+ <arg value="dir"/>
+ <arg value="."/>
+ <arg value="-nologo"/>
+ <arg value="-cg"/> <arg value="all"/>
+ <arg value="-gg"/>
+ <arg value="-sfrag"/>
+ <arg value="-srd"/>
+ <arg value="-dr"/> <arg value="OPENDJ"/>
+ <arg value="-var"/> <arg value="var.src"/>
+ <arg value="-template"/> <arg value="fragment"/>
+ <arg value="-o"/> <arg value="${build.dir}/msi/build/payload.wxs"/>
+ </exec>
+
+ <!-- Compile all .wxs files into .wixobj files (fast) -->
+ <exec executable="${wix.dir}/candle.exe" dir="${build.dir}/msi">
+ <arg value="-nologo"/>
+ <arg value="-out"/> <arg value="${build.dir}/msi/build/"/>
+ <arg value="-dsrc=files"/>
+ <arg value="-dname=${SHORT_NAME}"/>
+ <arg value="-dmajor=${MAJOR_VERSION}"/>
+ <arg value="-dminor=${MINOR_VERSION}"/>
+ <arg value="-dpoint=${POINT_VERSION}"/>
+ <arg value="build/package.wxs"/>
+ <arg value="build/payload.wxs"/>
+ </exec>
+
+ <!-- Build the package. This is the slow part. -->
+ <exec executable="${wix.dir}/light.exe" dir="${build.dir}/msi">
+ <arg value="-nologo"/>
+ <arg value="-ext"/> <arg value="WixUIExtension"/>
+ <arg value="-out"/> <arg value="dist/${SHORT_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}.${POINT_VERSION}.msi"/>
+ <arg value="build/package.wixobj"/>
+ <arg value="build/payload.wixobj"/>
+ </exec>
+
+ </target>
+
<!-- Package the Directory Server for the RPM distribution. -->
<target name="package-RPM"
description="Package the Directory Server for RPM distribution.">
diff --git a/opends/resource/msi/package.wxs b/opends/resource/msi/package.wxs
new file mode 100644
index 0000000..f0c384c
--- /dev/null
+++ b/opends/resource/msi/package.wxs
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ! 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 2013 ForgeRock AS
+ ! -->
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+ <Product Id="*" Codepage="1252" Language="1033" Manufacturer="ForgeRock"
+ Name="ForgeRock $(var.name) $(var.major).$(var.minor)" Version="$(var.major).$(var.minor).$(var.point).0"
+ UpgradeCode="A3E82AC0-88E6-4DEE-9D8C-5AE3B7853274">
+ <Package Id="*" Comments="This package contains ForgeRock $(var.name) $(var.major).$(var.minor).$(var.point)."
+ Description="ForgeRock products" InstallerVersion="300" Languages="1033" Manufacturer="ForgeRock"
+ Platform="x86" Compressed="yes"/>
+ <Media Id="1" Cabinet="opendj.cab" DiskPrompt="Disk 1" EmbedCab="yes" CompressionLevel="high"/>
+ <Property Id="DiskPrompt" Value="ForgeRock $(var.name) $(var.major).$(var.minor).$(var.point) Installation"/>
+
+ <Property Id="ALLUSERS" Value="1"/>
+ <Property Id="ARPHELPLINK" Value="http://forgerock.com"/>
+
+ <!-- Upgrading -->
+ <MajorUpgrade DowngradeErrorMessage="A newer version of $(var.name) is already installed."/>
+
+ <Directory Id="TARGETDIR" Name="SourceDir">
+ <Directory Id="ProgramFilesFolder" Name="PFiles">
+ <Directory Id="OPENDJ" Name="$(var.name)">
+ </Directory>
+ </Directory>
+ </Directory>
+
+ <Feature Id="All" Title="Server and tools" Level="1" ConfigurableDirectory="OPENDJ">
+ <ComponentGroupRef Id="all"/>
+ </Feature>
+
+ <!-- User interface -->
+ <Property Id="WIXUI_INSTALLDIR" Value="OPENDJ"/>
+ <UI Id="OpenDJ_Install">
+ <UIRef Id="WixUI_InstallDir"/>
+ <UIRef Id="WixUI_ErrorProgressText"/>
+ <!-- Don't show the license agreement in the install, just in setup -->
+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">1</Publish>
+ <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
+ </UI>
+ </Product>
+</Wix>
\ No newline at end of file
--
Gitblit v1.10.0