Dukales

boost from trunk MinGW 4.8 Win64 Core i7

Feb 26th, 2013
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 9.63 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. set -o verbose
  4. set -o xtrace
  5. set -o errexit
  6.  
  7. # Некоторая информация была почерпнута здесь http://www.hoxnox.com/2011/02/mingw-stlport-boost.html
  8.  
  9. MARCH=corei7-avx
  10. #native corei7-avx corei7
  11. MTUNE=corei7-avx
  12. #corei7-avx generic
  13. ADDRESS_MODEL=64
  14. #32 64
  15. #for boost::
  16. THREADAPI=pthread
  17. #win32 pthread
  18. #required: -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_LIB -lpthreadGC2
  19.  
  20. export MINGWDIR="/c/mingw"
  21. #export STLPORT_ROOT="D:/libs/STLport"
  22. #STDLIB="stdlib=stlport-5.2.1"
  23. PATH=/usr/bin:${MINGWDIR}/bin:/c/Windows/system32
  24. #${MINGWDIR}/x86_64-w64-mingw32/lib32
  25. SRC_DIR="${PWD}"
  26. BUILD_DIR="${SRC_DIR}/../build-boost"
  27. mkdir -p "${BUILD_DIR}"
  28. INSTALL_DIR="${SRC_DIR}/../boost"
  29. mkdir -p "${INSTALL_DIR}"
  30.  
  31. function colored_echo () {
  32.   echo -e "\e[1;31m${1}\e[0m"
  33. }
  34.  
  35. colored_echo "build boost"
  36.  
  37. PATCH_NAME="user-config.patch"
  38. function on_exit () {
  39.   if test -e "${SRC_DIR}/${PATCH_NAME}"
  40.   then
  41.     colored_echo "revert patch"
  42.     patch --strip=0 --reverse --forward --directory="${SRC_DIR}" --input "${PATCH_NAME}"
  43.     rm -vf "${SRC_DIR}/${PATCH_NAME}"
  44.   fi
  45.   exit "$?"
  46. }
  47. trap on_exit ERR EXIT SIGINT SIGTERM
  48.  
  49. colored_echo "create patch"
  50. cat - <<__EOF> "${PATCH_NAME}"
  51. diff C3 tools/build/v2/user-config.jam tools/build/v2/user-config.jam
  52. *** tools/build/v2/user-config.jam  Fri Sep 21 11:33:22 2012
  53. --- tools/build/v2/user-config.jam  Fri Sep 21 11:54:13 2012
  54. ***************
  55. *** 43,49 ****
  56.  
  57.   # Configure specific gcc version, giving alternative name to use.
  58.   # using gcc : 3.2 : g++-3.2 ;
  59. !
  60.  
  61.   # -------------------
  62.   # MSVC configuration.
  63. --- 43,49 ----
  64.  
  65.   # Configure specific gcc version, giving alternative name to use.
  66.   # using gcc : 3.2 : g++-3.2 ;
  67. ! using gcc :  :  :  ;
  68.  
  69.   # -------------------
  70.   # MSVC configuration.
  71. ***************
  72. *** 72,78 ****
  73.  
  74.   # Configure specifying location of both headers and libraries explicitly.
  75.   # using stlport : : /usr/include/stlport /usr/lib ;
  76. !
  77.  
  78.   # -----------------
  79.   # QT configuration.
  80. --- 72,78 ----
  81.  
  82.   # Configure specifying location of both headers and libraries explicitly.
  83.   # using stlport : : /usr/include/stlport /usr/lib ;
  84. ! #using stlport : 5.2.1 : D:/libs/STLport/stlport : D:/libs/STLport/lib ;
  85.  
  86.   # -----------------
  87.   # QT configuration.
  88. __EOF
  89. colored_echo "apply patch"
  90. patch --strip=0 --forward --directory="${SRC_DIR}" --input "${PATCH_NAME}" || colored_echo "patching is not required"
  91.  
  92. : '
  93. "${SRC_DIR}/b2.exe" --show-libraries
  94.  
  95. chrono
  96. date_time
  97. exception
  98. filesystem
  99. graph
  100. graph_parallel
  101. iostreams
  102. locale
  103. math
  104. mpi
  105. program_options
  106. python
  107. random
  108. regex
  109. serialization
  110. signals
  111. system
  112. test
  113. thread
  114. timer
  115. wave
  116.  
  117. Boost.Filesystem
  118. Boost.GraphParallel
  119. Boost.IOStreams
  120. Boost.MPI
  121. Boost.ProgramOptions
  122. Boost.Python (see the Boost.Python build documentation before building and installing it)
  123. Boost.Regex
  124. Boost.Serialization
  125. Boost.Signals
  126. Boost.System
  127. Boost.Thread
  128. Boost.Wave
  129. '
  130.  
  131. LIBRARY_LIST=""
  132. #"--with-regex --with-test --with-filesystem --with-serialization --with-system --with-thread --with-filesystem"
  133.  
  134. if test -z "${LIBRARY_LIST}"
  135. then
  136.   echo "Will build following libraries: ALL"
  137. else
  138.   echo -e "Will build following libraries:\n"`echo "${LIBRARY_LIST}" | sed -e "s/--with-//g"`
  139. fi
  140. LIBRARY_LIST=`echo "${LIBRARY_LIST}" | tr '\n' ' '`
  141.  
  142. CXXSTATIC="-D_STLP_USE_STATIC_LIB=1"
  143. CXXDYNAMIC="-DBOOST_ALL_DYN_LINK=1 -D_STLP_USE_DYNAMIC_LIB=1 -fno-keep-inline-dllexport"
  144. #-fkeep-inline-functions for release/debug dyn wave
  145.  
  146. if [[ ${ADDRESS_MODEL} -eq 32 ]]
  147. then
  148.     PATH=${MINGWDIR}/x86_64-w64-mingw32/lib32:${PATH}
  149.     LFLAGS_WIN32="-Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc"
  150.     CFLAGS_WIN32=""
  151.     BIT_CAPACIY="-m32"
  152. else
  153.     PATH=${MINGWDIR}/i686-w64-mingw32/lib64:${PATH}
  154.     LFLAGS_WIN32=""
  155.     CFLAGS_WIN32=""
  156.     BIT_CAPACIY="-m64"
  157. fi
  158.  
  159. #C:\mingw\x86_64-w64-mingw32\lib32;C:\mingw\i686-w64-mingw32\lib64;
  160. export PATH
  161.  
  162. if [[ "${THREADAPI}" = "win32" ]]
  163. then
  164.     THREADS="-mthreads -DBOOST_THREAD_WIN32 -DBOOST_THREAD_USE_LIB"
  165. else
  166.     THREADS="-pthread -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_LIB"
  167. fi
  168.  
  169. GRAPHITE=
  170. #"-fgraphite-identity -floop-interchange -floop-block -floop-parallelize-all"
  171. #The flag -fomit-frame-pointer is enabled at -O1, -O2, -O3 and -Os on arches where it doesn't interfere with debugging, such as AMD64, but not x86. So if you're on x86 you should add it to your CFLAGS. Also don't use -momit-leaf-frame-pointer together with -fomit-frame-pointer. It's pointless as -fomit-frame-pointer already omits all frame pointers. In fact if you use both, -momit-leaf-frame-pointer overrides -fomit-frame-pointer creating less optimized code.
  172. # -mfpmath=both is experimental
  173. OPTFLAGS="\
  174. ${CFLAGS_WIN32} \
  175. ${GRAPHITE} \
  176. -fbranch-target-load-optimize2 \
  177. -fcx-limited-range -fforce-addr \
  178. -fgcse-las -fgcse-sm -fgcse-after-reload \
  179. -ftree-loop-im"
  180.  
  181. #!!!!!!! http://comments.gmane.org/gmane.comp.gnu.mingw.w64.general/6317
  182. # my workaround: if you want to use "-mfpmath=both" (or, equivalently, "-mfpmath=sse+387") with "-std=gnu++11" option, then specify "-D__FLT_EVAL_METHOD__=2 -Wp,-w" option to g++ extra
  183. ARCH="${BIT_CAPACIY} -march=${MARCH}"
  184. # -mtune=${MTUNE}
  185. # echo "" | gcc -march=native -v -E - 2>&1 | grep cc1
  186.  
  187. USE_RTTI=
  188. #"-frtti" # configure -rtti
  189.  
  190. USE_LTO_CXX="-flto"
  191. USE_LTO_LINK=
  192. #"-flto"
  193. #"-flto -fuse-linker-plugin"
  194. #-flto=jobserver -fuse-linker-plugin
  195.  
  196. #g++: error: -E or -x required when input is from standard input
  197. COMMON="-v -pipe ${ARCH} ${USE_RTTI} \
  198. -mtls-dialect=gnu2 \
  199. -fsignaling-nans -fno-math-errno \
  200. ${USE_LTO}"
  201. STLP_CXXOTHER=
  202. #"-D_REENTRANT=1 -D_STLP_NEW_PLATFORM_SDK=1 -D_STLP_USE_EXCEPTIONS"
  203. LISTING=""
  204. #"-Wa,-adhlns=\"\[email protected]\""
  205. X="-x c++ "
  206. #"-std=gnu++11 -D__FLT_EVAL_METHOD__=2 -Wp,-w"
  207. CXXOTHER="${COMMON} \
  208. ${STLP_CXXOTHER} \
  209. ${X} \
  210. ${LISTING} \
  211. ${USE_LTO_CXX}"
  212. if [[ "${LINKAGE}"x -ne ""x ]]
  213. then
  214.     LINKAGE="-${LINKAGE}"
  215. fi
  216. LOTHER="${LINKAGE} ${COMMON} \
  217. ${LFLAGS_WIN32} \
  218. ${USE_LTO_LINK}"
  219.  
  220. STLP_CXXDEBUG=
  221. #"-D_STLP_DEBUG=1 -D_DEBUG=1 -D_STLP_DEBUG_MODE_THROWS=1 -D_STLP_DEBUG_ALLOC=1 -D_STLP_DEBUG_UNINITIALIZED=1"
  222. CXXDEBUG="-Og -g -ggdb \
  223. ${STLP_CXXDEBUG}"
  224. LDEBUG="-Wl,-O0"
  225. CXXRELEASE=" \
  226. -O3 \
  227. ${OPTFLAGS}"
  228. LRELEASE="-Wl,-s \
  229. -Wl,-O3 \
  230. ${OPTFLAGS}"
  231.  
  232. let "NUMBER_OF_PROCESSORS = ${NUMBER_OF_PROCESSORS} + 1"
  233.  
  234. colored_echo "release static"
  235. "${SRC_DIR}/b2.exe" -j${NUMBER_OF_PROCESSORS} -a -d+2 \
  236.    toolset=gcc \
  237.    "${STDLIB}" \
  238.    link=static \
  239.    runtime-link=static \
  240.    target-os=windows \
  241.    threading=multi \
  242.    threadapi="${THREADAPI}" \
  243.    variant=release \
  244.    cxxflags="${CXXRELEASE} ${CXXSTATIC} ${CXXOTHER}" \
  245.    linkflags="${LOTHER} ${LRELEASE}" \
  246.    --disable-icu \
  247.    --without-python \
  248.    --without-mpi \
  249.    -sNO_BZIP2=1 -sNO_ZLIB=1 \
  250.    address-model="${ADDRESS_MODEL}" \
  251.    architecture=x86 \
  252.    ${LIBRARY_LIST} \
  253.    --layout=tagged \
  254.    --build-dir="${BUILD_DIR}" \
  255.    --stagedir=${INSTALL_DIR} \
  256.    stage || colored_echo "Not all targets have been built"
  257.  
  258. colored_echo "debug static"
  259. "${SRC_DIR}/b2.exe" -j${NUMBER_OF_PROCESSORS} -a -d+2 \
  260.    toolset=gcc \
  261.    "${STDLIB}" \
  262.    link=static \
  263.    runtime-link=static \
  264.    target-os=windows \
  265.    threading=multi \
  266.    threadapi="${THREADAPI}" \
  267.    variant=debug \
  268.    cxxflags="${CXXDEBUG} ${CXXSTATIC} ${CXXOTHER}" \
  269.    linkflags="${LOTHER} ${LDEBUG}" \
  270.    --disable-icu \
  271.    --without-python \
  272.    --without-mpi \
  273.    -sNO_BZIP2=1 -sNO_ZLIB=1 \
  274.    address-model="${ADDRESS_MODEL}" \
  275.    architecture=x86 \
  276.    ${LIBRARY_LIST} \
  277.    --layout=tagged \
  278.    --build-dir="${BUILD_DIR}" \
  279.    --stagedir=${INSTALL_DIR} \
  280.    stage || colored_echo "Not all targets have been built"
  281.  
  282. colored_echo "release dynamic"
  283. #cp --force "${STLPORT_ROOT}/lib/libstlport.5.2.dll.a" "${STLPORT_ROOT}/lib/libstlport_gcc.a"
  284. "${SRC_DIR}/b2.exe" -j${NUMBER_OF_PROCESSORS} -a -d+2 \
  285.    toolset=gcc \
  286.    "${STDLIB}" \
  287.    link=shared \
  288.    runtime-link=shared \
  289.    target-os=windows \
  290.    threading=multi \
  291.    threadapi="${THREADAPI}" \
  292.    variant=release \
  293.    cxxflags="${CXXRELEASE} ${CXXDYNAMIC} ${CXXOTHER}" \
  294.    linkflags="${LOTHER} ${LRELEASE}" \
  295.    --disable-icu \
  296.    --without-python \
  297.    --without-mpi \
  298.    -sNO_BZIP2=1 -sNO_ZLIB=1 \
  299.    address-model="${ADDRESS_MODEL}" \
  300.    architecture=x86 \
  301.    ${LIBRARY_LIST} \
  302.    --layout=tagged \
  303.    --build-dir="${BUILD_DIR}" \
  304.    --stagedir=${INSTALL_DIR} \
  305.    stage || colored_echo "Not all targets have been built"
  306.  
  307. colored_echo "debug dynamic"
  308. #cp --force "${STLPORT_ROOT}/lib/libstlportstlg.5.2.dll.a" "${STLPORT_ROOT}/lib/libstlport_gcc_stldebug.a"
  309. "${SRC_DIR}/b2.exe" -j${NUMBER_OF_PROCESSORS} -a -d+2 \
  310.    toolset=gcc \
  311.    "${STDLIB}" \
  312.    link=shared \
  313.    runtime-link=shared \
  314.    target-os=windows \
  315.    threading=multi \
  316.    threadapi="${THREADAPI}" \
  317.    variant=debug \
  318.    cxxflags="${CXXDEBUG} ${CXXDYNAMIC} ${CXXOTHER}" \
  319.    linkflags="${LOTHER} ${LDEBUG}" \
  320.    --disable-icu \
  321.    --without-python \
  322.    --without-mpi \
  323.    -sNO_BZIP2=1 -sNO_ZLIB=1 \
  324.    address-model="${ADDRESS_MODEL}" \
  325.    architecture=x86 \
  326.    ${LIBRARY_LIST} \
  327.    --layout=tagged \
  328.    --build-dir="${BUILD_DIR}" \
  329.    --stagedir=${INSTALL_DIR} \
  330.    stage || colored_echo "Not all targets have been built"
  331.  
  332. mkdir -p "${INSTALL_DIR}/include"
  333. cp -vf -R "${SRC_DIR}/boost" "${INSTALL_DIR}/include/"
  334. #mkdir -p "${INSTALL_DIR}/include/boost"
  335. #tar --create --verbose --directory="${SRC_DIR}/boost" --file - . | tar --extract --verbose --directory="${INSTALL_DIR}/include/boost" --file -
  336. mkdir -p "${INSTALL_DIR}/bin/"
  337. mv -vf "${INSTALL_DIR}/lib/"*".dll" "${INSTALL_DIR}/bin/"
  338. #mv -vf "${INSTALL_DIR}/lib/*.dll.a" "${INSTALL_DIR}/bin/"
  339. #mv -vf "${INSTALL_DIR}/lib/*.a" "${INSTALL_DIR}/bin/"
Advertisement
Add Comment
Please, Sign In to add comment