Skip to content

Commit

Permalink
[libffi] Update to v3.3 release (#6119)
Browse files Browse the repository at this point in the history
* libffi 3.3-rc0 custom port, with arm/arm64 windows support

* fix linux build

* enable EFI64 in linux x64, should fix build errors in some cases

* libffi: move to the arm64 support pr branch

* libffi: move to latest upstream master

* libffi: update to upstream master

* libffi: update to v3.3-rc2

* libffi: update to v3.3 release

* libffi: update version in fficonfig.h

* libffi: Remove CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS

* [libffi] update portfile.cmake

* [libnice] fix Windows ARM64 build

* CI: set atk:arm64-windows to fail
atk compilation requires running glib(arm64) tools, which is not possible on a x86 system.

* CI: libffi:arm64-windows passing

* [gdk-pixbuf] fix Windows ARM64 build

* [pangomm] show unsupported architecture error on ARM

* [pangomm] update portfile.cmake

* [libffi] Avoid depending on VCPKG_TARGET_TRIPLET; use native cmake variables instead. Avoid double expansion inside if().

* [libffi] TARGET is a keyword for if() -- use quoted expansion instead.

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
  • Loading branch information
driver1998 and ras0219-msft committed Feb 7, 2020
1 parent 8eaa597 commit 7d4227f
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 106 deletions.
2 changes: 1 addition & 1 deletion ports/gdk-pixbuf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ set(LIBS
${PNG_LIBRARIES}
)
if(WIN32)
list(APPEND LIBS Gdiplus unofficial::gettext::libintl)
list(APPEND LIBS Gdiplus ole32 unofficial::gettext::libintl)
else()
list(APPEND LIBS m)
endif()
Expand Down
2 changes: 1 addition & 1 deletion ports/gdk-pixbuf/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: gdk-pixbuf
Version: 2.36.9-3
Version: 2.36.9-4
Homepage: https://developer.gnome.org/gdk-pixbuf/
Description: Image loading library.
Build-Depends: gettext, zlib, libpng, glib
98 changes: 71 additions & 27 deletions ports/libffi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if(NOT CMAKE_SYSTEM_PROCESSOR)
endif()

# config variables for ffi.h.in
set(VERSION 3.1)
set(VERSION 3.3)

set(KNOWN_PROCESSORS x86 x86_64 AMD64 ARM ARM64 i386)

Expand All @@ -21,11 +21,15 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "ARM")
set(TARGET ARM)
elseif(CMAKE_SYSTEM_NAME MATCHES "BSD" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
set(TARGET X86_FREEBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM")
set(TARGET ARM_WIN32)
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TARGET ARM_WIN64)
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
set(TARGET X86_WIN32)
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set(TARGET X86_WIN64)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
set(TARGET X86_DARWIN)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(TARGET X86_64)
Expand All @@ -35,43 +39,85 @@ else()
message(FATAL_ERROR "Cannot determine target. Please consult ${CMAKE_CURRENT_SOURCE_DIR}/configure.ac and add your platform to this CMake file.")
endif()

set(HAVE_LONG_DOUBLE 0)
set(HAVE_LONG_DOUBLE_VARIANT 0)
if("${TARGET}" STREQUAL "X86_64")
set(HAVE_LONG_DOUBLE 1)
else()
set(HAVE_LONG_DOUBLE 0)
endif()
set(FFI_EXEC_TRAMPOLINE_TABLE 0)

# mimic layout of original buildsystem
configure_file(include/ffi.h.in ${CMAKE_BINARY_DIR}/include/ffi.h)
file(COPY ${FFI_CONFIG_FILE} DESTINATION ${CMAKE_BINARY_DIR})
file(COPY src/x86/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include)

if ("${TARGET}" STREQUAL "ARM_WIN64")
file(COPY src/aarch64/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include)
elseif ("${TARGET}" STREQUAL "ARM_WIN32")
file(COPY src/arm/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include)
else()
file(COPY src/x86/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include)
endif()

include_directories(${CMAKE_BINARY_DIR}/include)
include_directories(${CMAKE_BINARY_DIR})
include_directories(include)

add_definitions(-DHAVE_CONFIG_H)
add_definitions(-DFFI_BUILDING)
if(BUILD_SHARED_LIBS AND WIN32)
add_definitions(-DFFI_BUILDING_DLL)
endif()

set(FFI_SOURCES
src/x86/ffi.c
src/closures.c
src/java_raw_api.c
src/prep_cif.c
src/raw_api.c
src/types.c)

if ("${TARGET}" STREQUAL "ARM_WIN64")
set(FFI_SOURCES
${FFI_SOURCES}
src/aarch64/ffi.c)
elseif("${TARGET}" STREQUAL "ARM_WIN32")
set(FFI_SOURCES
${FFI_SOURCES}
src/arm/ffi.c)
else()
set(FFI_SOURCES
${FFI_SOURCES}
src/java_raw_api.c
src/raw_api.c)
if("${TARGET}" STREQUAL "X86_WIN32" OR "${TARGET}" STREQUAL "X86_DARWIN" OR "${TARGET}" STREQUAL "X86")
set(FFI_SOURCES
${FFI_SOURCES}
src/x86/ffi.c)
elseif("${TARGET}" STREQUAL "X86_WIN64")
set(FFI_SOURCES
${FFI_SOURCES}
src/x86/ffiw64.c)
elseif("${TARGET}" STREQUAL "X86_64")
set(FFI_SOURCES
${FFI_SOURCES}
src/x86/ffi64.c
src/x86/ffiw64.c)
endif()
endif()

macro(add_assembly ASMFILE)
get_filename_component(ASMFILE_FULL "${ASMFILE}" ABSOLUTE)
if(MSVC)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(ARCH_ASSEMBLER ml /safeseh)
if ("${TARGET}" STREQUAL "ARM_WIN64")
set(ARCH_ASSEMBLER armasm64)
elseif ("${TARGET}" STREQUAL "ARM_WIN32")
set(ARCH_ASSEMBLER armasm)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(ARCH_ASSEMBLER ml /safeseh /c /Zi)
else()
set(ARCH_ASSEMBLER ml64)
set(ARCH_ASSEMBLER ml64 /c /Zi)
endif()

get_filename_component(ARCH_ASM_NAME "${ASMFILE_FULL}" NAME_WE)

execute_process(
COMMAND ${CMAKE_C_COMPILER} /nologo /EP /I. /Iinclude ${ASMFILE_FULL}
COMMAND ${CMAKE_C_COMPILER} /nologo /EP /I. /Iinclude /I${CMAKE_CURRENT_SOURCE_DIR}/include "${ASMFILE_FULL}"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
OUTPUT_FILE ${ARCH_ASM_NAME}.asm
)
Expand All @@ -81,7 +127,7 @@ macro(add_assembly ASMFILE)
# (even though it didn't report any errors and correctly generated object file)
# which in turn causes MSBUILD to stop.
execute_process(
COMMAND ${ARCH_ASSEMBLER} /c /Zi ${ARCH_ASM_NAME}.asm
COMMAND ${ARCH_ASSEMBLER} ${ARCH_ASM_NAME}.asm
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)

Expand All @@ -91,25 +137,23 @@ macro(add_assembly ASMFILE)
endif()
endmacro()

if(${TARGET} STREQUAL "X86")
if("${TARGET}" STREQUAL "X86")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -m32")
endif()

if(${TARGET} STREQUAL "X86")
if("${TARGET}" STREQUAL "X86" OR "${TARGET}" STREQUAL "X86_DARWIN")
add_assembly(src/x86/sysv.S)
add_assembly(src/x86/win32.S)
elseif(${TARGET} STREQUAL "X86_64")
list(APPEND FFI_SOURCES src/x86/ffi64.c)
elseif("${TARGET}" STREQUAL "X86_64")
add_assembly(src/x86/unix64.S)
add_assembly(src/x86/sysv.S)
elseif(${TARGET} STREQUAL "X86_WIN32")
add_assembly(src/x86/win32.S)
elseif(${TARGET} STREQUAL "X86_WIN64")
add_assembly(src/x86/win64.S)
elseif(${TARGET} STREQUAL "X86_DARWIN")
list(APPEND FFI_SOURCES src/x86/ffi64.c)
add_assembly(src/x86/darwin.S)
add_assembly(src/x86/darwin64.S)
elseif("${TARGET}" STREQUAL "X86_WIN32")
add_assembly(src/x86/sysv_intel.S)
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_WIN64")
add_assembly(src/aarch64/win64_armasm.S)
else()
message(FATAL_ERROR "Target not implemented")
endif()
Expand Down
2 changes: 1 addition & 1 deletion ports/libffi/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: libffi
Version: 3.1-7
Version: 3.3
Homepage: https://github.com/libffi/libffi
Description: Portable, high level programming interface to various calling conventions
Supports: !arm
14 changes: 0 additions & 14 deletions ports/libffi/auto-define-static-macro.patch

This file was deleted.

35 changes: 0 additions & 35 deletions ports/libffi/export-global-data.patch

This file was deleted.

8 changes: 4 additions & 4 deletions ports/libffi/fficonfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
#define HAVE_SYS_TYPES_H 1
#define LT_OBJDIR ".libs/"
#define PACKAGE "libffi"
#define PACKAGE_BUGREPORT "http://github.com/atgreen/libffi/issues"
#define PACKAGE_BUGREPORT "http://github.com/libffi/libffi/issues"
#define PACKAGE_NAME "libffi"
#define PACKAGE_STRING "libffi 3.1"
#define PACKAGE_STRING "libffi 3.3"
#define PACKAGE_TARNAME "libffi"
#define PACKAGE_URL ""
#define PACKAGE_VERSION "3.1"
#define PACKAGE_VERSION "3.3"
#define SIZEOF_DOUBLE 8
#define SIZEOF_LONG_DOUBLE 8
#ifndef _WIN64
Expand All @@ -42,7 +42,7 @@
#define SYMBOL_UNDERSCORE 1
#endif
#endif
#define VERSION "3.1"
#define VERSION "3.3"
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
Expand Down
24 changes: 7 additions & 17 deletions ports/libffi/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
include(vcpkg_common_functions)

if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL x86 AND NOT VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
message(FATAL_ERROR "Architecture not supported")
endif()

vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libffi/libffi
REF v3.1
SHA512 b214e4a876995f44e0a93bad5bf1b3501ea1fbedafbf33ea600007bd08c9bc965a1f0dd90ea870281c3add6c051febd19aa6cdce36f3ee8ba535ba2c0703153c
REF v3.3
SHA512 62798fb31ba65fa2a0e1f71dd3daca30edcf745dc562c6f8e7126e54db92572cc63f5aa36d927dd08375bb6f38a2380ebe6c5735f35990681878fc78fc9dbc83
HEAD_REF master
PATCHES
export-global-data.patch
)

