Skip to content

Commit

Permalink
sync (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
suyuan168 authored Feb 12, 2024
2 parents c6598a4 + b8178a8 commit 9beb085
Show file tree
Hide file tree
Showing 13 changed files with 316 additions and 145 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build:
strategy:
matrix:
OMR_TARGET: [bpi-r1, bpi-r2, bpi-r64, rpi2, rpi4, wrt32x, espressobin, r2s, rpi3, wrt3200acm, x86, x86_64, ubnt-erx, r4s, r7800, rutx12, rutx50, r5s, qnap-301w, rpi5]
OMR_TARGET: [bpi-r1, bpi-r2, bpi-r64, rpi2, rpi4, wrt32x, espressobin, r2s, rpi3, wrt3200acm, x86, x86_64, ubnt-erx, r4s, r7800, rutx12, rutx50, r5s, qnap-301w, rpi5, z8102ax-128m]
OMR_KERNEL: [5.4, 6.1]
runs-on: ubuntu-latest
continue-on-error: true
Expand Down Expand Up @@ -86,10 +86,11 @@ jobs:
run: |
make IGNORE_ERRORS=m -C $OMR_TARGET/$OMR_KERNEL/source target/install -j$(nproc) || make IGNORE_ERRORS=m -C $OMR_TARGET/$OMR_KERNEL/source target/install -j1 V=s
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.OMR_TARGET }}
path: /home/runner/work/omr/${{ matrix.OMR_TARGET }}/${{ matrix.OMR_KERNEL }}/source/bin
overwrite: true
- if: steps.branch_name.outputs.SOURCE_BRANCH == ''
name: Deploy - Create directory
uses: ysurac/ssh-action@master
Expand Down
4 changes: 3 additions & 1 deletion openmptcprouter-full/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ MY_DEPENDS := \
!(LINUX_5_4):mptcpd (TARGET_x86||TARGET_x86_64):kmod-igc !TARGET_mvebu:kmod-mmc-spi kmod-macsec usbutils v2ray-core LINUX_5_4:v2ray-config !LINUX_5_4:v2ray-config-nft syslogd \
(TARGET_x86||TARGET_x86_64):kmod-mlx4-core \
!(TARGET_ips40xx||TARGET_ramips):iptables-mod-ndpi !(TARGET_ips40xx||TARGET_ramips):kmod-ipt-ndpi libip4tc libip6tc \
xray-core LINUX_5_4:xray-config !LINUX_5_4:xray-config-nft shadowsocks-rust-sslocal shadowsocks-rust-ssservice LINUX_5_4:shadowsocks-rust-config !LINUX_5_4:shadowsocks-rust-config-nft luci-app-shadowsocks-rust (LINUX_5_4&&(TARGET_x86_64||aarch64)):kmod-tcp-bbr2 kmod-ovpn-dco-v2 \
xray-core LINUX_5_4:xray-config !LINUX_5_4:xray-config-nft (LINUX_5_4&&(TARGET_x86_64||aarch64)):kmod-tcp-bbr2 kmod-ovpn-dco-v2 \
!LINUX_5_4:shadowsocks-rust-sslocal !LINUX_5_4:shadowsocks-rust-ssservice !LINUX_5_4:shadowsocks-rust-config-nft !LINUX_5_4:luci-app-shadowsocks-rust \
luci-proto-external omr-schedule jq luci-app-ddns

# shadowsocks-rust-sslocal shadowsocks-rust-ssservice LINUX_5_4:shadowsocks-rust-config !LINUX_5_4:shadowsocks-rust-config-nft luci-app-shadowsocks-rust \
# keepalived disabled by default because it's running even with no configuration, would need a default OMR config with some changes
# (TARGET_x86||TARGET_x86_64):keepalived (TARGET_x86||TARGET_x86_64):keepalived-sync

Expand Down
15 changes: 15 additions & 0 deletions rust/Config.in
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
64 changes: 36 additions & 28 deletions rust/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,36 @@
# Copyright (C) 2023 Luca Barbato and Donald Hoskins

include $(TOPDIR)/rules.mk
include ./rust-values.mk

PKG_NAME:=rust
PKG_VERSION:=1.71.1

PKG_VERSION:=1.75.0

PKG_RELEASE:=1

