Skip to content

Commit 21eb2a4

Browse files
author
bors-servo
authored
Auto merge of #122 - myfreeweb:master, r=jdm
Fix build on FreeBSD <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/mozjs/122) <!-- Reviewable:end -->
2 parents 0158ca2 + 33fdb7b commit 21eb2a4

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ fn main() {
4242
.expect("Failed to run `make`");
4343
assert!(result.success());
4444
println!("cargo:rustc-link-search=native={}/js/src", out_dir);
45+
println!("cargo:rustc-link-lib=static=js_static"); // Must come before c++
4546
if target.contains("windows") {
4647
println!("cargo:rustc-link-lib=winmm");
4748
println!("cargo:rustc-link-lib=psapi");
4849
if target.contains("gnu") {
4950
println!("cargo:rustc-link-lib=stdc++");
5051
}
51-
} else if target.contains("apple") {
52+
} else if target.contains("apple") || target.contains("freebsd") {
5253
println!("cargo:rustc-link-lib=c++");
5354
} else {
5455
println!("cargo:rustc-link-lib=stdc++");
5556
}
56-
println!("cargo:rustc-link-lib=static=js_static");
5757
println!("cargo:outdir={}", out_dir);
5858
}

makefile.cargo

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,16 @@ CONFIGURE_FLAGS += --target=$(TARGET) --disable-gold
3939
else
4040

4141
ifeq (,$(VCINSTALLDIR))
42-
CC ?= gcc
43-
CPP ?= gcc -E
44-
CXX ?= g++
42+
ifeq (freebsd,$(findstring freebsd,$(TARGET)))
43+
# Does not symlink clang as "gcc" like macOS does
44+
CC ?= clang
45+
CPP ?= clang -E
46+
CXX ?= clang++
47+
else
48+
CC ?= gcc
49+
CPP ?= gcc -E
50+
CXX ?= g++
51+
endif
4552
AR ?= ar
4653
PYTHON ?= python
4754
endif

0 commit comments

Comments
 (0)