From b1cae5175e63c441a630c0b916186eedbf8cf508 Mon Sep 17 00:00:00 2001 From: Haibo Huang Date: Fri, 29 Mar 2019 17:51:16 -0700 Subject: Add Android.bp for iperf3 Bug: http://b/123261826 Test: build Change-Id: Iccc3cd1f1475e33956d92a497d9c4306d53c3983 --- .gitignore | 2 - Android.bp | 30 +++++++++++++ androidconfigure | 38 +++++++++++++++++ src/iperf_config.h | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/version.h | 27 ++++++++++++ 5 files changed, 217 insertions(+), 2 deletions(-) create mode 100644 Android.bp create mode 100755 androidconfigure create mode 100644 src/iperf_config.h create mode 100644 src/version.h diff --git a/.gitignore b/.gitignore index 424b143..5d34faa 100644 --- a/.gitignore +++ b/.gitignore @@ -16,8 +16,6 @@ docs/_static src/.deps src/.libs src/Makefile -src/iperf_config.h -src/version.h src/stamp-h1 src/iperf3 src/iperf3_profile diff --git a/Android.bp b/Android.bp new file mode 100644 index 0000000..46d7cc2 --- /dev/null +++ b/Android.bp @@ -0,0 +1,30 @@ +// Copyright (C) 2019 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +cc_binary { + name: "iperf", + srcs: [ + "src/*.c", + ], + exclude_srcs: [ + "src/t_*.c", + ], + cflags: [ + "-Wno-unused-parameter", + "-Wno-unused-variable", + // https://github.com/esnet/iperf/pull/855 + "-Wno-format", + "-Wno-constant-conversion", + ], +} diff --git a/androidconfigure b/androidconfigure new file mode 100755 index 0000000..3220acd --- /dev/null +++ b/androidconfigure @@ -0,0 +1,38 @@ +#!/bin/bash + +set -e +set -x + +if [ ! -d "$NDK" ]; then + echo 'Please set $NDK to the path to NDK' + exit 1 +fi + +cd $(dirname "$0") + +function RunConfigure() { + HOST=$1 + TARGET=$2 + ARCH=$3 + + TOOLCHAIN=${NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/ + + export AR=${TOOLCHAIN}${HOST}-ar + export AS=${TOOLCHAIN}${TARGET}-clang + export CC=${TOOLCHAIN}${TARGET}-clang + export CXX=${TOOLCHAIN}${TARGET}-clang++ + export LD=${TOOLCHAIN}${HOST}-ld + export STRIP=${TOOLCHAIN}${HOST}-strip + + # Tell configure what flags Android requires. + export CFLAGS="-fPIE -fPIC" + export LDFLAGS="-pie" + + ./configure --host=${HOST} +} + +# All arches generates the same iperf_config.h (for now). +RunConfigure "aarch64-linux-android" "aarch64-linux-android28" "arm64" +# RunConfigure "arm-linux-androideabi" "armv7a-linux-androideabi28" "arm" +# RunConfigure "i686-linux-android" "i686-linux-android28" "x86" +# RunConfigure "x86_64-linux-android" "x86_64-linux-android28" "x86-64" diff --git a/src/iperf_config.h b/src/iperf_config.h new file mode 100644 index 0000000..c3e54d0 --- /dev/null +++ b/src/iperf_config.h @@ -0,0 +1,122 @@ +/* src/iperf_config.h. Generated from iperf_config.h.in by configure. */ +/* src/iperf_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the `clock_gettime' function. */ +#define HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the `cpuset_setaffinity' function. */ +/* #undef HAVE_CPUSET_SETAFFINITY */ + +/* Have CPU affinity support. */ +#define HAVE_CPU_AFFINITY 1 + +/* Define to 1 if you have the `daemon' function. */ +#define HAVE_DAEMON 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ENDIAN_H 1 + +/* Have IPv6 flowlabel support. */ +#define HAVE_FLOWLABEL 1 + +/* Define to 1 if you have the `getline' function. */ +#define HAVE_GETLINE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETINET_SCTP_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_POLL_H 1 + +/* Define to 1 if you have the `sched_setaffinity' function. */ +#define HAVE_SCHED_SETAFFINITY 1 + +/* Have SCTP support. */ +/* #undef HAVE_SCTP */ + +/* Define to 1 if you have the `sendfile' function. */ +#define HAVE_SENDFILE 1 + +/* Define to 1 if you have the `SetProcessAffinityMask' function. */ +/* #undef HAVE_SETPROCESSAFFINITYMASK */ + +/* Have SO_MAX_PACING_RATE sockopt. */ +#define HAVE_SO_MAX_PACING_RATE 1 + +/* OpenSSL Is Available */ +/* #undef HAVE_SSL */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if the system has the type `struct sctp_assoc_value'. */ +/* #undef HAVE_STRUCT_SCTP_ASSOC_VALUE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_ENDIAN_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Have TCP_CONGESTION sockopt. */ +#define HAVE_TCP_CONGESTION 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "iperf" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "https://github.com/esnet/iperf" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "iperf" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "iperf 3.6+" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "iperf" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "https://software.es.net/iperf/" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "3.6+" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "3.6+" + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ diff --git a/src/version.h b/src/version.h new file mode 100644 index 0000000..275a9eb --- /dev/null +++ b/src/version.h @@ -0,0 +1,27 @@ +/* + * iperf, Copyright (c) 2014, The Regents of the University of + * California, through Lawrence Berkeley National Laboratory (subject + * to receipt of any required approvals from the U.S. Dept. of + * Energy). All rights reserved. + * + * If you have questions about your rights to use or distribute this + * software, please contact Berkeley Lab's Technology Transfer + * Department at TTD@lbl.gov. + * + * NOTICE. This software is owned by the U.S. Department of Energy. + * As such, the U.S. Government has been granted for itself and others + * acting on its behalf a paid-up, nonexclusive, irrevocable, + * worldwide license in the Software to reproduce, prepare derivative + * works, and perform publicly and display publicly. Beginning five + * (5) years after the date permission to assert copyright is obtained + * from the U.S. Department of Energy, and subject to any subsequent + * five (5) year renewals, the U.S. Government is granted for itself + * and others acting on its behalf a paid-up, nonexclusive, + * irrevocable, worldwide license in the Software to reproduce, + * prepare derivative works, distribute copies to the public, perform + * publicly and display publicly, and to permit others to do so. + * + * This code is distributed under a BSD style license, see the LICENSE + * file for complete information. + */ +#define IPERF_VERSION "3.6+" -- cgit v1.2.3