Skip to content

Commit cdfdc1e

Browse files
committed
Move extra::flate to libflate
This is hopefully the beginning of the long-awaited dissolution of libextra. Using the newly created build infrastructure for building libraries, I decided to move the first module out of libextra. While not being a particularly meaty module in and of itself, the flate module is required by rustc and additionally has a native C dependency. I was able to very easily split out the C dependency from rustrt, update librustc, and magically everything gets installed to the right locations and built automatically. This is meant to be a proof-of-concept commit to how easy it is to remove modules from libextra now. I didn't put any effort into modernizing the interface of libflate or updating it other than to remove the one glob import it had.
1 parent 2611483 commit cdfdc1e

File tree

10 files changed

+25
-14
lines changed

10 files changed

+25
-14
lines changed

doc/index.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ li {list-style-type: none; }
3737
* [The Rust parser, `libsyntax`](syntax/index.html)
3838
* [The Rust compiler, `librustc`](rustc/index.html)
3939

40+
* [The `flate` compression library](flate/index.html)
41+
4042
# Tooling
4143

4244
* [The `rustdoc` manual](rustdoc.html)
@@ -47,11 +49,11 @@ li {list-style-type: none; }
4749
* [Language FAQ](complement-lang-faq.html)
4850
* [Project FAQ](complement-project-faq.html)
4951
* [Usage FAQ](complement-usage-faq.html)
50-
* [Code cheatsheet](complement-cheatsheet.html) - "How do I do X?"
52+
* [Code cheatsheet](complement-cheatsheet.html) - "How do I do X?"
5153
* [How to submit a bug report](complement-bugreport.html)
5254

5355
# External resources
5456

55-
* The Rust [IRC channel](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust) - `#rust` on irc.mozilla.org
57+
* The Rust [IRC channel](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust) - `#rust` on irc.mozilla.org
5658
* The Rust community on [Reddit](http://reddit.com/r/rust)
5759
* The Rust [wiki](http://github.com/mozilla/rust/wiki)

mk/crates.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
# automatically generated for all stage/host/target combinations.
5050
################################################################################
5151

52-
TARGET_CRATES := std extra green rustuv native
52+
TARGET_CRATES := std extra green rustuv native flate
5353
HOST_CRATES := syntax rustc rustdoc rustpkg
5454
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5555
TOOLS := compiletest rustpkg rustdoc rustc
@@ -60,9 +60,10 @@ DEPS_green := std
6060
DEPS_rustuv := std native:uv native:uv_support
6161
DEPS_native := std
6262
DEPS_syntax := std extra
63-
DEPS_rustc := syntax native:rustllvm
63+
DEPS_rustc := syntax native:rustllvm flate
6464
DEPS_rustdoc := rustc native:sundown
6565
DEPS_rustpkg := rustc
66+
DEPS_flate := std native:miniz
6667

6768
TOOL_DEPS_compiletest := extra green rustuv
6869
TOOL_DEPS_rustpkg := rustpkg green rustuv

mk/rt.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
# that's per-target so you're allowed to conditionally add files based on the
3636
# target.
3737
################################################################################
38-
NATIVE_LIBS := rustrt sundown uv_support morestack
38+
NATIVE_LIBS := rustrt sundown uv_support morestack miniz
3939

4040
# $(1) is the target triple
4141
define NATIVE_LIBRARIES
@@ -49,8 +49,8 @@ NATIVE_DEPS_sundown_$(1) := sundown/src/autolink.c \
4949
sundown/html/html_smartypants.c \
5050
sundown/html/html.c
5151
NATIVE_DEPS_uv_support_$(1) := rust_uv.c
52+
NATIVE_DEPS_miniz_$(1) = miniz.c
5253
NATIVE_DEPS_rustrt_$(1) := rust_builtin.c \
53-
miniz.c \
5454
rust_android_dummy.c \
5555
rust_test_helpers.c \
5656
rust_try.ll \

mk/tests.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -855,14 +855,16 @@ $$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB): \
855855
tmp/$$(FT).rc \
856856
$$(SREQ2_T_$(2)_H_$(3))
857857
@$$(call E, compile_and_link: $$@)
858-
$$(STAGE2_T_$(2)_H_$(3)) --lib -o $$@ $$<
858+
$$(STAGE2_T_$(2)_H_$(3)) --lib -o $$@ $$< \
859+
-L "$$(RT_OUTPUT_DIR_$(2))"
859860

860861
$(3)/test/$$(FT_DRIVER)-$(2)$$(X_$(2)): \
861862
tmp/$$(FT_DRIVER).rs \
862863
$$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB) \
863864
$$(SREQ2_T_$(2)_H_$(3))
864865
@$$(call E, compile_and_link: $$@ $$<)
865-
$$(STAGE2_T_$(2)_H_$(3)) -o $$@ $$<
866+
$$(STAGE2_T_$(2)_H_$(3)) -o $$@ $$< \
867+
-L "$$(RT_OUTPUT_DIR_$(2))"
866868

