Re-land "Cleanup angle_libs_suffix in BUILD.gn."

We can use output_name instead of repeating the libs suffix in the GN
files.

The re-land adds automatic suffix application on Android. This makes
the configuration a bit simpler and should detect future breakage. Also
cleans up some of the "angle_libraries" code.

Bug: angleproject:3611
Change-Id: I4971d1085ca67802c916655c30efb7df4001f040
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1679993
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 0077222..072a2da 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -739,8 +739,9 @@
   ]
 }
 
-angle_shared_library("libGLESv2${angle_libs_suffix}") {
+angle_shared_library("libGLESv2") {
   sources = libglesv2_sources
+  output_name = "libGLESv2${angle_libs_suffix}"
 
   if (is_win) {
     sources += [ "src/libGLESv2/libGLESv2_autogen.def" ]
@@ -776,8 +777,9 @@
   ]
 }
 
-angle_shared_library("libGLESv1_CM${angle_libs_suffix}") {
+angle_shared_library("libGLESv1_CM") {
   sources = libglesv1_cm_sources
+  output_name = "libGLESv1_CM${angle_libs_suffix}"
 
   configs += [
     ":angle_gl_visibility_config",
@@ -789,7 +791,7 @@
 
   deps = [
     ":includes",
-    ":libGLESv2${angle_libs_suffix}",
+    ":libGLESv2",
   ]
 }
 
@@ -823,8 +825,9 @@
   ]
 }
 
-angle_shared_library("libEGL${angle_libs_suffix}") {
+angle_shared_library("libEGL") {
   sources = libegl_sources
+  output_name = "libEGL${angle_libs_suffix}"
 
   configs += [
     ":debug_annotations_config",
@@ -853,7 +856,7 @@
   ]
 
   data_deps = [
-    ":libGLESv2${angle_libs_suffix}",
+    ":libGLESv2",
   ]
 }
 
@@ -1054,7 +1057,9 @@
   }
 }
 
