Marcel Telka
2024-04-02 327b05574f0dc1b1046c72401256ce5afd3e3247
commit | author | age
dbd699 1 #
AL 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.
5 #
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.
9 #
10
11 #
12 # Copyright 2019 Aurelien Larcher
13 #
14
15 GCC_COMPONENT_VERSION_MAJOR = $(shell echo $(COMPONENT_VERSION) | $(NAWK) -F. '{print $$1}')
16
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
22
23 GCC_COMPONENT_PREFIX = /usr/gcc/$(GCC_COMPONENT_VERSION_MAJOR)
24
25 #
26 # Define default component variables for upstream GCC
27 #
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
50d32f 38 COMPONENT_PROJECT_URL = https://gcc.gnu.org/
dbd699 39 COMPONENT_SRC ?= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
AL 40 COMPONENT_ARCHIVE ?= $(COMPONENT_SRC).tar.xz
41 COMPONENT_ARCHIVE_URL ?= \
50d32f 42   https://ftp.gnu.org/gnu/gcc/gcc-$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
dbd699 43
AL 44 PATCH_EACH_ARCHIVE=1
45 PATCHDIR_PATCHES = $(shell find $(PATCH_DIR) -type f -name '$(PATCH_PATTERN)' \
a99182 46                                 2>/dev/null | $(SORT))
dbd699 47
AL 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
50d32f 57 COMPONENT_ARCHIVE_URL_1= https://www.mpfr.org/$(COMPONENT_SRC_1)/$(COMPONENT_ARCHIVE_1)
dbd699 58 COMPONENT_ARCHIVE_HASH_1= $(MPFR_ARCHIVE_HASH)
AL 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) )
61
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
50d32f 71 COMPONENT_ARCHIVE_URL_2=  https://ftp.gnu.org/gnu/mpc/$(COMPONENT_ARCHIVE_2)
dbd699 72 COMPONENT_ARCHIVE_HASH_2= $(MPC_ARCHIVE_HASH)
AL 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) )
75
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
50d32f 85 COMPONENT_ARCHIVE_URL_3=  https://ftp.gnu.org/gnu/gmp/$(COMPONENT_ARCHIVE_3)
dbd699 86 COMPONENT_ARCHIVE_HASH_3= $(GMP_ARCHIVE_HASH)
AL 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) )
89
90 BUILD_STYLE=configure
91
92 include $(WS_MAKE_RULES)/common.mk
93
94 PATH=$(PATH.gnu)
95
96 CC_BITS=
97 CFLAGS= -O2
98 CXXFLAGS= -O2
99 FCFLAGS= -O2
100
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
191f9f 104 COMMON_ENV+= STRIP="/usr/bin/strip -x"
RL 105 COMMON_ENV+= STRIP_FOR_TARGET="/usr/bin/strip -x"
dbd699 106 COMMON_ENV+= LD=/usr/bin/ld
AL 107
108 CONFIGURE_ENV+= $(COMMON_ENV)
109 COMPONENT_BUILD_ENV+= $(COMMON_ENV)
110 COMPONENT_INSTALL_ENV+= $(COMMON_ENV)
111
112 CONFIGURE_PREFIX=$(GCC_COMPONENT_PREFIX)
113
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"
123
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
128
af2a25 129 # If the compiler used to build matches the compiler being built, there is no
AL 130 # need for a 3 stage build.
72d1ee 131 CONFIGURE_OPTIONS += $(if $(strip $(shell $(CC) --version | grep $(COMPONENT_VERSION))),--disable-bootstrap,)
MT 132 COMPONENT_BUILD_TARGETS = $(if $(strip $(shell $(CC) --version | grep $(COMPONENT_VERSION))),,bootstrap)
af2a25 133
7501eb 134 # The Sun Assembler is only used on SPARC gates.
K 135 CONFIGURE_OPTIONS+= --with-gnu-as --with-as=/usr/bin/gas
dbd699 136
AL 137 # Set path to library install prefix
138 CONFIGURE_OPTIONS+= LDFLAGS="-R$(CONFIGURE_PREFIX)/lib"
139
191f9f 140 # Strip the resulting binaries
RL 141 COMPONENT_INSTALL_TARGETS = install-strip
142
dbd699 143 COMPONENT_POST_INSTALL_ACTION = \
AL 144   $(RM) -r $(PROTO_DIR)$(CONFIGURE_PREFIX)/lib/gcc/$(GNU_TRIPLET)/$(COMPONENT_VERSION)/include-fixed
145
146 unexport SHELLOPTS
147
148 #
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.
152 #
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.
159 #
32fa27 160 ifeq   ($(strip $(MACH)),i386)
dbd699 161 COMPONENT_PRE_TEST_ACTION += \
AL 162     (cd $(COMPONENT_TEST_DIR) ; \
163      ulimit -Ss 16385 ; \
164      $(ENV) $(COMPONENT_PRE_TEST_ENV) \
f4a93f 165             $(GMAKE) -k -i $(JOBS:%=-j%) check RUNTESTFLAGS="--target_board=unix/-m64\{,-msave-args\}" ; \
dbd699 166      $(FIND) . -name  '*.sum' | while read f; do \
AL 167             gsed -e '1,/^Running target unix/p' -e  'd' $f > $f.2; \
a99182 168             gsed -e '/^Running target unix/,/Summary ===$/p' -e  'd' $f | grep  '^.*: ' | $(SORT) -k 2 >> $f.2; \
dbd699 169             gsed -e '/Summary ===$/,$p' -e  'd' $f >> $f.2; \
AL 170             mv $f.2 $f; done; \
171      $(GMAKE) mail-report.log)
32fa27 172 else
K 173 COMPONENT_PRE_TEST_ACTION += \
174     (cd $(COMPONENT_TEST_DIR) ; \
175      ulimit -Ss 16385 ; \
176      $(ENV) $(COMPONENT_PRE_TEST_ENV) \
f4a93f 177             $(GMAKE) -k -i $(JOBS:%=-j%) check RUNTESTFLAGS="--target_board=unix/-m64" ; \
32fa27 178      $(FIND) . -name  '*.sum' | while read f; do \
K 179             gsed -e '1,/^Running target unix/p' -e  'd' $f > $f.2; \
a99182 180             gsed -e '/^Running target unix/,/Summary ===$/p' -e  'd' $f | grep  '^.*: ' | $(SORT) -k 2 >> $f.2; \
32fa27 181             gsed -e '/Summary ===$/,$p' -e  'd' $f >> $f.2; \
K 182             mv $f.2 $f; done; \
183      $(GMAKE) mail-report.log)
184 endif
dbd699 185
AL 186 COMPONENT_TEST_CMD = $(CAT)
187 COMPONENT_TEST_TARGETS = mail-report.log
188
189 # Master test results are different between x86 and SPARC.
190 COMPONENT_TEST_MASTER = \
191     $(COMPONENT_TEST_RESULTS_DIR)/results-$(MACH).master
192
193 # Required by the test suite
f53000 194 TEST_REQUIRED_PACKAGES += developer/test/dejagnu
MT 195 TEST_REQUIRED_PACKAGES += developer/build/autoconf-archive
196 TEST_REQUIRED_PACKAGES += developer/build/autogen
197 TEST_REQUIRED_PACKAGES += system/extended-system-utilities