Bug 578952 - Add LoongArch64 Support

Change-Id: Ib0e98cbdbb56a69bd1ec5f697e506a9f01db8d69
Reviewed-on: https://git.eclipse.org/r/c/equinox/rt.equinox.framework/+/191183
Tested-by: Equinox Bot <equinox-bot@eclipse.org>
Reviewed-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/.project b/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/.project
new file mode 100644
index 0000000..fdc653b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.equinox.launcher.gtk.linux.loongarch64</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+	</natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..39b903c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-SymbolicName: org.eclipse.equinox.launcher.gtk.linux.loongarch64;singleton:=true
+Bundle-Version: 1.2.400.qualifier
+Fragment-Host: org.eclipse.equinox.launcher;bundle-version="[1.5.0,1.7.0)"
+Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=loongarch64))
+Bundle-Localization: launcher.gtk.linux.loongarch64
+Eclipse-BundleShape: dir
diff --git a/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/about.html b/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/about.html
new file mode 100644
index 0000000..164f781
--- /dev/null
+++ b/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/about.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>About</title>
+</head>
+<body lang="EN-US">
+	<h2>About This Content</h2>
+
+	<p>November 30, 2017</p>
+	<h3>License</h3>
+
+	<p>
+		The Eclipse Foundation makes available all content in this plug-in
+		(&quot;Content&quot;). Unless otherwise indicated below, the Content
+		is provided to you under the terms and conditions of the Eclipse
+		Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
+		available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
+		For purposes of the EPL, &quot;Program&quot; will mean the Content.
+	</p>
+
+	<p>
+		If you did not receive this Content directly from the Eclipse
+		Foundation, the Content is being redistributed by another party
+		(&quot;Redistributor&quot;) and different terms and conditions may
+		apply to your use of any object code in the Content. Check the
+		Redistributor's license that was provided with the Content. If no such
+		license exists, contact the Redistributor. Unless otherwise indicated
+		below, the terms and conditions of the EPL still apply to any source
+		code in the Content and such source code may be obtained at <a
+			href="http://www.eclipse.org/">http://www.eclipse.org</a>.
+	</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/build.properties b/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/build.properties
new file mode 100644
index 0000000..a4442cb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/build.properties
@@ -0,0 +1,19 @@
+###############################################################################
+# Copyright (c) 2022 Loongson Technology Co.Ltd. and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+#     Loongson Technology Co.Ltd. - initial API and implementation
+###############################################################################
+bin.includes = META-INF/,\
+               launcher.gtk.linux.loongarch64.properties,\
+               about.html
+               
+generateSourceBundle=false
+binaryTag=v20211117-0650
diff --git a/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/launcher.gtk.linux.loongarch64.properties b/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/launcher.gtk.linux.loongarch64.properties
new file mode 100644
index 0000000..5ce54e0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/launcher.gtk.linux.loongarch64.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2022 Loongson Technology Co.Ltd. and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+# 
+# Contributors:
+#     Loongson Technology Co.Ltd. - initial API and implementation
+###############################################################################
+pluginName = Equinox Launcher Linux LOONGARCH64 Fragment
+providerName = Eclipse.org - Equinox
diff --git a/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/pom.xml b/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/pom.xml
new file mode 100644
index 0000000..63a9b8e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64/pom.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright (c) 2022 Loongson Technology Co.Ltd .
+  All rights reserved. This program and the accompanying materials
+  are made available under the terms of the Eclipse Distribution License v1.0
+  which accompanies this distribution, and is available at
+  http://www.eclipse.org/org/documents/edl-v10.php
+ 
+  Contributors:
+     Loongson Technology Co.Ltd. - initial implementation
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>launcher-binary-parent</artifactId>
+    <groupId>org.eclipse.equinox.framework</groupId>
+    <version>4.24.0-SNAPSHOT</version>
+    <relativePath>../../launcher-binary-parent</relativePath>
+  </parent>
+  <groupId>org.eclipse.equinox</groupId>
+  <artifactId>org.eclipse.equinox.launcher.gtk.linux.loongarch64</artifactId>
+  <version>1.2.400-SNAPSHOT</version>
+  <packaging>eclipse-plugin</packaging>
+
+  <properties>
+    <os>linux</os>
+    <ws>gtk</ws>
+    <arch>loongarch64</arch>
+    <skipAPIAnalysis>true</skipAPIAnalysis>
+  </properties>
+</project>
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.a1/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.a1/META-INF/MANIFEST.MF
index 25c9923..3365911 100644
--- a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.a1/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.a1/META-INF/MANIFEST.MF
@@ -27,6 +27,10 @@
  processor=ppc;
  osname=Linux,
  nativefile1.txt;
+ processor=loongarch64;
+ processor=loongarch;
+ osname=Linux,
+ nativefile1.txt;
  processor=s390;
  processor=s390x;
  osname=Linux,
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.a2/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.a2/META-INF/MANIFEST.MF
index f03a779..d471ccf 100644
--- a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.a2/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.a2/META-INF/MANIFEST.MF
@@ -31,6 +31,10 @@
  processor=s390x;
  osname=Linux,
  nativefile2.txt;
+ processor=loongarch64;
+ processor=loongarch;
+ osname=Linux,
+ nativefile2.txt;
  processor=Sparc;
  osname=Solaris;
  osname=SunOS,
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.b1/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.b1/META-INF/MANIFEST.MF
index d0bd4df..65f1c76 100644
--- a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.b1/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.b1/META-INF/MANIFEST.MF
@@ -31,6 +31,10 @@
  processor=s390x;
  osname=Linux,
  nativefile.txt;
