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.
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.
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]
23 # Copyright 2018, cgrzemba@opencsw.org
24 # Copyright 2018, Aurelien Larcher
25 # Copyright 2018, Michal Nowak
26 # Copyright 2021, Carsten Grzemba
27 # Copyright 2023,2024 Friedrich Kink
30 # This build is a mixture of configure and python style
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
35 include ..
/..
/..
/make-rules
/shared-macros.mk
38 COMPONENT_VERSION
= 1.83.0
39 COMPONENT_SUMMARY
= Rust
- Safe
, concurrent
, practical language
40 COMPONENT_PROJECT_URL
= https
://www.rust-lang.org
41 COMPONENT_SRC
= $(COMPONENT_NAME
)-$(COMPONENT_VERSION
)-src
42 COMPONENT_ARCHIVE
= $(COMPONENT_SRC
).
tar.gz
43 COMPONENT_ARCHIVE_HASH
= sha256
:722d773bd4eab2d828d7dd35b59f0b017ddf9a97ee2b46c1b7f7fac5c8841c6e
44 COMPONENT_ARCHIVE_URL
= https
://static.rust-lang.org
/dist/$(COMPONENT_ARCHIVE
)
45 COMPONENT_FMRI
= developer
/lang
/rustc
46 COMPONENT_CLASSIFICATION
= Development
/Other Languages
47 COMPONENT_LICENSE
= MIT or Apache-2.0
48 COMPONENT_LICENSE_FILE
= LICENSE-APACHE
50 RUST_BOOTSTRAP_PATH
= $(BUILD_DIR
)/$(MACH64
)
51 RUST_ARCH
= x86_64-unknown-illumos
53 TEST_TARGET
= $(NO_TESTS
)
55 include $(WS_MAKE_RULES
)/common.mk
59 # Need some help to pick the correct ar binary
62 # Put the bits cargo downloads in a private directory. This could be cached
63 # somewhere more permanent, but it's important to make sure that a person's
64 # $HOME/.cargo isn't used.
65 CARGO_HOME
= $(@D
)/.cargo
69 RUSTC_BIN_POST
= cargo
70 RUSTC_BIN_POST
+= clippy-driver
72 RUSTC_BIN_POST
+= rustc
73 RUSTC_BIN_POST
+= rustdoc
75 # Add arch triplet to pkg macros
76 PKG_MACROS
+= RUST_ARCH
="$(RUST_ARCH)"
78 # Rust expects the library path to be /usr/lib and is broken otherwise
79 RUSTC_LIBDIR
= $(USRLIBDIR
)
81 COMPONENT_PRE_CONFIGURE_ACTION
+= ( CLONEY_MODE
=hardlink
$(CLONEY
) $(SOURCE_DIR
) $(@D
); )
83 CONFIGURE_OPTIONS
= --prefix=$(CONFIGURE_PREFIX
)
84 CONFIGURE_OPTIONS
+= --mandir=$(CONFIGURE_MANDIR
)
85 CONFIGURE_OPTIONS
+= --bindir=$(CONFIGURE_BINDIR.
$(BITS
))
86 CONFIGURE_OPTIONS
+= --libdir=$(RUSTC_LIBDIR
)
87 CONFIGURE_OPTIONS
+= --docdir
=$(USRSHAREDOCDIR
)/rust-
$(COMPONENT_VERSION
)
88 CONFIGURE_OPTIONS
+= --datadir=$(USRSHAREDIR
)
89 CONFIGURE_OPTIONS
+= --sysconfdir
=$(ETCDIR
)
90 CONFIGURE_OPTIONS
+= --enable-local-rust
91 CONFIGURE_OPTIONS
+= --local-rust-root
=/usr
92 CONFIGURE_OPTIONS
+= --enable-extended
# Build and install cargo too.
93 CONFIGURE_OPTIONS
+= --default-linker
=$(CC
)
94 CONFIGURE_OPTIONS
+= --set target.
$(RUST_ARCH
).
cc=$(CC
)
95 CONFIGURE_OPTIONS
+= --set target.
$(RUST_ARCH
).
cxx=$(CXX
)
96 CONFIGURE_OPTIONS
+= --set target.
$(RUST_ARCH
).
ar=$(GNUAR
)
97 CONFIGURE_OPTIONS
+= --set target.
$(RUST_ARCH
).linker
=$(CC
)
98 CONFIGURE_OPTIONS
+= --enable-rpath
99 CONFIGURE_OPTIONS
+= --disable-codegen-tests
100 CONFIGURE_OPTIONS
+= --disable-dist-src
101 CONFIGURE_OPTIONS
+= --disable-llvm-static-stdcpp
102 CONFIGURE_OPTIONS
+= --enable-vendor
103 CONFIGURE_OPTIONS
+= --disable-docs
104 CONFIGURE_OPTIONS
+= --disable-compiler-docs
105 CONFIGURE_OPTIONS
+= --disable-cargo-native-static
106 CONFIGURE_OPTIONS
+= --enable-option-checking
107 CONFIGURE_OPTIONS
+= --release-channel
=stable
108 CONFIGURE_OPTIONS
+= --python
=$(PYTHON
)
109 CONFIGURE_OPTIONS
+= --disable-clang
110 CONFIGURE_OPTIONS
+= --enable-llvm-link-shared
111 CONFIGURE_OPTIONS
+= --llvm-root
=$(CLANG_PREFIX
)
112 CONFIGURE_OPTIONS
+= --llvm-config
=$(CLANG_PREFIX
)/bin
114 # Cleanup standard environment!
115 COMPONENT_BUILD_ENV
=
116 COMPONENT_BUILD_ENV
+= OPENSSL_DIR
=$(OPENSSL_PREFIX
)
117 COMPONENT_BUILD_ENV
+= OPENSSL_LIB_DIR
=$(OPENSSL_LIBDIR
)
118 COMPONENT_BUILD_ENV
+= OPENSSL_INCLUDE_DIR
=$(OPENSSL_INCDIR
)
119 COMPONENT_BUILD_ENV
+= CC
=$(CC
)
120 COMPONENT_BUILD_ENV
+= CFLAGS
="$(CFLAGS)"
121 COMPONENT_BUILD_ENV
+= CXX
=$(CXX
)
122 COMPONENT_BUILD_ENV
+= CXXFLAGS
="$(CXXFLAGS)"
123 COMPONENT_BUILD_ENV
+= AR
=$(GNUAR
)
124 COMPONENT_BUILD_ENV
+= RUSTC
=/usr
/bin
/rustc
125 COMPONENT_BUILD_ENV
+= CARGO_HOME
=$(CARGO_HOME
)
126 COMPONENT_BUILD_ENV
+= PATH
=$(PATH
)
127 COMPONENT_BUILD_ENV
+= VERBOSE
=1
128 COMPONENT_BUILD_ENV
+= RUST_BACKTRACE
=1
130 COMPONENT_PRE_INSTALL_ACTION
= mkdir
-p
$(PROTO_DIR
)
131 COMPONENT_POST_INSTALL_ACTION
+= $(TOUCH
) $(BUILD_DIR
)/META.depend-runtime.res
133 # Cleanup standard environment
134 COMPONENT_INSTALL_ENV
=
135 COMPONENT_INSTALL_ENV
+= $(COMPONENT_BUILD_ENV
)
136 COMPONENT_INSTALL_ENV
+= CARGO_HOME
=$(CARGO_HOME
)
138 COMPONENT_INSTALL_ENV
+= DESTDIR
=$(PROTO_DIR
)
140 # manually added dependencies
141 REQUIRED_PACKAGES
+= developer
/lang
/rustc
# previous before build version
143 # Auto-generated dependencies
144 REQUIRED_PACKAGES
+= $(GCC_RUNTIME_PKG
)
145 REQUIRED_PACKAGES
+= $(GXX_RUNTIME_PKG
)
146 REQUIRED_PACKAGES
+= $(OPENSSL_PKG
)
147 REQUIRED_PACKAGES
+= $(OPENSSL_PKG
)/32
148 REQUIRED_PACKAGES
+= library
/libgit2
149 REQUIRED_PACKAGES
+= library
/zlib
150 REQUIRED_PACKAGES
+= shell/ksh93
151 REQUIRED_PACKAGES
+= system
/library
152 REQUIRED_PACKAGES
+= system
/library
/math
153 REQUIRED_PACKAGES
+= web
/curl