PKG_SOURCE:=rustc-$(PKG_VERSION)-src.tar.gz
PKG_SOURCE_URL:=https://static.rust-lang.org/dist/
PKG_HASH:=6fa90d50d1d529a75f6cc349784de57d7ec0ba2419b09bde7d335c25bd4e472e
HOST_BUILD_DIR:=$(BUILD_DIR)/host/rust-$(RUSTC_TARGET_ARCH)/rustc-$(PKG_VERSION)-src
PKG_HASH:=5b739f45bc9d341e2d1c570d65d2375591e22c2d23ef5b8a37711a0386abc088
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
PKG_BUILD_FLAGS:=no-mips16

include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
include ./rust-values.mk

define Package/rust
SECTION:=lang
CATEGORY:=Languages
SUBMENU:=Rust
TITLE:=Rust Programming Language Compiler
URL:=https://www.rust-lang.org/
DEPENDS:=$(RUST_ARCH_DEPENDS) @LINUX_5_4
DEPENDS:=$(RUST_ARCH_DEPENDS) @!(LINUX_5_4)
endef

define Package/rust/description
Expand All @@ -39,8 +41,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 = \
Expand All @@ -49,28 +55,29 @@ 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 \
--enable-cargo-native-static \
--set=llvm.download-ci-llvm=false \
--set=llvm.download-ci-llvm=true \
$(TARGET_CONFIGURE_ARGS)

define Host/Uninstall
Expand All @@ -80,23 +87,24 @@ 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) \
TARGET_CFLAGS="$(TARGET_CFLAGS)" \
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' \
-e 's|@RUSTC_LDFLAGS@|$(RUSTC_LDFLAGS)|g' \
$(CURDIR)/files/cargo-config > $(CARGO_HOME)/config ; \
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

Expand Down
8 changes: 0 additions & 8 deletions rust/files/cargo-config

This file was deleted.

14 changes: 7 additions & 7 deletions rust/patches/0001-Update-xz2-and-use-it-static.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Subject: [PATCH] Update xz2 and use it static

--- a/src/bootstrap/Cargo.lock
+++ b/src/bootstrap/Cargo.lock
@@ -443,9 +443,9 @@ dependencies = [
@@ -391,9 +391,9 @@ dependencies = [

[[package]]
name = "lzma-sys"
Expand All @@ -23,7 +23,7 @@ Subject: [PATCH] Update xz2 and use it static
dependencies = [
"cc",
"libc",
@@ -912,9 +912,9 @@ dependencies = [
@@ -834,9 +834,9 @@ dependencies = [

[[package]]
name = "xz2"
Expand All @@ -37,12 +37,12 @@ Subject: [PATCH] Update xz2 and use it static
]
--- a/src/bootstrap/Cargo.toml
+++ b/src/bootstrap/Cargo.toml
@@ -50,7 +50,7 @@ toml = "0.5"
ignore = "0.4.10"
opener = "0.5"
once_cell = "1.7.2"
@@ -57,7 +57,7 @@ tar = "0.4"
termcolor = "1.2.0"
toml = "0.5"
walkdir = "2"
-xz2 = "0.1"
+xz2 = { version = "0.1", features = ["static"] }
walkdir = "2"

# Dependencies needed by the build-metrics feature
sysinfo = { version = "0.26.0", optional = true }
35 changes: 0 additions & 35 deletions rust/patches/0002-Bumped-libc-version.patch

This file was deleted.

52 changes: 52 additions & 0 deletions rust/patches/0002-rustc-bootstrap-cache.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -557,7 +557,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/src/core/download.rs
+++ b/src/bootstrap/src/core/download.rs
@@ -208,7 +208,13 @@ impl Config {
Some(other) => panic!("unsupported protocol {other} in {url}"),
None => panic!("no protocol in {url}"),
}
- t!(std::fs::rename(&tempfile, dest_path));
+ match std::fs::rename(&tempfile, dest_path) {
+ Ok(v) => v,
+ Err(_) => {
+ t!(std::fs::copy(&tempfile, dest_path));
+ t!(std::fs::remove_file(&tempfile));
+ }
+ }
}

fn download_http_with_retries(&self, tempfile: &Path, url: &str, help_on_error: &str) {
@@ -544,7 +550,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));
@@ -671,7 +680,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));
Loading

0 comments on commit 9beb085

Please sign in to comment.