867869
$(3)/test/$$(FT_DRIVER)-$(2).out: \
868870
$(3)/test/$$(FT_DRIVER)-$(2)$$(X_$(2)) \

src/libextra/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ pub mod rational;
8282
pub mod complex;
8383
pub mod stats;
8484
pub mod semver;
85-
pub mod flate;
8685
pub mod hex;
8786
pub mod uuid;
8887

src/libextra/flate.rs renamed to src/libflate/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ Simple compression
1414
1515
*/
1616

17+
#[crate_id = "flate#0.10-pre"];
18+
#[crate_type = "rlib"];
19+
#[crate_type = "dylib"];
20+
#[license = "MIT/ASL2"];
1721
#[allow(missing_doc)];
1822

1923
use std::libc::{c_void, size_t, c_int};
@@ -23,7 +27,7 @@ use std::vec;
2327
pub mod rustrt {
2428
use std::libc::{c_int, c_void, size_t};
2529

26-
#[link(name = "rustrt", kind = "static")]
30+
#[link(name = "miniz", kind = "static")]
2731
extern {
2832
pub fn tdefl_compress_mem_to_heap(psrc_buf: *c_void,
2933
src_buf_len: size_t,
@@ -91,7 +95,7 @@ pub fn inflate_bytes_zlib(bytes: &[u8]) -> ~[u8] {
9195

9296
#[cfg(test)]
9397
mod tests {
94-
use super::*;
98+
use super::{inflate_bytes, deflate_bytes};
9599
use std::rand;
96100
use std::rand::Rng;
97101

src/librustc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ This API is completely unstable and subject to change.
3030
#[feature(macro_rules, globs, struct_variant, managed_boxes)];
3131

3232
extern mod extra;
33+
extern mod flate;
3334
extern mod syntax;
3435

3536
use back::link;

src/librustc/metadata/loader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use std::os::consts::{macos, freebsd, linux, android, win32};
3333
use std::ptr;
3434
use std::str;
3535
use std::vec;
36-
use extra::flate;
36+
use flate;
3737

3838
pub enum Os {
3939
OsMacos,

src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2683,7 +2683,7 @@ pub fn crate_ctxt_to_encode_parms<'r>(cx: &'r CrateContext, ie: encoder::encode_
26832683
}
26842684

26852685
pub fn write_metadata(cx: &CrateContext, crate: &ast::Crate) -> ~[u8] {
2686-
use extra::flate;
2686+
use flate;
26872687

26882688
if !cx.sess.building_library.get() {
26892689
return ~[]

src/librustdoc/html/markdown.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
//! functionality through a unit-struct, `Markdown`, which has an implementation
1717
//! of `fmt::Default`. Example usage:
1818
//!
19-
//! ```rust
19+
//! ```rust,ignore
20+
//! use rustdoc::html::markdown::Markdown;
21+
//!
2022
//! let s = "My *markdown* _text_";
2123
//! let html = format!("{}", Markdown(s));
2224
//! // ... something using html

0 commit comments

Comments
 (0)