Skip to content

Instantly share code, notes, and snippets.

@tonytheodore
Created February 12, 2017 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonytheodore/be60a47906f567414958432793f11cbe to your computer and use it in GitHub Desktop.
Save tonytheodore/be60a47906f567414958432793f11cbe to your computer and use it in GitHub Desktop.
boost single thread
build with:
make boost boost_CONFIGURE_OPTS="threading=single"
will fail as context, thread_win32 (and atomic) are always multi-threaded
diff --git a/src/boost.mk b/src/boost.mk
index cc9fdbc..4a8c125 100644
--- a/src/boost.mk
+++ b/src/boost.mk
@@ -11,6 +11,9 @@ $(PKG)_FILE := boost_$(subst .,_,$($(PKG)_VERSION)).tar.bz2
$(PKG)_URL := http://$(SOURCEFORGE_MIRROR)/project/boost/boost/$($(PKG)_VERSION)/$($(PKG)_FILE)
$(PKG)_DEPS := gcc bzip2 expat zlib
+$(PKG)_MT_SUFFIX = \
+ $(if $(findstring threading=single,$($(PKG)_CONFIGURE_OPTS)),,-mt)
+
define $(PKG)_UPDATE
$(WGET) -q -O- 'http://www.boost.org/users/download/' | \
$(SED) -n 's,.*/boost/\([0-9][^"/]*\)/".*,\1,p' | \
@@ -58,6 +61,7 @@ define $(PKG)_BUILD
--includedir='$(PREFIX)/$(TARGET)/include' \
-sEXPAT_INCLUDE='$(PREFIX)/$(TARGET)/include' \
-sEXPAT_LIBPATH='$(PREFIX)/$(TARGET)/lib' \
+ $($(PKG)_CONFIGURE_OPTS) \
install
$(if $(BUILD_SHARED), \
@@ -70,11 +74,11 @@ define $(PKG)_BUILD
-W -Wall -Werror -ansi -U__STRICT_ANSI__ -pedantic \
'$(PWD)/src/$(PKG)-test.cpp' -o '$(PREFIX)/$(TARGET)/bin/test-boost.exe' \
-DBOOST_THREAD_USE_LIB \
- -lboost_serialization-mt \
- -lboost_thread_win32-mt \
- -lboost_system-mt \
- -lboost_chrono-mt \
- -lboost_context-mt
+ -lboost_serialization$($(PKG)_MT_SUFFIX) \
+ -lboost_thread_win32$($(PKG)_MT_SUFFIX) \
+ -lboost_system$($(PKG)_MT_SUFFIX) \
+ -lboost_chrono$($(PKG)_MT_SUFFIX) \
+ -lboost_context$($(PKG)_MT_SUFFIX)
# test cmake
mkdir '$(1).test-cmake'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment