Skip to content

Commit b7e57da

Browse files
authored
Rollup merge of #39759 - binarycrusader:master, r=alexcrichton
add solaris rustbuild support Add Solaris as recognized ostype Add cputype recognition for Solaris Fixes #39729 A future pull request will discriminate between the commercial release and older opensource derivatives to account for divergence, for now, this is compatible with both.
2 parents 02b29f2 + 3807e1f commit b7e57da

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/bootstrap/bootstrap.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def build_triple(self):
317317
try:
318318
ostype = subprocess.check_output(['uname', '-s']).strip().decode(default_encoding)
319319
cputype = subprocess.check_output(['uname', '-m']).strip().decode(default_encoding)
320-
except (subprocess.CalledProcessError, WindowsError):
320+
except (subprocess.CalledProcessError, OSError):
321321
if sys.platform == 'win32':
322322
return 'x86_64-pc-windows-msvc'
323323
err = "uname not found"
@@ -347,6 +347,21 @@ def build_triple(self):
347347
ostype = 'unknown-openbsd'
348348
elif ostype == 'NetBSD':
349349
ostype = 'unknown-netbsd'
350+
elif ostype == 'SunOS':
351+
ostype = 'sun-solaris'
352+
# On Solaris, uname -m will return a machine classification instead
353+
# of a cpu type, so uname -p is recommended instead. However, the
354+
# output from that option is too generic for our purposes (it will
355+
# always emit 'i386' on x86/amd64 systems). As such, isainfo -k
356+
# must be used instead.
357+
try:
358+
cputype = subprocess.check_output(['isainfo',
359+
'-k']).strip().decode(default_encoding)
360+
except (subprocess.CalledProcessError, OSError):
361+
err = "isainfo not found"
362+
if self.verbose:
363+
raise Exception(err)
364+
sys.exit(err)
350365
elif ostype == 'Darwin':
351366
ostype = 'apple-darwin'
352367
elif ostype.startswith('MINGW'):

src/libunwind/build.rs

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ fn main() {
2727
println!("cargo:rustc-link-lib=gcc_s");
2828
} else if target.contains("openbsd") {
2929
println!("cargo:rustc-link-lib=gcc");
30+
} else if target.contains("solaris") {
31+
println!("cargo:rustc-link-lib=gcc_s");
3032
} else if target.contains("bitrig") {
3133
println!("cargo:rustc-link-lib=c++abi");
3234
} else if target.contains("dragonfly") {

0 commit comments

Comments
 (0)