From 66e8017d743abd0085d1fe1ee06911f508610367 Mon Sep 17 00:00:00 2001 From: Marco Serantoni Date: Sun, 29 Dec 2013 20:36:30 +0100 Subject: [PATCH] [MacOSX] fixes a missing feature in boost and fixes static build with x86/i386 involved (https://svn.boost.org/trac/boost/ticket/8266) --- CMakeModules/download_boost.cmake | 21 ++++---- patches/boost_macosx_x86.patch | 72 ++++++++++++++++++++++++++++ patches/boost_macosx_x86_build.patch | 13 +++++ 3 files changed, 98 insertions(+), 8 deletions(-) create mode 100644 patches/boost_macosx_x86.patch create mode 100644 patches/boost_macosx_x86_build.patch diff --git a/CMakeModules/download_boost.cmake b/CMakeModules/download_boost.cmake index 1548ab5a6f..bf43e685d6 100644 --- a/CMakeModules/download_boost.cmake +++ b/CMakeModules/download_boost.cmake @@ -40,8 +40,9 @@ set( BOOST_ROOT "${PROJECT_SOURCE_DIR}/boost_root" ) # Space separated list which indicates the subset of boost libraries to compile. # Chosen libraries are based on AVHTTP requirements, and possibly # unit_test_framework for its own worth. +# tool_manager.cpp -> coroutine -> context (_jump_fcontext) set( BOOST_LIBS_BUILT - #context + context #coroutine date_time #exception @@ -55,7 +56,6 @@ set( BOOST_LIBS_BUILT thread #unit_test_framework ) - #-------------------------------------------------------------------- find_package( BZip2 REQUIRED ) @@ -104,14 +104,14 @@ if( MINGW ) foreach( lib ${boost_libs_list} ) set( b2_libs ${b2_libs} --with-${lib} ) endforeach() - unset( PIC_STUFF ) + unset( BOOST_CFLAGS ) else() string( REGEX REPLACE "\\;" "," libs_csv "${boost_libs_list}" ) #message( STATUS "libs_csv:${libs_csv}" ) set( bootstrap ./bootstrap.sh --with-libraries=${libs_csv} ) # pass to *both* C and C++ compilers - set( PIC_STUFF "cflags=${PIC_FLAG}" ) + set( BOOST_CFLAGS "cflags=${PIC_FLAG}" ) set( BOOST_INCLUDE "${BOOST_ROOT}/include" ) unset( b2_libs ) endif() @@ -121,8 +121,8 @@ if( APPLE ) # I set this to being compatible with wxWidgets # wxWidgets still using libstdc++ (gcc), meanwhile OSX # has switched to libc++ (llvm) by default - set(BOOST_CXXFLAGS "cxxflags=-mmacosx-version-min=10.5" ) - set(BOOST_LINKFLAGS "linkflags=-mmacosx-version-min=10.5" ) + set(BOOST_CXXFLAGS "cxxflags=-mmacosx-version-min=10.5 -fno-common -fno-lto" ) + set(BOOST_LINKFLAGS "linkflags=-mmacosx-version-min=10.5 -fno-common -fno-lto" ) set(BOOST_TOOLSET "toolset=darwin" ) if( CMAKE_OSX_ARCHITECTURES ) @@ -141,6 +141,9 @@ if( APPLE ) set(BOOST_ARCHITECTURE "architecture=combined") endif() + set(BOOST_CFLAGS "${BOOST_CFLAGS} -arch ${CMAKE_OSX_ARCHITECTURES}" ) + set(BOOST_CXXFLAGS "${BOOST_CXXFLAGS} -arch ${CMAKE_OSX_ARCHITECTURES}" ) + set(BOOST_LINKFLAGS "${BOOST_LINKFLAGS} -arch ${CMAKE_OSX_ARCHITECTURES}" ) endif() endif() @@ -159,6 +162,8 @@ ExternalProject_Add( boost # PATCH_COMMAND continuation (any *_COMMAND here can be continued with COMMAND): COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_minkowski.patch" COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_cstdint.patch" + COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_macosx_x86.patch" #https://svn.boost.org/trac/boost/ticket/8266 + COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_macosx_x86_build.patch" #https://svn.boost.org/trac/boost/ticket/8266 # [Mis-]use this step to erase all the boost headers and libraries before # replacing them below. @@ -170,7 +175,7 @@ ExternalProject_Add( boost BUILD_COMMAND ./b2 variant=release threading=multi - ${PIC_STUFF} + ${BOOST_CFLAGS} ${BOOST_TOOLSET} ${BOOST_CXXFLAGS} ${BOOST_LINKFLAGS} @@ -229,7 +234,7 @@ ExternalProject_Add_Step( boost bzr_commit_boost ExternalProject_Add_Step( boost bzr_add_boost # add only the headers to the scratch repo, repo = "../.bzr" from ${headers_src} - COMMAND bzr add -q ${headers_src} + COMMAND bzr add -q ${PREFIX}/src/boost COMMENT "adding pristine boost files to 'boost scratch repo'" DEPENDERS bzr_commit_boost ) diff --git a/patches/boost_macosx_x86.patch b/patches/boost_macosx_x86.patch new file mode 100644 index 0000000000..f14c5f49f8 --- /dev/null +++ b/patches/boost_macosx_x86.patch @@ -0,0 +1,72 @@ +=== modified file 'libs/context/build/Jamfile.v2' +--- libs/context/build/Jamfile.v2 2013-12-29 11:28:14 +0000 ++++ libs/context/build/Jamfile.v2 2013-12-29 11:31:05 +0000 +@@ -414,6 +414,25 @@ + ; + + alias asm_context_sources ++ : asm/make_i386_x86_64_sysv_macho_gas.S ++ asm/jump_i386_x86_64_sysv_macho_gas.S ++ : 32_64 ++ x86 ++ mach-o ++ darwin ++ darwin ++ ; ++ ++alias asm_context_sources ++ : [ make asm/make_i386_x86_64_sysv_macho_gas.o : asm/make_i386_x86_64_sysv_macho_gas.S : @gas ] ++ [ make asm/jump_i386_x86_64_sysv_macho_gas.o : asm/jump_i386_x86_64_sysv_macho_gas.S : @gas ] ++ : 32_64 ++ x86 ++ mach-o ++ darwin ++ ; ++ ++alias asm_context_sources + : asm/make_x86_64_ms_pe_masm.asm + asm/jump_x86_64_ms_pe_masm.asm + dummy.cpp + +=== added file 'libs/context/src/asm/jump_i386_x86_64_sysv_macho_gas.S' +--- libs/context/src/asm/jump_i386_x86_64_sysv_macho_gas.S 1970-01-01 00:00:00 +0000 ++++ libs/context/src/asm/jump_i386_x86_64_sysv_macho_gas.S 2013-12-29 11:33:46 +0000 +@@ -0,0 +1,16 @@ ++/* ++ Copyright Sergue E. Leontiev 2013. ++ Distributed under the Boost Software License, Version 1.0. ++ (See accompanying file LICENSE_1_0.txt or copy at ++ http://www.boost.org/LICENSE_1_0.txt) ++*/ ++ ++// Stub file for universal binary ++ ++#if defined(__i386__) ++ #include "jump_i386_sysv_macho_gas.S" ++#elif defined(__x86_64__) ++ #include "jump_x86_64_sysv_macho_gas.S" ++#else ++ #error "No arch's" ++#endif + +=== added file 'libs/context/src/asm/make_i386_x86_64_sysv_macho_gas.S' +--- libs/context/src/asm/make_i386_x86_64_sysv_macho_gas.S 1970-01-01 00:00:00 +0000 ++++ libs/context/src/asm/make_i386_x86_64_sysv_macho_gas.S 2013-12-29 11:32:49 +0000 +@@ -0,0 +1,16 @@ ++/* ++ Copyright Sergue E. Leontiev 2013. ++ Distributed under the Boost Software License, Version 1.0. ++ (See accompanying file LICENSE_1_0.txt or copy at ++ http://www.boost.org/LICENSE_1_0.txt) ++*/ ++ ++// Stub file for universal binary ++ ++#if defined(__i386__) ++ #include "make_i386_sysv_macho_gas.S" ++#elif defined(__x86_64__) ++ #include "make_x86_64_sysv_macho_gas.S" ++#else ++ #error "No arch's" ++#endif + diff --git a/patches/boost_macosx_x86_build.patch b/patches/boost_macosx_x86_build.patch new file mode 100644 index 0000000000..4beb68444b --- /dev/null +++ b/patches/boost_macosx_x86_build.patch @@ -0,0 +1,13 @@ +=== modified file 'tools/build/v2/tools/gcc.jam' +--- tools/build/v2/tools/gcc.jam 2013-12-29 13:13:00 +0000 ++++ tools/build/v2/tools/gcc.jam 2013-12-29 14:36:31 +0000 +@@ -635,7 +635,7 @@ + + actions compile.asm + { +- "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" ++ "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) -D$(DEFINES) $(USER_OPTIONS) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" + } + + # Class checking that we do not try to use the static property +