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