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

Update to build curl from scratch #225

Merged
merged 1 commit into from
Sep 12, 2018
Merged

Update to build curl from scratch #225

merged 1 commit into from
Sep 12, 2018

Conversation

alexcrichton
Copy link
Owner

It looks like it's basically not possible for MSVC to pick up nghttp2 otherwise
because that detection requires pkg-config. I'm sort of personally real tired
of dealing with build systems, so instead use the cc crate to do everything.

This commit switches builds from source to always use the cc crate and we
manually list all the relevant #define directives as well as the list of files
that we're interested in. This is likely not reproducing exactly what libcurl
requires 100%, but it's providing a lot of other benefits:

  • This build strategy truly will be cross platform modulo us fixing bugs. We can
    now actually get dependency detection and such working across all platforms as
    we don't rely on external tools.
  • We can now use the vanilla upstream curl submodule because there's no need
    to generate a configure script.
  • The curl CLI tool is no longer built, we never needed it anyway!
  • We have much more precise control about what's happening in that we can
    precisely and programmatically know what's activated in the build.

Downsides of this approach include:

  • Updates of the curl submodule are likely going to be harder as we need to
    make sure all the right files are built and they're built with the right
    #defines. This is expected to be a very low cost over time compared to the
    headache dealing with cross-platform builds right now.
  • We likely aren't building curl in the exact same way, for example some
    #define might be required to make curl "go fast" on newer platforms, but we
    may forget to pass it until much later. This is again, however, seen as not
    much of a problem compared to the current headache trying to build curl in a
    cross-platform manner that hooks up all the dependencies correctly.

It looks like it's basically not possible for MSVC to pick up nghttp2 otherwise
because that detection requires `pkg-config`. I'm sort of personally real tired
of dealing with build systems, so instead use the `cc` crate to do everything.

This commit switches builds from source to always use the `cc` crate and we
manually list all the relevant `#define` directives as well as the list of files
that we're interested in. This is likely not reproducing exactly what libcurl
requires 100%, but it's providing a lot of other benefits:

* This build strategy truly will be cross platform modulo us fixing bugs. We can
  now actually get dependency detection and such working across all platforms as
  we don't rely on external tools.
* We can now use the vanilla upstream `curl` submodule because there's no need
  to generate a configure script.
* The `curl` CLI tool is no longer built, we never needed it anyway!
* We have much more precise control about what's happening in that we can
  precisely and programmatically know what's activated in the build.

Downsides of this approach include:

* Updates of the `curl` submodule are likely going to be harder as we need to
  make sure all the right files are built and they're built with the right
  `#define`s. This is expected to be a very low cost over time compared to the
  headache dealing with cross-platform builds right now.
* We likely aren't building `curl` in the exact same way, for example some
  `#define` might be required to make curl "go fast" on newer platforms, but we
  may forget to pass it until much later. This is again, however, seen as not
  much of a problem compared to the current headache trying to build curl in a
  cross-platform manner that hooks up all the dependencies correctly.
@alexcrichton alexcrichton merged commit ede3241 into master Sep 12, 2018
@alexcrichton alexcrichton deleted the rebuild branch September 12, 2018 19:53
alexcrichton added a commit to rust-lang/git2-rs that referenced this pull request Sep 13, 2018
I've spent too many hours of my life bending over backwards trying to satisfy
native libraryies' build systems. The most recent pain is that informing a
native build system of its dependencies (such as telling libgit2 where libssh2
is installed) is an absolute never-ending nightmare.

The towel is now thrown in as `cmake` is jettisoned and this is now just using
the `cc` crate to directly compile all the various C code.

For some more info see alexcrichton/curl-rust#225
alexcrichton added a commit to alexcrichton/ssh2-rs that referenced this pull request Sep 13, 2018
This has been done in a few other projects and has made it lightyears easier to
compile native C code, so let's do it here!

More info at alexcrichton/curl-rust#225
alexcrichton added a commit to rust-lang/libz-sys that referenced this pull request Sep 13, 2018
No more dealing with tons of platforms and bending over backwards, let's just
compile C code.

More info in alexcrichton/curl-rust#225
alexcrichton added a commit to alexcrichton/ssh2-rs that referenced this pull request Sep 13, 2018
* Remove `cmake` dependency in favor of `cc`

This has been done in a few other projects and has made it lightyears easier to
compile native C code, so let's do it here!

More info at alexcrichton/curl-rust#225
alexcrichton added a commit to rust-lang/git2-rs that referenced this pull request Sep 13, 2018
I've spent too many hours of my life bending over backwards trying to satisfy
native libraryies' build systems. The most recent pain is that informing a
native build system of its dependencies (such as telling libgit2 where libssh2
is installed) is an absolute never-ending nightmare.

The towel is now thrown in as `cmake` is jettisoned and this is now just using
the `cc` crate to directly compile all the various C code.

For some more info see alexcrichton/curl-rust#225
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant