fritzkink
2023-11-19 a979abaf8af543e335db4a398e9a1ed8a7ad255d
commit | author | age
ccb9cb 1 #
CG 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
22 #
23 # Copyright 2018, cgrzemba@opencsw.org
eaa987 24 # Copyright 2018, Aurelien Larcher
36e531 25 # Copyright 2018, Michal Nowak
967bfd 26 # Copyright 2021, Carsten Grzemba
fbc35e 27 # Copyright 2023, Friedrich Kink
ccb9cb 28 #
eaa987 29
a979ab 30 # This build is a mixture of configure and python style
F 31 # it starts with configure for the initial setup 
32 # the compiler build itself is intensively using python tools
33 # therefor this patially python settings
34
fbc35e 35 BUILD_BITS=        64
a979ab 36 OPENSSL_VERSION=    3.1
F 37 TEST_STYLE=        none
fbc35e 38
ccb9cb 39 include ../../../make-rules/shared-macros.mk
CG 40
41 COMPONENT_NAME=        rustc
a979ab 42 COMPONENT_VERSION=    1.71.1
eaa987 43 COMPONENT_SUMMARY=    Rust - Safe, concurrent, practical language
ac558e 44 COMPONENT_PROJECT_URL=    https://www.rust-lang.org
ccb9cb 45 COMPONENT_SRC=        $(COMPONENT_NAME)-$(COMPONENT_VERSION)-src
CG 46 COMPONENT_ARCHIVE=    $(COMPONENT_SRC).tar.gz
a979ab 47 COMPONENT_ARCHIVE_HASH=    sha256:6fa90d50d1d529a75f6cc349784de57d7ec0ba2419b09bde7d335c25bd4e472e
36e531 48 COMPONENT_ARCHIVE_URL=    https://static.rust-lang.org/dist/$(COMPONENT_ARCHIVE)
ac558e 49 COMPONENT_FMRI=        developer/lang/rustc
AW 50 COMPONENT_CLASSIFICATION=    Development/Other Languages
ccb9cb 51 COMPONENT_LICENSE=    MIT or Apache-2.0
5716a5 52 COMPONENT_LICENSE_FILE=    LICENSE-APACHE
ccb9cb 53
fbc35e 54 RUST_BOOTSTRAP_PATH=    $(BUILD_DIR)/$(MACH64)
F 55 RUST_ARCH=        x86_64-unknown-illumos
ccb9cb 56
fbc35e 57 TEST_TARGET=        $(NO_TESTS)
ccb9cb 58
5716a5 59 include $(WS_MAKE_RULES)/common.mk
a979ab 60 include $(WS_MAKE_RULES)/setup.py.mk
F 61
62 CLANG_VERSION=        17
fbc35e 63
F 64 # Need some help to pick the correct ar binary
65 GNUAR=$(GNUBIN)/ar
eaa987 66
5716a5 67 # Put the bits cargo downloads in a private directory.  This could be cached
F 68 # somewhere more permanent, but it's important to make sure that a person's
69 # $HOME/.cargo isn't used.
a979ab 70 CARGO_HOME=             $(@D)/.cargo
5716a5 71
a979ab 72 PATH=                   $(PATH.gnu)
5716a5 73
fbc35e 74 RUSTC_BIN_POST=        cargo
F 75 RUSTC_BIN_POST+=    clippy-driver
76 RUSTC_BIN_POST+=    rls
77 RUSTC_BIN_POST+=    rustc
78 RUSTC_BIN_POST+=    rustdoc
79
80 # Add arch triplet to pkg macros
81 PKG_MACROS+=        RUST_ARCH="$(RUST_ARCH)"
82
83 # Rust expects the library path to be /usr/lib and is broken otherwise 
84 RUSTC_LIBDIR=        $(USRLIBDIR)
85
a979ab 86 COMPONENT_PRE_CONFIGURE_ACTION += ( CLONEY_MODE=hardlink $(CLONEY) $(SOURCE_DIR) $(@D); )
5716a5 87
fbc35e 88 CONFIGURE_OPTIONS = --prefix=$(CONFIGURE_PREFIX)
ccb9cb 89 CONFIGURE_OPTIONS += --mandir=$(CONFIGURE_MANDIR)
eaa987 90 CONFIGURE_OPTIONS += --bindir=$(CONFIGURE_BINDIR.$(BITS))
6ae15b 91 CONFIGURE_OPTIONS += --libdir=$(RUSTC_LIBDIR)
eaa987 92 CONFIGURE_OPTIONS += --docdir=$(USRSHAREDOCDIR)/rust-$(COMPONENT_VERSION)
AL 93 CONFIGURE_OPTIONS += --datadir=$(USRSHAREDIR)
ccb9cb 94 CONFIGURE_OPTIONS += --sysconfdir=$(ETCDIR)
a979ab 95 CONFIGURE_OPTIONS += --local-rust-root=/usr
ccb9cb 96 CONFIGURE_OPTIONS += --enable-extended       # Build and install cargo too.
eaa987 97 CONFIGURE_OPTIONS += --default-linker=$(CC)
a979ab 98 CONFIGURE_OPTIONS += --set target.$(RUST_ARCH).cc=$(CC)
F 99 CONFIGURE_OPTIONS += --set target.$(RUST_ARCH).cxx=$(CXX)
100 CONFIGURE_OPTIONS += --set target.$(RUST_ARCH).ar=$(GNUAR)
101 CONFIGURE_OPTIONS += --set target.$(RUST_ARCH).linker=$(CC)
ccb9cb 102 CONFIGURE_OPTIONS += --enable-rpath
CG 103 CONFIGURE_OPTIONS += --disable-codegen-tests
104 CONFIGURE_OPTIONS += --disable-dist-src
105 CONFIGURE_OPTIONS += --disable-llvm-static-stdcpp
106 CONFIGURE_OPTIONS += --enable-vendor
107 CONFIGURE_OPTIONS += --disable-docs
967bfd 108 CONFIGURE_OPTIONS += --disable-compiler-docs
5716a5 109 CONFIGURE_OPTIONS += --disable-cargo-native-static
F 110 CONFIGURE_OPTIONS += --enable-option-checking
ccb9cb 111 CONFIGURE_OPTIONS += --release-channel=stable
CG 112 CONFIGURE_OPTIONS += --python=$(PYTHON)
fbc35e 113 CONFIGURE_OPTIONS += --disable-clang
967bfd 114 CONFIGURE_OPTIONS += --enable-llvm-link-shared
ac558e 115 CONFIGURE_OPTIONS += --llvm-root=$(CLANG_PREFIX)
AW 116 CONFIGURE_OPTIONS += --llvm-config=$(CLANG_PREFIX)/bin
ccb9cb 117
a979ab 118 COMPONENT_BUILD_CMD = $(PYTHON) x.py build 
F 119 COMPONENT_INSTALL_CMD = $(PYTHON) x.py install
120 COMPONENT_INSTALL_ARGS =
5716a5 121
eaa987 122 # Cleanup standard environment!
fbc35e 123 COMPONENT_BUILD_ENV =
5716a5 124 COMPONENT_BUILD_ENV += OPENSSL_DIR=$(OPENSSL_PREFIX)
ac558e 125 COMPONENT_BUILD_ENV += OPENSSL_LIB_DIR=$(OPENSSL_LIBDIR)
AW 126 COMPONENT_BUILD_ENV += OPENSSL_INCLUDE_DIR=$(OPENSSL_INCDIR)
5716a5 127 COMPONENT_BUILD_ENV += OPENSSL_STATIC=0
eaa987 128 COMPONENT_BUILD_ENV += CC=$(CC)
c20ebe 129 COMPONENT_BUILD_ENV += CFLAGS="$(CFLAGS)"
eaa987 130 COMPONENT_BUILD_ENV += CXX=$(CXX)
c20ebe 131 COMPONENT_BUILD_ENV += CXXFLAGS="$(CXXFLAGS)"
eaa987 132 COMPONENT_BUILD_ENV += AR=$(GNUAR)
a979ab 133 COMPONENT_BUILD_ENV += RUSTC=/usr/bin/rustc
fbc35e 134 COMPONENT_BUILD_ENV += CARGO_HOME=$(CARGO_HOME)
a979ab 135 COMPONENT_BUILD_ENV += GMAKE=
eaa987 136 # Enforce linker consistency
a979ab 137 COMPONENT_BUILD_ENV +=    RUSTFLAGS="-C linker=$(CC)"
F 138 COMPONENT_BUILD_ENV +=    RUST_BACKTRACE=1
ccb9cb 139
fbc35e 140 COMPONENT_PRE_INSTALL_ACTION = mkdir -p $(PROTO_DIR)
a979ab 141 COMPONENT_POST_INSTALL_ACTION +=  $(TOUCH) $(BUILD_DIR)/META.depend-runtime.res
ccb9cb 142
eaa987 143 # Cleanup standard environment
809eab 144 COMPONENT_INSTALL_ENV= 
fbc35e 145 COMPONENT_INSTALL_ENV+=    $(COMPONENT_BUILD_ENV)
F 146 COMPONENT_INSTALL_ENV+=    CARGO_HOME=$(CARGO_HOME)
eaa987 147 # Set install path
fbc35e 148 COMPONENT_INSTALL_ENV+=    DESTDIR=$(PROTO_DIR)
ccb9cb 149
fbc35e 150 TEST_TARGET=        $(NO_TESTS)
ccb9cb 151
a979ab 152 # manually added dependencies
F 153 REQUIRED_PACKAGES += developer/lang/rustc # previous before build version
9513a1 154
5716a5 155 # Auto-generated dependencies
eaa987 156 REQUIRED_PACKAGES += $(GCC_RUNTIME_PKG)
AL 157 REQUIRED_PACKAGES += $(GXX_RUNTIME_PKG)
a979ab 158 REQUIRED_PACKAGES += library/security/openssl-31
ccb9cb 159 REQUIRED_PACKAGES += library/zlib
5716a5 160 REQUIRED_PACKAGES += shell/ksh93
5ccb1e 161 REQUIRED_PACKAGES += system/library
ccb9cb 162 REQUIRED_PACKAGES += system/library/math
CG 163 REQUIRED_PACKAGES += web/curl