|
1 # |
|
2 # CDDL HEADER START |
|
3 # |
|
4 # The contents of this file are subject to the terms of the |
|
5 # Common Development and Distribution License (the "License"). |
|
6 # You may not use this file except in compliance with the License. |
|
7 # |
|
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
9 # or http://www.opensolaris.org/os/licensing. |
|
10 # See the License for the specific language governing permissions |
|
11 # and limitations under the License. |
|
12 # |
|
13 # When distributing Covered Code, include this CDDL HEADER in each |
|
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
15 # If applicable, add the following below this CDDL HEADER, with the |
|
16 # fields enclosed by brackets "[]" replaced with your own identifying |
|
17 # information: Portions Copyright [yyyy] [name of copyright owner] |
|
18 # |
|
19 # CDDL HEADER END |
|
20 # |
|
21 # Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
|
22 # |
|
23 include ../../make-rules/shared-macros.mk |
|
24 |
|
25 PATH=$(dir $(CC)):/usr/gnu/bin:/usr/bin |
|
26 |
|
27 COMPONENT_NAME= stdcxx |
|
28 COMPONENT_VERSION= 4.2.1 |
|
29 COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION) |
|
30 COMPONENT_PROJECT_URL= http://stdcxx.apache.org/ |
|
31 COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.gz |
|
32 COMPONENT_ARCHIVE_HASH= sha1:38efa30958222b2733f22098b3db09161d2e6c8c |
|
33 COMPONENT_ARCHIVE_URL= http://www.apache.org/dist/stdcxx/$(COMPONENT_ARCHIVE) |
|
34 |
|
35 include ../../make-rules/prep.mk |
|
36 include ../../make-rules/configure.mk |
|
37 include ../../make-rules/ips.mk |
|
38 |
|
39 ISA_PATCH_DIR_32 = $(WS_TOP)/components/stdcxx/isa_patches/$(MACH) |
|
40 ISA_PATCH_DIR_64 = $(WS_TOP)/components/stdcxx/isa_patches/$(MACH64) |
|
41 ISA_PATCH_DIR = $(ISA_PATCH_DIR_$(BITS)) |
|
42 |
|
43 ISA_PATCHES_$(MACH) = \ |
|
44 $(ISA_PATCH_DIR)/1034-sunpro.config.$(MACH).patch \ |
|
45 $(ISA_PATCH_DIR)/1035-GNUmakefile.tst.$(MACH).patch \ |
|
46 $(ISA_PATCH_DIR)/1036-GNUmakefile.rwt.$(MACH).patch \ |
|
47 $(ISA_PATCH_DIR)/1037-GNUmakefile.lib.$(MACH).patch \ |
|
48 $(ISA_PATCH_DIR)/1038-GNUmakefile.ph.$(MACH).patch \ |
|
49 $(ISA_PATCH_DIR)/1039-GNUmakefile.exm.$(MACH).patch \ |
|
50 $(ISA_PATCH_DIR)/1040-GNUmakefile.cfg.$(MACH).patch \ |
|
51 $(ISA_PATCH_DIR)/1041-GNUmakefile.bin.$(MACH).patch |
|
52 |
|
53 ISA_PATCHES_$(MACH64) = \ |
|
54 $(ISA_PATCH_DIR)/1034-sunpro.config.$(MACH64).patch \ |
|
55 $(ISA_PATCH_DIR)/1035-GNUmakefile.tst.$(MACH64).patch \ |
|
56 $(ISA_PATCH_DIR)/1036-GNUmakefile.rwt.$(MACH64).patch \ |
|
57 $(ISA_PATCH_DIR)/1037-GNUmakefile.lib.$(MACH64).patch \ |
|
58 $(ISA_PATCH_DIR)/1038-GNUmakefile.ph.$(MACH64).patch \ |
|
59 $(ISA_PATCH_DIR)/1039-GNUmakefile.exm.$(MACH64).patch \ |
|
60 $(ISA_PATCH_DIR)/1040-GNUmakefile.cfg.$(MACH64).patch \ |
|
61 $(ISA_PATCH_DIR)/1041-GNUmakefile.bin.$(MACH64).patch |
|
62 |
|
63 ISA_PATCHES_32 = $(ISA_PATCHES_$(MACH)) |
|
64 ISA_PATCHES_64 = $(ISA_PATCHES_$(MACH64)) |
|
65 ISA_PATCHES = $(ISA_PATCHES_$(BITS)) |
|
66 |
|
67 PATCH_LEVEL = 1 |
|
68 |
|
69 TOPDIR = $(COMPONENT_DIR)/$(COMPONENT_SRC) |
|
70 LOCAL_BUILDDIR = $(TOPDIR)/build |
|
71 MARG = -m$(BITS) |
|
72 PICFLAG = -KPIC -DPIC |
|
73 |
|
74 # Please see the README file in this directory for a detailed explanation |
|
75 # about these flags, what they do, and why we need them. |
|
76 FLAGS_sparc = -m32 -xarch=sparcvis -xmemalign=8i |
|
77 FLAGS_sparcv9 = -m64 -xarch=sparcvis -xmemalign=16i |
|
78 FLAGS_i386 = -m32 -xarch=386 |
|
79 FLAGS_amd64 = -m64 -xarch=generic |
|
80 CFLAGS_sparc = -Xc -features=extinl -xvis=yes |
|
81 CFLAGS_sparc += -xregs=no%appl -xbuiltin=%none -xO4 $(PICFLAG) |
|
82 CFLAGS_i386 = -Xc -features=extinl -xregs=no%frameptr |
|
83 CFLAGS_i386 += -xO3 -xbuiltin=%none $(PICFLAG) |
|
84 |
|
85 CFLAGS_32 = $(FLAGS_$(MACH)) $(CFLAGS_$(MACH)) |
|
86 CFLAGS_64 = $(FLAGS_$(MACH64)) $(CFLAGS_$(MACH)) |
|
87 |
|
88 CXXFLAGS_sparc = -xvis=yes -xregs=no%appl -xO4 |
|
89 CXXFLAGS_sparc += -xbuiltin=%none $(PICFLAG) |
|
90 CXXFLAGS_i386 = -xregs=no%frameptr -xO3 -xbuiltin=%none $(PICFLAG) |
|
91 CFLAGS_GENERIC += -xc99=%all |
|
92 CFLAGS_GENERIC += -mt -D_REENTRANT -DNDEBUG |
|
93 CFLAGS_GENERIC += -D__EXTENSIONS__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 |
|
94 CFLAGS_GENERIC += -D_XPG6 -D_XOPEN_SOURCE=600 -D_POSIX_PTHREAD_SEMANTICS |
|
95 CFLAGS_GENERIC += -D_POSIX_C_SOURCE=200112L -D__XOPEN_OR_POSIX |
|
96 CFLAGS_GENERIC += -D_STRICT_STDC -D_STRICT_STDC__ -D_STDC_C99 -D_ISOC99_SOURCE |
|
97 CFLAGS_GENERIC += -D_IN_BUILD_STDCXX |
|
98 CFLAGS_GENERIC += $(CFLAGS_$(BITS)) |
|
99 CFLAGS = $(CFLAGS_GENERIC) |
|
100 |
|
101 CXXFLAGS_GENERIC = -library=Cstd -library=Crun -norunpath |
|
102 CXXFLAGS_GENERIC += -Qoption ccfe ++boolflag:sunwcch=false |
|
103 CXXFLAGS_GENERIC += -Qoption ccfe +d2,-xgeninl=system |
|
104 CXXFLAGS_GENERIC += -Qoption ccfe -expand=10000 |
|
105 CXXFLAGS_GENERIC += -features=except,rtti,export,extensions,nestedaccess,tmplife,tmplrefstatic |
|
106 CXXFLAGS_GENERIC += -instances=global |
|
107 CXXFLAGS_GENERIC += -template=geninlinefuncs |
|
108 CXXFLAGS_GENERIC += -verbose=template |
|
109 CXXFLAGS_GENERIC += $(CXXFLAGS_$(MACH)) |
|
110 CXXFLAGS_GENERIC += -xlang=c99 |
|
111 CXXFLAGS_GENERIC += -xbuiltin=%none |
|
112 CXXFLAGS_GENERIC += -xinline= |
|
113 CXXFLAGS_GENERIC += -xlibmieee |
|
114 CXXFLAGS_GENERIC += -xustr=ascii_utf16_ushort |
|
115 CXXFLAGS_GENERIC += -z ignore $(PICFLAG) |
|
116 CXXFLAGS_GENERIC += -mt -D_REENTRANT -DNDEBUG |
|
117 CXXFLAGS_GENERIC += -D_IN_BUILD_STDCXX |
|
118 CXXFLAGS_GENERIC += -D__EXTENSIONS__ |
|
119 CXXFLAGS_GENERIC += -D_LARGEFILE_SOURCE |
|
120 CXXFLAGS_GENERIC += -D_FILE_OFFSET_BITS=64 |
|
121 CXXFLAGS_GENERIC += -D_XOPEN_SOURCE=500 |
|
122 CXXFLAGS_GENERIC += -D_XPG5 |
|
123 CXXFLAGS_GENERIC += -D_POSIX_PTHREAD_SEMANTICS -s |
|
124 CXXFLAGS_GENERIC += +w2 -errtags -erroff=hidef |
|
125 |
|
126 CXXFLAGS_32 = $(FLAGS_$(MACH)) |
|
127 CXXFLAGS_64 = $(FLAGS_$(MACH64)) |
|
128 |
|
129 CXXFLAGS = $(CXXFLAGS_$(BITS)) $(CXXFLAGS_$(MACH)) $(CXXFLAGS_GENERIC) |
|
130 |
|
131 CPPFLAGS = -I$(TOPDIR)/include/ansi |
|
132 CPPFLAGS += -I$(TOPDIR)/include/tr1 |
|
133 CPPFLAGS += -I$(TOPDIR)/include |
|
134 |
|
135 # -mt will automatically pass -lthread unless we pass -lpthread |
|
136 # on link line. -lthread causes regressions. see man CC(1) and -mt. |
|
137 # -lumem must be passed before -lc. |
|
138 LDFLAGS = -lpthread -lumem -lm -lc -s -z ignore |
|
139 |
|
140 # We cannot have -B direct |
|
141 LD_OPTIONS = -M /usr/lib/ld/map.noexstk -M /usr/lib/ld/map.noexdata |
|
142 LD_OPTIONS += -M /usr/lib/ld/map.pagealign |
|
143 LD_OPTIONS += -lpthread -lumem -lm -lc -s -z ignore |
|
144 |
|
145 # If I name it NLSPATH, gmake insists on getting its value from the |
|
146 # running environment. Also, it all has to be on one line. += prepends |
|
147 # a whitespace. |
|
148 BUILD_NLSPATH = :%N.cat:/usr/lib/locale/%L/%N.cat:/usr/share/locale/%L/%N.cat:$(BUILD_DIR_$(BITS))/lib/rwstderr.cat |
|
149 |
|
150 CONFIGURE_ENV = CC="$(CC)" |
|
151 CONFIGURE_ENV += CXX="$(CXX)" |
|
152 CONFIGURE_ENV += CFLAGS="$(CFLAGS)" |
|
153 CONFIGURE_ENV += CPPFLAGS="$(CPPFLAGS)" |
|
154 CONFIGURE_ENV += CXXFLAGS="$(CXXFLAGS)" |
|
155 CONFIGURE_ENV += LDFLAGS="$(LDFLAGS)" |
|
156 CONFIGURE_ENV += LD_OPTIONS="$(LD_OPTIONS)" |
|
157 CONFIGURE_ENV += LD="$(CXX) $(CXXFLAGS) $(LDFLAGS)" |
|
158 CONFIGURE_ENV += MAKE="$(MAKE)" |
|
159 CONFIGURE_ENV += TOPDIR="$(TOPDIR)" |
|
160 CONFIGURE_ENV += MAKEFLAGS="" |
|
161 |
|
162 CONFIGURE_OPTIONS = $(MARG) |
|
163 CONFIGURE_OPTIONS += -topdir=$(TOPDIR) |
|
164 CONFIGURE_OPTIONS += -builddir=$(LOCAL_BUILDDIR) |
|
165 |
|
166 GCP = /usr/gnu/bin/cp |
|
167 |
|
168 COMPONENT_BUILD_ENV = MAKEFLAGS="" |
|
169 COMPONENT_BUILD_ENV += MAKELEVEL="" |
|
170 COMPONENT_BUILD_ENV += SHELL="/bin/bash" |
|
171 COMPONENT_BUILD_ENV += NLSPATH="$(BUILD_NLSPATH)" |
|
172 |
|
173 PKG_PROTO_DIRS += $(COMPONENT_DIR)/$(COMPONENT_SRC)-32 |
|
174 PKG_PROTO_DIRS += $(COMPONENT_DIR)/$(COMPONENT_SRC)-64 |
|
175 |
|
176 COMPONENT_PREP_ACTION = \ |
|
177 ( if test -f $(TOPDIR)/.unpacked ; then \ |
|
178 cd $(TOPDIR) ; \ |
|
179 else $(UNPACK) $(UNPACK_ARGS) $(COMPONENT_ARCHIVE) ; \ |
|
180 $(TOUCH) $(TOPDIR)/.unpacked ; \ |
|
181 cd $(TOPDIR) ; \ |
|
182 fi ; \ |
|
183 list='$(ISA_PATCHES)' ; for f in $$list ; do \ |
|
184 $(GPATCH) $(GPATCH_FLAGS) <$$f ; \ |
|
185 done ) |
|
186 |
|
187 COMPONENT_PRE_CONFIGURE_ACTION = \ |
|
188 ( if test -f $(TOPDIR)/.unpacked ; then \ |
|
189 cd $(TOPDIR) ; \ |
|
190 else $(UNPACK) $(UNPACK_ARGS) $(COMPONENT_ARCHIVE) ; \ |
|
191 $(TOUCH) $(TOPDIR)/.unpacked ; \ |
|
192 cd $(TOPDIR) ; \ |
|
193 list1='$(ISA_PATCHES)' ; for f in $$list1 ; do \ |
|
194 $(GPATCH) $(GPATCH_FLAGS) <$$f ; \ |
|
195 done ; \ |
|
196 list2='$(PATCHES)' ; for f in $$list2 ; do \ |
|
197 $(GPATCH) $(GPATCH_FLAGS) <$(COMPONENT_DIR)/$$f ; \ |
|
198 done ; \ |
|
199 $(TOUCH) $(TOPDIR)/.patched ; \ |
|
200 fi ; \ |
|
201 $(CP) -Rp $(COMPONENT_DIR)/Solaris . ; \ |
|
202 $(CP) -p ./Solaris/configure . ; \ |
|
203 $(TOUCH) -acm ./configure ; \ |
|
204 $(CHMOD) 0755 ./configure ) |
|
205 |
|
206 COMPONENT_POST_CONFIGURE_ACTION = \ |
|
207 ( $(CLONEY) $(TOPDIR) $(@D) ; \ |
|
208 find ./$(COMPONENT_SRC) -type f -name "*.~1~" \ |
|
209 -exec chmod 0644 {} \; > /dev/null 2>&1 ) |
|
210 |
|
211 COMPONENT_POST_BUILD_ACTION = \ |
|
212 ( cd $(BUILD_DIR_$(BITS))/build ; \ |
|
213 $(GMAKE) locales ; \ |
|
214 cd $(TOPDIR) ; \ |
|
215 $(CP) -p $(COMPONENT_DIR)/Solaris/fix_nls_symlinks.sh . ; \ |
|
216 $(CHMOD) 0755 fix_nls_symlinks.sh ; \ |
|
217 $(SHELL) ./fix_nls_symlinks.sh ; \ |
|
218 cd $(COMPONENT_DIR) ; \ |
|
219 $(GCP) -rpd $(COMPONENT_SRC) $(COMPONENT_SRC)-$(BITS) ; \ |
|
220 $(RM) -rf $(COMPONENT_SRC) ) |
|
221 |
|
222 build: $(BUILD_32) $(BUILD_64) |
|
223 |
|
224 install: $(BUILD_DIR_32)/.built $(BUILD_DIR_64)/.built |
|
225 $(CP) $(COMPONENT_DIR)/Solaris/install.sh $(COMPONENT_DIR)/ |
|
226 $(CHMOD) 0755 $(COMPONENT_DIR)/install.sh |
|
227 $(MKDIR) $(PROTO_DIR)/usr |
|
228 ( $(SHELL) $(COMPONENT_DIR)/install.sh \ |
|
229 -prefix=$(PROTO_DIR)/usr \ |
|
230 -builddir=$(BUILD_DIR_32) \ |
|
231 -componentdir=$(COMPONENT_DIR) \ |
|
232 -componentsrc=$(COMPONENT_SRC) \ |
|
233 -srcdir=$(TOPDIR)-32 ) |
|
234 ( $(SHELL) $(COMPONENT_DIR)/install.sh \ |
|
235 -prefix=$(PROTO_DIR)/usr \ |
|
236 -builddir=$(BUILD_DIR_64) \ |
|
237 -componentdir=$(COMPONENT_DIR) \ |
|
238 -componentsrc=$(COMPONENT_SRC) \ |
|
239 -srcdir=$(TOPDIR)-64 \ |
|
240 -mach64=$(MACH64) ) |
|
241 test -d $(TOPDIR) || $(MKDIR) $(TOPDIR) |
|
242 |
|
243 test: |
|
244 test -d $(BUILD_DIR_32) || echo "$(BUILD_DIR_32) does not exist!" |
|
245 test -d $(BUILD_DIR_64) || echo "$(BUILD_DIR_64) does not exist!" |
|
246 $(CP) -p $(COMPONENT_DIR)/Solaris/prep_build_area.sh \ |
|
247 $(COMPONENT_DIR)/ |
|
248 $(CHMOD) 0755 $(COMPONENT_DIR)/prep_build_area.sh |
|
249 $(SHELL) $(COMPONENT_DIR)/prep_build_area.sh -m32 \ |
|
250 -builddir=$(BUILD_DIR_32) \ |
|
251 -srcdir=$(TOPDIR)-32 |
|
252 $(SHELL) $(COMPONENT_DIR)/prep_build_area.sh -m64 \ |
|
253 -builddir=$(BUILD_DIR_64) \ |
|
254 -srcdir=$(TOPDIR)-64 |
|
255 ( cd $(BUILD_DIR_32)/build/tests ; \ |
|
256 $(CP) -p $(COMPONENT_DIR)/Solaris/run_tests.sh . ; \ |
|
257 $(CHMOD) 0755 run_tests.sh ; \ |
|
258 $(SHELL) ./run_tests.sh > \ |
|
259 $(COMPONENT_DIR)/runtests-$(MACH).out 2>&1 ) |
|
260 ( cd $(BUILD_DIR_64)/build/tests ; \ |
|
261 $(CP) -p $(COMPONENT_DIR)/Solaris/run_tests.sh . ; \ |
|
262 $(CHMOD) 0755 run_tests.sh ; \ |
|
263 $(SHELL) ./run_tests.sh > \ |
|
264 $(COMPONENT_DIR)/runtests-$(MACH64).out 2>&1 ) |
|
265 |
|
266 clean:: |
|
267 $(RM) -r $(COMPONENT_SRC) $(COMPONENT_SRC)-32 $(COMPONENT_SRC)-64 |
|
268 $(RM) -f *.sed *.out |
|
269 |
|
270 BUILD_PKG_DEPENDENCIES = $(BUILD_TOOLS) |
|
271 |
|
272 include ../../make-rules/depend.mk |
|
273 |