FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
mcpp/src/fallback/sysroot_complete.cppm at main · mcpp-community/mcpp · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
mcpp-community
/
mcpp
Public
Notifications
You must be signed in to change notification settings
Fork
12
Star
109
Code
Issues
36
Pull requests
8
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
mcpp
/
src
/
fallback
/
sysroot_complete.cppm
Copy path
More file actions
More file actions
Latest commit
History
History
History
52 lines (43 loc) · 2 KB
Breadcrumbs
mcpp
/
src
/
fallback
/
sysroot_complete.cppm
Copy path
File metadata and controls
52 lines (43 loc) · 2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
mcpp.fallback.sysroot_complete — ensure sysroot has complete headers.
//
//
When GCC's probed sysroot exists but may be missing linux kernel
//
headers or glibc headers, symlink them from the payload xpkgs.
export
module
mcpp.fallback.sysroot_complete;
import
std;
import
mcpp.toolchain.model;
export
namespace
mcpp
::fallback {
//
Ensure sysroot directory has complete headers by symlinking from
//
payload xpkgs. Called when GCC's probed sysroot exists but may
//
be missing linux kernel headers or glibc headers.
void
ensure_sysroot_complete
(
const
std::filesystem::path& sysroot,
const
mcpp::toolchain::PayloadPaths& pp) {
if
(sysroot.
empty
())
return
;
auto
sysrootInclude = sysroot /
"
usr
"
/
"
include
"
;
if
(!
std::filesystem::exists
(sysrootInclude))
return
;
std::error_code ec;
//
Ensure linux kernel headers are present in sysroot.
//
If missing, symlink from linux-headers payload.
if
(!pp.
linuxInclude
.
empty
()) {
for
(
auto
dir : {
"
linux
"
,
"
asm
"
,
"
asm-generic
"
}) {
auto
target = sysrootInclude / dir;
auto
source = pp.
linuxInclude
/ dir;
if
(!
std::filesystem::exists
(target, ec) &&
std::filesystem::exists
(source, ec)) {
std::filesystem::create_directory_symlink
(source, target, ec);
}
}
}
//
Ensure glibc headers are present if sysroot is bare.
if
(!
std::filesystem::exists
(sysrootInclude /
"
features.h
"
, ec)) {
//
Symlink individual glibc dirs/files into sysroot.
for
(
auto
& entry :
std::filesystem::directory_iterator
(pp.
glibcInclude
, ec)) {
auto
target = sysrootInclude / entry.
path
().
filename
();
if
(!
std::filesystem::exists
(target, ec)) {
if
(entry.
is_directory
(ec))
std::filesystem::create_directory_symlink
(entry.
path
(), target, ec);
else
std::filesystem::create_symlink
(entry.
path
(), target, ec);
}
}
}
}
}
//
namespace mcpp::fallback
Back
|
FazBrowse Home
|
New Git URL