+ processor=loongarch64;
+ processor=loongarch;
+ osname=Linux,
+ nativefile.txt;
  processor=Sparc;
  osname=Solaris;
  osname=SunOS,
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.b2/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.b2/META-INF/MANIFEST.MF
index dfd3508..5068e95 100644
--- a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.b2/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.b2/META-INF/MANIFEST.MF
@@ -31,6 +31,10 @@
  processor=s390x;
  osname=Linux,
  nativefile.txt;
+ processor=loongarch64;
+ processor=loongarch;
+ osname=Linux,
+ nativefile.txt;
  processor=Sparc;
  osname=Solaris;
  osname=SunOS,
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/processor.aliases b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/processor.aliases
index 50487ae..8e2d55f 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/processor.aliases
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/processor.aliases
@@ -32,3 +32,4 @@
 s390x                                  # IBM System 390 (64-bit)
 v850e                                   # NEC V850E
 x86-64 amd64 em64t x86_64               # 64 bit x86 architecture
+loongarch64 LoongArch64                 # 64 bit loongarch architecture
diff --git a/features/org.eclipse.equinox.executable.feature/build.properties b/features/org.eclipse.equinox.executable.feature/build.properties
index 2ab3c26..9766293 100644
--- a/features/org.eclipse.equinox.executable.feature/build.properties
+++ b/features/org.eclipse.equinox.executable.feature/build.properties
@@ -38,3 +38,6 @@
 
 root.linux.gtk.x86_64=bin/gtk/linux/x86_64,gtk_root
 root.linux.gtk.x86_64.permissions.755=libcairo-swt.so
+
+root.linux.gtk.loongarch64=bin/gtk/linux/loongarch64,gtk_root
+root.linux.gtk.loongarch64.permissions.755=launcher
diff --git a/features/org.eclipse.equinox.executable.feature/library/gtk/build.sh b/features/org.eclipse.equinox.executable.feature/library/gtk/build.sh
index ac71e22..f837c03 100755
--- a/features/org.eclipse.equinox.executable.feature/library/gtk/build.sh
+++ b/features/org.eclipse.equinox.executable.feature/library/gtk/build.sh
@@ -107,6 +107,11 @@
 				defaultJava=DEFAULT_JAVA_EXEC
 				OUTPUT_DIR="$EXEC_DIR/bin/$defaultWS/$defaultOS/$defaultOSArch"
 				;;
+            		"loongarch64")
+				defaultOSArch="loongarch64"
+				defaultJava=DEFAULT_JAVA_EXEC
+				OUTPUT_DIR="$EXEC_DIR/bin/$defaultWS/$defaultOS/$defaultOSArch"
+				;;
 			*)
 				echo "*** Unknown MODEL <${MODEL}>"
 				;;
diff --git a/features/org.eclipse.equinox.executable.feature/resources/build.properties b/features/org.eclipse.equinox.executable.feature/resources/build.properties
index 44f1fcc..7317639 100644
--- a/features/org.eclipse.equinox.executable.feature/resources/build.properties
+++ b/features/org.eclipse.equinox.executable.feature/resources/build.properties
@@ -32,3 +32,5 @@
 root.linux.gtk.x86_64=bin/gtk/linux/x86_64,gtk_root
 root.linux.gtk.x86_64.permissions.755=libcairo-swt.so
 
+root.linux.gtk.loongarch64=bin/gtk/linux/loongarch64,gtk_root
+root.linux.gtk.loongarch64.permissions.755=launcher
diff --git a/features/org.eclipse.equinox.executable.feature/resources/build.xml b/features/org.eclipse.equinox.executable.feature/resources/build.xml
index fa0a16c..b55147f 100644
--- a/features/org.eclipse.equinox.executable.feature/resources/build.xml
+++ b/features/org.eclipse.equinox.executable.feature/resources/build.xml
@@ -108,6 +108,14 @@
 		</copy>
 		<chmod perm="755" dir="${feature.base}/linux.gtk.x86_64/${collectingFolder}" includes="launcher" />
 	</target>
+	<target name="rootFileslinux_gtk_loongarch64">
+		<mkdir dir="${feature.base}/linux.gtk.loongarch64/${collectingFolder}"/>
+		<copy todir="${feature.base}/linux.gtk.loongarch64/${collectingFolder}" failonerror="true" overwrite="true">
+			<fileset dir="${basedir}/bin/gtk/linux/loongarch64" includes="**"			/>
+			<fileset dir="${basedir}/gtk_root" includes="**"			/>
+		</copy>
+		<chmod perm="755" dir="${feature.base}/linux.gtk.loongarch64/${collectingFolder}" includes="launcher" />
+	</target>
 	<target name="rootFileslinux_gtk_ia64">
 		<mkdir dir="${feature.base}/linux.gtk.ia64/${collectingFolder}"/>
 		<copy todir="${feature.base}/linux.gtk.ia64/${collectingFolder}" failonerror="true" overwrite="true">
diff --git a/pom.xml b/pom.xml
index ad2ed34..3e3b419 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,6 +76,18 @@
 	<module>bundles/org.eclipse.equinox.launcher.gtk.linux.aarch64</module>
       </modules>
     </profile>
+    <profile>
+      <id>build-native-launchers-gtk.linux.loongarch64</id>
+      <activation>
+	<property>
+	  <name>native</name>
+	  <value>gtk.linux.loongarch64</value>
+        </property>
+      </activation>
+      <modules>
+	<module>bundles/org.eclipse.equinox.launcher.gtk.linux.loongarch64</module>
+      </modules>
+    </profile>
   </profiles>
 
   <modules>