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