Skip to content

Commit

Permalink
Amend rust-lang#403: Change *-sys to *_sys
Browse files Browse the repository at this point in the history
  • Loading branch information
lambda-fairy committed Mar 5, 2015
1 parent 71d5471 commit 2baf8d3
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions text/0403-cargo-build-command.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ around build commands to facilitate linking native code to Cargo packages.

1. Instead of having the `build` command be some form of script, it will be a
Rust command instead
2. Establish a namespace of `foo-sys` packages which represent the native
2. Establish a namespace of `foo_sys` packages which represent the native
library `foo`. These packages will have Cargo-based dependencies between
`*-sys` packages to express dependencies among C packages themselves.
`*_sys` packages to express dependencies among C packages themselves.
3. Establish a set of standard environment variables for build commands which
will instruct how `foo-sys` packages should be built in terms of dynamic or
will instruct how `foo_sys` packages should be built in terms of dynamic or
static linkage, as well as providing the ability to override where a package
comes from via environment variables.

Expand Down Expand Up @@ -101,7 +101,7 @@ Summary:
* Add platform-specific dependencies to Cargo manifests
* Allow pre-built libraries in the same manner as Cargo overrides
* Use Rust for build scripts
* Develop a convention of `*-sys` packages
* Develop a convention of `*_sys` packages

## Modifications to `rustc`

Expand Down Expand Up @@ -358,38 +358,38 @@ useful to interdependencies among native packages themselves. For example
libssh2 depends on OpenSSL on linux, which means it needs to find the
corresponding libraries and header files. The metadata keys serve as a vector
through which this information can be transmitted. The maintainer of the
`openssl-sys` package (described below) would have a build script responsible
`openssl_sys` package (described below) would have a build script responsible
for generating this sort of metadata so consumer packages can use it to build C
libraries themselves.

## A set of `*-sys` packages
## A set of `*_sys` packages

This section will discuss a *convention* by which Cargo packages providing
native dependencies will be named, it is not proposed to have Cargo enforce this
convention via any means. These conventions are proposed to address constraints
5 and 6 above.

Common C dependencies will be refactored into a package named `foo-sys` where
`foo` is the name of the C library that `foo-sys` will provide and link to.
Common C dependencies will be refactored into a package named `foo_sys` where
`foo` is the name of the C library that `foo_sys` will provide and link to.
There are two key motivations behind this convention:

* Each `foo-sys` package will declare its own dependencies on other `foo-sys`
* Each `foo_sys` package will declare its own dependencies on other `foo_sys`
based packages
* Dependencies on native libraries expressed through Cargo will be subject to
version management, version locking, and deduplication as usual.

Each `foo-sys` package is responsible for providing the following:
Each `foo_sys` package is responsible for providing the following:

* Declarations of all symbols in a library. Essentially each `foo-sys` library
* Declarations of all symbols in a library. Essentially each `foo_sys` library
is *only* a header file in terms of Rust-related code.
* Ensuring that the native library `foo` is linked to the `foo-sys` crate. This
* Ensuring that the native library `foo` is linked to the `foo_sys` crate. This
guarantees that all exposed symbols are indeed linked into the crate.

Dependencies making use of `*-sys` packages will not expose `extern` blocks
themselves, but rather use the symbols exposed in the `foo-sys` package
directly. Additionally, packages using `*-sys` packages should not declare a
Dependencies making use of `*_sys` packages will not expose `extern` blocks
themselves, but rather use the symbols exposed in the `foo_sys` package
directly. Additionally, packages using `*_sys` packages should not declare a
`#[link]` directive to link to the native library as it's already linked to the
`*-sys` package.
`*_sys` package.

## Phasing strategy

Expand Down Expand Up @@ -517,7 +517,7 @@ perform this configuration (be it environment or in files).
* Features themselves will also likely need to be platform-specific, but this
runs into a number of tricky situations and needs to be fleshed out.

[verbose]: https://github.com/alexcrichton/complicated-linkage-example/blob/master/curl-sys/Cargo.toml#L9-L17
[verbose]: https://github.com/alexcrichton/complicated-linkage-example/blob/master/curl_sys/Cargo.toml#L9-L17

# Alternatives

Expand Down

0 comments on commit 2baf8d3

Please sign in to comment.