зеркало из https://github.com/microsoft/vcpkg.git
[vcpkg] initial openbsd (community) support (#14549)
* initial openbsd support in vcpkg * after clang-format * hardcoded in the preferred compiler for openbsd in bootstrap scipt (thanks @tormfinn) * Fetch a patched pkg-config because openbsd pkg-config lacks {fcfiledir} * fixes from review feedback * corrected hash for pkg-config.openbsd * re-added missing endif() * regenerate docs * Update scripts/cmake/vcpkg_configure_meson.cmake Co-authored-by: Nicole Mazzuca <mazzucan@outlook.com>
This commit is contained in:
Родитель
42456b785a
Коммит
d9633d939c
|
@ -4,8 +4,8 @@ File contains helpful variabls for portfiles which are commonly needed or used.
|
|||
|
||||
## The following variables are available:
|
||||
```cmake
|
||||
VCPKG_TARGET_IS_<target> with <target> being one of the following: WINDOWS, UWP, LINUX, OSX, ANDROID, FREEBSD. only defined if <target>
|
||||
VCPKG_HOST_IS_<target> with <host> being one of the following: WINDOWS, LINUX, OSX, FREEBSD. only defined if <host>
|
||||
VCPKG_TARGET_IS_<target> with <target> being one of the following: WINDOWS, UWP, LINUX, OSX, ANDROID, FREEBSD, OPENBSD. only defined if <target>
|
||||
VCPKG_HOST_IS_<target> with <host> being one of the following: WINDOWS, LINUX, OSX, FREEBSD, OPENBSD. only defined if <host>
|
||||
VCPKG_HOST_PATH_SEPARATOR Host specific path separator (USAGE: "<something>${VCPKG_HOST_PATH_SEPARATOR}<something>"; only use and pass variables with VCPKG_HOST_PATH_SEPARATOR within "")
|
||||
VCPKG_HOST_EXECUTABLE_SUFFIX executable suffix of the host
|
||||
VCPKG_TARGET_EXECUTABLE_SUFFIX executable suffix of the target
|
||||
|
|
|
@ -28,6 +28,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|||
set(PLATFORM darwin64-x86_64-cc)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
set(PLATFORM BSD-generic64)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||
set(PLATFORM BSD-generic64)
|
||||
elseif(MINGW)
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
set(PLATFORM mingw64)
|
||||
|
|
|
@ -245,6 +245,17 @@ if [ "$ARCH" = "armv7l" -o "$ARCH" = "aarch64" -o "$ARCH" = "s390x" ]; then
|
|||
vcpkgUseSystem=true
|
||||
fi
|
||||
|
||||
if [ "$UNAME" = "OpenBSD" ]; then
|
||||
vcpkgUseSystem=true
|
||||
|
||||
if [ -z "$CXX" ]; then
|
||||
CXX=/usr/bin/clang++
|
||||
fi
|
||||
if [ -z "$CC" ]; then
|
||||
CC=/usr/bin/clang
|
||||
fi
|
||||
fi
|
||||
|
||||
if $vcpkgUseSystem; then
|
||||
cmakeExe="cmake"
|
||||
ninjaExe="ninja"
|
||||
|
|
|
@ -94,7 +94,11 @@ function(vcpkg_build_make)
|
|||
#TODO: optimize for install-data (release) and install-exec (release/debug)
|
||||
else()
|
||||
# Compiler requriements
|
||||
find_program(MAKE make REQUIRED)
|
||||
if(VCPKG_HOST_IS_OPENBSD)
|
||||
find_program(MAKE gmake REQUIRED)
|
||||
else()
|
||||
find_program(MAKE make REQUIRED)
|
||||
endif()
|
||||
set(MAKE_COMMAND "${MAKE}")
|
||||
# Set make command and install command
|
||||
set(MAKE_OPTS ${_bc_MAKE_OPTIONS} V=1 -j ${VCPKG_CONCURRENCY} -f ${_bc_MAKEFILE} ${_bc_BUILD_TARGET})
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
##
|
||||
## ## The following variables are available:
|
||||
## ```cmake
|
||||
## VCPKG_TARGET_IS_<target> with <target> being one of the following: WINDOWS, UWP, LINUX, OSX, ANDROID, FREEBSD. only defined if <target>
|
||||
## VCPKG_HOST_IS_<target> with <host> being one of the following: WINDOWS, LINUX, OSX, FREEBSD. only defined if <host>
|
||||
## VCPKG_TARGET_IS_<target> with <target> being one of the following: WINDOWS, UWP, LINUX, OSX, ANDROID, FREEBSD, OPENBSD. only defined if <target>
|
||||
## VCPKG_HOST_IS_<target> with <host> being one of the following: WINDOWS, LINUX, OSX, FREEBSD, OPENBSD. only defined if <host>
|
||||
## VCPKG_HOST_PATH_SEPARATOR Host specific path separator (USAGE: "<something>${VCPKG_HOST_PATH_SEPARATOR}<something>"; only use and pass variables with VCPKG_HOST_PATH_SEPARATOR within "")
|
||||
## VCPKG_HOST_EXECUTABLE_SUFFIX executable suffix of the host
|
||||
## VCPKG_TARGET_EXECUTABLE_SUFFIX executable suffix of the target
|
||||
|
@ -41,6 +41,8 @@ elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android")
|
|||
set(VCPKG_TARGET_IS_ANDROID 1)
|
||||
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
set(VCPKG_TARGET_IS_FREEBSD 1)
|
||||
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||
set(VCPKG_TARGET_IS_OPENBSD 1)
|
||||
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "MinGW")
|
||||
set(VCPKG_TARGET_IS_WINDOWS 1)
|
||||
set(VCPKG_TARGET_IS_MINGW 1)
|
||||
|
@ -55,6 +57,8 @@ elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
|
|||
set(VCPKG_HOST_IS_LINUX 1)
|
||||
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
set(VCPKG_HOST_IS_FREEBSD 1)
|
||||
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||
set(VCPKG_HOST_IS_OPENBSD 1)
|
||||
endif()
|
||||
|
||||
#Helper variable to identify the host path separator.
|
||||
|
@ -136,17 +140,17 @@ if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX)
|
|||
endif()
|
||||
|
||||
# Platforms with libm
|
||||
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_MINGW)
|
||||
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_MINGW)
|
||||
list(APPEND VCPKG_SYSTEM_LIBRARIES m)
|
||||
endif()
|
||||
|
||||
# Platforms with pthread
|
||||
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_MINGW)
|
||||
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD OR VCPKG_TARGET_IS_MINGW)
|
||||
list(APPEND VCPKG_SYSTEM_LIBRARIES pthread)
|
||||
endif()
|
||||
|
||||
# Platforms with libstdc++
|
||||
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_MINGW)
|
||||
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD OR VCPKG_TARGET_IS_MINGW)
|
||||
list(APPEND VCPKG_SYSTEM_LIBRARIES [=[stdc\+\+]=])
|
||||
endif()
|
||||
|
||||
|
@ -161,7 +165,7 @@ if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX OR VC
|
|||
endif()
|
||||
|
||||
# Platforms with GCC libs
|
||||
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_MINGW)
|
||||
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD OR VCPKG_TARGET_IS_MINGW)
|
||||
list(APPEND VCPKG_SYSTEM_LIBRARIES gcc)
|
||||
list(APPEND VCPKG_SYSTEM_LIBRARIES gcc_s)
|
||||
endif()
|
||||
|
|
|
@ -217,6 +217,8 @@ function(vcpkg_configure_cmake)
|
|||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/ios.cmake")
|
||||
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/freebsd.cmake")
|
||||
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/openbsd.cmake")
|
||||
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "MinGW")
|
||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/mingw.cmake")
|
||||
endif()
|
||||
|
|
|
@ -663,7 +663,8 @@ function(vcpkg_configure_make)
|
|||
if (CMAKE_HOST_WIN32)
|
||||
set(command ${base_cmd} -c "${CONFIGURE_ENV} ./${RELATIVE_BUILD_PATH}/configure ${_csc_BUILD_TRIPLET} ${_csc_OPTIONS} ${_csc_OPTIONS_${_buildtype}}")
|
||||
else()
|
||||
set(command /bin/bash "./${RELATIVE_BUILD_PATH}/configure" ${_csc_BUILD_TRIPLET} ${_csc_OPTIONS} ${_csc_OPTIONS_${_buildtype}})
|
||||
find_program(BASH bash REQUIRED)
|
||||
set(command "${BASH}" "./${RELATIVE_BUILD_PATH}/configure" ${_csc_BUILD_TRIPLET} ${_csc_OPTIONS} ${_csc_OPTIONS_${_buildtype}})
|
||||
endif()
|
||||
if(_csc_ADD_BIN_TO_PATH)
|
||||
set(PATH_BACKUP $ENV{PATH})
|
||||
|
|
|
@ -143,6 +143,8 @@ function(vcpkg_internal_meson_generate_native_file_config _config) #https://meso
|
|||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/ios.cmake")
|
||||
elseif(VCPKG_TARGET_IS_FREEBSD)
|
||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/freebsd.cmake")
|
||||
elseif(VCPKG_TARGET_IS_OPENBSD)
|
||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/openbsd.cmake")
|
||||
elseif(VCPKG_TARGET_IS_MINGW)
|
||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/mingw.cmake")
|
||||
endif()
|
||||
|
|
|
@ -423,6 +423,17 @@ function(vcpkg_find_acquire_program VAR)
|
|||
debug_message(STATUS "PKG_CONFIG found in ENV! Using $ENV{PKG_CONFIG}")
|
||||
set(PKGCONFIG $ENV{PKG_CONFIG} PARENT_SCOPE)
|
||||
return()
|
||||
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||
# As of 6.8, the OpenBSD specific pkg-config doesn't support {pcfiledir}
|
||||
set(_vfa_SUPPORTED ON)
|
||||
set(_vfa_RENAME "pkg-config")
|
||||
set(PKGCONFIG_VERSION 0.29.2.1)
|
||||
set(NOEXTRACT ON)
|
||||
set(ARCHIVE "pkg-config.openbsd")
|
||||
set(SUBDIR "openbsd")
|
||||
set(URL "https://raw.githubusercontent.com/jgilje/pkg-config-openbsd/master/pkg-config")
|
||||
set(HASH b7ec9017b445e00ae1377e36e774cf3f5194ab262595840b449832707d11e443a102675f66d8b7e8b2e2f28cebd6e256835507b1e0c69644cc9febab8285080b)
|
||||
set(VERSION_CMD --version)
|
||||
elseif(CMAKE_HOST_WIN32)
|
||||
if(NOT EXISTS "${PKGCONFIG}")
|
||||
set(VERSION 0.29.2-1)
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
if(NOT _VCPKG_OPENBSD_TOOLCHAIN)
|
||||
set(_VCPKG_OPENBSD_TOOLCHAIN 1)
|
||||
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||
set(CMAKE_CROSSCOMPILING OFF CACHE BOOL "")
|
||||
endif()
|
||||
set(CMAKE_SYSTEM_NAME OpenBSD CACHE STRING "")
|
||||
|
||||
if(NOT DEFINED CMAKE_CXX_COMPILER)
|
||||
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_C_COMPILER)
|
||||
set(CMAKE_C_COMPILER "/usr/bin/clang")
|
||||
endif()
|
||||
|
||||
get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
|
||||
if(NOT _CMAKE_IN_TRY_COMPILE)
|
||||
string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ")
|
||||
string(APPEND CMAKE_CXX_FLAGS_INIT " -fPIC ${VCPKG_CXX_FLAGS} ")
|
||||
string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ")
|
||||
string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " ${VCPKG_CXX_FLAGS_DEBUG} ")
|
||||
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ${VCPKG_C_FLAGS_RELEASE} ")
|
||||
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ${VCPKG_CXX_FLAGS_RELEASE} ")
|
||||
|
||||
string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
|
||||
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
|
||||
string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT " ${VCPKG_LINKER_FLAGS_DEBUG} ")
|
||||
string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT " ${VCPKG_LINKER_FLAGS_DEBUG} ")
|
||||
string(APPEND CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT " ${VCPKG_LINKER_FLAGS_RELEASE} ")
|
||||
string(APPEND CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT " ${VCPKG_LINKER_FLAGS_RELEASE} ")
|
||||
endif(NOT _CMAKE_IN_TRY_COMPILE)
|
||||
endif(NOT _VCPKG_OPENBSD_TOOLCHAIN)
|
|
@ -137,6 +137,9 @@ int main() {}
|
|||
if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
|
||||
# AppleClang never requires (or allows) -lc++fs, even with libc++ version 8.0.0
|
||||
set(_VCPKG_CXXFS_LIBRARY OFF)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||
# As above, not required on this platform (tested at least on 6.8)
|
||||
set(_VCPKG_CXXFS_LIBRARY OFF)
|
||||
else()
|
||||
check_cxx_source_compiles([[
|
||||
#include <ciso646>
|
||||
|
|
|
@ -156,6 +156,12 @@ namespace vcpkg
|
|||
Checks::check_exit(VCPKG_LINE_INFO, rcode == 0, "Could not determine current executable path.");
|
||||
Checks::check_exit(VCPKG_LINE_INFO, len > 0, "Could not determine current executable path.");
|
||||
return fs::path(exePath, exePath + len - 1);
|
||||
#elif defined(__OpenBSD__)
|
||||
const char* progname = getprogname();
|
||||
char resolved_path[PATH_MAX];
|
||||
auto ret = realpath(progname, resolved_path);
|
||||
Checks::check_exit(VCPKG_LINE_INFO, ret != nullptr, "Could not determine current executable path.");
|
||||
return fs::u8path(resolved_path);
|
||||
#else /* LINUX */
|
||||
std::array<char, 1024 * 4> buf;
|
||||
auto written = readlink("/proc/self/exe", buf.data(), buf.size());
|
||||
|
|
|
@ -694,6 +694,10 @@ namespace vcpkg::Build
|
|||
{
|
||||
return m_paths.scripts / fs::u8path("toolchains/freebsd.cmake");
|
||||
}
|
||||
else if (cmake_system_name == "OpenBSD")
|
||||
{
|
||||
return m_paths.scripts / fs::u8path("toolchains/openbsd.cmake");
|
||||
}
|
||||
else if (cmake_system_name == "Android")
|
||||
{
|
||||
return m_paths.scripts / fs::u8path("toolchains/android.cmake");
|
||||
|
|
|
@ -53,11 +53,13 @@ namespace vcpkg
|
|||
static constexpr StringLiteral OS_STRING = "linux";
|
||||
#elif defined(__FreeBSD__)
|
||||
static constexpr StringLiteral OS_STRING = "freebsd";
|
||||
#elif defined(__OpenBSD__)
|
||||
static constexpr StringLiteral OS_STRING = "openbsd";
|
||||
#else
|
||||
return std::string("operating system is unknown");
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__)
|
||||
#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
static const std::string XML_VERSION = "2";
|
||||
static const fs::path XML_PATH = paths.scripts / "vcpkgTools.xml";
|
||||
static const std::regex XML_VERSION_REGEX{R"###(<tools[\s]+version="([^"]+)">)###"};
|
||||
|
|
|
@ -90,6 +90,8 @@ namespace vcpkg
|
|||
return Triplet::from_canonical_name("x64-osx");
|
||||
#elif defined(__FreeBSD__)
|
||||
return Triplet::from_canonical_name("x64-freebsd");
|
||||
#elif defined(__OpenBSD__)
|
||||
return Triplet::from_canonical_name("x64-openbsd");
|
||||
#elif defined(__GLIBC__)
|
||||
#if defined(__aarch64__)
|
||||
return Triplet::from_canonical_name("arm64-linux");
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
# Use with
|
||||
# VCPKG_FORCE_SYSTEM_BINARIES=1 ./vcpkg install brotli
|
||||
|
||||
set(VCPKG_TARGET_ARCHITECTURE x64)
|
||||
set(VCPKG_CRT_LINKAGE dynamic)
|
||||
set(VCPKG_LIBRARY_LINKAGE static)
|
||||
|
||||
set(VCPKG_CMAKE_SYSTEM_NAME OpenBSD)
|
Загрузка…
Ссылка в новой задаче