Skip to content

Commit

Permalink
Merge branch 'main' into mozjs_download
Browse files Browse the repository at this point in the history
  • Loading branch information
wusyong committed Mar 22, 2024
2 parents 379438b + b695c63 commit 9c941ae
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
9 changes: 5 additions & 4 deletions mozjs-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ fn cc_flags() -> Vec<&'static str> {

let is_apple = target.contains("apple");
let is_freebsd = target.contains("freebsd");
let is_ohos = target.contains("ohos");

if is_apple || is_freebsd {
if is_apple || is_freebsd || is_ohos {
result.push("-stdlib=libc++");
}

Expand Down Expand Up @@ -267,7 +268,7 @@ fn build_spidermonkey(build_dir: &Path) {
cmd.env("MAKEFLAGS", makeflags);
}

if target.contains("apple") || target.contains("freebsd") {
if target.contains("apple") || target.contains("freebsd") || target.contains("ohos") {
cmd.env("CXXFLAGS", "-stdlib=libc++");
}

Expand Down Expand Up @@ -299,7 +300,7 @@ fn build_spidermonkey(build_dir: &Path) {
if target.contains("gnu") {
println!("cargo:rustc-link-lib=stdc++");
}
} else if target.contains("apple") || target.contains("freebsd") {
} else if target.contains("apple") || target.contains("freebsd") || target.contains("ohos") {
println!("cargo:rustc-link-lib=c++");
} else {
println!("cargo:rustc-link-lib=stdc++");
Expand Down Expand Up @@ -875,7 +876,7 @@ fn link_static_lib_binaries(build_dir: &Path) -> Result<(), std::io::Error> {
if target.contains("gnu") {
println!("cargo:rustc-link-lib=stdc++");
}
} else if target.contains("apple") || target.contains("freebsd") {
} else if target.contains("apple") || target.contains("freebsd") || target.contains("ohos") {
println!("cargo:rustc-link-lib=c++");
} else {
println!("cargo:rustc-link-lib=stdc++");
Expand Down
21 changes: 21 additions & 0 deletions mozjs-sys/etc/patches/0030-autoconf-add-ohos.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/build/autoconf/config.sub b/build/autoconf/config.sub
--- a/build/autoconf/config.sub (revision 20f7934762a6a1d4751353c8d024a0185ba85547)
+++ b/build/autoconf/config.sub (revision 1d3dc1d7b53439ce8f799526ddbbe0f833b8ef0f)
@@ -1754,7 +1754,7 @@
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
- | fiwix* )
+ | fiwix* | ohos* )
;;
# This one is extra strict with allowed versions
sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
@@ -1772,7 +1772,7 @@
# (given a valid OS), if there is a kernel.
case $kernel-$os in
linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
- | linux-musl* | linux-relibc* | linux-uclibc* )
+ | linux-musl* | linux-relibc* | linux-uclibc* | linux-ohos* )
;;
uclinux-uclibc* )
;;
4 changes: 2 additions & 2 deletions mozjs-sys/mozjs/build/autoconf/config.sub
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ case $os in
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
| fiwix* )
| fiwix* | ohos* )
;;
# This one is extra strict with allowed versions
sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
Expand All @@ -1772,7 +1772,7 @@ esac
# (given a valid OS), if there is a kernel.
case $kernel-$os in
linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
| linux-musl* | linux-relibc* | linux-uclibc* )
| linux-musl* | linux-relibc* | linux-uclibc* | linux-ohos* )
;;
uclinux-uclibc* )
;;
Expand Down

0 comments on commit 9c941ae

Please sign in to comment.