| 1 |
operz |
27 |
# vim: ft=make ts=4 sw=4 noet |
| 2 |
|
|
.DEFAULT_GOAL := all |
| 3 |
|
|
|
| 4 |
|
|
NAME = gcc |
| 5 |
|
|
VERSION = 12.5.0 |
| 6 |
|
|
GARTYPE = v2 |
| 7 |
|
|
|
| 8 |
|
|
DESCRIPTION = GNU Compiler Collection 12.x |
| 9 |
|
|
define BLURB |
| 10 |
|
|
GCC 12.x C, C++, and Fortran compiler. Builds into /opt/ozsw using |
| 11 |
|
|
GCC 9.x (OZSWgcc9) as the bootstrap compiler. |
| 12 |
|
|
After installation, update GCC12_CC_HOME = /opt/ozsw in garrc and set |
| 13 |
|
|
GARCOMPILER = GCC12. |
| 14 |
|
|
endef |
| 15 |
|
|
|
| 16 |
|
|
MASTER_SITES = http://ftp.gnu.org/gnu/gcc/gcc-$(VERSION)/ |
| 17 |
|
|
DISTFILES += $(DISTNAME).tar.gz |
| 18 |
|
|
|
| 19 |
|
|
LICENSE = COPYING3 |
| 20 |
|
|
|
| 21 |
|
|
BUILD_DEP_PKGS += OZSWbinutils OZSWzlib OZSWgcc9 |
| 22 |
|
|
|
| 23 |
|
|
# ----------------------------------------------------------------------- |
| 24 |
|
|
# OZSWgcc12rt - GCC 12 runtime libraries only. |
| 25 |
|
|
# ----------------------------------------------------------------------- |
| 26 |
|
|
PACKAGES += OZSWgcc12rt |
| 27 |
|
|
SPKG_DESC_OZSWgcc12rt = GCC 12.x runtime libraries (libgcc_s, libstdc++, libgfortran, libgomp, ...) |
| 28 |
|
|
CATALOGNAME_OZSWgcc12rt = gcc12rt |
| 29 |
|
|
RUNTIME_DEP_PKGS_OZSWgcc12rt += OZSWzlib |
| 30 |
|
|
PKGFILES_OZSWgcc12rt = .*/lib/libgcc_s\.so.* |
| 31 |
|
|
PKGFILES_OZSWgcc12rt += .*/lib/libstdc\+\+\.so.* |
| 32 |
|
|
PKGFILES_OZSWgcc12rt += .*/lib/libgfortran\.so.* |
| 33 |
|
|
PKGFILES_OZSWgcc12rt += .*/lib/libgomp\.so.* |
| 34 |
|
|
PKGFILES_OZSWgcc12rt += .*/lib/libquadmath\.so.* |
| 35 |
|
|
PKGFILES_OZSWgcc12rt += .*/lib/libitm\.so.* |
| 36 |
|
|
PKGFILES_OZSWgcc12rt += .*/lib/libatomic\.so.* |
| 37 |
|
|
PKGFILES_OZSWgcc12rt += .*/lib/libssp\.so.* |
| 38 |
|
|
|
| 39 |
|
|
# ----------------------------------------------------------------------- |
| 40 |
|
|
# OZSWgcc12 - the compiler, headers, static support libs, and tools. |
| 41 |
|
|
# ----------------------------------------------------------------------- |
| 42 |
|
|
PACKAGES += OZSWgcc12 |
| 43 |
|
|
SPKG_DESC_OZSWgcc12 = GNU Compiler Collection 12.x (C, C++, Fortran) - compiler |
| 44 |
|
|
CATALOGNAME_OZSWgcc12 = gcc12 |
| 45 |
|
|
RUNTIME_DEP_PKGS_OZSWgcc12 += OZSWgcc12rt OZSWzlib |
| 46 |
|
|
|
| 47 |
|
|
# ----------------------------------------------------------------------- |
| 48 |
|
|
# Build configuration |
| 49 |
|
|
# ----------------------------------------------------------------------- |
| 50 |
|
|
|
| 51 |
|
|
OBJDIR = ../gcc-build |
| 52 |
|
|
|
| 53 |
|
|
PARALLELMFLAGS = -j4 |
| 54 |
|
|
|
| 55 |
|
|
# Expose madvise, O_CLOEXEC, etc. from Solaris system headers |
| 56 |
|
|
EXTENSIONS = 1 |
| 57 |
|
|
|
| 58 |
|
|
POSIX_HDR = \#ifndef _XOPEN_SOURCE\n\#define _XOPEN_SOURCE 600\n\#endif\n\#ifndef _POSIX_C_SOURCE\n\#define _POSIX_C_SOURCE 200112L\n\#endif\n\#include <sys/types.h>\n\#include <sys/stat.h>\n\#include <unistd.h> |
| 59 |
|
|
SUN_PROC_STUB = \#ifdef __sun\n\#define PROC_UNSUPPORTED 1\n\#endif |
| 60 |
|
|
|
| 61 |
|
|
post-extract: |
| 62 |
|
|
@echo "==> Applying Solaris libiberty compatibility fixes" |
| 63 |
|
|
@for f in getpwd.c pex-common.c pex-common.h unlink-if-ordinary.c; do \ |
| 64 |
|
|
gsed -i "1s|^|$(POSIX_HDR)\n|" $(WORKSRC)/libiberty/$$f; \ |
| 65 |
|
|
done |
| 66 |
|
|
@for f in pex-unix.c regex.c; do \ |
| 67 |
|
|
gsed -i "1s|^|$(SUN_PROC_STUB)\n\n|" $(WORKSRC)/libiberty/$$f; \ |
| 68 |
|
|
done |
| 69 |
|
|
@echo "==> Applying Solaris c++tools/module compatibility fixes" |
| 70 |
|
|
@gsed -i '1s|^|#ifndef O_DIRECTORY\n# define O_DIRECTORY 0\n#endif\n|' \ |
| 71 |
|
|
$(WORKSRC)/c++tools/resolver.cc |
| 72 |
|
|
@echo "==> Creating libiberty/ansidecl.h shim (modern OZSWbinutils ansidecl.h dropped PTR)" |
| 73 |
|
|
@printf '#ifndef PTR\n# define PTR void *\n#endif\n#include_next "ansidecl.h"\n' \ |
| 74 |
|
|
> $(WORKSRC)/libiberty/ansidecl.h |
| 75 |
|
|
@gsed -i 's|^/\* Some open(2) flag differences|/* Solaris: madvise() and MADV_RANDOM are hidden when _POSIX_C_SOURCE > 2\n * or _XPG4_2 is defined (the POSIX mmap path). Add explicit declarations. */\n#if defined (__sun) \&\& MAPPED_READING\nextern "C" int madvise (char *, size_t, int);\n# ifndef MADV_RANDOM\n# define MADV_RANDOM 1\n# endif\n#endif\n\n/* Some open(2) flag differences|' \ |
| 76 |
|
|
$(WORKSRC)/gcc/cp/module.cc |
| 77 |
|
|
@$(MAKECOOKIE) |
| 78 |
|
|
|
| 79 |
|
|
post-configure: |
| 80 |
|
|
@echo "==> Reordering COMPILE.c in libiberty Makefiles (INCDIR before CPPFLAGS)" |
| 81 |
|
|
@for mk in \ |
| 82 |
|
|
$(OBJDIR)/libiberty/Makefile \ |
| 83 |
|
|
$(OBJDIR)/build-i386-pc-solaris2.11/libiberty/Makefile; do \ |
| 84 |
|
|
test -f $$mk && \ |
| 85 |
|
|
gsed -i 's|^\(COMPILE.c = \$$(CC) -c -DHAVE_CONFIG_H \$$(CFLAGS)\) \$$(CPPFLAGS) \(-I. -I\$$(INCDIR)\)|\1 \2 $$(CPPFLAGS)|' $$mk || true; \ |
| 86 |
|
|
done |
| 87 |
|
|
@echo "==> Patching runtime_sysinfo.go: add _O_CLOEXEC=0 (absent from snv_111b fcntl.h)" |
| 88 |
|
|
@gsed -i '/^const _FD_CLOEXEC/a const _O_CLOEXEC = 0' \ |
| 89 |
|
|
$(OBJDIR)/i386-pc-solaris2.11/libgo/runtime_sysinfo.go || true |
| 90 |
|
|
@$(MAKECOOKIE) |
| 91 |
|
|
|
| 92 |
|
|
# Download GCC prerequisites (GMP, MPFR, MPC, ISL) into the source tree. |
| 93 |
|
|
# Patch the script to use ftp:// and gtar (required on OpenSolaris). |
| 94 |
|
|
pre-configure: |
| 95 |
|
|
@echo "==> Patching contrib/download_prerequisites for OpenSolaris" |
| 96 |
|
|
gsed -i 's|https\?:|ftp:|g' $(WORKSRC)/contrib/download_prerequisites |
| 97 |
|
|
gsed -i 's/tar -x/gtar -x/g' $(WORKSRC)/contrib/download_prerequisites |
| 98 |
|
|
cd $(WORKSRC) && sh contrib/download_prerequisites --no-verify |
| 99 |
|
|
@$(MAKECOOKIE) |
| 100 |
|
|
|
| 101 |
|
|
CONFIGURE_ARGS = --prefix=$(prefix) |
| 102 |
|
|
CONFIGURE_ARGS += --enable-languages=c,c++,fortran |
| 103 |
|
|
CONFIGURE_ARGS += --with-gnu-as |
| 104 |
|
|
CONFIGURE_ARGS += --with-as=$(bindir)/as |
| 105 |
|
|
CONFIGURE_ARGS += --with-gnu-ld |
| 106 |
|
|
CONFIGURE_ARGS += --with-ld=$(bindir)/ld |
| 107 |
|
|
CONFIGURE_ARGS += --disable-libsanitizer |
| 108 |
|
|
CONFIGURE_ARGS += --disable-multilib |
| 109 |
|
|
CONFIGURE_ARGS += --with-zlib=$(BUILD_PREFIX) |
| 110 |
|
|
CONFIGURE_ARGS += LDFLAGS_FOR_TARGET="-Wl,-R,$(BUILD_PREFIX)/lib" |
| 111 |
|
|
|
| 112 |
|
|
# Keep GCC's internal static libs in OZSWgcc12 |
| 113 |
|
|
MERGE_EXCLUDE_STATICLIBS = |
| 114 |
|
|
|
| 115 |
|
|
EXTRA_CC_FLAGS = -fPIC |
| 116 |
|
|
EXTRA_CXX_FLAGS = -fPIC |
| 117 |
|
|
|
| 118 |
|
|
include gar/category.mk |