file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
Expand All @@ -32,14 +22,14 @@ vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets()

if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(READ ${CURRENT_PACKAGES_DIR}/include/ffi.h FFI_H)
string(REPLACE "/* *know* they are going to link with the static library. */"
"/* *know* they are going to link with the static library. */
string(REPLACE " *know* they are going to link with the static library. */"
" *know* they are going to link with the static library. */
#define FFI_BUILDING
" FFI_H "${FFI_H}")
file(WRITE ${CURRENT_PACKAGES_DIR}/include/ffi.h "${FFI_H}")
endif()

file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libffi)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libffi/LICENSE ${CURRENT_PACKAGES_DIR}/share/libffi/copyright)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
3 changes: 2 additions & 1 deletion ports/libnice/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ find_library(GOBJECT_LIBRARY gobject-2.0)
find_library(GIO_LIBRARY gio-2.0)
find_library(IPHLPAPI_LIBRARY iphlpapi)
find_library(WS2_32_LIB ws2_32)
find_library(ADVAPI32_LIB advapi32)
find_package(OpenSSL REQUIRED)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down Expand Up @@ -121,7 +122,7 @@ SET(HEADERS
)
add_library(libnice ${SRCS} ${HEADERS})
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/wd4244 /wd4005 /wd4391 /wd4142 /wd4267")
target_link_libraries(libnice ${IPHLPAPI_LIBRARY} ${WS2_32_LIB} ${GLIB_LIBRARY} ${GOBJECT_LIBRARY} ${GIO_LIBRARY} OpenSSL::SSL)
target_link_libraries(libnice ${IPHLPAPI_LIBRARY} ${WS2_32_LIB} ${ADVAPI32_LIB} ${GLIB_LIBRARY} ${GOBJECT_LIBRARY} ${GIO_LIBRARY} OpenSSL::SSL)
install(TARGETS libnice
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
Expand Down
2 changes: 1 addition & 1 deletion ports/libnice/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: libnice
Version: 0.1.15-1
Version: 0.1.15-2
Homepage: https://nice.freedesktop.org
Description: Libnice is an implementation of the IETF's Interactive Connectivity Establishment (ICE) standard (RFC 5245) and the Session Traversal Utilities for NAT (STUN) standard (RFC 5389).
Build-Depends: glib, openssl
2 changes: 1 addition & 1 deletion ports/pangomm/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: pangomm
Version: 2.40.1-2
Version: 2.40.1-3
Homepage: https://ftp.gnome.org/pub/GNOME/sources/pangomm
Description: pangomm is the official C++ interface for the Pango font layout library. See, for instance, the Pango::Layout class.
Build-Depends: glib, gettext, cairo, fontconfig, freetype, harfbuzz, pango, cairomm, glibmm
4 changes: 2 additions & 2 deletions ports/pangomm/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include(vcpkg_common_functions)
vcpkg_fail_port_install(ON_ARCH "arm" "arm64")

vcpkg_download_distfile(ARCHIVE
URLS "http://ftp.gnome.org/pub/GNOME/sources/pangomm/2.40/pangomm-2.40.1.tar.xz"
Expand Down Expand Up @@ -62,4 +62,4 @@ file(

vcpkg_copy_pdbs()

file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/pangomm RENAME copyright)
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
3 changes: 2 additions & 1 deletion scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ asmjit:arm-uwp=fail
asyncplusplus:arm-uwp=fail
asyncplusplus:x64-uwp=fail
atk:x64-osx=fail
atk:arm64-windows=fail
atkmm:x64-linux=fail
atlmfc:x64-linux=fail
atlmfc:x64-osx=fail
Expand Down Expand Up @@ -742,7 +743,6 @@ libfabric:x64-linux=fail
libfabric:x64-osx=fail
libfabric:x64-uwp=fail
libfabric:x64-windows=ignore
libffi:arm64-windows=fail
libffi:arm-uwp=fail
libfreenect2:arm64-windows=fail
libgd:x64-linux=ignore
Expand Down Expand Up @@ -1328,6 +1328,7 @@ pangolin:x64-windows-static=fail
pangomm:x64-osx=fail
pangomm:x64-windows=ignore
pangomm:x86-windows=ignore
pangomm:arm64-windows=fail
parmetis:x64-linux=fail
parmetis:x64-osx=fail
pbc:arm-uwp=fail
Expand Down

0 comments on commit 7d4227f

Please sign in to comment.