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

Various changes to the build script #28

Merged
merged 11 commits into from
Aug 27, 2019

Commits on Jul 26, 2019

  1. Remove #[link] attributes

    They cause the following warnings:
    warning: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...",
                                                   /*opt*/ cfg = "...")]`
     --> /tmp/coreaudio-sys/target/x86_64-apple-darwin/debug/build/coreaudio-sys-0d8fd082e359c2ec/out/coreaudio.rs:3:1
      |
    3 | #[link = "/tmp/MacOSX10.14.sdk/System/Library/Frameworks/AudioToolbox"]
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: #[warn(ill_formed_attribute_input)] on by default
      = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
      = note: for more information, see issue #57571 <rust-lang/rust#57571>
    
    And they are actually redundant with the cargo:rustc-link-lib lines the
    build script prints already.
    glandium committed Jul 26, 2019
    Configuration menu
    Copy the full SHA
    62f6e22 View commit details
    Browse the repository at this point in the history
  2. Run cargo fmt

    glandium committed Jul 26, 2019
    Configuration menu
    Copy the full SHA
    7150b8c View commit details
    Browse the repository at this point in the history

Commits on Aug 6, 2019

  1. Simplify and fix bindgen setup both for native and cross compilation

    The current setup requires 2 environment variables for
    cross-compilation, and can fail to build under some circumstances on a
    freshly installed OSX + Xcode machine.
    
    This change simplifies the setup by:
    - On native builds, using `xcrun --show-sdk-path` instead of
      `xcode-select -p` to find the SDK.
    - On cross builds, checking COREAUDIO_SDK_PATH.
    - Pass --target to clang, which makes things work for cross-compilation
      with plain clang (as opposed to osxcross).
    - Pass -isysroot to clang instead of -F, which makes it find all
      possible headers in the SDK, especially TargetConditionals.h, which
      lives in $COREAUDIO_SDK_PATH/usr/include.
    - Instruct cargo of the environment variables that affect the build
      script.
    
    COREAUDIO_CFLAGS is left as a convenience, for now.
    glandium committed Aug 6, 2019
    Configuration menu
    Copy the full SHA
    7659009 View commit details
    Browse the repository at this point in the history
  2. Update bindgen build dependency to 0.50

    As of 0.49, bindgen supports a BINDGEN_EXTRA_CLANG_ARGS environment variable
    that can be used to pass extra arguments to clang. This can be used
    instead of COREAUDIO_CFLAGS.
    glandium committed Aug 6, 2019
    Configuration menu
    Copy the full SHA
    5277523 View commit details
    Browse the repository at this point in the history
  3. Re-enable rustfmt of generated bindings

    Because recent versions of bindgen generate their bindings on one line,
    because of bindgen's use of u128 and rust's warnings of its unsafety
    FFI-wise, and because of rust-lang/rust#62999,
    combined, building the crate generates massive logs... which exceed
    travis's maximum log length.
    
    It was disabled in RustAudio#13 because back then rustfmt had some problems with
    the bindgen output. Now that rustfmt is part of rust, these kind of
    problems presumably should happen less if at all.
    glandium committed Aug 6, 2019
    Configuration menu
    Copy the full SHA
    7a51ced View commit details
    Browse the repository at this point in the history
  4. Panic instead of printing errors in the build script

    Simply printing errors to stderr does nothing visible by default. So
    when building without an SDK available, there is no apparent error
    showing up other than in some file "hidden" in target/, and an error
    that including coreaudio.rs failed.
    
    Similarly, when attempting to build for an unsupported target, the
    script reaches the `unreachable!()`.
    glandium committed Aug 6, 2019
    Configuration menu
    Copy the full SHA
    2edcf2e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    8dd06b5 View commit details
    Browse the repository at this point in the history
  6. Disable bindgen features

    glandium committed Aug 6, 2019
    Configuration menu
    Copy the full SHA
    7e87594 View commit details
    Browse the repository at this point in the history
  7. Simplify the build script further

    Instead of passing the full paths to the headers to bindgen, create a
    meta header that #include's all the needed ones. This leaves it to clang
    to find them in the right /System/Library/Frameworks directory.
    glandium committed Aug 6, 2019
    Configuration menu
    Copy the full SHA
    8b6ebfd View commit details
    Browse the repository at this point in the history
  8. Allow the SDK not to be found by the build script

    Now that the build script itself doesn't need the SDK path, allow not to
    specify one explicitly. This allows things to work out when the
    environment works out of the box one way or another (via wrapper
    scripts, setting BINDGEN_EXTRA_CLANG_ARGS, etc.)
    glandium committed Aug 6, 2019
    Configuration menu
    Copy the full SHA
    d2e8a69 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    0ed7f4c View commit details
    Browse the repository at this point in the history