aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxyb <xyb@xyb.name>2020-09-05 10:45:48 -0700
committerGitHub <noreply@github.com>2020-09-05 10:45:48 -0700
commitfdac1fc5aa36e8edeb9f358f0fad041de2626215 (patch)
tree56cdf5ea8aa709b27b2ea8c989af3c0b3f000117
parentbd8af0789804dad0f76dced3f837845f086350c5 (diff)
downloadvcpkg-fdac1fc5aa36e8edeb9f358f0fad041de2626215.tar.gz
vcpkg-fdac1fc5aa36e8edeb9f358f0fad041de2626215.zip
Add community triple arm64-linux and arm-linux. (#11880)
Verify the following command on both 32 bits and 64 bits OS on Raspberry pi 3. ./bootstrap-vcpkg.sh ./vcpkg install boost
-rw-r--r--ports/boost-build/CONTROL2
-rw-r--r--ports/boost-build/portfile.cmake4
-rw-r--r--ports/boost-modular-build-helper/CMakeLists.txt2
-rw-r--r--ports/boost-modular-build-helper/CONTROL2
-rw-r--r--ports/boost-modular-build-helper/boost-modular-build.cmake20
-rw-r--r--ports/libffi/CMakeLists.txt18
-rw-r--r--ports/libffi/CONTROL2
-rw-r--r--scripts/bootstrap.sh18
-rw-r--r--scripts/buildsystems/vcpkg.cmake4
-rw-r--r--scripts/cmake/vcpkg_configure_cmake.cmake2
-rw-r--r--toolsrc/src/vcpkg.cpp8
-rw-r--r--toolsrc/src/vcpkg/triplet.cpp6
-rw-r--r--triplets/community/arm-linux.cmake9
-rw-r--r--triplets/community/arm64-linux.cmake9
14 files changed, 91 insertions, 15 deletions
diff --git a/ports/boost-build/CONTROL b/ports/boost-build/CONTROL
index 8b4c5e161..036631336 100644
--- a/ports/boost-build/CONTROL
+++ b/ports/boost-build/CONTROL
@@ -1,6 +1,6 @@
Source: boost-build
Version: 1.73.0
-Port-Version: 3
+Port-Version: 4
Homepage: https://github.com/boostorg/build
Description: Boost.Build
Build-Depends: boost-uninstall \ No newline at end of file
diff --git a/ports/boost-build/portfile.cmake b/ports/boost-build/portfile.cmake
index 9b06d0074..bad139ac2 100644
--- a/ports/boost-build/portfile.cmake
+++ b/ports/boost-build/portfile.cmake
@@ -2,9 +2,7 @@ include(vcpkg_common_functions)
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
-if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" AND NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" AND NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "s390x")
- return()
-elseif(CMAKE_HOST_WIN32 AND VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "MinGW")
+if(CMAKE_HOST_WIN32 AND VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "MinGW")
return()
endif()
diff --git a/ports/boost-modular-build-helper/CMakeLists.txt b/ports/boost-modular-build-helper/CMakeLists.txt
index 629e01f6d..852430dc9 100644
--- a/ports/boost-modular-build-helper/CMakeLists.txt
+++ b/ports/boost-modular-build-helper/CMakeLists.txt
@@ -37,6 +37,8 @@ endif()
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "s390x")
list(APPEND B2_OPTIONS architecture=s390x)
+elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
+ list(APPEND B2_OPTIONS architecture=arm)
else()
list(APPEND B2_OPTIONS architecture=x86)
endif()
diff --git a/ports/boost-modular-build-helper/CONTROL b/ports/boost-modular-build-helper/CONTROL
index 601b286e0..b39ec5f42 100644
--- a/ports/boost-modular-build-helper/CONTROL
+++ b/ports/boost-modular-build-helper/CONTROL
@@ -1,4 +1,4 @@
Source: boost-modular-build-helper
Version: 1.73.0
-Port-Version: 4
+Port-Version: 5
Build-Depends: boost-uninstall \ No newline at end of file
diff --git a/ports/boost-modular-build-helper/boost-modular-build.cmake b/ports/boost-modular-build-helper/boost-modular-build.cmake
index b0952e0ac..26784ed26 100644
--- a/ports/boost-modular-build-helper/boost-modular-build.cmake
+++ b/ports/boost-modular-build-helper/boost-modular-build.cmake
@@ -18,7 +18,13 @@ function(boost_modular_build)
# Todo: this serves too similar a purpose as vcpkg_find_acquire_program()
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
- set(BOOST_BUILD_PATH "${CURRENT_INSTALLED_DIR}/../x64-linux/tools/boost-build")
+ if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64")
+ set(BOOST_BUILD_PATH "${CURRENT_INSTALLED_DIR}/../arm64-linux/tools/boost-build")
+ else()
+ set(BOOST_BUILD_PATH "${CURRENT_INSTALLED_DIR}/../x64-linux/tools/boost-build")
+ endif()
+ elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "armv7l")
+ set(BOOST_BUILD_PATH "${CURRENT_INSTALLED_DIR}/../arm-linux/tools/boost-build")
elseif(CMAKE_HOST_WIN32 AND VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "MinGW")
get_filename_component(BOOST_BUILD_PATH "${CURRENT_INSTALLED_DIR}/../x86-windows/tools/boost-build" ABSOLUTE)
elseif(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" AND NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" AND NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "s390x")
@@ -29,9 +35,17 @@ function(boost_modular_build)
if(NOT EXISTS "${BOOST_BUILD_PATH}")
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
- message(FATAL_ERROR "The x64 boost-build tools must be installed to build arm64 for Linux. Please run `vcpkg install boost-build:x64-linux`.")
+ if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64")
+ message(FATAL_ERROR "The arm64 boost-build tools must be installed to build arm64 for Linux. Please run `vcpkg install boost-build:arm64-linux`.")
+ else()
+ message(FATAL_ERROR "The x64 boost-build tools must be installed to build arm64 for Linux. Please run `vcpkg install boost-build:x64-linux`.")
+ endif()
else()
- message(FATAL_ERROR "The x86 boost-build tools must be installed to build for non-x86/x64 platforms. Please run `vcpkg install boost-build:x86-windows`.")
+ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "armv7l")
+ message(FATAL_ERROR "The arm boost-build tools must be installed to build arm64 for Linux. Please run `vcpkg install boost-build:arm-linux`.")
+ else()
+ message(FATAL_ERROR "The x86 boost-build tools must be installed to build for non-x86/x64 platforms. Please run `vcpkg install boost-build:x86-windows`.")
+ endif()
endif()
endif()
diff --git a/ports/libffi/CMakeLists.txt b/ports/libffi/CMakeLists.txt
index d7c741859..693fcc935 100644
--- a/ports/libffi/CMakeLists.txt
+++ b/ports/libffi/CMakeLists.txt
@@ -11,7 +11,7 @@ endif()
# config variables for ffi.h.in
set(VERSION 3.3)
-set(KNOWN_PROCESSORS x86 x86_64 AMD64 ARM ARM64 i386)
+set(KNOWN_PROCESSORS x86 x86_64 AMD64 ARM ARM64 i386 armv7l aarch64)
if(NOT CMAKE_SYSTEM_PROCESSOR IN_LIST KNOWN_PROCESSORS)
message(FATAL_ERROR "Unknown processor: ${CMAKE_SYSTEM_PROCESSOR}")
@@ -19,6 +19,10 @@ endif()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ARM")
set(TARGET ARM)
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv7l")
+ set(TARGET ARM)
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
+ set(TARGET ARM64)
elseif(CMAKE_SYSTEM_NAME MATCHES "BSD" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
set(TARGET X86_FREEBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
@@ -50,9 +54,9 @@ set(FFI_EXEC_TRAMPOLINE_TABLE 0)
configure_file(include/ffi.h.in ${CMAKE_BINARY_DIR}/include/ffi.h)
file(COPY ${FFI_CONFIG_FILE} DESTINATION ${CMAKE_BINARY_DIR})
-if ("${TARGET}" STREQUAL "ARM_WIN64")
+if ("${TARGET}" STREQUAL "ARM_WIN64" OR "${TARGET}" STREQUAL "ARM64")
file(COPY src/aarch64/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include)
-elseif ("${TARGET}" STREQUAL "ARM_WIN32")
+elseif ("${TARGET}" STREQUAL "ARM_WIN32" OR "${TARGET}" STREQUAL "ARM")
file(COPY src/arm/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include)
else()
file(COPY src/x86/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include)
@@ -72,11 +76,11 @@ set(FFI_SOURCES
src/prep_cif.c
src/types.c)
-if ("${TARGET}" STREQUAL "ARM_WIN64")
+if ("${TARGET}" STREQUAL "ARM_WIN64" OR "${TARGET}" STREQUAL "ARM64")
set(FFI_SOURCES
${FFI_SOURCES}
src/aarch64/ffi.c)
-elseif("${TARGET}" STREQUAL "ARM_WIN32")
+elseif("${TARGET}" STREQUAL "ARM_WIN32" OR "${TARGET}" STREQUAL "ARM")
set(FFI_SOURCES
${FFI_SOURCES}
src/arm/ffi.c)
@@ -162,8 +166,12 @@ elseif("${TARGET}" STREQUAL "X86_WIN64")
add_assembly(src/x86/win64_intel.S)
elseif("${TARGET}" STREQUAL "ARM_WIN32")
add_assembly(src/arm/sysv_msvc_arm32.S)
+elseif("${TARGET}" STREQUAL "ARM")
+ add_assembly(src/arm/sysv.S)
elseif("${TARGET}" STREQUAL "ARM_WIN64")
add_assembly(src/aarch64/win64_armasm.S)
+elseif("${TARGET}" STREQUAL "ARM64")
+ add_assembly(src/aarch64/sysv.S)
else()
message(FATAL_ERROR "Target not implemented")
endif()
diff --git a/ports/libffi/CONTROL b/ports/libffi/CONTROL
index a5d4c2094..6f1154eda 100644
--- a/ports/libffi/CONTROL
+++ b/ports/libffi/CONTROL
@@ -1,5 +1,5 @@
Source: libffi
Version: 3.3
-Port-Version: 4
+Port-Version: 5
Homepage: https://github.com/libffi/libffi
Description: Portable, high level programming interface to various calling conventions
diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh
index 321a16e05..46f695864 100644
--- a/scripts/bootstrap.sh
+++ b/scripts/bootstrap.sh
@@ -79,6 +79,16 @@ vcpkgCheckRepoTool()
fi
}
+vcpkgCheckBuildTool()
+{
+ __tool=$1
+ if ! command -v "$__tool" >/dev/null 2>&1 ; then
+ echo "Could not find $__tool. Please install it (and other dependencies) with:"
+ echo "sudo apt-get install cmake ninja-build"
+ exit 1
+ fi
+}
+
vcpkgCheckEqualFileHash()
{
url=$1; filePath=$2; expectedHash=$3
@@ -226,10 +236,18 @@ selectCXX()
# Preparation
UNAME="$(uname)"
+ARCH="$(uname -m)"
+
+# Force using system utilities for building vcpkg if host arch is arm or arm64.
+if [ "$ARCH" = "armv7l" -o "$ARCH" = "aarch64" ]; then
+ vcpkgUseSystem=true
+fi
if $vcpkgUseSystem; then
cmakeExe="cmake"
ninjaExe="ninja"
+ vcpkgCheckBuildTool "$cmakeExe"
+ vcpkgCheckBuildTool "$ninjaExe"
else
fetchTool "cmake" "$UNAME" cmakeExe || exit 1
fetchTool "ninja" "$UNAME" ninjaExe || exit 1
diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake
index c1df616da..f2e89c5db 100644
--- a/scripts/buildsystems/vcpkg.cmake
+++ b/scripts/buildsystems/vcpkg.cmake
@@ -172,6 +172,10 @@ else()
set(_VCPKG_TARGET_TRIPLET_ARCH x64)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "s390x")
set(_VCPKG_TARGET_TRIPLET_ARCH s390x)
+ elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "armv7l")
+ set(_VCPKG_TARGET_TRIPLET_ARCH arm)
+ elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64")
+ set(_VCPKG_TARGET_TRIPLET_ARCH arm64)
else()
if( _CMAKE_IN_TRY_COMPILE )
message(STATUS "Unable to determine target architecture, continuing without vcpkg.")
diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake
index b443856f9..63d7f8786 100644
--- a/scripts/cmake/vcpkg_configure_cmake.cmake
+++ b/scripts/cmake/vcpkg_configure_cmake.cmake
@@ -150,7 +150,7 @@ function(vcpkg_configure_cmake)
endif()
# If we use Ninja, make sure it's on PATH
- if(GENERATOR STREQUAL "Ninja")
+ if(GENERATOR STREQUAL "Ninja" AND NOT DEFINED ENV{VCPKG_FORCE_SYSTEM_BINARIES})
vcpkg_find_acquire_program(NINJA)
get_filename_component(NINJA_PATH ${NINJA} DIRECTORY)
vcpkg_add_to_path("${NINJA_PATH}")
diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp
index d0df8749f..6c30f7ced 100644
--- a/toolsrc/src/vcpkg.cpp
+++ b/toolsrc/src/vcpkg.cpp
@@ -235,6 +235,14 @@ int main(const int argc, const char* const* const argv)
load_config(fs);
+#if (defined(__aarch64__) || defined(__arm__) || defined(_M_ARM) || defined(_M_ARM64)) && !defined(_WIN32)
+ if (!System::get_environment_variable("VCPKG_FORCE_SYSTEM_BINARIES").has_value())
+ {
+ Checks::exit_with_message(VCPKG_LINE_INFO,
+ "Environment variable VCPKG_FORCE_SYSTEM_BINARIES must be set on arm platform.");
+ }
+#endif
+
VcpkgCmdArguments args = VcpkgCmdArguments::create_from_command_line(fs, argc, argv);
args.imbue_from_environment();
args.check_feature_flag_consistency();
diff --git a/toolsrc/src/vcpkg/triplet.cpp b/toolsrc/src/vcpkg/triplet.cpp
index c9ae74970..1d325fb65 100644
--- a/toolsrc/src/vcpkg/triplet.cpp
+++ b/toolsrc/src/vcpkg/triplet.cpp
@@ -87,7 +87,13 @@ namespace vcpkg
#elif defined(__FreeBSD__)
return Triplet::from_canonical_name("x64-freebsd");
#elif defined(__GLIBC__)
+#if defined(__aarch64__)
+ return Triplet::from_canonical_name("arm64-linux");
+#elif defined(__arm__)
+ return Triplet::from_canonical_name("arm-linux");
+#else
return Triplet::from_canonical_name("x64-linux");
+#endif
#else
return Triplet::from_canonical_name("x64-linux-musl");
#endif
diff --git a/triplets/community/arm-linux.cmake b/triplets/community/arm-linux.cmake
new file mode 100644
index 000000000..6f69da83b
--- /dev/null
+++ b/triplets/community/arm-linux.cmake
@@ -0,0 +1,9 @@
+set(VCPKG_TARGET_ARCHITECTURE arm)
+set(VCPKG_CRT_LINKAGE dynamic)
+set(VCPKG_LIBRARY_LINKAGE static)
+
+set(VCPKG_CMAKE_SYSTEM_NAME Linux)
+
+if(NOT CMAKE_HOST_SYSTEM_PROCESSOR)
+ execute_process(COMMAND "uname" "-m" OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
diff --git a/triplets/community/arm64-linux.cmake b/triplets/community/arm64-linux.cmake
new file mode 100644
index 000000000..5faf2f0a0
--- /dev/null
+++ b/triplets/community/arm64-linux.cmake
@@ -0,0 +1,9 @@
+set(VCPKG_TARGET_ARCHITECTURE arm64)
+set(VCPKG_CRT_LINKAGE dynamic)
+set(VCPKG_LIBRARY_LINKAGE static)
+
+set(VCPKG_CMAKE_SYSTEM_NAME Linux)
+
+if(NOT CMAKE_HOST_SYSTEM_PROCESSOR)
+ execute_process(COMMAND "uname" "-m" OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()