-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
46 changed files
with
2,101 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
include $(TOPDIR)/rules.mk | ||
|
||
GO_VERSION_MAJOR_MINOR:=1.21 | ||
GO_VERSION_PATCH:=2 | ||
GO_VERSION_PATCH:=3 | ||
|
||
PKG_NAME:=golang | ||
PKG_VERSION:=$(GO_VERSION_MAJOR_MINOR)$(if $(GO_VERSION_PATCH),.$(GO_VERSION_PATCH)) | ||
|
@@ -21,7 +21,7 @@ GO_SOURCE_URLS:=https://dl.google.com/go/ \ | |
|
||
PKG_SOURCE:=go$(PKG_VERSION).src.tar.gz | ||
PKG_SOURCE_URL:=$(GO_SOURCE_URLS) | ||
PKG_HASH:=45e59de173baec39481854490d665b726cec3e5b159f6b4172e5ec7780b2c201 | ||
PKG_HASH:=186f2b6f8c8b704e696821b09ab2041a5c1ee13dcbc3156a13adcf75931ee488 | ||
|
||
PKG_MAINTAINER:=Jeffery To <[email protected]> | ||
PKG_LICENSE:=BSD-3-Clause | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
.../patches/0001-Allow-profile-to-be-set-by-SETUPTOOLS_RUST_CARGO_PROFILE-env-variable.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
From b10cab4efeb80abb5a236d651c9ff9355e470527 Mon Sep 17 00:00:00 2001 | ||
From: Jeffery To <[email protected]> | ||
Date: Mon, 2 Oct 2023 16:13:51 +0800 | ||
Subject: [PATCH] Allow profile to be set by SETUPTOOLS_RUST_CARGO_PROFILE env | ||
variable | ||
|
||
This allows the profile to be set dynamically, without having to edit | ||
pyproject.toml/setup.py. | ||
--- | ||
setuptools_rust/build.py | 20 ++++++++++++++++---- | ||
1 file changed, 16 insertions(+), 4 deletions(-) | ||
|
||
--- a/setuptools_rust/build.py | ||
+++ b/setuptools_rust/build.py | ||
@@ -528,10 +528,10 @@ class build_rust(RustCommand): | ||
if target_triple is not None: | ||
args.extend(["--target", target_triple]) | ||
|
||
- if release: | ||
- profile = ext.get_cargo_profile() | ||
- if not profile: | ||
- args.append("--release") | ||
+ ext_profile = ext.get_cargo_profile() | ||
+ env_profile = os.getenv("SETUPTOOLS_RUST_CARGO_PROFILE") | ||
+ if release and not ext_profile and not env_profile: | ||
+ args.append("--release") | ||
|
||
if quiet: | ||
args.append("-q") | ||
@@ -552,6 +552,18 @@ class build_rust(RustCommand): | ||
if ext.args is not None: | ||
args.extend(ext.args) | ||
|
||
+ if env_profile: | ||
+ if ext_profile: | ||
+ args = [p for p in args if not p.startswith("--profile=")] | ||
+ while True: | ||
+ try: | ||
+ index = args.index("--profile") | ||
+ del args[index:index + 2] | ||
+ except ValueError: | ||
+ break | ||
+ | ||
+ args.extend(["--profile", env_profile]) | ||
+ | ||
if ext.cargo_manifest_args is not None: | ||
args.extend(ext.cargo_manifest_args) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
[ "$1" = python3-zope-interface ] || exit 0 | ||
|
||
python3 -c 'import zope.interface' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
menu "Configuration options (for developers)" | ||
|
||
config RUST_SCCACHE | ||
bool "Use sccache" | ||
help | ||
Shared compilation cache; see https://github.com/mozilla/sccache | ||
|
||
config RUST_SCCACHE_DIR | ||
string "Set sccache directory" if RUST_SCCACHE | ||
default "" | ||
help | ||
Store sccache in this directory. | ||
If not set, uses './.sccache' | ||
|
||
endmenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,19 +5,18 @@ | |
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=rust | ||
PKG_VERSION:=1.72.0 | ||
PKG_RELEASE:=2 | ||
PKG_VERSION:=1.73.0 | ||
PKG_RELEASE:=1 | ||
|
||
PKG_SOURCE:=rustc-$(PKG_VERSION)-src.tar.gz | ||
PKG_SOURCE_URL:=https://static.rust-lang.org/dist/ | ||
PKG_HASH:=ea9d61bbb51d76b6ea681156f69f0e0596b59722f04414b01c6e100b4b5be3a1 | ||
PKG_HASH:=96d62e6d1f2d21df7ac8acb3b9882411f9e7c7036173f7f2ede9e1f1f6b1bb3a | ||
HOST_BUILD_DIR:=$(BUILD_DIR)/host/rustc-$(PKG_VERSION)-src | ||
|
||
PKG_MAINTAINER:=Luca Barbato <[email protected]> | ||
PKG_LICENSE:=Apache-2.0 MIT | ||
PKG_LICENSE_FILES:=LICENSE-APACHE LICENSE-MIT | ||
|
||
HOST_BUILD_DEPENDS:=python3/host | ||
PKG_HOST_ONLY:=1 | ||
|
||
include $(INCLUDE_DIR)/host-build.mk | ||
|
@@ -31,7 +30,6 @@ define Package/rust | |
TITLE:=Rust Programming Language Compiler | ||
URL:=https://www.rust-lang.org/ | ||
DEPENDS:=$(RUST_ARCH_DEPENDS) | ||
BUILDONLY:=1 | ||
endef | ||
|
||
define Package/rust/description | ||
|
@@ -40,8 +38,12 @@ define Package/rust/description | |
guarantee memory safety by using a borrow checker to validate references. | ||
endef | ||
|
||
define Package/rust/config | ||
source "$(SOURCE)/Config.in" | ||
endef | ||
|
||
# Rust-lang has an uninstall script | ||
RUST_UNINSTALL:=$(CARGO_HOME)/lib/rustlib/uninstall.sh | ||
RUST_UNINSTALL:=$(STAGING_DIR)/host/lib/rustlib/uninstall.sh | ||
|
||
# Target Flags | ||
TARGET_CONFIGURE_ARGS = \ | ||
|
@@ -50,23 +52,24 @@ TARGET_CONFIGURE_ARGS = \ | |
--set=target.$(RUSTC_TARGET_ARCH).cxx=$(TARGET_CXX_NOCACHE) \ | ||
--set=target.$(RUSTC_TARGET_ARCH).linker=$(TARGET_CC_NOCACHE) \ | ||
--set=target.$(RUSTC_TARGET_ARCH).ranlib=$(TARGET_RANLIB) \ | ||
--set=target.$(RUSTC_TARGET_ARCH).crt-static=false \ | ||
$(if $(CONFIG_USE_MUSL),--set=target.$(RUSTC_TARGET_ARCH).musl-root=$(TOOLCHAIN_DIR)) | ||
|
||
# CARGO_HOME is an environmental | ||
HOST_CONFIGURE_OPTS += CARGO_HOME="$(CARGO_HOME)" | ||
HOST_CONFIGURE_VARS += CARGO_HOME="$(CARGO_HOME)" | ||
|
||
# Rust Configuration Arguments | ||
HOST_CONFIGURE_ARGS = \ | ||
--build=$(RUSTC_HOST_ARCH) \ | ||
--target=$(RUSTC_TARGET_ARCH),$(RUSTC_HOST_ARCH) \ | ||
--host=$(RUSTC_HOST_ARCH) \ | ||
--prefix=$(CARGO_HOME) \ | ||
--bindir=$(CARGO_HOME)/bin \ | ||
--libdir=$(CARGO_HOME)/lib \ | ||
--sysconfdir=$(CARGO_HOME)/etc \ | ||
--datadir=$(CARGO_HOME)/share \ | ||
--mandir=$(CARGO_HOME)/man \ | ||
--dist-compression-formats=xz \ | ||
--prefix=$(STAGING_DIR)/host \ | ||
--bindir=$(STAGING_DIR)/host/bin \ | ||
--libdir=$(STAGING_DIR)/host/lib \ | ||
--sysconfdir=$(STAGING_DIR)/host/etc \ | ||
--datadir=$(STAGING_DIR)/host/share \ | ||
--mandir=$(STAGING_DIR)/host/man \ | ||
--dist-compression-formats=gz \ | ||
--enable-missing-tools \ | ||
--disable-sanitizers \ | ||
--release-channel=stable \ | ||
|
@@ -81,22 +84,23 @@ define Host/Uninstall | |
endef | ||
|
||
define Host/Compile | ||
( \ | ||
cd $(HOST_BUILD_DIR) ; \ | ||
$(PYTHON) x.py --config ./config.toml dist build-manifest cargo llvm-tools \ | ||
rustc rust-std rust-src ; \ | ||
) | ||
$(RUST_SCCACHE_VARS) \ | ||
CARGO_HOME=$(CARGO_HOME) \ | ||
OPENWRT_RUSTC_BOOTSTRAP_CACHE=$(DL_DIR)/rustc \ | ||
$(PYTHON) $(HOST_BUILD_DIR)/x.py \ | ||
--build-dir $(HOST_BUILD_DIR)/build \ | ||
--config $(HOST_BUILD_DIR)/config.toml \ | ||
dist build-manifest cargo llvm-tools rustc rust-std rust-src | ||
endef | ||
|
||
define Host/Install | ||
( \ | ||
cd $(HOST_BUILD_DIR)/build/dist ; \ | ||
find -iname "*.xz" -exec tar -xJf {} \; ; \ | ||
find ./* -type f -name install.sh -execdir sh {} --prefix=$(CARGO_HOME) --disable-ldconfig \; ; \ | ||
\ | ||
sed -e 's|@RUSTC_TARGET_ARCH@|$(RUSTC_TARGET_ARCH)|g' \ | ||
-e 's|@TARGET_CC_NOCACHE@|$(TARGET_CC_NOCACHE)|g' \ | ||
$(CURDIR)/files/cargo-config > $(CARGO_HOME)/config.toml ; \ | ||
for targz in *.tar.gz; do \ | ||
$(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc "$$$$targz" | tar -xf - ; \ | ||
done ; \ | ||
find . -mindepth 2 -maxdepth 2 -type f -name install.sh \ | ||
-execdir bash '{}' --prefix=$(STAGING_DIR)/host --disable-ldconfig \; ; \ | ||
) | ||
endef | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- a/src/bootstrap/bootstrap.py | ||
+++ b/src/bootstrap/bootstrap.py | ||
@@ -546,7 +546,7 @@ class RustBuild(object): | ||
shutil.rmtree(bin_root) | ||
|
||
key = self.stage0_compiler.date | ||
- cache_dst = os.path.join(self.build_dir, "cache") | ||
+ cache_dst = os.getenv('OPENWRT_RUSTC_BOOTSTRAP_CACHE', os.path.join(self.build_dir, "cache")) | ||
rustc_cache = os.path.join(cache_dst, key) | ||
if not os.path.exists(rustc_cache): | ||
os.makedirs(rustc_cache) | ||
--- a/src/bootstrap/download.rs | ||
+++ b/src/bootstrap/download.rs | ||
@@ -520,7 +520,10 @@ impl Config { | ||
key: &str, | ||
destination: &str, | ||
) { | ||
- let cache_dst = self.out.join("cache"); | ||
+ let cache_dst = match env::var_os("OPENWRT_RUSTC_BOOTSTRAP_CACHE") { | ||
+ Some(v) => PathBuf::from(v), | ||
+ None => self.out.join("cache"), | ||
+ }; | ||
let cache_dir = cache_dst.join(key); | ||
if !cache_dir.exists() { | ||
t!(fs::create_dir_all(&cache_dir)); | ||
@@ -647,7 +650,10 @@ download-rustc = false | ||
let llvm_assertions = self.llvm_assertions; | ||
|
||
let cache_prefix = format!("llvm-{llvm_sha}-{llvm_assertions}"); | ||
- let cache_dst = self.out.join("cache"); | ||
+ let cache_dst = match env::var_os("OPENWRT_RUSTC_BOOTSTRAP_CACHE") { | ||
+ Some(v) => PathBuf::from(v), | ||
+ None => self.out.join("cache"), | ||
+ }; | ||
let rustc_cache = cache_dst.join(cache_prefix); | ||
if !rustc_cache.exists() { | ||
t!(fs::create_dir_all(&rustc_cache)); |
Oops, something went wrong.