Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ddf82636
R
Rust
项目概览
int
/
Rust
接近 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
ddf82636
编写于
11月 26, 2020
作者:
P
Pietro Albini
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bootstrap: convert build-manifest to use the new Tarball struct
上级
3ffea60d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
146 addition
and
88 deletion
+146
-88
src/bootstrap/dist.rs
src/bootstrap/dist.rs
+21
-88
src/bootstrap/lib.rs
src/bootstrap/lib.rs
+1
-0
src/bootstrap/tarball.rs
src/bootstrap/tarball.rs
+124
-0
未找到文件。
src/bootstrap/dist.rs
浏览文件 @
ddf82636
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
use
crate
::
cache
::{
Interned
,
INTERNER
};
use
crate
::
cache
::{
Interned
,
INTERNER
};
use
crate
::
compile
;
use
crate
::
compile
;
use
crate
::
config
::
TargetSelection
;
use
crate
::
config
::
TargetSelection
;
use
crate
::
tarball
::{
OverlayKind
,
Tarball
};
use
crate
::
tool
::{
self
,
Tool
};
use
crate
::
tool
::{
self
,
Tool
};
use
crate
::
util
::{
exe
,
is_dylib
,
timeit
};
use
crate
::
util
::{
exe
,
is_dylib
,
timeit
};
use
crate
::{
Compiler
,
DependencyType
,
Mode
,
LLVM_TOOLS
};
use
crate
::{
Compiler
,
DependencyType
,
Mode
,
LLVM_TOOLS
};
...
@@ -2517,68 +2518,36 @@ fn run(self, builder: &Builder<'_>) -> Option<PathBuf> {
...
@@ -2517,68 +2518,36 @@ fn run(self, builder: &Builder<'_>) -> Option<PathBuf> {
builder
.info
(
&
format!
(
"Dist RustDev ({})"
,
target
));
builder
.info
(
&
format!
(
"Dist RustDev ({})"
,
target
));
let
_
time
=
timeit
(
builder
);
let
_
time
=
timeit
(
builder
);
let
src
=
builder
.src
.join
(
"src/llvm-project/llvm"
);
let
name
=
pkgname
(
builder
,
"rust-dev"
);
let
tmp
=
tmpdir
(
builder
);
let
image
=
tmp
.join
(
"rust-dev-image"
);
drop
(
fs
::
remove_dir_all
(
&
image
));
// Prepare the image directory
let
mut
tarball
=
Tarball
::
new
(
builder
,
"rust-dev"
,
&
target
.triple
);
let
dst_bindir
=
image
.join
(
"bin"
);
tarball
.set_overlay
(
OverlayKind
::
LLVM
);
t!
(
fs
::
create_dir_all
(
&
dst_bindir
));
let
src_bindir
=
builder
.llvm_out
(
target
)
.join
(
"bin"
);
let
src_bindir
=
builder
.llvm_out
(
target
)
.join
(
"bin"
);
let
install_bin
=
for
bin
in
&
[
|
name
|
builder
.install
(
&
src_bindir
.join
(
exe
(
name
,
target
)),
&
dst_bindir
,
0o755
);
"llvm-config"
,
install_bin
(
"llvm-config"
);
"llvm-ar"
,
install_bin
(
"llvm-ar"
);
"llvm-objdump"
,
install_bin
(
"llvm-objdump"
);
"llvm-profdata"
,
install_bin
(
"llvm-profdata"
);
"llvm-bcanalyzer"
,
install_bin
(
"llvm-bcanalyzer"
);
"llvm-cov"
,
install_bin
(
"llvm-cov"
);
"llvm-dwp"
,
install_bin
(
"llvm-dwp"
);
]
{
builder
.install
(
&
builder
.llvm_filecheck
(
target
),
&
dst_bindir
,
0o755
);
tarball
.add_file
(
src_bindir
.join
(
exe
(
bin
,
target
)),
"bin"
,
0o755
);
}
tarball
.add_file
(
&
builder
.llvm_filecheck
(
target
),
"bin"
,
0o755
);
// Copy the include directory as well; needed mostly to build
// Copy the include directory as well; needed mostly to build
// librustc_llvm properly (e.g., llvm-config.h is in here). But also
// librustc_llvm properly (e.g., llvm-config.h is in here). But also
// just broadly useful to be able to link against the bundled LLVM.
// just broadly useful to be able to link against the bundled LLVM.
builder
.cp_r
(
&
builder
.llvm_out
(
target
)
.join
(
"include"
),
&
image
.join
(
"include"
)
);
tarball
.add_dir
(
&
builder
.llvm_out
(
target
)
.join
(
"include"
),
"."
);
// Copy libLLVM.so to the target lib dir as well, so the RPATH like
// Copy libLLVM.so to the target lib dir as well, so the RPATH like
// `$ORIGIN/../lib` can find it. It may also be used as a dependency
// `$ORIGIN/../lib` can find it. It may also be used as a dependency
// of `rustc-dev` to support the inherited `-lLLVM` when using the
// of `rustc-dev` to support the inherited `-lLLVM` when using the
// compiler libraries.
// compiler libraries.
maybe_install_llvm
(
builder
,
target
,
&
image
.join
(
"lib"
));
maybe_install_llvm
(
builder
,
target
,
&
tarball
.image_dir
()
.join
(
"lib"
));
// Prepare the overlay
let
overlay
=
tmp
.join
(
"rust-dev-overlay"
);
drop
(
fs
::
remove_dir_all
(
&
overlay
));
builder
.create_dir
(
&
overlay
);
builder
.install
(
&
src
.join
(
"README.txt"
),
&
overlay
,
0o644
);
builder
.install
(
&
src
.join
(
"LICENSE.TXT"
),
&
overlay
,
0o644
);
builder
.create
(
&
overlay
.join
(
"version"
),
&
builder
.rust_version
());
// Generate the installer tarball
Some
(
tarball
.generate
())
let
mut
cmd
=
rust_installer
(
builder
);
cmd
.arg
(
"generate"
)
.arg
(
"--product-name=Rust"
)
.arg
(
"--rel-manifest-dir=rustlib"
)
.arg
(
"--success-message=rust-dev-installed."
)
.arg
(
"--image-dir"
)
.arg
(
&
image
)
.arg
(
"--work-dir"
)
.arg
(
&
tmpdir
(
builder
))
.arg
(
"--output-dir"
)
.arg
(
&
distdir
(
builder
))
.arg
(
"--non-installed-overlay"
)
.arg
(
&
overlay
)
.arg
(
format!
(
"--package-name={}-{}"
,
name
,
target
.triple
))
.arg
(
"--legacy-manifest-dirs=rustlib,cargo"
)
.arg
(
"--component-name=rust-dev"
);
builder
.run
(
&
mut
cmd
);
Some
(
distdir
(
builder
)
.join
(
format!
(
"{}-{}.tar.gz"
,
name
,
target
.triple
)))
}
}
}
}
...
@@ -2607,45 +2576,9 @@ fn make_run(run: RunConfig<'_>) {
...
@@ -2607,45 +2576,9 @@ fn make_run(run: RunConfig<'_>) {
fn
run
(
self
,
builder
:
&
Builder
<
'_
>
)
->
PathBuf
{
fn
run
(
self
,
builder
:
&
Builder
<
'_
>
)
->
PathBuf
{
let
build_manifest
=
builder
.tool_exe
(
Tool
::
BuildManifest
);
let
build_manifest
=
builder
.tool_exe
(
Tool
::
BuildManifest
);
let
name
=
pkgname
(
builder
,
"build-manifest"
);
let
tarball
=
Tarball
::
new
(
builder
,
"build-manifest"
,
&
self
.target.triple
);
let
tmp
=
tmpdir
(
builder
);
tarball
.add_file
(
&
build_manifest
,
"bin"
,
0o755
);
tarball
.generate
()
// Prepare the image.
let
image
=
tmp
.join
(
"build-manifest-image"
);
let
image_bin
=
image
.join
(
"bin"
);
let
_
=
fs
::
remove_dir_all
(
&
image
);
t!
(
fs
::
create_dir_all
(
&
image_bin
));
builder
.install
(
&
build_manifest
,
&
image_bin
,
0o755
);
// Prepare the overlay.
let
overlay
=
tmp
.join
(
"build-manifest-overlay"
);
let
_
=
fs
::
remove_dir_all
(
&
overlay
);
builder
.create_dir
(
&
overlay
);
builder
.create
(
&
overlay
.join
(
"version"
),
&
builder
.rust_version
());
for
file
in
&
[
"COPYRIGHT"
,
"LICENSE-APACHE"
,
"LICENSE-MIT"
,
"README.md"
]
{
builder
.install
(
&
builder
.src
.join
(
file
),
&
overlay
,
0o644
);
}
// Create the final tarball.
let
mut
cmd
=
rust_installer
(
builder
);
cmd
.arg
(
"generate"
)
.arg
(
"--product-name=Rust"
)
.arg
(
"--rel-manifest-dir=rustlib"
)
.arg
(
"--success-message=build-manifest installed."
)
.arg
(
"--image-dir"
)
.arg
(
&
image
)
.arg
(
"--work-dir"
)
.arg
(
&
tmpdir
(
builder
))
.arg
(
"--output-dir"
)
.arg
(
&
distdir
(
builder
))
.arg
(
"--non-installed-overlay"
)
.arg
(
&
overlay
)
.arg
(
format!
(
"--package-name={}-{}"
,
name
,
self
.target.triple
))
.arg
(
"--legacy-manifest-dirs=rustlib,cargo"
)
.arg
(
"--component-name=build-manifest"
);
builder
.run
(
&
mut
cmd
);
distdir
(
builder
)
.join
(
format!
(
"{}-{}.tar.gz"
,
name
,
self
.target.triple
))
}
}
}
}
...
...
src/bootstrap/lib.rs
浏览文件 @
ddf82636
...
@@ -142,6 +142,7 @@
...
@@ -142,6 +142,7 @@
mod
run
;
mod
run
;
mod
sanity
;
mod
sanity
;
mod
setup
;
mod
setup
;
mod
tarball
;
mod
test
;
mod
test
;
mod
tool
;
mod
tool
;
mod
toolstate
;
mod
toolstate
;
...
...
src/bootstrap/tarball.rs
0 → 100644
浏览文件 @
ddf82636
use
std
::
path
::{
Path
,
PathBuf
};
use
build_helper
::
t
;
use
crate
::
builder
::
Builder
;
#[derive(Copy,
Clone)]
pub
(
crate
)
enum
OverlayKind
{
Rust
,
LLVM
,
}
impl
OverlayKind
{
fn
included_files
(
&
self
)
->
&
[
&
str
]
{
match
self
{
OverlayKind
::
Rust
=>
&
[
"COPYRIGHT"
,
"LICENSE-APACHE"
,
"LICENSE-MIT"
,
"README.md"
],
OverlayKind
::
LLVM
=>
{
&
[
"src/llvm-project/llvm/LICENSE.TXT"
,
"src/llvm-project/llvm/README.txt"
]
}
}
}
}
pub
(
crate
)
struct
Tarball
<
'a
>
{
builder
:
&
'a
Builder
<
'a
>
,
pkgname
:
String
,
component
:
String
,
target
:
String
,
overlay
:
OverlayKind
,
temp_dir
:
PathBuf
,
image_dir
:
PathBuf
,
overlay_dir
:
PathBuf
,
work_dir
:
PathBuf
,
}
impl
<
'a
>
Tarball
<
'a
>
{
pub
(
crate
)
fn
new
(
builder
:
&
'a
Builder
<
'a
>
,
component
:
&
str
,
target
:
&
str
)
->
Self
{
let
pkgname
=
crate
::
dist
::
pkgname
(
builder
,
component
);
let
temp_dir
=
builder
.out
.join
(
"tmp"
)
.join
(
"tarball"
)
.join
(
component
);
let
_
=
std
::
fs
::
remove_dir_all
(
&
temp_dir
);
let
image_dir
=
temp_dir
.join
(
"image"
);
let
overlay_dir
=
temp_dir
.join
(
"overlay"
);
let
work_dir
=
temp_dir
.join
(
"work"
);
Self
{
builder
,
pkgname
,
component
:
component
.into
(),
target
:
target
.into
(),
overlay
:
OverlayKind
::
Rust
,
temp_dir
,
image_dir
,
overlay_dir
,
work_dir
,
}
}
pub
(
crate
)
fn
set_overlay
(
&
mut
self
,
overlay
:
OverlayKind
)
{
self
.overlay
=
overlay
;
}
pub
(
crate
)
fn
image_dir
(
&
self
)
->
&
Path
{
t!
(
std
::
fs
::
create_dir_all
(
&
self
.image_dir
));
&
self
.image_dir
}
pub
(
crate
)
fn
add_file
(
&
self
,
src
:
impl
AsRef
<
Path
>
,
destdir
:
impl
AsRef
<
Path
>
,
perms
:
u32
)
{
// create_dir_all fails to create `foo/bar/.`, so when the destination is "." this simply
// uses the base directory as the destination directory.
let
destdir
=
if
destdir
.as_ref
()
==
Path
::
new
(
"."
)
{
self
.image_dir
.clone
()
}
else
{
self
.image_dir
.join
(
destdir
.as_ref
())
};
t!
(
std
::
fs
::
create_dir_all
(
&
destdir
));
self
.builder
.install
(
src
.as_ref
(),
&
destdir
,
perms
);
}
pub
(
crate
)
fn
add_dir
(
&
self
,
src
:
impl
AsRef
<
Path
>
,
destdir
:
impl
AsRef
<
Path
>
)
{
t!
(
std
::
fs
::
create_dir_all
(
destdir
.as_ref
()));
self
.builder
.cp_r
(
src
.as_ref
(),
&
self
.image_dir
.join
(
destdir
.as_ref
())
.join
(
src
.as_ref
()
.file_name
()
.unwrap
()),
);
}
pub
(
crate
)
fn
generate
(
self
)
->
PathBuf
{
t!
(
std
::
fs
::
create_dir_all
(
&
self
.overlay_dir
));
self
.builder
.create
(
&
self
.overlay_dir
.join
(
"version"
),
&
self
.builder
.rust_version
());
for
file
in
self
.overlay
.included_files
()
{
self
.builder
.install
(
&
self
.builder.src
.join
(
file
),
&
self
.overlay_dir
,
0o644
);
}
let
distdir
=
crate
::
dist
::
distdir
(
self
.builder
);
let
mut
cmd
=
self
.builder
.tool_cmd
(
crate
::
tool
::
Tool
::
RustInstaller
);
cmd
.arg
(
"generate"
)
.arg
(
"--product-name=Rust"
)
.arg
(
"--rel-manifest-dir=rustlib"
)
.arg
(
format!
(
"--success-message={} installed."
,
self
.component
))
.arg
(
"--image-dir"
)
.arg
(
self
.image_dir
)
.arg
(
"--work-dir"
)
.arg
(
self
.work_dir
)
.arg
(
"--output-dir"
)
.arg
(
&
distdir
)
.arg
(
"--non-installed-overlay"
)
.arg
(
self
.overlay_dir
)
.arg
(
format!
(
"--package-name={}-{}"
,
self
.pkgname
,
self
.target
))
.arg
(
"--legacy-manifest-dirs=rustlib,cargo"
)
.arg
(
format!
(
"--component-name={}"
,
self
.component
));
self
.builder
.run
(
&
mut
cmd
);
t!
(
std
::
fs
::
remove_dir_all
(
&
self
.temp_dir
));
distdir
.join
(
format!
(
"{}-{}.tar.gz"
,
self
.pkgname
,
self
.target
))
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录