Skip to content

Commit 1871bff

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 4148711 + 3807e1f commit 1871bff

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
@@ -315,7 +315,7 @@ def build_triple(self):
315315
try:
316316
ostype = subprocess.check_output(['uname', '-s']).strip().decode(default_encoding)
317317
cputype = subprocess.check_output(['uname', '-m']).strip().decode(default_encoding)
318-
except (subprocess.CalledProcessError, WindowsError):
318+
except (subprocess.CalledProcessError, OSError):
319319
if sys.platform == 'win32':
320320
return 'x86_64-pc-windows-msvc'
321321
err = "uname not found"
@@ -345,6 +345,21 @@ def build_triple(self):
345345
ostype = 'unknown-openbsd'
346346
elif ostype == 'NetBSD':
347347
ostype = 'unknown-netbsd'
348+
elif ostype == 'SunOS':
349+
ostype = 'sun-solaris'
350+
# On Solaris, uname -m will return a machine classification instead
351+
# of a cpu type, so uname -p is recommended instead. However, the
352+
# output from that option is too generic for our purposes (it will
353+
# always emit 'i386' on x86/amd64 systems). As such, isainfo -k
354+
# must be used instead.
355+
try:
356+
cputype = subprocess.check_output(['isainfo',
357+
'-k']).strip().decode(default_encoding)
358+
except (subprocess.CalledProcessError, OSError):
359+
err = "isainfo not found"
360+
if self.verbose:
361+
raise Exception(err)
362+
sys.exit(err)
348363
elif ostype == 'Darwin':
349364
ostype = 'apple-darwin'
350365
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)