1 # SPDX-License-Identifier: GPL-2.0-only
3 # Copyright (C) 2023 Luca Barbato and Donald Hoskins
5 include $(TOPDIR
)/rules.mk
11 PKG_SOURCE
:=rustc-
$(PKG_VERSION
)-src.
tar.gz
12 PKG_SOURCE_URL
:=https
://static.rust-lang.org
/dist/
13 PKG_HASH
:=ea9d61bbb51d76b6ea681156f69f0e0596b59722f04414b01c6e100b4b5be3a1
14 HOST_BUILD_DIR
:=$(BUILD_DIR
)/host
/rustc-
$(PKG_VERSION
)-src
16 PKG_MAINTAINER
:=Luca Barbato
<lu_zero@luminem.org
>
17 PKG_LICENSE
:=Apache-2.0 MIT
18 PKG_LICENSE_FILES
:=LICENSE-APACHE LICENSE-MIT
20 HOST_BUILD_DEPENDS
:=python3
/host
23 include $(INCLUDE_DIR
)/host-build.mk
24 include $(INCLUDE_DIR
)/package.mk
25 include .
/rust-values.mk
31 TITLE
:=Rust Programming Language Compiler
32 URL
:=https
://www.rust-lang.org
/
33 DEPENDS
:=$(RUST_ARCH_DEPENDS
)
37 define Package
/rust
/description
38 Rust is a multi-paradigm
, general-purpose programming language designed for performance
39 and safety
, especially safe concurrency. Rust is syntactically similar to C
++, but can
40 guarantee memory safety by using a borrow checker to validate references.
43 # Rust-lang has an uninstall script
44 RUST_UNINSTALL
:=$(CARGO_HOME
)/lib
/rustlib
/uninstall.sh
47 TARGET_CONFIGURE_ARGS
= \
48 --set
=target.
$(RUSTC_TARGET_ARCH
).
ar=$(TARGET_AR
) \
49 --set
=target.
$(RUSTC_TARGET_ARCH
).
cc=$(TARGET_CC_NOCACHE
) \
50 --set
=target.
$(RUSTC_TARGET_ARCH
).
cxx=$(TARGET_CXX_NOCACHE
) \
51 --set
=target.
$(RUSTC_TARGET_ARCH
).linker
=$(TARGET_CC_NOCACHE
) \
52 --set
=target.
$(RUSTC_TARGET_ARCH
).ranlib
=$(TARGET_RANLIB
) \
53 $(if
$(CONFIG_USE_MUSL
),--set
=target.
$(RUSTC_TARGET_ARCH
).musl-root
=$(TOOLCHAIN_DIR
))
55 # CARGO_HOME is an environmental
56 HOST_CONFIGURE_OPTS
+= CARGO_HOME
="$(CARGO_HOME)"
58 # Rust Configuration Arguments
59 HOST_CONFIGURE_ARGS
= \
60 --build
=$(RUSTC_HOST_ARCH
) \
61 --target
=$(RUSTC_TARGET_ARCH
),$(RUSTC_HOST_ARCH
) \
62 --host
=$(RUSTC_HOST_ARCH
) \
63 --prefix=$(CARGO_HOME
) \
64 --bindir=$(CARGO_HOME
)/bin \
65 --libdir=$(CARGO_HOME
)/lib \
66 --sysconfdir
=$(CARGO_HOME
)/etc \
67 --datadir=$(CARGO_HOME
)/share \
68 --mandir=$(CARGO_HOME
)/man \
69 --dist-compression-formats
=xz \
70 --enable-missing-tools \
71 --disable-sanitizers \
72 --release-channel
=stable \
73 --enable-cargo-native-static \
74 --set
=llvm.download-ci-llvm
=true \
75 $(TARGET_CONFIGURE_ARGS
)
78 # Call the Uninstall script
79 [ -f
$(RUST_UNINSTALL
) ] && \
80 $(BASH
) $(RUST_UNINSTALL
) || echo No Uninstall
85 cd
$(HOST_BUILD_DIR
) ; \
86 $(PYTHON
) x.py
--config .
/config.toml
dist build-manifest cargo llvm-tools \
87 rustc rust-std rust-src
; \
93 cd
$(HOST_BUILD_DIR
)/build
/dist ; \
94 find
-iname
"*.xz" -exec
tar -xJf
{} \
; ; \
95 find .
/* -type f
-name
install.sh
-execdir sh
{} --prefix=$(CARGO_HOME
) --disable-ldconfig \
; ; \
97 sed
-e
's|@RUSTC_TARGET_ARCH@|$(RUSTC_TARGET_ARCH)|g' \
98 -e
's|@TARGET_CC_NOCACHE@|$(TARGET_CC_NOCACHE)|g' \
99 $(CURDIR
)/files
/cargo-config
> $(CARGO_HOME
)/config.toml
; \
103 $(eval
$(call HostBuild
))
104 $(eval
$(call BuildPackage
,rust
))