-angle_shared_library("libfeature_support${angle_libs_suffix}") {
+angle_shared_library("libfeature_support") {
+  output_name = "libfeature_support${angle_libs_suffix}"
+
   if (is_android) {
     libs = [ "log" ]
   }
@@ -1086,11 +1091,11 @@
   action_foreach("compressed_symbols") {
     sources = []
     foreach(_library, angle_libraries) {
-      sources += [ "${root_out_dir}/lib${_library}${angle_libs_suffix}.so" ]
+      sources += [ "$root_out_dir/${_library}${angle_libs_suffix}.so" ]
     }
     if (angle_enable_vulkan_validation_layers) {
       foreach(_layer, vulkan_validation_layers) {
-        sources += [ "${root_out_dir}/lib${_layer}.so" ]
+        sources += [ "$root_out_dir/lib${_layer}.so" ]
       }
     }
 
@@ -1099,7 +1104,7 @@
 
     deps = []
     foreach(_library, angle_libraries) {
-      deps += [ "${angle_root}:lib${_library}${angle_libs_suffix}" ]
+      deps += [ ":$_library" ]
     }
 
     if (angle_enable_vulkan_validation_layers) {
diff --git a/android/angle_apk.gni b/android/angle_apk.gni
index 2561888..39f3c8a 100644
--- a/android/angle_apk.gni
+++ b/android/angle_apk.gni
@@ -14,10 +14,10 @@
 ]
 
 angle_libraries = [
-  "EGL",
-  "GLESv1_CM",
-  "GLESv2",
-  "feature_support",
+  "libEGL",
+  "libGLESv1_CM",
+  "libGLESv2",
+  "libfeature_support",
 ]
 
 template("angle_apk") {
@@ -60,15 +60,13 @@
         secondary_abi_shared_libraries = []
         foreach(_library, angle_libraries) {
           secondary_abi_shared_libraries +=
-              [ "${angle_root}:lib${_library}${angle_libs_suffix}" +
-                "($android_secondary_abi_toolchain)" ]
+              [ "$angle_root:${_library}($android_secondary_abi_toolchain)" ]
         }
         if (angle_enable_vulkan_validation_layers) {
           foreach(_layer, vulkan_validation_layers) {
-            secondary_abi_shared_libraries += [
-              "${angle_root}/third_party/vulkan-validation-layers:${_layer}" +
-                  "($android_secondary_abi_toolchain)",
-            ]
+            secondary_abi_shared_libraries +=
+                [ "$angle_root/third_party/vulkan-validation-layers:${_layer}" +
+                  "($android_secondary_abi_toolchain)" ]
           }
         }
       } else {
@@ -77,7 +75,7 @@
                 "root_out_dir")
         secondary_abi_loadable_modules = []
         foreach(_library, angle_libraries) {
-          secondary_abi_loadable_modules += [ "${_secondary_out_dir}/lib.compressed/lib${_library}${angle_libs_suffix}.so" ]
+          secondary_abi_loadable_modules += [ "$_secondary_out_dir/lib.compressed/${_library}${angle_libs_suffix}.so" ]
         }
         if (angle_enable_vulkan_validation_layers) {
           foreach(_layer, vulkan_validation_layers) {
@@ -91,24 +89,24 @@
     if (symbol_level == 0) {
       shared_libraries = []
       foreach(_library, angle_libraries) {
-        shared_libraries +=
-            [ "${angle_root}:lib${_library}${angle_libs_suffix}" ]
+        shared_libraries += [ "$angle_root:$_library" ]
       }
       if (angle_enable_vulkan_validation_layers) {
         foreach(_layer, vulkan_validation_layers) {
           shared_libraries +=
-              [ "${angle_root}/third_party/vulkan-validation-layers:${_layer}" ]
+              [ "$angle_root/third_party/vulkan-validation-layers:${_layer}" ]
         }
       }
     } else {
       loadable_modules = []
       foreach(_library, angle_libraries) {
-        loadable_modules += [ "${root_out_dir}/lib.compressed/lib${_library}${angle_libs_suffix}.so" ]
+        loadable_modules += [
+          "$root_out_dir/lib.compressed/${_library}${angle_libs_suffix}.so",
+        ]
       }
       if (angle_enable_vulkan_validation_layers) {
         foreach(_layer, vulkan_validation_layers) {
-          loadable_modules +=
-              [ "${root_out_dir}/lib.compressed/lib${_layer}.so" ]
+          loadable_modules += [ "$root_out_dir/lib.compressed/lib${_layer}.so" ]
         }
       }
     }
diff --git a/gni/angle.gni b/gni/angle.gni
index 0efa48c..2a8b805 100644
--- a/gni/angle.gni
+++ b/gni/angle.gni
@@ -46,7 +46,13 @@
         (angle_64bit_current_cpu && android64_ndk_api_level >= 26)
   }
   angle_shared_libvulkan = false
-  angle_libs_suffix = ""
+
+  # Default to using "_angle" suffix on Android
+  if (is_android) {
+    angle_libs_suffix = "_angle"
+  } else {
+    angle_libs_suffix = ""
+  }
 }
 
 declare_args() {
diff --git a/samples/BUILD.gn b/samples/BUILD.gn
index 13022bf..faac6f3 100644
--- a/samples/BUILD.gn
+++ b/samples/BUILD.gn
@@ -28,9 +28,9 @@
     "sample_util/tga_utils.h",
   ]
   data_deps = [
-    "../:libEGL${angle_libs_suffix}",
-    "../:libGLESv1_CM${angle_libs_suffix}",
-    "../:libGLESv2${angle_libs_suffix}",
+    "../:libEGL",
+    "../:libGLESv1_CM",
+    "../:libGLESv2",
   ]
   public_deps = [
     "../:angle_common",
diff --git a/src/tests/BUILD.gn b/src/tests/BUILD.gn
index 09fd9d5..be8646f 100644
--- a/src/tests/BUILD.gn
+++ b/src/tests/BUILD.gn
@@ -142,7 +142,7 @@
            ":angle_test_expectations",
            "${angle_root}:preprocessor",
            "${angle_root}:translator",
-           "${angle_root}:libfeature_support${angle_libs_suffix}",
+           "${angle_root}:libfeature_support",
            ":angle_unittests_main",
          ]
   if (!is_android && !is_fuchsia) {
@@ -195,9 +195,9 @@
     ]
 
     data_deps = [
-      "${angle_root}:libEGL${angle_libs_suffix}",
-      "${angle_root}:libGLESv1_CM${angle_libs_suffix}",
-      "${angle_root}:libGLESv2${angle_libs_suffix}",
+      "${angle_root}:libEGL",
+      "${angle_root}:libGLESv1_CM",
+      "${angle_root}:libGLESv2",
     ]
 
     if (is_android) {
@@ -301,8 +301,8 @@
     ]
 
     data_deps = [
-      "${angle_root}:libEGL${angle_libs_suffix}",
-      "${angle_root}:libGLESv2${angle_libs_suffix}",
+      "${angle_root}:libEGL",
+      "${angle_root}:libGLESv2",
     ]
 
     configs += [
@@ -816,8 +816,8 @@
       ":angle_deqp_glshared",
       "${angle_root}:angle_common",
       "${angle_root}:angle_util",
-      "${angle_root}:libEGL${angle_libs_suffix}",
-      "${angle_root}:libGLESv2${angle_libs_suffix}",
+      "${angle_root}:libEGL",
+      "${angle_root}:libGLESv2",
     ]
 
     configs += [ "${angle_root}:library_name_config" ]