Merge pull request #20261 from pprindeville/strongswan-update-5.9.9
[feed/packages.git] / lang / rust / rust-host.mk
1 # SPDX-License-Identifier: GPL-2.0-only
2 #
3 # Copyright (C) 2023 Luca Barbato and Donald Hoskins
4
5 # Rust Environmental Vars
6 CONFIG_HOST_SUFFIX:=$(word 4, $(subst -, ,$(GNU_HOST_NAME)))
7 RUSTC_HOST_ARCH:=$(HOST_ARCH)-unknown-linux-$(CONFIG_HOST_SUFFIX)
8 CARGO_HOME:=$(STAGING_DIR_HOST)/cargo
9
10 # Support only a subset for now.
11 RUST_ARCH_DEPENDS:=@(aarch64||arm||i386||i686||mips||mipsel||mips64||mips64el||mipsel||powerpc64||x86_64)
12
13 # Common Build Flags
14 RUST_BUILD_FLAGS = \
15 CARGO_HOME="$(CARGO_HOME)"
16
17 # This adds the rust environmental variables to Make calls
18 MAKE_FLAGS += $(RUST_BUILD_FLAGS)
19
20 # Force linking of the SSP library
21 ifdef CONFIG_PKG_CC_STACKPROTECTOR_REGULAR
22 ifeq ($(strip $(PKG_SSP)),1)
23 RUSTC_LDFLAGS += -lssp_nonshared
24 endif
25 endif
26 ifdef CONFIG_PKG_CC_STACKPROTECTOR_STRONG
27 ifeq ($(strip $(PKG_SSP)),1)
28 TARGET_CFLAGS += -lssp_nonshared
29 endif
30 endif
31
32 # mips64 openwrt has a specific targed in rustc
33 ifeq ($(ARCH),mips64)
34 RUSTC_TARGET_ARCH:=$(REAL_GNU_TARGET_NAME)
35 else
36 RUSTC_TARGET_ARCH:=$(subst openwrt,unknown,$(REAL_GNU_TARGET_NAME))
37 endif
38
39 RUSTC_TARGET_ARCH:=$(subst muslgnueabi,musleabi,$(RUSTC_TARGET_ARCH))
40
41 ifeq ($(ARCH),i386)
42 RUSTC_TARGET_ARCH:=$(subst i486,i586,$(RUSTC_TARGET_ARCH))
43 endif
44
45 # ARM Logic
46 ifeq ($(ARCH),arm)
47 ifeq ($(CONFIG_arm_v7),y)
48 RUSTC_TARGET_ARCH:=$(subst arm,armv7,$(RUSTC_TARGET_ARCH))
49 endif
50
51 ifeq ($(CONFIG_HAS_FPU),y)
52 RUSTC_TARGET_ARCH:=$(subst musleabi,musleabihf,$(RUSTC_TARGET_ARCH))
53 endif
54 endif
55
56 ifeq ($(ARCH),aarch64)
57 RUST_CFLAGS:=-mno-outline-atomics
58 endif