diff --git a/.gitignore b/.gitignore index 1fd824f53..cbfbb783b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -build/ +/build/ downloads/ sstate-cache/ .vscode/ +/src/kernel/linux/v4.4/tools/build/ diff --git a/prebuilt/bsp/trustzone/mtee/build/yocto_build/README b/prebuilt/bsp/trustzone/mtee/build/yocto_build/README new file mode 120000 index 000000000..443793f93 --- /dev/null +++ b/prebuilt/bsp/trustzone/mtee/build/yocto_build/README @@ -0,0 +1 @@ +../../../README \ No newline at end of file diff --git a/src/bsp/trustzone/mtee/build/oe-logs b/src/bsp/trustzone/mtee/build/oe-logs new file mode 120000 index 000000000..1589748c6 --- /dev/null +++ b/src/bsp/trustzone/mtee/build/oe-logs @@ -0,0 +1 @@ +/home/hx/mtk8516/mt8516_avs_share-master/build/tmp/work/aud8516p1v2_consys_slc_128-poky-linux/tee-mtee/1.0-r0/temp \ No newline at end of file diff --git a/src/bsp/trustzone/mtee/build/oe-workdir b/src/bsp/trustzone/mtee/build/oe-workdir new file mode 120000 index 000000000..4ff16f680 --- /dev/null +++ b/src/bsp/trustzone/mtee/build/oe-workdir @@ -0,0 +1 @@ +/home/hx/mtk8516/mt8516_avs_share-master/build/tmp/work/aud8516p1v2_consys_slc_128-poky-linux/tee-mtee/1.0-r0 \ No newline at end of file diff --git a/src/bsp/trustzone/mtee/build/yocto_build/README b/src/bsp/trustzone/mtee/build/yocto_build/README new file mode 100644 index 000000000..78f843096 --- /dev/null +++ b/src/bsp/trustzone/mtee/build/yocto_build/README @@ -0,0 +1,2 @@ +The "tz" directory is intended for Mediatek solution TrustZone. + diff --git a/src/connectivity/bt_others/bluetooth_mw/non_rpc_test/build/BUILD.gn b/src/connectivity/bt_others/bluetooth_mw/non_rpc_test/build/BUILD.gn new file mode 100755 index 000000000..eb8e258ff --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/non_rpc_test/build/BUILD.gn @@ -0,0 +1,108 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + mw_config_path = "" + mw_include_path = "" + mw_alsa_inc_path = "" + asound_inc_path = "" + mw_alsa_uploader_inc_path = "" + bt_sys_log_flag = "" + bt_tmp_path = "" + bt_misc_path = "" + bt_etc_path = "" + bt_backtrace = "" + rpc_dbg_flag = "" + libbt_playback_link = "" + libbt_uploader_link = "" +} + +assert(mw_config_path != "", "mw_config_path build argument wasn't provided.") +assert(mw_include_path != "", "mw_include_path build argument wasn't provided.") +assert(mw_alsa_inc_path != "", "mw_alsa_inc_path build argument wasn't provided.") +assert(mw_alsa_uploader_inc_path != "", "mw_alsa_uploader_inc_path build argument wasn't provided.") +assert(bt_tmp_path != "", "bt_tmp_path build argument wasn't provided.") +assert(bt_misc_path != "", "bt_misc_path build argument wasn't provided.") +assert(bt_etc_path != "", "bt_etc_path build argument wasn't provided.") + + +config("default_include_dirs") { + # TODO(armansito): Remove "core_include_path" once the cutils includes have + # been removed. + assert(mw_config_path != "", + "mw_config_path build argument wasn't provided.") + assert(mw_include_path != "", + "mw_include_path build argument wasn't provided.") + + include_dirs = [ + mw_config_path, + mw_include_path, + mw_alsa_uploader_inc_path, + mw_alsa_inc_path, + asound_inc_path, + ] +} + +config("linux") { + # TODO(keybuk): AndroidConfig.h or equivalent + + cflags = [ + "-Wall", + #"-Werror", + "-g", + "-Os", + "-fpic", + "-fdata-sections", + "-ffunction-sections", + "-fvisibility=hidden", + bt_sys_log_flag, + ] + + cflags_c = [ "-std=c99" ] + + cflags_cc = [ +#TODO(jpawlowski): we should use same c++ version as Android, which is c++11, +# but we use some c++14 features. Uncomment when this get fixed in code.: + "-std=c++1y", + "-fno-exceptions", + ] + + defines = [ +# "_FORTIFY_SOURCE=2", + "_GNU_SOURCE", + "HAS_NO_BDROID_BUILDCFG", + "LOG_NDEBUG=1", + "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", + "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE", + + # This is a macro to that can be used by source code to detect if the + # current build is done by GN or via Android.mk. This is a temporary + # workaround until we can remove all Android-specific dependencies. + "OS_GENERIC", + + "BT_TMP_PATH=\"$bt_tmp_path/\"", + "BT_MISC_PATH=\"$bt_misc_path/\"", + "BT_ETC_PATH=\"$bt_etc_path/\"", + ] +} + +config("pic") { + cflags = [ "-fPIC" ] +} + +config("gc") { + ldflags = [ "-Wl,--gc-sections" ] +} diff --git a/src/connectivity/bt_others/bluetooth_mw/non_rpc_test/build/config/BUILDCONFIG.gn b/src/connectivity/bt_others/bluetooth_mw/non_rpc_test/build/config/BUILDCONFIG.gn new file mode 100644 index 000000000..419d62fad --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/non_rpc_test/build/config/BUILDCONFIG.gn @@ -0,0 +1,49 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +set_default_toolchain("//build/toolchain/gcc") + +set_defaults("executable") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("shared_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("source_set") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("static_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} diff --git a/src/connectivity/bt_others/bluetooth_mw/non_rpc_test/build/toolchain/gcc/BUILD.gn b/src/connectivity/bt_others/bluetooth_mw/non_rpc_test/build/toolchain/gcc/BUILD.gn new file mode 100644 index 000000000..228f0f592 --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/non_rpc_test/build/toolchain/gcc/BUILD.gn @@ -0,0 +1,108 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + libbt_mw_path = "" + external_libs_path = "" + cc = "" + cxx = "" +} + +assert(libbt_mw_path != "", "libbt_mw_path build argument wasn't provided.") +assert(external_libs_path != "", "external_libs_path build argument wasn't provided.") +assert(cc != "", "cc build argument wasn't provided.") +assert(cxx != "", "cxx build argument wasn't provided.") + +toolchain("gcc") { + tool("cc") { + depfile = "{{output}}.d" + command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CC {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CXX {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("alink") { + rspfile = "{{output}}.rsp" + command = "rm -f {{output}} && ar rcs {{output}} @$rspfile" + description = "AR {{target_output_name}}{{output_extension}}" + rspfile_content = "{{inputs}}" + outputs = [ + "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", + ] + default_output_extension = ".a" + + output_prefix = "lib" + } + + tool("solink") { + soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". + rspfile = soname + ".rsp" + + command = + "$cxx -shared {{ldflags}} -o $soname -Wl,-soname=$soname $libbt_mw_path $external_libs_path @$rspfile" + rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}" + + description = "SOLINK $soname" + + # Use this for {{output_extension}} expansions unless a target manually + # overrides it (in which case {{output_extension}} will be what the target + # specifies). + default_output_extension = ".so" + + outputs = [ + soname, + ] + link_output = soname + depend_output = soname + + output_prefix = "lib" + } + + tool("link") { + outfile = "{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + command = "$cxx {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group $libbt_mw_path $external_libs_path {{libs}}" + + description = "LINK $outfile" + rspfile_content = "{{inputs}}" + outputs = [ + outfile, + ] + } + + tool("stamp") { + command = "touch {{output}}" + description = "STAMP {{output}}" + } + + tool("copy") { + command = "cp -af {{source}} {{output}}" + description = "COPY {{source}} {{output}}" + } +} diff --git a/src/connectivity/bt_others/bluetooth_mw/playback/build/BUILD.gn b/src/connectivity/bt_others/bluetooth_mw/playback/build/BUILD.gn new file mode 100755 index 000000000..ef5fe6052 --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/playback/build/BUILD.gn @@ -0,0 +1,106 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + mw_inc_path = "" + asound_inc_path = "" + bt_alsa_flag = "" + bt_sys_log_flag = "" + bt_tmp_path = "" + bt_misc_path = "" + bt_etc_path = "" + stack_include_path = "" + stack_root_path = "" +} + +assert(mw_inc_path != "", "mw_inc_path build argument wasn't provided.") +assert(asound_inc_path != "", "asound_inc_path build argument wasn't provided.") +#print(mw_inc_path) + +assert(bt_tmp_path != "", "bt_tmp_path build argument wasn't provided.") +assert(bt_misc_path != "", "bt_misc_path build argument wasn't provided.") +assert(bt_etc_path != "", "bt_etc_path build argument wasn't provided.") +assert(stack_include_path != "", "stack_include_path build argument wasn't provided.") +assert(stack_root_path != "", "stack_include_path build argument wasn't provided.") + +#print(asound_inc_path) + +config("default_include_dirs") { + # TODO(armansito): Remove "core_include_path" once the cutils includes have + # been removed. + assert(mw_inc_path != "", + "mw_inc_path build argument wasn't provided.") + assert(asound_inc_path != "", + "asound_inc_path build argument wasn't provided.") + include_dirs = [ + mw_inc_path, + asound_inc_path, + stack_include_path, + stack_root_path, + ] +} + +config("linux") { + # TODO(keybuk): AndroidConfig.h or equivalent + + cflags = [ + "-Wall", + #"-Werror", + "-g", + "-Os", + "-fpic", + "-fdata-sections", + "-ffunction-sections", + "-fvisibility=hidden", + bt_alsa_flag, + bt_sys_log_flag, + ] + + cflags_c = [ "-std=c99" ] + + cflags_cc = [ +#TODO(jpawlowski): we should use same c++ version as Android, which is c++11, +# but we use some c++14 features. Uncomment when this get fixed in code.: + "-std=c++1y", + "-fno-exceptions", + ] + + defines = [ + "_FORTIFY_SOURCE=2", + "_GNU_SOURCE", + "HAS_NO_BDROID_BUILDCFG", + "LOG_NDEBUG=1", + "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", + "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE", + + # This is a macro to that can be used by source code to detect if the + # current build is done by GN or via Android.mk. This is a temporary + # workaround until we can remove all Android-specific dependencies. + "OS_GENERIC", + + "BT_TMP_PATH=\"$bt_tmp_path/\"", + "BT_MISC_PATH=\"$bt_misc_path/\"", + "BT_ETC_PATH=\"$bt_etc_path/\"", + ] +} + +config("pic") { + cflags = [ "-fPIC" ] +} + +config("gc") { + ldflags = [ "-Wl,--gc-sections" ] +} diff --git a/src/connectivity/bt_others/bluetooth_mw/playback/build/config/BUILDCONFIG.gn b/src/connectivity/bt_others/bluetooth_mw/playback/build/config/BUILDCONFIG.gn new file mode 100644 index 000000000..419d62fad --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/playback/build/config/BUILDCONFIG.gn @@ -0,0 +1,49 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +set_default_toolchain("//build/toolchain/gcc") + +set_defaults("executable") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("shared_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("source_set") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("static_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} diff --git a/src/connectivity/bt_others/bluetooth_mw/playback/build/toolchain/gcc/BUILD.gn b/src/connectivity/bt_others/bluetooth_mw/playback/build/toolchain/gcc/BUILD.gn new file mode 100644 index 000000000..0068ccd30 --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/playback/build/toolchain/gcc/BUILD.gn @@ -0,0 +1,108 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + libasound_path = "" + bluedroid_libs_path = "" + cc = "" + cxx = "" +} + +assert(libasound_path != "", "libasound_path build argument wasn't provided.") +assert(bluedroid_libs_path != "", "bluedroid_libs_path build argument wasn't provided.") +assert(cc != "", "cc build argument wasn't provided.") +assert(cxx != "", "cxx build argument wasn't provided.") + +toolchain("gcc") { + tool("cc") { + depfile = "{{output}}.d" + command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CC {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CXX {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("alink") { + rspfile = "{{output}}.rsp" + command = "rm -f {{output}} && ar rcs {{output}} @$rspfile" + description = "AR {{target_output_name}}{{output_extension}}" + rspfile_content = "{{inputs}}" + outputs = [ + "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", + ] + default_output_extension = ".a" + + output_prefix = "lib" + } + + tool("solink") { + soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". + rspfile = soname + ".rsp" + + command = + "$cxx -shared {{ldflags}} -o $soname -Wl,-soname=$soname $libasound_path $bluedroid_libs_path @$rspfile" + rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}" + + description = "SOLINK $soname" + + # Use this for {{output_extension}} expansions unless a target manually + # overrides it (in which case {{output_extension}} will be what the target + # specifies). + default_output_extension = ".so" + + outputs = [ + soname, + ] + link_output = soname + depend_output = soname + + output_prefix = "lib" + } + + tool("link") { + outfile = "{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + command = "$cxx {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}}" + + description = "LINK $outfile" + rspfile_content = "{{inputs}}" + outputs = [ + outfile, + ] + } + + tool("stamp") { + command = "touch {{output}}" + description = "STAMP {{output}}" + } + + tool("copy") { + command = "cp -af {{source}} {{output}}" + description = "COPY {{source}} {{output}}" + } +} diff --git a/src/connectivity/bt_others/bluetooth_mw/rpc/build/BUILD.gn b/src/connectivity/bt_others/bluetooth_mw/rpc/build/BUILD.gn new file mode 100755 index 000000000..e0f8212d2 --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/rpc/build/BUILD.gn @@ -0,0 +1,109 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + mw_config_path = "" + mw_include_path = "" + mw_alsa_inc_path = "" + mw_alsa_uploader_inc_path = "" + bt_sys_log_flag = "" + bt_tmp_path = "" + bt_misc_path = "" + bt_etc_path = "" + bt_backtrace = "" + rpc_dbg_flag = "" + libbt_playback_link = "" + libbt_uploader_link = "" +} + +assert(mw_config_path != "", "mw_config_path build argument wasn't provided.") +assert(mw_include_path != "", "mw_include_path build argument wasn't provided.") + +assert(bt_tmp_path != "", "bt_tmp_path build argument wasn't provided.") +assert(bt_misc_path != "", "bt_misc_path build argument wasn't provided.") +assert(bt_etc_path != "", "bt_etc_path build argument wasn't provided.") + +config("default_include_dirs") { + # TODO(armansito): Remove "core_include_path" once the cutils includes have + # been removed. + assert(mw_config_path != "", + "mw_config_path build argument wasn't provided.") + assert(mw_include_path != "", + "mw_include_path build argument wasn't provided.") + + include_dirs = [ + mw_config_path, + mw_include_path, + mw_alsa_inc_path, + mw_alsa_uploader_inc_path, + ] +} + +config("linux") { + # TODO(keybuk): AndroidConfig.h or equivalent + + cflags = [ + #TODO(jpawlowski): uncomment once we have no warnings on linux build + "-Wall", + #"-Werror", + "-g", + "-rdynamic", + "-funwind-tables", + "-Os", + "-fpic", + "-fdata-sections", + "-ffunction-sections", + "-fvisibility=hidden", + bt_sys_log_flag, + bt_backtrace, + rpc_dbg_flag, + ] + + cflags_c = [ "-std=c99" ] + + cflags_cc = [ +#TODO(jpawlowski): we should use same c++ version as Android, which is c++11, +# but we use some c++14 features. Uncomment when this get fixed in code.: + "-std=c++1y", + "-fno-exceptions", + ] + + defines = [ +# "_FORTIFY_SOURCE=2", + "_GNU_SOURCE", + "HAS_NO_BDROID_BUILDCFG", + "LOG_NDEBUG=1", + "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", + "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE", + + # This is a macro to that can be used by source code to detect if the + # current build is done by GN or via Android.mk. This is a temporary + # workaround until we can remove all Android-specific dependencies. + "OS_GENERIC", + + "BT_TMP_PATH=\"$bt_tmp_path/\"", + "BT_MISC_PATH=\"$bt_misc_path/\"", + "BT_ETC_PATH=\"$bt_etc_path/\"", + ] +} + +config("pic") { + cflags = [ "-fPIC" ] +} + +config("gc") { + ldflags = [ "-Wl,--gc-sections" ] +} diff --git a/src/connectivity/bt_others/bluetooth_mw/rpc/build/config/BUILDCONFIG.gn b/src/connectivity/bt_others/bluetooth_mw/rpc/build/config/BUILDCONFIG.gn new file mode 100644 index 000000000..419d62fad --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/rpc/build/config/BUILDCONFIG.gn @@ -0,0 +1,49 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +set_default_toolchain("//build/toolchain/gcc") + +set_defaults("executable") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("shared_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("source_set") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("static_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} diff --git a/src/connectivity/bt_others/bluetooth_mw/rpc/build/toolchain/gcc/BUILD.gn b/src/connectivity/bt_others/bluetooth_mw/rpc/build/toolchain/gcc/BUILD.gn new file mode 100644 index 000000000..0140237cb --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/rpc/build/toolchain/gcc/BUILD.gn @@ -0,0 +1,107 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + libbt_mw_path = "" + libz_path = "" + cc = "" + cxx = "" +} + +assert(libbt_mw_path != "", "libbt_mw_path build argument wasn't provided.") +assert(cc != "", "cc build argument wasn't provided.") +assert(cxx != "", "cxx build argument wasn't provided.") + +toolchain("gcc") { + tool("cc") { + depfile = "{{output}}.d" + command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CC {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CXX {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("alink") { + rspfile = "{{output}}.rsp" + command = "rm -f {{output}} && ar rcs {{output}} @$rspfile" + description = "AR {{target_output_name}}{{output_extension}}" + rspfile_content = "{{inputs}}" + outputs = [ + "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", + ] + default_output_extension = ".a" + + output_prefix = "lib" + } + + tool("solink") { + soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". + rspfile = soname + ".rsp" + + command = + "$cxx -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile" + rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive $libbt_mw_path $libz_path {{libs}}" + + description = "SOLINK $soname" + + # Use this for {{output_extension}} expansions unless a target manually + # overrides it (in which case {{output_extension}} will be what the target + # specifies). + default_output_extension = ".so" + + outputs = [ + soname, + ] + link_output = soname + depend_output = soname + + output_prefix = "lib" + } + + tool("link") { + outfile = "{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + command = "$cxx {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group $libbt_mw_path $libz_path {{libs}}" + + description = "LINK $outfile" + rspfile_content = "{{inputs}}" + outputs = [ + outfile, + ] + } + + tool("stamp") { + command = "touch {{output}}" + description = "STAMP {{output}}" + } + + tool("copy") { + command = "cp -af {{source}} {{output}}" + description = "COPY {{source}} {{output}}" + } +} diff --git a/src/connectivity/bt_others/bluetooth_mw/rpc_test/build/BUILD.gn b/src/connectivity/bt_others/bluetooth_mw/rpc_test/build/BUILD.gn new file mode 100755 index 000000000..97b42008c --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/rpc_test/build/BUILD.gn @@ -0,0 +1,103 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + mw_include_path = "" + mw_config_path = "" + mw_alsa_inc_path = "" + asound_inc_path = "" + mw_alsa_uploader_inc_path = "" + mtk_rpc_ipc_inc_path = "" + bt_sys_log_flag = "" + bt_tmp_path = "" + bt_misc_path = "" + bt_etc_path = "" + libbt_playback_link = "" + libbt_uploader_link = "" +} + + +assert(mw_include_path != "", "mw_include_path build argument wasn't provided.") +assert(mw_config_path != "", "mw_config_path build argument wasn't provided.") + +assert(bt_tmp_path != "", "bt_tmp_path build argument wasn't provided.") +assert(bt_misc_path != "", "bt_misc_path build argument wasn't provided.") +assert(bt_etc_path != "", "bt_etc_path build argument wasn't provided.") + +config("default_include_dirs") { + # TODO(armansito): Remove "core_include_path" once the cutils includes have + # been removed. + include_dirs = [ + mw_include_path, + mw_config_path, + mw_alsa_inc_path, + asound_inc_path, + mtk_rpc_ipc_inc_path, + mw_alsa_uploader_inc_path, + ] +} + +config("linux") { + # TODO(keybuk): AndroidConfig.h or equivalent + + cflags = [ + #TODO(jpawlowski): uncomment once we have no warnings on linux build + "-Wall", + #"-Werror", + "-g", + "-Os", + "-fpic", + "-fdata-sections", + "-ffunction-sections", + "-fvisibility=hidden", + bt_sys_log_flag, + ] + + cflags_c = [ "-std=c99" ] + + cflags_cc = [ +#TODO(jpawlowski): we should use same c++ version as Android, which is c++11, +# but we use some c++14 features. Uncomment when this get fixed in code.: + "-std=c++1y", + "-fno-exceptions", + ] + + defines = [ + "_FORTIFY_SOURCE=2", + "_GNU_SOURCE", + "HAS_NO_BDROID_BUILDCFG", + "LOG_NDEBUG=1", + "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", + "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE", + + # This is a macro to that can be used by source code to detect if the + # current build is done by GN or via Android.mk. This is a temporary + # workaround until we can remove all Android-specific dependencies. + "OS_GENERIC", + + "BT_TMP_PATH=\"$bt_tmp_path/\"", + "BT_MISC_PATH=\"$bt_misc_path/\"", + "BT_ETC_PATH=\"$bt_etc_path/\"", + ] +} + +config("pic") { + cflags = [ "-fPIC" ] +} + +config("gc") { + ldflags = [ "-Wl,--gc-sections" ] +} diff --git a/src/connectivity/bt_others/bluetooth_mw/rpc_test/build/config/BUILDCONFIG.gn b/src/connectivity/bt_others/bluetooth_mw/rpc_test/build/config/BUILDCONFIG.gn new file mode 100644 index 000000000..419d62fad --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/rpc_test/build/config/BUILDCONFIG.gn @@ -0,0 +1,49 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +set_default_toolchain("//build/toolchain/gcc") + +set_defaults("executable") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("shared_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("source_set") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("static_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} diff --git a/src/connectivity/bt_others/bluetooth_mw/rpc_test/build/toolchain/gcc/BUILD.gn b/src/connectivity/bt_others/bluetooth_mw/rpc_test/build/toolchain/gcc/BUILD.gn new file mode 100644 index 000000000..62ef5b5ba --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/rpc_test/build/toolchain/gcc/BUILD.gn @@ -0,0 +1,107 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + libbt_mw_path = "" + libbt_aud_hw_path = "" + libz_path = "" + cc = "" + cxx = "" +} + +assert(cc != "", "cc build argument wasn't provided.") +assert(cxx != "", "cxx build argument wasn't provided.") + +toolchain("gcc") { + tool("cc") { + depfile = "{{output}}.d" + command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CC {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CXX {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("alink") { + rspfile = "{{output}}.rsp" + command = "rm -f {{output}} && ar rcs {{output}} @$rspfile" + description = "AR {{target_output_name}}{{output_extension}}" + rspfile_content = "{{inputs}}" + outputs = [ + "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", + ] + default_output_extension = ".a" + + output_prefix = "lib" + } + + tool("solink") { + soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". + rspfile = soname + ".rsp" + + command = + "$cxx -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile" + rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}" + + description = "SOLINK $soname" + + # Use this for {{output_extension}} expansions unless a target manually + # overrides it (in which case {{output_extension}} will be what the target + # specifies). + default_output_extension = ".so" + + outputs = [ + soname, + ] + link_output = soname + depend_output = soname + + output_prefix = "lib" + } + + tool("link") { + outfile = "{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + command = "$cxx {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group $libbt_mw_path $libbt_aud_hw_path $libz_path {{libs}}" + + description = "LINK $outfile" + rspfile_content = "{{inputs}}" + outputs = [ + outfile, + ] + } + + tool("stamp") { + command = "touch {{output}}" + description = "STAMP {{output}}" + } + + tool("copy") { + command = "cp -af {{source}} {{output}}" + description = "COPY {{source}} {{output}}" + } +} diff --git a/src/connectivity/bt_others/bluetooth_mw/sdk/build/BUILD.gn b/src/connectivity/bt_others/bluetooth_mw/sdk/build/BUILD.gn new file mode 100755 index 000000000..e597b5700 --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/sdk/build/BUILD.gn @@ -0,0 +1,105 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + storage_path = "" + conf_path = "" + platform_libs_path = "" + bt_sys_log_flag = "" + bt_tmp_path = "" + bt_misc_path = "" + bt_etc_path = "" + rpc_dbg_flag = "" + stack_include_path = "" + stack_root_path = "" +} + +assert(storage_path != "", "storage_path build argument wasn't provided.") +assert(conf_path != "", "conf_path build argument wasn't provided.") +assert(platform_libs_path != "", "storage_path build argument wasn't provided.") + +assert(bt_tmp_path != "", "bt_tmp_path build argument wasn't provided.") +assert(bt_misc_path != "", "bt_misc_path build argument wasn't provided.") +assert(bt_etc_path != "", "bt_etc_path build argument wasn't provided.") +assert(stack_include_path != "", "stack_include_path build argument wasn't provided.") +assert(stack_root_path != "", "stack_include_path build argument wasn't provided.") + +config("default_include_dirs") { + include_dirs = [ + "//inc", + "//inc/hardware", + storage_path, + platform_libs_path, + stack_include_path, + stack_root_path, + ] +} + +config("linux") { + # TODO(keybuk): AndroidConfig.h or equivalent + + cflags = [ + "-Wall", + #"-Werror", + "-g", + "-Os", + "-fpic", + "-fdata-sections", + "-ffunction-sections", + "-fvisibility=hidden", + "-DMTK_BLUEDROID_PATCH", + bt_sys_log_flag, + rpc_dbg_flag, + ] + + cflags_c = [ "-std=c99" ] + + cflags_cc = [ +#TODO(jpawlowski): we should use same c++ version as Android, which is c++11, +# but we use some c++14 features. Uncomment when this get fixed in code.: + "-std=c++1y", + "-fno-exceptions", + ] + + defines = [ +# "_FORTIFY_SOURCE=2", + "_GNU_SOURCE", + "HAS_NO_BDROID_BUILDCFG", + "LOG_NDEBUG=1", + "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", + "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE", + + # This is a macro to that can be used by source code to detect if the + # current build is done by GN or via Android.mk. This is a temporary + # workaround until we can remove all Android-specific dependencies. + "OS_GENERIC", + "MTK_LINUX", + "MW_STORAGE_PATH=\"$storage_path\"", + "CONFIG_PATH=\"$conf_path\"", + "PLATFORM_LIB_PATH=\"$platform_libs_path\"", + "BT_TMP_PATH=\"$bt_tmp_path/\"", + "BT_MISC_PATH=\"$bt_misc_path/\"", + "BT_ETC_PATH=\"$bt_etc_path/\"", + ] +} + +config("pic") { + cflags = [ "-fPIC" ] +} + +config("gc") { + ldflags = [ "-Wl,--gc-sections" ] +} diff --git a/src/connectivity/bt_others/bluetooth_mw/sdk/build/config/BUILDCONFIG.gn b/src/connectivity/bt_others/bluetooth_mw/sdk/build/config/BUILDCONFIG.gn new file mode 100644 index 000000000..419d62fad --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/sdk/build/config/BUILDCONFIG.gn @@ -0,0 +1,49 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +set_default_toolchain("//build/toolchain/gcc") + +set_defaults("executable") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("shared_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("source_set") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("static_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} diff --git a/src/connectivity/bt_others/bluetooth_mw/sdk/build/toolchain/gcc/BUILD.gn b/src/connectivity/bt_others/bluetooth_mw/sdk/build/toolchain/gcc/BUILD.gn new file mode 100644 index 000000000..1a2ba18f1 --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/sdk/build/toolchain/gcc/BUILD.gn @@ -0,0 +1,106 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + bluedroid_libs_path = "" + cc = "" + cxx = "" +} + +assert(bluedroid_libs_path != "", "bluedroid_libs_path build argument wasn't provided.") +assert(cc != "", "cc build argument wasn't provided.") +assert(cxx != "", "cxx build argument wasn't provided.") + +toolchain("gcc") { + tool("cc") { + depfile = "{{output}}.d" + command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CC {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CXX {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("alink") { + rspfile = "{{output}}.rsp" + command = "rm -f {{output}} && ar rcs {{output}} @$rspfile" + description = "AR {{target_output_name}}{{output_extension}}" + rspfile_content = "{{inputs}}" + outputs = [ + "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", + ] + default_output_extension = ".a" + + output_prefix = "lib" + } + + tool("solink") { + soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". + rspfile = soname + ".rsp" + + command = + "$cxx -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile" + rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive $bluedroid_libs_path {{libs}}" + + description = "SOLINK $soname" + + # Use this for {{output_extension}} expansions unless a target manually + # overrides it (in which case {{output_extension}} will be what the target + # specifies). + default_output_extension = ".so" + + outputs = [ + soname, + ] + link_output = soname + depend_output = soname + + output_prefix = "lib" + } + + tool("link") { + outfile = "{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + command = "$cxx {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}}" + + description = "LINK $outfile" + rspfile_content = "{{inputs}}" + outputs = [ + outfile, + ] + } + + tool("stamp") { + command = "touch {{output}}" + description = "STAMP {{output}}" + } + + tool("copy") { + command = "cp -af {{source}} {{output}}" + description = "COPY {{source}} {{output}}" + } +} diff --git a/src/connectivity/bt_others/bluetooth_mw/uploader/build/BUILD.gn b/src/connectivity/bt_others/bluetooth_mw/uploader/build/BUILD.gn new file mode 100755 index 000000000..5a87db715 --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/uploader/build/BUILD.gn @@ -0,0 +1,86 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + mw_inc_path = "" + asound_inc_path = "" + bt_alsa_flag = "" +} + +assert(mw_inc_path != "", "mw_inc_path build argument wasn't provided.") +assert(asound_inc_path != "", "asound_inc_path build argument wasn't provided.") +#print(mw_inc_path) +#print(asound_inc_path) + +config("default_include_dirs") { + # TODO(armansito): Remove "core_include_path" once the cutils includes have + # been removed. + assert(mw_inc_path != "", + "mw_inc_path build argument wasn't provided.") + assert(asound_inc_path != "", + "asound_inc_path build argument wasn't provided.") + include_dirs = [ + mw_inc_path, + asound_inc_path, + ] +} + +config("linux") { + # TODO(keybuk): AndroidConfig.h or equivalent + + cflags = [ + "-Wall", + # "-Werror", + "-g", + "-Os", + "-fpic", + "-fdata-sections", + "-ffunction-sections", + "-fvisibility=hidden", + bt_alsa_flag, + ] + + cflags_c = [ "-std=c99" ] + + cflags_cc = [ +#TODO(jpawlowski): we should use same c++ version as Android, which is c++11, +# but we use some c++14 features. Uncomment when this get fixed in code.: + "-std=c++1y", + "-fno-exceptions", + ] + + defines = [ + "_FORTIFY_SOURCE=2", + "_GNU_SOURCE", + "HAS_NO_BDROID_BUILDCFG", + "LOG_NDEBUG=1", + "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", + "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE", + + # This is a macro to that can be used by source code to detect if the + # current build is done by GN or via Android.mk. This is a temporary + # workaround until we can remove all Android-specific dependencies. + "OS_GENERIC", + ] +} + +config("pic") { + cflags = [ "-fPIC" ] +} + +config("gc") { + ldflags = [ "-Wl,--gc-sections" ] +} diff --git a/src/connectivity/bt_others/bluetooth_mw/uploader/build/config/BUILDCONFIG.gn b/src/connectivity/bt_others/bluetooth_mw/uploader/build/config/BUILDCONFIG.gn new file mode 100644 index 000000000..419d62fad --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/uploader/build/config/BUILDCONFIG.gn @@ -0,0 +1,49 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +set_default_toolchain("//build/toolchain/gcc") + +set_defaults("executable") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("shared_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("source_set") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("static_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} diff --git a/src/connectivity/bt_others/bluetooth_mw/uploader/build/toolchain/gcc/BUILD.gn b/src/connectivity/bt_others/bluetooth_mw/uploader/build/toolchain/gcc/BUILD.gn new file mode 100644 index 000000000..580520908 --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_mw/uploader/build/toolchain/gcc/BUILD.gn @@ -0,0 +1,108 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + libbt_mw_path = "" + libasound_path = "" + cc = "" + cxx = "" +} + +assert(libbt_mw_path != "", "libbt_mw_path build argument wasn't provided.") +assert(libasound_path != "", "libasound_path build argument wasn't provided.") +assert(cc != "", "cc build argument wasn't provided.") +assert(cxx != "", "cxx build argument wasn't provided.") + +toolchain("gcc") { + tool("cc") { + depfile = "{{output}}.d" + command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CC {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CXX {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("alink") { + rspfile = "{{output}}.rsp" + command = "rm -f {{output}} && ar rcs {{output}} @$rspfile" + description = "AR {{target_output_name}}{{output_extension}}" + rspfile_content = "{{inputs}}" + outputs = [ + "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", + ] + default_output_extension = ".a" + + output_prefix = "lib" + } + + tool("solink") { + soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". + rspfile = soname + ".rsp" + + command = + "$cxx -shared {{ldflags}} -o $soname -Wl,-soname=$soname $libasound_path @$rspfile" + rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}" + + description = "SOLINK $soname" + + # Use this for {{output_extension}} expansions unless a target manually + # overrides it (in which case {{output_extension}} will be what the target + # specifies). + default_output_extension = ".so" + + outputs = [ + soname, + ] + link_output = soname + depend_output = soname + + output_prefix = "lib" + } + + tool("link") { + outfile = "{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + command = "$cxx {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group $libbt_mw_path {{libs}}" + + description = "LINK $outfile" + rspfile_content = "{{inputs}}" + outputs = [ + outfile, + ] + } + + tool("stamp") { + command = "touch {{output}}" + description = "STAMP {{output}}" + } + + tool("copy") { + command = "cp -af {{source}} {{output}}" + description = "COPY {{source}} {{output}}" + } +} diff --git a/src/connectivity/bt_others/bluetooth_tool/btut/build/BUILD.gn b/src/connectivity/bt_others/bluetooth_tool/btut/build/BUILD.gn new file mode 100755 index 000000000..44b19620d --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_tool/btut/build/BUILD.gn @@ -0,0 +1,111 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + libhw_include_path = "" + core_include_path = "" + btif_include_path = "" + stack_include_path = "" + utils_include_path = "" + mtk_bt_include_path = "" + bt_sys_log_flag = "" + + bt_tmp_path = "" + bt_misc_path = "" + bt_etc_path = "" +} + +assert(libhw_include_path != "", "libhw_include_path build argument wasn't provided.") +assert(core_include_path != "", "core_include_path build argument wasn't provided.") +assert(btif_include_path != "", "btif_include_path build argument wasn't provided.") +assert(stack_include_path != "", "stack_include_path build argument wasn't provided.") +assert(utils_include_path != "", "utils_include_path build argument wasn't provided.") +assert(mtk_bt_include_path != "", "mtk_bt_include_path build argument wasn't provided.") + +assert(bt_tmp_path != "", "bt_tmp_path build argument wasn't provided.") +assert(bt_misc_path != "", "bt_misc_path build argument wasn't provided.") +assert(bt_etc_path != "", "bt_etc_path build argument wasn't provided.") + +#print(libhw_include_path) +#print(core_include_path) +#print(btif_include_path) +#print(stack_include_path) +#print(utils_include_path) +#print(mtk_bt_include_path) + +config("default_include_dirs") { + include_dirs = [ + libhw_include_path, + core_include_path, + btif_include_path, + stack_include_path, + utils_include_path, + mtk_bt_include_path, + ] +} + +config("linux") { + # TODO(keybuk): AndroidConfig.h or equivalent + + cflags = [ + "-Wall", + #"-Werror", + "-g", + "-Os", + "-fpic", + "-fdata-sections", + "-ffunction-sections", + "-fvisibility=hidden", + "-DHAS_MDROID_BUILDCFG", + "-DMTK_BT_COMMON", + bt_sys_log_flag, + ] + + cflags_c = [ "-std=c99" ] + + cflags_cc = [ +#TODO(jpawlowski): we should use same c++ version as Android, which is c++11, +# but we use some c++14 features. Uncomment when this get fixed in code.: + "-std=c++1y", + "-fno-exceptions", + ] + + defines = [ + "_FORTIFY_SOURCE=2", + "_GNU_SOURCE", + "HAS_NO_BDROID_BUILDCFG", + "LOG_NDEBUG=1", + "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", + "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE", + + # This is a macro to that can be used by source code to detect if the + # current build is done by GN or via Android.mk. This is a temporary + # workaround until we can remove all Android-specific dependencies. + "OS_GENERIC", + + "BT_TMP_PATH=\"$bt_tmp_path/\"", + "BT_MISC_PATH=\"$bt_misc_path/\"", + "BT_ETC_PATH=\"$bt_etc_path/\"", + ] +} + +config("pic") { + cflags = [ "-fPIC" ] +} + +config("gc") { + ldflags = [ "-Wl,--gc-sections" ] +} diff --git a/src/connectivity/bt_others/bluetooth_tool/btut/build/config/BUILDCONFIG.gn b/src/connectivity/bt_others/bluetooth_tool/btut/build/config/BUILDCONFIG.gn new file mode 100755 index 000000000..419d62fad --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_tool/btut/build/config/BUILDCONFIG.gn @@ -0,0 +1,49 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +set_default_toolchain("//build/toolchain/gcc") + +set_defaults("executable") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("shared_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("source_set") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("static_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} diff --git a/src/connectivity/bt_others/bluetooth_tool/btut/build/toolchain/gcc/BUILD.gn b/src/connectivity/bt_others/bluetooth_tool/btut/build/toolchain/gcc/BUILD.gn new file mode 100755 index 000000000..2fc0e7104 --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_tool/btut/build/toolchain/gcc/BUILD.gn @@ -0,0 +1,107 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + bluedroid_libs_path = "" + external_libs_path = "" + cc = "" + cxx = "" +} + +assert(bluedroid_libs_path != "", "bluedroid_libs_path build argument wasn't provided.") +assert(external_libs_path != "", "external_libs_path build argument wasn't provided.") +assert(cc != "", "cc build argument wasn't provided.") +assert(cxx != "", "cxx build argument wasn't provided.") + +toolchain("gcc") { + tool("cc") { + depfile = "{{output}}.d" + command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CC {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CXX {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("alink") { + rspfile = "{{output}}.rsp" + command = "rm -f {{output}} && ar rcs {{output}} @$rspfile" + description = "AR {{target_output_name}}{{output_extension}}" + rspfile_content = "{{inputs}}" + outputs = [ + "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", + ] + default_output_extension = ".a" + + output_prefix = "lib" + } + + tool("solink") { + soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". + rspfile = soname + ".rsp" + + command = + "$cxx -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile" + rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}" + + description = "SOLINK $soname" + + # Use this for {{output_extension}} expansions unless a target manually + # overrides it (in which case {{output_extension}} will be what the target + # specifies). + default_output_extension = ".so" + + outputs = [ + soname, + ] + link_output = soname + depend_output = soname + + output_prefix = "lib" + } + + tool("link") { + outfile = "{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + command = "$cxx {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group $bluedroid_libs_path $external_libs_path {{libs}}" + description = "LINK $outfile" + rspfile_content = "{{inputs}}" + outputs = [ + outfile, + ] + } + + tool("stamp") { + command = "touch {{output}}" + description = "STAMP {{output}}" + } + + tool("copy") { + command = "cp -af {{source}} {{output}}" + description = "COPY {{source}} {{output}}" + } +} diff --git a/src/connectivity/bt_others/bluetooth_tool/dbg/build/BUILD.gn b/src/connectivity/bt_others/bluetooth_tool/dbg/build/BUILD.gn new file mode 100755 index 000000000..f5d008818 --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_tool/dbg/build/BUILD.gn @@ -0,0 +1,80 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + mtk_rpcipc_inc_path = "" + mtk_inc_rpc_path = "" +} + +assert(mtk_rpcipc_inc_path != "", "mtk_rpcipc_inc_path build argument wasn't provided.") +assert(mtk_inc_rpc_path != "", "mtk_inc_rpc_path build argument wasn't provided.") + +config("default_include_dirs") { + # TODO(armansito): Remove "core_include_path" once the cutils includes have + # been removed. + include_dirs = [ + mtk_rpcipc_inc_path, + mtk_inc_rpc_path, + ] +} + +config("linux") { + # TODO(keybuk): AndroidConfig.h or equivalent + + cflags = [ + #TODO(jpawlowski): uncomment once we have no warnings on linux build + "-Wall", + #"-Werror", + "-g", + "-Os", + "-fpic", + "-fdata-sections", + "-ffunction-sections", + "-fvisibility=hidden", + ] + + cflags_c = [ "-std=c99" ] + + cflags_cc = [ +#TODO(jpawlowski): we should use same c++ version as Android, which is c++11, +# but we use some c++14 features. Uncomment when this get fixed in code.: + "-std=c++1y", + "-fno-exceptions", + ] + + defines = [ + "_FORTIFY_SOURCE=2", + "_GNU_SOURCE", + "HAS_NO_BDROID_BUILDCFG", + "LOG_NDEBUG=1", + "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", + "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE", + + # This is a macro to that can be used by source code to detect if the + # current build is done by GN or via Android.mk. This is a temporary + # workaround until we can remove all Android-specific dependencies. + "OS_GENERIC", + "BT_RPC_DBG_CLIENT", + ] +} + +config("pic") { + cflags = [ "-fPIC" ] +} + +config("gc") { + ldflags = [ "-Wl,--gc-sections" ] +} diff --git a/src/connectivity/bt_others/bluetooth_tool/dbg/build/config/BUILDCONFIG.gn b/src/connectivity/bt_others/bluetooth_tool/dbg/build/config/BUILDCONFIG.gn new file mode 100755 index 000000000..419d62fad --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_tool/dbg/build/config/BUILDCONFIG.gn @@ -0,0 +1,49 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +set_default_toolchain("//build/toolchain/gcc") + +set_defaults("executable") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("shared_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("source_set") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("static_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} diff --git a/src/connectivity/bt_others/bluetooth_tool/dbg/build/toolchain/gcc/BUILD.gn b/src/connectivity/bt_others/bluetooth_tool/dbg/build/toolchain/gcc/BUILD.gn new file mode 100755 index 000000000..b2518f07b --- /dev/null +++ b/src/connectivity/bt_others/bluetooth_tool/dbg/build/toolchain/gcc/BUILD.gn @@ -0,0 +1,108 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + libipcrpc_path = "" + libmtk_bt_service_client_path = "" + cc = "" + cxx = "" +} + +assert(libipcrpc_path != "", "libipcrpc_path build argument wasn't provided.") +assert(libmtk_bt_service_client_path != "", "libmtk_bt_service_client_path build argument wasn't provided.") +assert(cc != "", "cc build argument wasn't provided.") +assert(cxx != "", "cxx build argument wasn't provided.") +print(libmtk_bt_service_client_path) +toolchain("gcc") { + tool("cc") { + depfile = "{{output}}.d" + command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CC {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CXX {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("alink") { + rspfile = "{{output}}.rsp" + command = "rm -f {{output}} && ar rcs {{output}} @$rspfile" + description = "AR {{target_output_name}}{{output_extension}}" + rspfile_content = "{{inputs}}" + outputs = [ + "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", + ] + default_output_extension = ".a" + + output_prefix = "lib" + } + + tool("solink") { + soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". + rspfile = soname + ".rsp" + + command = + "$cxx -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile" + rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive $libipcrpc_path $libmtk_bt_service_client_path {{libs}}" + + description = "SOLINK $soname" + + # Use this for {{output_extension}} expansions unless a target manually + # overrides it (in which case {{output_extension}} will be what the target + # specifies). + default_output_extension = ".so" + + outputs = [ + soname, + ] + link_output = soname + depend_output = soname + + output_prefix = "lib" + } + + tool("link") { + outfile = "{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + command = "$cxx {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group $libipcrpc_path $libmtk_bt_service_client_path {{libs}}" + + description = "LINK $outfile" + rspfile_content = "{{inputs}}" + outputs = [ + outfile, + ] + } + + tool("stamp") { + command = "touch {{output}}" + description = "STAMP {{output}}" + } + + tool("copy") { + command = "cp -af {{source}} {{output}}" + description = "COPY {{source}} {{output}}" + } +} diff --git a/src/connectivity/bt_others/boots/build/BUILD.gn b/src/connectivity/bt_others/boots/build/BUILD.gn new file mode 100644 index 000000000..c7379a452 --- /dev/null +++ b/src/connectivity/bt_others/boots/build/BUILD.gn @@ -0,0 +1,72 @@ +# +# Copyright (C) 2017 MediaTek, Inc. +# +# 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. +# + +declare_args() { + boots_socket_path = "" +} + +#assert(boots_socket_path != "", "boots_socket_path build argument wasn't provided.") + +config("default_include_dirs") { + include_dirs = [ + ] +} + +config("linux") { + # TODO(keybuk): AndroidConfig.h or equivalent + + cflags = [ + "-Wall", + #"-Werror", + "-g", + "-O0", + "-fpic", + "-fdata-sections", + "-ffunction-sections", + "-fvisibility=hidden", + ] + + cflags_c = [ "-std=c99" ] + + cflags_cc = [ +#TODO(jpawlowski): we should use same c++ version as Android, which is c++11, +# but we use some c++14 features. Uncomment when this get fixed in code.: + "-std=c++1y", + "-fno-exceptions", + ] + + defines = [ + "_FORTIFY_SOURCE=2", + "_GNU_SOURCE", + "LOG_NDEBUG=1", + "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", + "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE", + + # This is a macro to that can be used by source code to detect if the + # current build is done by GN or via Android.mk. This is a temporary + # workaround until we can remove all Android-specific dependencies. + + "BOOTS_SOCKET_PATH=\"$boots_socket_path/\"", + ] +} + +config("pic") { + cflags = [ "-fPIC" ] +} + +config("gc") { + ldflags = [ "-Wl,--gc-sections" ] +} diff --git a/src/connectivity/bt_others/boots/build/config/BUILDCONFIG.gn b/src/connectivity/bt_others/boots/build/config/BUILDCONFIG.gn new file mode 100644 index 000000000..ce5640b34 --- /dev/null +++ b/src/connectivity/bt_others/boots/build/config/BUILDCONFIG.gn @@ -0,0 +1,49 @@ +# +# Copyright (C) 2017 MediaTek, Inc. +# +# 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. +# + +set_default_toolchain("//build/toolchain/gcc") + +set_defaults("executable") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("shared_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("source_set") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("static_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} diff --git a/src/connectivity/bt_others/boots/build/toolchain/gcc/BUILD.gn b/src/connectivity/bt_others/boots/build/toolchain/gcc/BUILD.gn new file mode 100644 index 000000000..756a2e6a9 --- /dev/null +++ b/src/connectivity/bt_others/boots/build/toolchain/gcc/BUILD.gn @@ -0,0 +1,103 @@ +# +# Copyright (C) 2017 MediaTek, Inc. +# +# 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. +# + +declare_args() { + cc = "" + cxx = "" +} + +assert(cc != "", "cc build argument wasn't provided.") +assert(cxx != "", "cxx build argument wasn't provided.") + +toolchain("gcc") { + tool("cc") { + depfile = "{{output}}.d" + command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CC {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CXX {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("alink") { + rspfile = "{{output}}.rsp" + command = "rm -f {{output}} && ar rcs {{output}} @$rspfile" + description = "AR {{target_output_name}}{{output_extension}}" + rspfile_content = "{{inputs}}" + outputs = [ + "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", + ] + default_output_extension = ".a" + + output_prefix = "lib" + } + + tool("solink") { + soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". + rspfile = soname + ".rsp" + + command = + "$cxx -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile" + rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}" + + description = "SOLINK $soname" + + # Use this for {{output_extension}} expansions unless a target manually + # overrides it (in which case {{output_extension}} will be what the target + # specifies). + default_output_extension = ".so" + + outputs = [ + soname, + ] + link_output = soname + depend_output = soname + + output_prefix = "lib" + } + + tool("link") { + outfile = "{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + command = "$cxx {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}}" + description = "LINK $outfile" + rspfile_content = "{{inputs}}" + outputs = [ + outfile, + ] + } + + tool("stamp") { + command = "touch {{output}}" + description = "STAMP {{output}}" + } + + tool("copy") { + command = "cp -af {{source}} {{output}}" + description = "COPY {{source}} {{output}}" + } +} diff --git a/src/connectivity/bt_others/picus/build/BUILD.gn b/src/connectivity/bt_others/picus/build/BUILD.gn new file mode 100644 index 000000000..0877040e5 --- /dev/null +++ b/src/connectivity/bt_others/picus/build/BUILD.gn @@ -0,0 +1,70 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + +} + +config("default_include_dirs") { + include_dirs = [ + + ] +} + +config("linux") { + # TODO(keybuk): AndroidConfig.h or equivalent + + cflags = [ + "-Wall", + #"-Werror", + "-g", + "-O0", + "-fpic", + "-fdata-sections", + "-ffunction-sections", + "-fvisibility=hidden", + ] + + cflags_c = [ "-std=c99" ] + + cflags_cc = [ +#TODO(jpawlowski): we should use same c++ version as Android, which is c++11, +# but we use some c++14 features. Uncomment when this get fixed in code.: + "-std=c++1y", + "-fno-exceptions", + ] + + defines = [ + "_FORTIFY_SOURCE=2", + "_GNU_SOURCE", + "LOG_NDEBUG=1", + "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", + "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE", + + # This is a macro to that can be used by source code to detect if the + # current build is done by GN or via Android.mk. This is a temporary + # workaround until we can remove all Android-specific dependencies. + "OS_GENERIC", + ] +} + +config("pic") { + cflags = [ "-fPIC" ] +} + +config("gc") { + ldflags = [ "-Wl,--gc-sections" ] +} diff --git a/src/connectivity/bt_others/picus/build/config/BUILDCONFIG.gn b/src/connectivity/bt_others/picus/build/config/BUILDCONFIG.gn new file mode 100644 index 000000000..419d62fad --- /dev/null +++ b/src/connectivity/bt_others/picus/build/config/BUILDCONFIG.gn @@ -0,0 +1,49 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +set_default_toolchain("//build/toolchain/gcc") + +set_defaults("executable") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("shared_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("source_set") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("static_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} diff --git a/src/connectivity/bt_others/picus/build/toolchain/gcc/BUILD.gn b/src/connectivity/bt_others/picus/build/toolchain/gcc/BUILD.gn new file mode 100644 index 000000000..da393e9e3 --- /dev/null +++ b/src/connectivity/bt_others/picus/build/toolchain/gcc/BUILD.gn @@ -0,0 +1,103 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + cc = "" + cxx = "" +} + +assert(cc != "", "cc build argument wasn't provided.") +assert(cxx != "", "cxx build argument wasn't provided.") + +toolchain("gcc") { + tool("cc") { + depfile = "{{output}}.d" + command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CC {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CXX {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("alink") { + rspfile = "{{output}}.rsp" + command = "rm -f {{output}} && ar rcs {{output}} @$rspfile" + description = "AR {{target_output_name}}{{output_extension}}" + rspfile_content = "{{inputs}}" + outputs = [ + "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", + ] + default_output_extension = ".a" + + output_prefix = "lib" + } + + tool("solink") { + soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". + rspfile = soname + ".rsp" + + command = + "$cxx -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile" + rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}" + + description = "SOLINK $soname" + + # Use this for {{output_extension}} expansions unless a target manually + # overrides it (in which case {{output_extension}} will be what the target + # specifies). + default_output_extension = ".so" + + outputs = [ + soname, + ] + link_output = soname + depend_output = soname + + output_prefix = "lib" + } + + tool("link") { + outfile = "{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + command = "$cxx {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}}" + description = "LINK $outfile" + rspfile_content = "{{inputs}}" + outputs = [ + outfile, + ] + } + + tool("stamp") { + command = "touch {{output}}" + description = "STAMP {{output}}" + } + + tool("copy") { + command = "cp -af {{source}} {{output}}" + description = "COPY {{source}} {{output}}" + } +} diff --git a/src/connectivity/bt_others/vendor_lib/mt66xx/build/BUILD.gn b/src/connectivity/bt_others/vendor_lib/mt66xx/build/BUILD.gn new file mode 100755 index 000000000..f859c4f70 --- /dev/null +++ b/src/connectivity/bt_others/vendor_lib/mt66xx/build/BUILD.gn @@ -0,0 +1,130 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + mtk_include_path = "" + bluedroid_hci_include_path = "" + + libhw_include_path = "" + + nvram_include_path = "" + cutils_include_path = "" + sysprop_include_path = "" + external_include_for_vendor_path = "" + + chip_flag = "" + bdaddr_flag = "" + c4a_flag = "" + nvram_flag = "" + + cutils_link = "" + file_op_link = "" + nvram_custom_link = "" + nvram_link = "" + bt_sys_log_flag = "" + bt_tmp_path = "" + bt_misc_path = "" + bt_etc_path = "" + rpc_dbg_flag = "" + merge_interface = "" +} + +assert(mtk_include_path != "", "mtk_include_path build argument wasn't provided.") +assert(bluedroid_hci_include_path != "", "bluedroid_hci_include_path build argument wasn't provided.") + +assert(nvram_include_path != "", "nvram_include_path build argument wasn't provided.") +assert(cutils_include_path != "", "cutils_include_path build argument wasn't provided.") +assert(sysprop_include_path != "", "sysprop_include_path build argument wasn't provided.") +assert(external_include_for_vendor_path != "", "external_include_for_vendor_path build argument wasn't provided.") + +assert(chip_flag != "", "chip_flag build argument wasn't provided.") + +assert(bt_tmp_path != "", "bt_tmp_path build argument wasn't provided.") +assert(bt_misc_path != "", "bt_misc_path build argument wasn't provided.") +assert(bt_etc_path != "", "bt_etc_path build argument wasn't provided.") + +config("default_include_dirs") { + include_dirs = [ + mtk_include_path, + bluedroid_hci_include_path, + libhw_include_path, + nvram_include_path, + cutils_include_path, + sysprop_include_path, + external_include_for_vendor_path, + ] +} + +config("linux") { + # TODO(keybuk): AndroidConfig.h or equivalent + + cflags = [ + "-Wall", + #"-Werror", + "-g", + "-O0", + "-fpic", + "-fdata-sections", + "-ffunction-sections", + "-fvisibility=hidden", + "-DHAS_MDROID_BUILDCFG", + "-DMTK_BLUEDROID_PATCH", + chip_flag, + bdaddr_flag, + c4a_flag, + nvram_flag, + bt_sys_log_flag, + rpc_dbg_flag, + merge_interface, + ] + + cflags_c = [ "-std=c99" ] + + cflags_cc = [ +#TODO(jpawlowski): we should use same c++ version as Android, which is c++11, +# but we use some c++14 features. Uncomment when this get fixed in code.: + "-std=c++1y", + "-fno-exceptions", + ] + + defines = [ + "_FORTIFY_SOURCE=2", + "_GNU_SOURCE", + "HAS_NO_BDROID_BUILDCFG", + "LOG_NDEBUG=1", + "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", + "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE", + + # This is a macro to that can be used by source code to detect if the + # current build is done by GN or via Android.mk. This is a temporary + # workaround until we can remove all Android-specific dependencies. + "OS_GENERIC", + "MTK_COMBO_SUPPORT", + "HAVE_SYS_UIO_H", + + "BT_TMP_PATH=\"$bt_tmp_path/\"", + "BT_MISC_PATH=\"$bt_misc_path/\"", + "BT_ETC_PATH=\"$bt_etc_path/\"", + ] +} + +config("pic") { + cflags = [ "-fPIC" ] +} + +config("gc") { + ldflags = [ "-Wl,--gc-sections" ] +} diff --git a/src/connectivity/bt_others/vendor_lib/mt66xx/build/config/BUILDCONFIG.gn b/src/connectivity/bt_others/vendor_lib/mt66xx/build/config/BUILDCONFIG.gn new file mode 100755 index 000000000..419d62fad --- /dev/null +++ b/src/connectivity/bt_others/vendor_lib/mt66xx/build/config/BUILDCONFIG.gn @@ -0,0 +1,49 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +set_default_toolchain("//build/toolchain/gcc") + +set_defaults("executable") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("shared_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("source_set") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("static_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} diff --git a/src/connectivity/bt_others/vendor_lib/mt66xx/build/toolchain/gcc/BUILD.gn b/src/connectivity/bt_others/vendor_lib/mt66xx/build/toolchain/gcc/BUILD.gn new file mode 100755 index 000000000..fabcaa827 --- /dev/null +++ b/src/connectivity/bt_others/vendor_lib/mt66xx/build/toolchain/gcc/BUILD.gn @@ -0,0 +1,105 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + external_libs_for_vendor_path = "" + cc = "" + cxx = "" +} + +assert(external_libs_for_vendor_path != "", "zlib_path build argument wasn't provided.") +assert(cc != "", "cc build argument wasn't provided.") +assert(cxx != "", "cxx build argument wasn't provided.") + +toolchain("gcc") { + tool("cc") { + depfile = "{{output}}.d" + command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CC {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CXX {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("alink") { + rspfile = "{{output}}.rsp" + command = "rm -f {{output}} && ar rcs {{output}} @$rspfile" + description = "AR {{target_output_name}}{{output_extension}}" + rspfile_content = "{{inputs}}" + outputs = [ + "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", + ] + default_output_extension = ".a" + + output_prefix = "lib" + } + + tool("solink") { + soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". + rspfile = soname + ".rsp" + + command = + "$cxx -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile" + rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive $external_libs_for_vendor_path {{libs}}" + + description = "SOLINK $soname" + + # Use this for {{output_extension}} expansions unless a target manually + # overrides it (in which case {{output_extension}} will be what the target + # specifies). + default_output_extension = ".so" + + outputs = [ + soname, + ] + link_output = soname + depend_output = soname + + output_prefix = "lib" + } + + tool("link") { + outfile = "{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + command = "$cxx {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group $external_libs_for_vendor_path {{libs}}" + description = "LINK $outfile" + rspfile_content = "{{inputs}}" + outputs = [ + outfile, + ] + } + + tool("stamp") { + command = "touch {{output}}" + description = "STAMP {{output}}" + } + + tool("copy") { + command = "cp -af {{source}} {{output}}" + description = "COPY {{source}} {{output}}" + } +} diff --git a/src/connectivity/bt_stack/bluedroid_turnkey/build/BUILD.gn b/src/connectivity/bt_stack/bluedroid_turnkey/build/BUILD.gn new file mode 100755 index 000000000..c161c5439 --- /dev/null +++ b/src/connectivity/bt_stack/bluedroid_turnkey/build/BUILD.gn @@ -0,0 +1,117 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + libhw_include_path = "" + core_include_path = "" + audio_include_path = "" + zlib_include_path = "" + conf_path = "" + cache_path = "" + + bt_tmp_path = "" + bt_misc_path = "" + bt_etc_path = "" + bt_sys_log_flag = "" + bt_performance_analysis_flag = "" + rpc_dbg_flag = "" + enable_aac = "" + aac_include_path = "" + aac_link = "" +} + +assert(libhw_include_path != "", "libhw_include_path build argument wasn't provided.") +assert(core_include_path != "", "core_include_path build argument wasn't provided.") +assert(audio_include_path != "", "audio_include_path build argument wasn't provided.") +assert(zlib_include_path != "", "zlib_include_path build argument wasn't provided.") +assert(conf_path != "", "conf_path build argument wasn't provided.") +assert(cache_path != "", "cache_path build argument wasn't provided.") + +assert(bt_tmp_path != "", "bt_tmp_path build argument wasn't provided.") +assert(bt_misc_path != "", "bt_misc_path build argument wasn't provided.") +assert(bt_etc_path != "", "bt_etc_path build argument wasn't provided.") + +config("default_include_dirs") { + include_dirs = [ + libhw_include_path, + core_include_path, + audio_include_path, + zlib_include_path, + "//mediatek/include", + "//hci/include", + aac_include_path, + ] +} + +config("linux") { + # TODO(keybuk): AndroidConfig.h or equivalent + + cflags = [ + "-Wall", + #"-Werror", + "-g", + "-rdynamic", + "-funwind-tables", + "-Os", + "-fpic", + "-fdata-sections", + "-ffunction-sections", + "-fvisibility=hidden", + "-DMTK_BLUEDROID_PATCH", + bt_sys_log_flag, + bt_performance_analysis_flag, + rpc_dbg_flag, + enable_aac, + ] + + cflags_c = [ "-std=c99" ] + + cflags_cc = [ +#TODO(jpawlowski): we should use same c++ version as Android, which is c++11, +# but we use some c++14 features. Uncomment when this get fixed in code.: + "-std=c++1y", + "-fno-exceptions", + ] + + defines = [ + "_FORTIFY_SOURCE=2", + "_GNU_SOURCE", + "HAS_NO_BDROID_BUILDCFG", + "LOG_NDEBUG=1", + "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", + "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE", + + # This is a macro to that can be used by source code to detect if the + # current build is done by GN or via Android.mk. This is a temporary + # workaround until we can remove all Android-specific dependencies. + "OS_GENERIC", + "MTK_LINUX", + "BT_CONF_PATH=\"$conf_path/\"", + "BT_CACHE_PATH=\"$cache_path/\"", + + "BT_TMP_PATH=\"$bt_tmp_path/\"", + "BT_MISC_PATH=\"$bt_misc_path/\"", + "BT_ETC_PATH=\"$bt_etc_path/\"", + ] +} + +config("pic") { + cflags = [ "-fPIC" ] +} + +config("gc") { + ldflags = [ "-Wl,--gc-sections" ] +} diff --git a/src/connectivity/bt_stack/bluedroid_turnkey/build/config/BUILDCONFIG.gn b/src/connectivity/bt_stack/bluedroid_turnkey/build/config/BUILDCONFIG.gn new file mode 100755 index 000000000..419d62fad --- /dev/null +++ b/src/connectivity/bt_stack/bluedroid_turnkey/build/config/BUILDCONFIG.gn @@ -0,0 +1,49 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +set_default_toolchain("//build/toolchain/gcc") + +set_defaults("executable") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("shared_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("source_set") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} + +set_defaults("static_library") { + configs = [ + "//build:linux", + "//build:gc", + "//build:default_include_dirs", + ] +} diff --git a/src/connectivity/bt_stack/bluedroid_turnkey/build/toolchain/gcc/BUILD.gn b/src/connectivity/bt_stack/bluedroid_turnkey/build/toolchain/gcc/BUILD.gn new file mode 100755 index 000000000..6e994e164 --- /dev/null +++ b/src/connectivity/bt_stack/bluedroid_turnkey/build/toolchain/gcc/BUILD.gn @@ -0,0 +1,105 @@ +# +# Copyright (C) 2015 Google, Inc. +# +# 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. +# + +declare_args() { + zlib_path = "" + cc = "" + cxx = "" +} + +assert(zlib_path != "", "zlib_path build argument wasn't provided.") +assert(cc != "", "cc build argument wasn't provided.") +assert(cxx != "", "cxx build argument wasn't provided.") + +toolchain("gcc") { + tool("cc") { + depfile = "{{output}}.d" + command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CC {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CXX {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + + tool("alink") { + rspfile = "{{output}}.rsp" + command = "rm -f {{output}} && ar rcs {{output}} @$rspfile" + description = "AR {{target_output_name}}{{output_extension}}" + rspfile_content = "{{inputs}}" + outputs = [ + "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", + ] + default_output_extension = ".a" + + output_prefix = "lib" + } + + tool("solink") { + soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". + rspfile = soname + ".rsp" + + command = + "$cxx -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile" + rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive $zlib_path {{libs}}" + + description = "SOLINK $soname" + + # Use this for {{output_extension}} expansions unless a target manually + # overrides it (in which case {{output_extension}} will be what the target + # specifies). + default_output_extension = ".so" + + outputs = [ + soname, + ] + link_output = soname + depend_output = soname + + output_prefix = "lib" + } + + tool("link") { + outfile = "{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + command = "$cxx {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}}" + description = "LINK $outfile" + rspfile_content = "{{inputs}}" + outputs = [ + outfile, + ] + } + + tool("stamp") { + command = "touch {{output}}" + description = "STAMP {{output}}" + } + + tool("copy") { + command = "cp -af {{source}} {{output}}" + description = "COPY {{source}} {{output}}" + } +}