Build glib on x86-linux (#5313)

* Build glib on x86-linux

* [libffi] Code cleanup

* [glib] Use CMAKE_CXX_FLAGS instead of VCPKG_CXX_FLAGS

* [libffi] Use ${TARGET} in conditions
This commit is contained in:
Todor Prokopov 2019-03-01 08:58:46 +02:00 committed by Victor Romero
parent 590f3a78b2
commit 1afa2b0f7b
7 changed files with 45 additions and 23 deletions

View File

@ -71,13 +71,25 @@ else()
set(ENV{MSGFMT} "/bin/echo")
set(ENV{GMSGFMT} "/bin/echo")
if(NOT EXISTS "${CMAKE_BINARY_DIR}/config/config.h")
string(TOUPPER UPPER_CONFIG "${CMAKE_BUILD_TYPE}")
set(CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${UPPER_CONFIG}} -I${PCRE_INCLUDE_DIR}")
set(CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${UPPER_CONFIG}} -I${PCRE_INCLUDE_DIR}")
if(BUILD_SHARED_LIBS)
set(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_${UPPER_CONFIG}} -L${LIB_DIR}")
else()
set(LDFLAGS "${CMAKE_STATIC_LINKER_FLAGS} ${CMAKE_STATIC_LINKER_FLAGS_${UPPER_CONFIG}} -L${LIB_DIR}")
endif()
string(STRIP "${CXXFLAGS}" CXXFLAGS)
string(STRIP "${CFLAGS}" CFLAGS)
string(STRIP "${LDFLAGS}" LDFLAGS)
execute_process(
COMMAND "${CMAKE_SOURCE_DIR}/configure"
--disable-libelf
--disable-libmount
"CPPFLAGS=-I${PCRE_INCLUDE_DIR}"
"CFLAGS=-I${PCRE_INCLUDE_DIR}"
"LDFLAGS=-L${LIB_DIR}"
"CPPFLAGS=${CXXFLAGS}"
"CFLAGS=${CFLAGS}"
"LDFLAGS=${LDFLAGS}"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/config
RESULT_VARIABLE res
)

View File

@ -1,4 +1,4 @@
Source: glib
Version: 2.52.3-11
Version: 2.52.3-13
Description: Portable, general-purpose utility library.
Build-Depends: zlib, pcre, libffi, gettext, libiconv

View File

@ -16,17 +16,18 @@ endif()
include(vcpkg_common_functions)
set(GLIB_VERSION 2.52.3)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/glib-${GLIB_VERSION})
vcpkg_download_distfile(ARCHIVE
URLS "https://ftp.gnome.org/pub/gnome/sources/glib/2.52/glib-${GLIB_VERSION}.tar.xz"
FILENAME "glib-${GLIB_VERSION}.tar.xz"
SHA512 a068f2519cfb82de8d4b7f004e7c1f15e841cad4046430a83b02b359d011e0c4077cdff447a1687ed7c68f1a11b4cf66b9ed9fc23ab5f0c7c6be84eb0ddc3017)
vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF ${GLIB_VERSION}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/use-libiconv-on-windows.patch)
use-libiconv-on-windows.patch
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/cmake DESTINATION ${SOURCE_PATH})

View File

@ -97,18 +97,22 @@ 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")
add_assembly(src/x86/sysv.S)
add_assembly(src/x86/win32.S)
elseif("${TARGET}" STREQUAL "X86_64")
elseif(${TARGET} STREQUAL "X86_64")
list(APPEND FFI_SOURCES src/x86/ffi64.c)
add_assembly(src/x86/unix64.S)
add_assembly(src/x86/sysv.S)
elseif("${TARGET}" STREQUAL "X86_WIN32")
elseif(${TARGET} STREQUAL "X86_WIN32")
add_assembly(src/x86/win32.S)
elseif("${TARGET}" STREQUAL "X86_WIN64")
elseif(${TARGET} STREQUAL "X86_WIN64")
add_assembly(src/x86/win64.S)
elseif("${TARGET}" STREQUAL "X86_DARWIN")
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)
@ -116,7 +120,7 @@ else()
message(FATAL_ERROR "Target not implemented")
endif()
if(CMAKE_BUILD_TYPE STREQUAL Debug)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND FFI_SOURCES src/debug.c)
add_definitions(-DFFI_DEBUG)
endif()

View File

@ -1,3 +1,3 @@
Source: libffi
Version: 3.1-1
Version: 3.1-4
Description: Portable, high level programming interface to various calling conventions

View File

@ -1,3 +1,6 @@
#ifdef __linux__
#define EH_FRAME_FLAGS "a"
#endif
#define HAVE_ALLOCA 1
#ifndef _WIN64
#define HAVE_AS_ASCII_PSEUDO_OP 1
@ -8,6 +11,9 @@
#ifndef _WIN64
#define HAVE_AS_X86_PCREL 1
#endif
#ifdef __linux__
#define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1
#endif
#define HAVE_INTTYPES_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STDINT_H 1
@ -31,9 +37,11 @@
#define SIZEOF_SIZE_T 8
#endif
#define STDC_HEADERS 1
#ifndef __linux__
#ifndef _WIN64
#define SYMBOL_UNDERSCORE 1
#endif
#endif
#define VERSION "3.1"
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__

View File

@ -9,18 +9,15 @@ vcpkg_from_github(
REF v3.1
SHA512 b214e4a876995f44e0a93bad5bf1b3501ea1fbedafbf33ea600007bd08c9bc965a1f0dd90ea870281c3add6c051febd19aa6cdce36f3ee8ba535ba2c0703153c
HEAD_REF master
PATCHES
export-global-data.patch
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/export-global-data.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DFFI_CONFIG_FILE=${CMAKE_CURRENT_LIST_DIR}/fficonfig.h
OPTIONS_DEBUG
@ -30,7 +27,7 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
vcpkg_copy_pdbs()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_apply_patches(
SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
PATCHES