fastfetch: update to 2.30.1
[oi-userland.git] / make-rules / gcc-component.mk
blobbda1256f1bca400c27408cc42ef092d285c5e8aa
2 # This file and its contents are supplied under the terms of the
3 # Common Development and Distribution License ("CDDL"). You may
4 # only use this file in accordance with the terms of the CDDL.
6 # A full copy of the text of the CDDL should have accompanied this
7 # source. A copy of the CDDL is also available via the Internet at
8 # http://www.illumos.org/license/CDDL.
12 # Copyright 2019 Aurelien Larcher
15 GCC_COMPONENT_VERSION_MAJOR = $(shell echo $(COMPONENT_VERSION) | $(NAWK) -F. '{print $$1}')
17 ifeq ($(strip $(ILLUMOS_GCC_REVISION)),)
18 GCC_COMPONENT_STRING_VERSION = $(COMPONENT_VERSION)-oi-$(COMPONENT_REVISION)
19 else
20 GCC_COMPONENT_STRING_VERSION = $(COMPONENT_VERSION)-il-$(ILLUMOS_GCC_REVISION)
21 endif
23 GCC_COMPONENT_PREFIX = /usr/gcc/$(GCC_COMPONENT_VERSION_MAJOR)
26 # Define default component variables for upstream GCC
28 ifeq ($(strip $(COMPONENT_VERSION)),)
29 $(error Empty GCC version)
30 endif
31 ifeq ($(strip $(COMPONENT_ARCHIVE_HASH)),)
32 $(error Empty GCC archive hash)
33 endif
34 COMPONENT_NAME= gcc
35 COMPONENT_FMRI= developer/gcc-$(GCC_COMPONENT_VERSION_MAJOR)
36 COMPONENT_SUMMARY= GNU Compiler Collection
37 COMPONENT_CLASSIFICATION= Development/C
38 COMPONENT_PROJECT_URL = https://gcc.gnu.org/
39 COMPONENT_SRC ?= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
40 COMPONENT_ARCHIVE ?= $(COMPONENT_SRC).tar.xz
41 COMPONENT_ARCHIVE_URL ?= \
42 https://ftp.gnu.org/gnu/gcc/gcc-$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
44 PATCH_EACH_ARCHIVE=1
45 PATCHDIR_PATCHES = $(shell find $(PATCH_DIR) -type f -name '$(PATCH_PATTERN)' \
46 2>/dev/null | $(SORT))
48 MPFR_NAME= mpfr
49 ifeq ($(strip $(MPFR_VERSION)),)
50 $(error Empty MPFR version)
51 endif
52 ifeq ($(strip $(MPFR_ARCHIVE_HASH)),)
53 $(error Empty MPFR archive hash)
54 endif
55 COMPONENT_SRC_1= $(MPFR_NAME)-$(MPFR_VERSION)
56 COMPONENT_ARCHIVE_1= $(COMPONENT_SRC_1).tar.bz2
57 COMPONENT_ARCHIVE_URL_1= https://www.mpfr.org/$(COMPONENT_SRC_1)/$(COMPONENT_ARCHIVE_1)
58 COMPONENT_ARCHIVE_HASH_1= $(MPFR_ARCHIVE_HASH)
59 CLEAN_PATHS += $(COMPONENT_SRC_1)
60 COMPONENT_POST_UNPACK_ACTION_1 += ( $(RM) -r $(COMPONENT_SRC)/$(MPFR_NAME) && $(CP) -rpP $(COMPONENT_SRC_1) $(COMPONENT_SRC)/$(MPFR_NAME) )
62 MPC_NAME=mpc
63 ifeq ($(strip $(MPC_VERSION)),)
64 $(error Empty MPC version)
65 endif
66 ifeq ($(strip $(MPC_ARCHIVE_HASH)),)
67 $(error Empty MPC archive hash)
68 endif
69 COMPONENT_SRC_2= $(MPC_NAME)-$(MPC_VERSION)
70 COMPONENT_ARCHIVE_2= $(COMPONENT_SRC_2).tar.gz
71 COMPONENT_ARCHIVE_URL_2= https://ftp.gnu.org/gnu/mpc/$(COMPONENT_ARCHIVE_2)
72 COMPONENT_ARCHIVE_HASH_2= $(MPC_ARCHIVE_HASH)
73 CLEAN_PATHS += $(COMPONENT_SRC_2)
74 COMPONENT_POST_UNPACK_ACTION_2 += ( $(RM) -r $(COMPONENT_SRC)/$(MPC_NAME) && $(CP) -rpP $(COMPONENT_SRC_2) $(COMPONENT_SRC)/$(MPC_NAME) )
76 GMP_NAME=gmp
77 ifeq ($(strip $(GMP_VERSION)),)
78 $(error Empty GMP version)
79 endif
80 ifeq ($(strip $(GMP_ARCHIVE_HASH)),)
81 $(error Empty GMP archive hash)
82 endif
83 COMPONENT_SRC_3= $(GMP_NAME)-$(GMP_VERSION)
84 COMPONENT_ARCHIVE_3= $(COMPONENT_SRC_3).tar.bz2
85 COMPONENT_ARCHIVE_URL_3= https://ftp.gnu.org/gnu/gmp/$(COMPONENT_ARCHIVE_3)
86 COMPONENT_ARCHIVE_HASH_3= $(GMP_ARCHIVE_HASH)
87 CLEAN_PATHS += $(COMPONENT_SRC_3)
88 COMPONENT_POST_UNPACK_ACTION_3 += ( $(RM) -r $(COMPONENT_SRC)/$(GMP_NAME) && $(CP) -rpP $(COMPONENT_SRC_3) $(COMPONENT_SRC)/$(GMP_NAME) )
90 BUILD_STYLE=configure
92 include $(WS_MAKE_RULES)/common.mk
94 PATH=$(PATH.gnu)
96 CC_BITS=
97 CFLAGS= -O2
98 CXXFLAGS= -O2
99 FCFLAGS= -O2
101 COMMON_ENV= LD_OPTIONS="-zignore -zcombreloc -i"
102 COMMON_ENV+= LD_FOR_TARGET=/usr/bin/ld
103 COMMON_ENV+= LD_FOR_HOST=/usr/bin/ld
104 COMMON_ENV+= STRIP="/usr/bin/strip -x"
105 COMMON_ENV+= STRIP_FOR_TARGET="/usr/bin/strip -x"
106 COMMON_ENV+= LD=/usr/bin/ld
108 CONFIGURE_ENV+= $(COMMON_ENV)
109 COMPONENT_BUILD_ENV+= $(COMMON_ENV)
110 COMPONENT_INSTALL_ENV+= $(COMMON_ENV)
112 CONFIGURE_PREFIX=$(GCC_COMPONENT_PREFIX)
114 # General options
115 CONFIGURE_OPTIONS+= --sbindir=$(CONFIGURE_BINDIR.$(BITS))
116 CONFIGURE_OPTIONS+= --libdir=$(CONFIGURE_LIBDIR.$(BITS))
117 CONFIGURE_OPTIONS+= --libexecdir=$(CONFIGURE_LIBDIR.$(BITS))
118 CONFIGURE_OPTIONS+= --host $(GNU_TRIPLET)
119 CONFIGURE_OPTIONS+= --build $(GNU_TRIPLET)
120 CONFIGURE_OPTIONS+= --target $(GNU_TRIPLET)
121 CONFIGURE_OPTIONS+= --with-pkgversion="OpenIndiana $(GCC_COMPONENT_STRING_VERSION)"
122 CONFIGURE_OPTIONS+= --with-bugurl="https://bugs.openindiana.org"
124 # Toolchain options
125 CONFIGURE_OPTIONS+= --without-gnu-ld
126 CONFIGURE_OPTIONS+= --with-ld=/usr/bin/ld
127 CONFIGURE_OPTIONS+= --with-build-time-tools=/usr/gnu/$(GNU_TRIPLET)/bin
129 # If the compiler used to build matches the compiler being built, there is no
130 # need for a 3 stage build.
131 CONFIGURE_OPTIONS += $(if $(strip $(shell $(CC) --version | grep $(COMPONENT_VERSION))),--disable-bootstrap,)
132 COMPONENT_BUILD_TARGETS = $(if $(strip $(shell $(CC) --version | grep $(COMPONENT_VERSION))),,bootstrap)
134 # The Sun Assembler is only used on SPARC gates.
135 CONFIGURE_OPTIONS+= --with-gnu-as --with-as=/usr/bin/gas
137 # Set path to library install prefix
138 CONFIGURE_OPTIONS+= LDFLAGS="-R$(CONFIGURE_PREFIX)/lib"
140 # Strip the resulting binaries
141 COMPONENT_INSTALL_TARGETS = install-strip
143 COMPONENT_POST_INSTALL_ACTION = \
144 $(RM) -r $(PROTO_DIR)$(CONFIGURE_PREFIX)/lib/gcc/$(GNU_TRIPLET)/$(COMPONENT_VERSION)/include-fixed
146 unexport SHELLOPTS
149 # Run the tests and generate a summary report, then output the summary
150 # report into the results file. Note that list of reported tests is sorted
151 # to allow parallel test run.
153 # To ensure that all tests that are expected to pass actually
154 # pass, we have to increase the stacksize limit to at least
155 # 16MB. Otherwise we'll get spurious failures in the test
156 # harness (gcc.c-torture/compile/limits-exprparen.c and others).
157 # With the soft stacksize limit set to 16384 we get reasonably good
158 # test results.
160 ifeq ($(strip $(MACH)),i386)
161 COMPONENT_PRE_TEST_ACTION += \
162 (cd $(COMPONENT_TEST_DIR) ; \
163 ulimit -Ss 16385 ; \
164 $(ENV) $(COMPONENT_PRE_TEST_ENV) \
165 $(GMAKE) -k -i $(JOBS:%=-j%) check RUNTESTFLAGS="--target_board=unix/-m64\{,-msave-args\}" ; \
166 $(FIND) . -name '*.sum' | while read f; do \
167 gsed -e '1,/^Running target unix/p' -e 'd' $f > $f.2; \
168 gsed -e '/^Running target unix/,/Summary ===$/p' -e 'd' $f | grep '^.*: ' | $(SORT) -k 2 >> $f.2; \
169 gsed -e '/Summary ===$/,$p' -e 'd' $f >> $f.2; \
170 mv $f.2 $f; done; \
171 $(GMAKE) mail-report.log)
172 else
173 COMPONENT_PRE_TEST_ACTION += \
174 (cd $(COMPONENT_TEST_DIR) ; \
175 ulimit -Ss 16385 ; \
176 $(ENV) $(COMPONENT_PRE_TEST_ENV) \
177 $(GMAKE) -k -i $(JOBS:%=-j%) check RUNTESTFLAGS="--target_board=unix/-m64" ; \
178 $(FIND) . -name '*.sum' | while read f; do \
179 gsed -e '1,/^Running target unix/p' -e 'd' $f > $f.2; \
180 gsed -e '/^Running target unix/,/Summary ===$/p' -e 'd' $f | grep '^.*: ' | $(SORT) -k 2 >> $f.2; \
181 gsed -e '/Summary ===$/,$p' -e 'd' $f >> $f.2; \
182 mv $f.2 $f; done; \
183 $(GMAKE) mail-report.log)
184 endif
186 COMPONENT_TEST_CMD = $(CAT)
187 COMPONENT_TEST_TARGETS = mail-report.log
189 # Master test results are different between x86 and SPARC.
190 COMPONENT_TEST_MASTER = \
191 $(COMPONENT_TEST_RESULTS_DIR)/results-$(MACH).master
193 # Required by the test suite
194 TEST_REQUIRED_PACKAGES += developer/test/dejagnu
195 TEST_REQUIRED_PACKAGES += developer/build/autoconf-archive
196 TEST_REQUIRED_PACKAGES += developer/build/autogen
197 TEST_REQUIRED_PACKAGES += system/extended-system-utilities