Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile successfully on FreeBSD #80

Merged
merged 1 commit into from Jun 10, 2016
Merged

Compile successfully on FreeBSD #80

merged 1 commit into from Jun 10, 2016

Conversation

@dlrobertson
Copy link
Contributor

dlrobertson commented Jun 5, 2016

  • Add static MAKE_CMD variable for the make command
  • replace instances of make with $(MAKE)

This change is Reviewable

build.rs Outdated
fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let target = env::var("TARGET").unwrap();
let result = Command::new("make")
let result = Command::new(MAKE_CMD)

This comment has been minimized.

@mbrubeck

mbrubeck Jun 5, 2016

Contributor

Maybe this should use the $MAKE env var if it's set (and fall back to the constant if it's not), so people on other BSDs or similar systems can more easily build without patching the build script.

@mbrubeck mbrubeck self-assigned this Jun 5, 2016
@dlrobertson dlrobertson force-pushed the dlrobertson:freebsd branch from 27d1bb1 to d5114d8 Jun 5, 2016
build.rs Outdated
fn find_make() -> String {
Command::new("gmake").status()
.map(|_| "gmake".to_string())
.unwrap_or("make".to_string())

This comment has been minimized.

@dlrobertson

dlrobertson Jun 5, 2016

Author Contributor

Is this the best way to find if gmake exists?

This comment has been minimized.

@emilio

emilio Jun 5, 2016

Member

I'll let @mbrubeck do the final review, though if it works it's probably ok.

For reference, this is what it's used to find python in the style crate, though your version looks way cleaner.

build.rs Outdated
fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let target = env::var("TARGET").unwrap();
let result = Command::new("make")
let result = Command::new(env::var("MAKE").unwrap_or(find_make()))

This comment has been minimized.

@emilio

emilio Jun 5, 2016

Member

nit: unwrap_or_else(find_make) won't call the function if MAKE is found.

This comment has been minimized.

@dlrobertson

dlrobertson Jun 5, 2016

Author Contributor

Ah! good call

@dlrobertson dlrobertson force-pushed the dlrobertson:freebsd branch from d5114d8 to 834cf11 Jun 5, 2016
build.rs Outdated
fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let target = env::var("TARGET").unwrap();
let result = Command::new("make")
let result = Command::new(env::var("MAKE").unwrap_or_else(find_make()))

This comment has been minimized.

@emilio

emilio Jun 5, 2016

Member

nit again: you're still calling the function, remove the two parens because it's not building now :P

@dlrobertson dlrobertson force-pushed the dlrobertson:freebsd branch from 834cf11 to d294feb Jun 5, 2016
@dlrobertson
Copy link
Contributor Author

dlrobertson commented Jun 5, 2016

Updated

@mbrubeck
Copy link
Contributor

mbrubeck commented Jun 6, 2016

@bors-servo delegate+

r=mbrubeck with or without some optional suggestions below

Previously, danlrobertson (Dan Robertson) wrote…

Updated


Reviewed 1 of 2 files at r1, 1 of 1 files at r4.
Review status: all files reviewed at latest revision, 4 unresolved discussions.


build.rs, line 12 [r2] (raw file):

Previously, emilio (Emilio Cobos Álvarez) wrote…

I'll let @mbrubeck do the final review, though if it works it's probably ok.

For reference, this is what it's used to find python in the style crate, though your version looks way cleaner.

This seems fine to me. My only other idea is to iterate through `["gmake", "make"]` and try running the actual command with each one, continuing if it returns an `std::io::ErrorKind::NotFound` and breaking on any other result.

build.rs, line 18 [r3] (raw file):

Previously, emilio (Emilio Cobos Álvarez) wrote…

nit again: you're still calling the function, remove the two parens because it's not building now :P

nit: Could use `env::var_os` here, I think.

build.rs, line 11 [r4] (raw file):

fn find_make() -> String {
    Command::new("gmake").status()
                         .map(|_| "gmake".to_string())

Personally I'd find a match slightly more readable than map/unwrap_or here, but it's up to you.


Comments from Reviewable

@bors-servo
Copy link
Contributor

bors-servo commented Jun 6, 2016

✌️ @danlrobertson can now approve this pull request

@dlrobertson
Copy link
Contributor Author

dlrobertson commented Jun 10, 2016

Thanks for the good suggestions!

Previously, mbrubeck (Matt Brubeck) wrote…

@bors-servo delegate+

r=mbrubeck with or without some optional suggestions below


Review status: all files reviewed at latest revision, 4 unresolved discussions.


build.rs, line 12 [r2] (raw file):

Previously, mbrubeck (Matt Brubeck) wrote…

This seems fine to me. My only other idea is to iterate through ["gmake", "make"] and try running the actual command with each one, continuing if it returns an std::io::ErrorKind::NotFound and breaking on any other result.

This would add more information in the case that neither one is present (although this is almost certainly very rare). I like the idea, but I think I'll stick with a `match` and `Command::status`

build.rs, line 18 [r3] (raw file):

Previously, mbrubeck (Matt Brubeck) wrote…

nit: Could use env::var_os here, I think.

I'll try it out and see what happens!

build.rs, line 11 [r4] (raw file):

Previously, mbrubeck (Matt Brubeck) wrote…

Personally I'd find a match slightly more readable than map/unwrap_or here, but it's up to you.

Now that I think about it, I agree.

Comments from Reviewable

@bors-servo
Copy link
Contributor

bors-servo commented Jun 10, 2016

✌️ @danlrobertson can now approve this pull request

1 similar comment
@bors-servo
Copy link
Contributor

bors-servo commented Jun 10, 2016

✌️ @danlrobertson can now approve this pull request

@dlrobertson
Copy link
Contributor Author

dlrobertson commented Jun 10, 2016

^ highfive bug?

@jdm
Copy link
Member

jdm commented Jun 10, 2016

Homu instead of highfive, but yes.

 - Add static MAKE_CMD variable for the make command
 - replace instances of `make` with $(MAKE)
@dlrobertson dlrobertson force-pushed the dlrobertson:freebsd branch 2 times, most recently from 94bc6a5 to 5f81658 Jun 10, 2016
@dlrobertson
Copy link
Contributor Author

dlrobertson commented Jun 10, 2016

@bors-servo r=mbrubeck

Previously, jdm (Josh Matthews) wrote…

Homu instead of highfive, but yes.


Review status: 1 of 2 files reviewed at latest revision, 4 unresolved discussions.


Comments from Reviewable

@bors-servo
Copy link
Contributor

bors-servo commented Jun 10, 2016

📌 Commit 5f81658 has been approved by mbrubeck

@bors-servo
Copy link
Contributor

bors-servo commented Jun 10, 2016

Testing commit 5f81658 with merge 67b5e70...

bors-servo added a commit that referenced this pull request Jun 10, 2016
Compile successfully on FreeBSD

 - Add static MAKE_CMD variable for the make command
 - replace instances of `make` with $(MAKE)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/mozjs/80)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jun 10, 2016

☀️ Test successful - travis

@bors-servo bors-servo merged commit 5f81658 into servo:master Jun 10, 2016
2 of 3 checks passed
2 of 3 checks passed
code-review/reviewable 1 file, 4 discussions left (emilio, mbrubeck)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@dlrobertson
Copy link
Contributor Author

dlrobertson commented Jun 10, 2016

servo/angle#8 failed on appveyor... currently investigating

@dlrobertson dlrobertson deleted the dlrobertson:freebsd branch Nov 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.