Add initial fuchsia target

Add two fuchsia targets, one for x86_64 and one for arm64. The targets
are non-functional but compile.

Bug: 120845351
Test: builds

Change-Id: Ie2de71f74fc863ee8ba9b3ed0a63982942e1fdde
diff --git a/AndroidProducts.mk b/AndroidProducts.mk
new file mode 100644
index 0000000..8f37225
--- /dev/null
+++ b/AndroidProducts.mk
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2019 The Android Open-Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+PRODUCT_MAKEFILES := \
+    $(LOCAL_DIR)/fuchsia_x86_64/fuchsia_x86_64.mk \
+    $(LOCAL_DIR)/fuchsia_arm64/fuchsia_arm64.mk
+
+COMMON_LUNCH_CHOICES := \
+    fuchsia_arm64-eng \
+    fuchsia_x86_64-eng
diff --git a/BoardConfig_common.mk b/BoardConfig_common.mk
new file mode 100644
index 0000000..1a95e15
--- /dev/null
+++ b/BoardConfig_common.mk
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2018 The Android Open-Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+TARGET_NO_BOOTLOADER := true
+TARGET_NO_KERNEL := true
+TARGET_NO_RECOVERY := true
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..525b74b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,8 @@
+### Fuchsia Device Targets
+
+These targets are used to build ART for Fuchsia. They differ from usual Android devices as they do not target specific hardware. They will produce a fuchsia package (.far file).
+
+Supported architectures:
+
+* arm64
+* x86_64
diff --git a/fuchsia.mk b/fuchsia.mk
new file mode 100644
index 0000000..eee12d7
--- /dev/null
+++ b/fuchsia.mk
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Common product definitons.
+
+PRODUCT_BRAND := Fuchsia
+PRODUCT_MODEL := Fuchsia
+
+# Define the Fuchsia product.
+PRODUCT_FUCHSIA := true
+
+# Don't build ramdisk for Fuchsia.
+PRODUCT_BUILD_RAMDISK_IMAGE := false
+
+# default is nosdcard, S/W button enabled in resource
+PRODUCT_CHARACTERISTICS := nosdcard
+
+# Hand-picked packages.
+PRODUCT_PACKAGES += \
+    art-runtime \
+    bouncycastle \
+    conscrypt \
+    core-libart \
+    core-oj \
+    dalvikvm \
+    libart \
+    libjavacore \
+    libopenjdk \
+    okhttp
+
+# Fuchsia only has 64-bit support.
+TARGET_SUPPORTS_32_BIT_APPS := false
+TARGET_SUPPORTS_64_BIT_APPS := true
diff --git a/fuchsia_arm64/BoardConfig.mk b/fuchsia_arm64/BoardConfig.mk
new file mode 100644
index 0000000..4b932d0
--- /dev/null
+++ b/fuchsia_arm64/BoardConfig.mk
@@ -0,0 +1,26 @@
+#
+# Copyright (C) 2019 The Android Open-Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# 64bit support only.
+TARGET_CPU_ABI := arm64-v8a
+TARGET_ARCH := arm64
+TARGET_ARCH_VARIANT := armv8-a
+
+TARGET_2ND_CPU_ABI :=
+TARGET_2ND_ARCH :=
+TARGET_2ND_ARCH_VARIANT :=
+
+include device/google/fuchsia/BoardConfig_common.mk
diff --git a/fuchsia_arm64/fuchsia_arm64.mk b/fuchsia_arm64/fuchsia_arm64.mk
new file mode 100644
index 0000000..32b2a74
--- /dev/null
+++ b/fuchsia_arm64/fuchsia_arm64.mk
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+PRODUCT_NAME := fuchsia_arm64
+PRODUCT_DEVICE := fuchsia_arm64
+
+include device/google/fuchsia/fuchsia.mk
+
+# TODO(b/122047335): Uncomment this.
+#PRODUCT_COPY_FILES += \
+    prebuilts/clang/host/linux-x86/clang-fuchsia/lib/aarch64-fuchsia/lib/libunwind.so.1:system/lib64/libunwind.so.1 \
+    prebuilts/fuchsia_sdk/arch/arm64/sysroot/dist/lib/ld.so.1:system/lib64/ld.so.1
diff --git a/fuchsia_x86_64/BoardConfig.mk b/fuchsia_x86_64/BoardConfig.mk
new file mode 100644
index 0000000..90d3688
--- /dev/null
+++ b/fuchsia_x86_64/BoardConfig.mk
@@ -0,0 +1,26 @@
+#
+# Copyright (C) 2019 The Android Open-Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# 64bit support only.
+TARGET_CPU_ABI := x86_64
+TARGET_ARCH := x86_64
+TARGET_ARCH_VARIANT := x86_64
+
+TARGET_2ND_CPU_ABI :=
+TARGET_2ND_ARCH :=
+TARGET_2ND_ARCH_VARIANT :=
+
+include device/google/fuchsia/BoardConfig_common.mk
diff --git a/fuchsia_x86_64/fuchsia_x86_64.mk b/fuchsia_x86_64/fuchsia_x86_64.mk
new file mode 100644
index 0000000..d14a638
--- /dev/null
+++ b/fuchsia_x86_64/fuchsia_x86_64.mk
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+PRODUCT_NAME := fuchsia_x86_64
+PRODUCT_DEVICE := fuchsia_x86_64
+
+include device/google/fuchsia/fuchsia.mk
+
+# TODO(b/122047335): Uncomment this.
+#PRODUCT_COPY_FILES += \
+    prebuilts/clang/host/linux-x86/clang-fuchsia/lib/x86_64-fuchsia/lib/libunwind.so.1:system/lib64/libunwind.so.1 \
+    prebuilts/fuchsia_sdk/arch/x64/sysroot/dist/lib/ld.so.1:system/lib64/ld.so.1