aboutsummaryrefslogtreecommitdiff
path: root/package/boost/boost.mk
blob: 70160da4de01c97a909b2ef3480fce62d1a6b0dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
################################################################################
#
# boost
#
################################################################################

BOOST_VERSION = 1.57.0
BOOST_SOURCE = boost_$(subst .,_,$(BOOST_VERSION)).tar.bz2
BOOST_SITE = http://downloads.sourceforge.net/project/boost/boost/$(BOOST_VERSION)
BOOST_INSTALL_STAGING = YES
BOOST_LICENSE = Boost Software License 1.0
BOOST_LICENSE_FILES = LICENSE_1_0.txt

TARGET_CC_VERSION = $(shell $(TARGET_CC) -dumpversion)
HOST_CC_VERSION = $(shell $(HOSTCC) -dumpversion)

HOST_BOOST_DEPENDENCIES =

# keep host variant as minimal as possible
HOST_BOOST_FLAGS = --without-icu \
	--without-libraries=$(subst $(space),$(comma),atomic chrono context \
	coroutine date_time exception filesystem graph graph_parallel \
	iostreams locale log math mpi program_options python random regex \
	serialization signals system test thread timer wave)

# coroutine breaks on some weak toolchains and it's new for 1.54+
# log breaks with some toolchain combinations and it's new for 1.54+
BOOST_WITHOUT_FLAGS = coroutine log

BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_ATOMIC),,atomic)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_CHRONO),,chrono)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_CONTEXT),,context)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_DATE_TIME),,date_time)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_EXCEPTION),,exception)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_FILESYSTEM),,filesystem)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_GRAPH),,graph)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_GRAPH_PARALLEL),,graph_parallel)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_IOSTREAMS),,iostreams)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_LOCALE),,locale)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_MATH),,math)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_MPI),,mpi)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_PROGRAM_OPTIONS),,program_options)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_PYTHON),,python)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_RANDOM),,random)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_REGEX),,regex)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_SERIALIZATION),,serialization)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_SIGNALS),,signals)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_SYSTEM),,system)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_TEST),,test)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_THREAD),,thread)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_TIMER),,timer)
BOOST_WITHOUT_FLAGS += $(if $(BR2_PACKAGE_BOOST_WAVE),,wave)

BOOST_TARGET_CXXFLAGS = $(TARGET_CXXFLAGS)

ifeq ($(BR2_PACKAGE_ICU),y)
BOOST_FLAGS += --with-icu=$(STAGING_DIR)/usr
BOOST_DEPENDENCIES += icu
else
BOOST_FLAGS += --without-icu
endif

ifeq ($(BR2_PACKAGE_BOOST_IOSTREAMS),y)
BOOST_DEPENDENCIES += bzip2 zlib
endif

ifeq ($(BR2_PACKAGE_BOOST_PYTHON),y)
BOOST_FLAGS += --with-python-root=$(HOST_DIR)
ifeq ($(BR2_PACKAGE_PYTHON3),y)
BOOST_FLAGS += --with-python=$(HOST_DIR)/usr/bin/python$(PYTHON3_VERSION_MAJOR)
BOOST_TARGET_CXXFLAGS += -I$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)m
BOOST_DEPENDENCIES += python3
else
BOOST_FLAGS += --with-python=$(HOST_DIR)/usr/bin/python$(PYTHON_VERSION_MAJOR)
BOOST_TARGET_CXXFLAGS += -I$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)
BOOST_DEPENDENCIES += python
endif
endif

HOST_BOOST_OPTS += toolset=gcc threading=multi variant=release link=shared \
	runtime-link=shared

ifeq ($(BR2_MIPS_OABI32),y)
BOOST_ABI = o32
else ifeq ($(BR2_arm),y)
BOOST_ABI = aapcs
else
BOOST_ABI = sysv
endif

BOOST_OPTS += toolset=gcc \
	     threading=multi \
	     abi=$(BOOST_ABI) \
	     variant=$(if $(BR2_ENABLE_DEBUG),debug,release) \
	     link=$(if $(BR2_STATIC_LIBS),static,shared) \
	     runtime-link=$(if $(BR2_STATIC_LIBS),static,shared)

ifeq ($(BR2_PACKAGE_BOOST_LOCALE),y)
ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
# posix backend needs monetary.h which isn't available on uClibc
BOOST_OPTS += boost.locale.posix=off
endif

BOOST_DEPENDENCIES += $(if $(BR2_ENABLE_LOCALE),,libiconv)
endif

BOOST_WITHOUT_FLAGS_COMMASEPERATED += $(subst $(space),$(comma),$(strip $(BOOST_WITHOUT_FLAGS)))
BOOST_FLAGS += $(if $(BOOST_WITHOUT_FLAGS_COMMASEPERATED), --without-libraries=$(BOOST_WITHOUT_FLAGS_COMMASEPERATED))
BOOST_LAYOUT = $(call qstrip, $(BR2_PACKAGE_BOOST_LAYOUT))

define BOOST_CONFIGURE_CMDS
	(cd $(@D) && ./bootstrap.sh $(BOOST_FLAGS))
	echo "using gcc : $(TARGET_CC_VERSION) : $(TARGET_CXX) : <cxxflags>\"$(BOOST_TARGET_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > $(@D)/user-config.jam
	echo "" >> $(@D)/user-config.jam
endef

define HOST_BOOST_CONFIGURE_CMDS
	(cd $(@D) && ./bootstrap.sh $(HOST_BOOST_FLAGS))
	echo "using gcc : $(HOST_CC_VERSION) : $(HOSTCXX) : <cxxflags>\"$(HOST_CXXFLAGS)\" <linkflags>\"$(HOST_LDFLAGS)\" ;" > $(@D)/user-config.jam
	echo "" >> $(@D)/user-config.jam
endef

define BOOST_INSTALL_TARGET_CMDS
	(cd $(@D) && ./b2 -j$(PARALLEL_JOBS) -q -d+1 \
	--user-config=$(@D)/user-config.jam \
	$(BOOST_OPTS) \
	--prefix=$(TARGET_DIR)/usr \
	--ignore-site-config \
	--layout=$(BOOST_LAYOUT) install )
endef

define HOST_BOOST_BUILD_CMDS
	(cd $(@D) && ./b2 -j$(PARALLEL_JOBS) -q -d+1 \
	--user-config=$(@D)/user-config.jam \
	$(HOST_BOOST_OPTS) \
	--ignore-site-config \
	--prefix=$(HOST_DIR)/usr )
endef

define HOST_BOOST_INSTALL_CMDS
	(cd $(@D) && ./b2 -j$(PARALLEL_JOBS) -q -d+1 \
	--user-config=$(@D)/user-config.jam \
	$(HOST_BOOST_OPTS) \
	--prefix=$(HOST_DIR)/usr \
	--ignore-site-config \
	--layout=$(BOOST_LAYOUT) install )
endef

define BOOST_INSTALL_STAGING_CMDS
	(cd $(@D) && ./bjam -j$(PARALLEL_JOBS) -d+1 \
	--user-config=$(@D)/user-config.jam \
	$(BOOST_OPTS) \
	--prefix=$(STAGING_DIR)/usr \
	--ignore-site-config \
	--layout=$(BOOST_LAYOUT) install)
endef

$(eval $(generic-package))
$(eval $(host-generic-package))