Bug 491521 - Provide 64-bit SWT libraries for Solaris/SPARC

Change-Id: I5de93dd150be9978eff808581873488184ddacbe
Signed-off-by: Arun Thondapu <arunkumar.thondapu@in.ibm.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.sh b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.sh
index dad026c..2b84973 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.sh
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.sh
@@ -55,22 +55,13 @@
 		PROC=`uname -i`
 		MAKEFILE=make_solaris.mak
 		if [ "${MODEL}" = "" ]; then
-			if [ "`isainfo -b`" = "64" ]; then
+			MODEL=`isainfo -k`
+			if [ "${MODEL}" = "amd64" ]; then
 				MODEL=x86_64
-			elif uname -p > /dev/null 2>&1; then
-				MODEL=`uname -p`
+				MAKEFILE=make_solaris_x86_64.mak
+				MAKE_TYPE=gmake
 			fi
 		fi
-		case $MODEL in
-			"i386" | "x86")
-				MAKEFILE=make_solaris_x86.mak
-				MAKE_TYPE=gmake
-				;;
-			"x86_64")
-				MAKEFILE=make_solaris_x86_64.mak
- 				MAKE_TYPE=gmake
- 				;;
-		esac
 		;;
 	"FreeBSD")
 		SWT_OS=freebsd
@@ -98,10 +89,6 @@
 		SWT_ARCH=x86_64
 		AWT_ARCH=amd64
 		;;
-	"sparc64")
-		SWT_ARCH=$MODEL
-		AWT_ARCH=sparcv9
-		;;
 	i?86)
 		SWT_ARCH=x86
 		AWT_ARCH=i386
@@ -323,23 +310,23 @@
 #			export XULRUNNER_LIBS="-L${XULRUNNER_SDK}/lib -lxpcomglue"
 #		fi
  		;;
-	"solaris.sparc64")
-#		export PATH="/export/home/SUNWspro/bin:/usr/ccs/bin:/usr/bin"
+	"solaris.sparcv9")
+		PATH="/usr/ccs/bin:/opt/csw/bin:$PATH"
 		if [ "${CC}" = "" ]; then
-			export CC="cc"
+			CC="cc"
 		fi	
 		if [ "${CXX}" = "" ]; then
-			export CXX="CC"
+			CXX="CC"
 		fi
 		if [ "${CDE_HOME}" = "" ]; then
-			export CDE_HOME="/usr/dt"
+			CDE_HOME="/usr/dt"
 		fi
 		if [ "${JAVA_HOME}" = "" ]; then
-			export JAVA_HOME="/bluebird/teamswt/swt-builddir/JDKs/SOLARIS/SPARC64/jdk1.5.0_22"
+			JAVA_HOME="/bluebird/teamswt/swt-builddir/JDKs/SOLARIS/SPARC64/jdk1.5.0_22"
 		fi
-#		if [ "${PKG_CONFIG_PATH}" = "" ]; then
-#			export PKG_CONFIG_PATH="/usr/local/cairo-1.4.10/lib/pkgconfig"
-#		fi
+		if [ "${PKG_CONFIG_PATH}" = "" ]; then
+			PKG_CONFIG_PATH="/opt/csw/lib/pkgconfig"
+		fi
 #		if [ "${MOZILLA_SDK}" = "" ]; then
 #			export MOZILLA_SDK="/bluebird/teamswt/swt-builddir/geckoSDK/1.4/gecko-sdk"
 #		fi
@@ -349,6 +336,7 @@
 #		if [ "${MOZILLA_LIBS}" = "" ]; then
 #			export MOZILLA_LIBS="${MOZILLA_SDK}/embedstring/bin/libembedstring.a -L${MOZILLA_SDK}/xpcom/bin -L${MOZILLA_SDK}/nspr/bin -lxpcom -lnspr4 -lplds4 -lplc4"
 #		fi
+		export PATH CC CXX CDE_HOME JAVA_HOME PKG_CONFIG_PATH;
 		;;
 	"solaris.sparc")
 		PATH="/export/home/SUNWspro/bin:/usr/ccs/bin:/usr/bin:$PATH"
@@ -486,7 +474,7 @@
 
 
 # For 64-bit CPUs, we have a switch
-if [ ${MODEL} = 'x86_64' -o ${MODEL} = 'ppc64' -o ${MODEL} = 'ia64' -o ${MODEL} = 'sparc64'  -o ${MODEL} = 's390x' -o ${MODEL} = 'ppc64le' -o ${MODEL} = 'aarch64' ]; then
+if [ ${MODEL} = 'x86_64' -o ${MODEL} = 'ppc64' -o ${MODEL} = 'ia64' -o ${MODEL} = 'sparcv9'  -o ${MODEL} = 's390x' -o ${MODEL} = 'ppc64le' -o ${MODEL} = 'aarch64' ]; then
 	SWT_PTR_CFLAGS=-DJNI64
 	if [ -d /lib64 ]; then
 		XLIB64=-L/usr/X11R6/lib64
@@ -511,16 +499,11 @@
 			export SWT_LFLAGS
 		fi
 	fi
-	if [ ${MODEL} = 'sparc64' ]; then
-			SWT_PTR_CFLAGS="${SWT_PTR_CFLAGS} -xarch=v9"
-			SWT_LFLAGS="-xarch=v9"
-			SWT_CDE_64SUFFIX="/64"
-			export SWT_LFLAGS SWT_CDE_64SUFFIX
-	fi
 	if [ ${OS} = 'SunOS' ]; then
 			SWT_PTR_CFLAGS="${SWT_PTR_CFLAGS} -m64"
 			SWT_LFLAGS=-m64
-			export SWT_LFLAGS	
+			SWT_CDE_64SUFFIX="/64"
+			export SWT_LFLAGS SWT_CDE_64SUFFIX
 	fi
 	export SWT_PTR_CFLAGS
 fi
@@ -535,7 +518,7 @@
 	export SWT_LFLAGS SWT_PTR_CFLAGS
 fi
 
-if [ x`pkg-config --exists gnome-vfs-module-2.0 libgnome-2.0 libgnomeui-2.0 && echo YES` = "xYES"  -a ${MODEL} != "sparc64" -a ${MODEL} != 'ia64' -a ${GTK_VERSION} != '3.0' ]; then
+if [ x`pkg-config --exists gnome-vfs-module-2.0 libgnome-2.0 libgnomeui-2.0 && echo YES` = "xYES"  -a ${MODEL} != "sparcv9" -a ${MODEL} != 'ia64' -a ${GTK_VERSION} != '3.0' ]; then
 	if [ "${SWT_OS}" != "solaris" -o "${MODEL}" != "x86_64" ]; then
 		echo "libgnomeui-2.0 found, compiling SWT program support using GNOME"
 		MAKE_GNOME=make_gnome
diff --git a/bundles/org.eclipse.swt/buildSWT.xml b/bundles/org.eclipse.swt/buildSWT.xml
index a8a092f..2761d37 100644
--- a/bundles/org.eclipse.swt/buildSWT.xml
+++ b/bundles/org.eclipse.swt/buildSWT.xml
@@ -106,6 +106,10 @@
 			<param name="fragment" value="org.eclipse.swt.gtk.solaris.sparc"/>
 		</antcall>
 		<antcall target="check_fragment_libraries">
+			<param name="library_count" value="7"/>
+			<param name="fragment" value="org.eclipse.swt.gtk.solaris.sparcv9"/>
+		</antcall>		
+		<antcall target="check_fragment_libraries">
 			<param name="library_count" value="8"/>
 			<param name="fragment" value="org.eclipse.swt.gtk.solaris.x86"/>
 		</antcall>
@@ -134,7 +138,7 @@
 	<target name="check_fragment_libraries" depends="get_version">
 		<echo>Checking ${fragment}</echo>
 		<property name="checkdir" value="~/build/check_libraries"/>
-		<property name="library_count" value="139"/>
+		<property name="library_count" value="146"/>
 		<property name="fragment" value=""/>
 		<fileset id="match" dir="${repo.bin}/bundles/${fragment}">
 			<filename regex="[0-9][0-9][0-9][0-9]."/>
@@ -224,12 +228,12 @@
 			trust="true"
 			outputproperty="m_solaris_sparc_output"
 			command="hostname"/>
-		<sshexec host="${m_solaris_x86}"
+		<sshexec host="${m_solaris_x86_64}"
 			username="swtbuild"
 			keyfile="${keyfile}"
 			failonerror="false"
 			trust="true"
-			outputproperty="m_solaris_x86_output"
+			outputproperty="m_solaris_x86_64_output"
 			command="hostname"/>
 
 		<sshexec host="${m_aix}"
@@ -306,10 +310,10 @@
 				<matches pattern="x${m_solaris_sparc_output}*" string="x${m_solaris_sparc}"/>
 			</and>
 		</condition>
-		<condition property="m_solaris_x86_test" value="${success_msg}" else="${fail_msg}">
+		<condition property="m_solaris_x86_64_test" value="${success_msg}" else="${fail_msg}">
 			<and>
-				<length string="${m_solaris_x86_output}" when="greater" length="0"/>
-				<matches pattern="x${m_solaris_x86_output}*" string="x${m_solaris_x86}"/>
+				<length string="${m_solaris_x86_64_output}" when="greater" length="0"/>
+				<matches pattern="x${m_solaris_x86_64_output}*" string="x${m_solaris_x86_64}"/>
 			</and>
 		</condition>
 		<condition property="m_aix_test" value="${success_msg}" else="${fail_msg}">
@@ -341,13 +345,13 @@
 		<echo>${m_linux_ppc64} - ${m_linux_ppc64_test}</echo>
 		<!--<echo>${m_linux_ppc64le} - ${m_linux_ppc64le_test}</echo-->
 		<echo>${m_solaris_sparc} - ${m_solaris_sparc_test}</echo>
-		<echo>${m_solaris_x86} - ${m_solaris_x86_test}</echo>
+		<echo>${m_solaris_x86_64} - ${m_solaris_x86_64_test}</echo>
 		<echo>${m_aix} - ${m_aix_test}</echo>
 		<echo>${m_hpux} - ${m_hpux_test}</echo>
 		<echo>${m_mac} - ${m_mac_test}</echo>
 		<echo>-------------------------</echo>
 		<condition property="m_fail">
-			<matches pattern="Fail" string="${m_linux_x86_test} ${m_linux_x86_64_test} ${m_linux_ppc_test} ${m_linux_ppc64_test} ${m_solaris_sparc_test} ${m_solaris_x86_test} ${m_aix_test} ${m_hpux_test} ${m_mac_test}"/>
+			<matches pattern="Fail" string="${m_linux_x86_test} ${m_linux_x86_64_test} ${m_linux_ppc_test} ${m_linux_ppc64_test} ${m_solaris_sparc_test} ${m_solaris_x86_64_test} ${m_aix_test} ${m_hpux_test} ${m_mac_test}"/>
 		</condition>
 		<fail if="m_fail" message="Failed"/>
 	</target>