Bug 1295666 - Import byteorder as a separate crate. r?kinetik
Now that
bug 1231764 has landed cargo support in the build system,
we can remove the patches hacking the byteorder crate into a
module within the mp4parse crate.
This updates the import script to copy the byteorder source
files to a separate directory and removes the obsolete patches.
We update the patch against mp4parse/Cargo.toml to add a dependency
path referring to the new source location. This tells cargo to use
the in-tree copy instead of trying to pull from a registery.
MozReview-Commit-ID: FHMkyEq2HdH
deleted file mode 100644
--- a/media/libstagefright/binding/byteorder-mod.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-diff --git a/media/libstagefright/binding/mp4parse/src/byteorder/mod.rs b/media/libstagefright/binding/mp4parse/src/byteorder/mod.rs
-index a25bab6..13db30a 100644
---- a/media/libstagefright/binding/mp4parse/src/byteorder/mod.rs
-+++ b/media/libstagefright/binding/mp4parse/src/byteorder/mod.rs
-@@ -36,24 +36,17 @@ assert_eq!(wtr, vec![5, 2, 0, 3]);
- ```
- */
-
--#![crate_name = "byteorder"]
- #![doc(html_root_url = "http://burntsushi.net/rustdoc/byteorder")]
-
--#![cfg_attr(not(feature = "std"), no_std)]
--
- #![deny(missing_docs)]
-
--#[cfg(feature = "std")]
--extern crate core;
--
--use core::mem::transmute;
--use core::ptr::copy_nonoverlapping;
-+use std::mem::transmute;
-+use std::ptr::copy_nonoverlapping;
-
--#[cfg(feature = "std")]
--pub use new::{ReadBytesExt, WriteBytesExt};
-+pub use byteorder::new::{ReadBytesExt, WriteBytesExt};
-
--#[cfg(feature = "std")]
--mod new;
-+// Re-export new so gecko can build us as a mod instead of a crate.
-+pub mod new;
-
- #[inline]
- fn extend_sign(val: u64, nbytes: usize) -> i64 {
-@@ -300,7 +293,7 @@ pub type NativeEndian = BigEndian;
-
- macro_rules! read_num_bytes {
- ($ty:ty, $size:expr, $src:expr, $which:ident) => ({
-- assert!($size == ::core::mem::size_of::<$ty>());
-+ assert!($size == ::std::mem::size_of::<$ty>());
- assert!($size <= $src.len());
- let mut data: $ty = 0;
- unsafe {
-diff --git a/media/libstagefright/binding/mp4parse/src/byteorder/new.rs b/media/libstagefright/binding/mp4parse/src/byteorder/new.rs
-index b5f3770..b32f97b 100644
---- a/media/libstagefright/binding/mp4parse/src/byteorder/new.rs
-+++ b/media/libstagefright/binding/mp4parse/src/byteorder/new.rs
-@@ -1,6 +1,6 @@
- use std::io::{self, Result};
-
--use ByteOrder;
-+use byteorder::ByteOrder;
-
- /// Extends `Read` with methods for reading numbers. (For `std::io`.)
- ///
--- a/media/libstagefright/binding/mp4parse-cargo.patch
+++ b/media/libstagefright/binding/mp4parse-cargo.patch
@@ -1,11 +1,11 @@
--- a/media/libstagefright/binding/mp4parse/Cargo.toml
+++ b/media/libstagefright/binding/mp4parse/Cargo.toml
-@@ -17,23 +17,6 @@ exclude = [
+@@ -17,23 +17,9 @@ exclude = [
"*.mp4",
]
-build = "build.rs"
-
-[dependencies]
-byteorder = "0.5.0"
-afl = { version = "0.1.1", optional = true }
@@ -19,8 +19,11 @@
-rusty-cheddar = "0.3.2"
-
-[features]
-fuzz = ["afl", "afl-plugin", "abort_on_panic"]
-
# Somewhat heavy-handed, but we want at least -Z force-overflow-checks=on.
[profile.release]
debug-assertions = true
++
++[dependencies]
++byteorder = { path = "../byteorder" }
deleted file mode 100644
--- a/media/libstagefright/binding/mp4parse-mod.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/media/libstagefright/binding/mp4parse/src/lib.rs b/media/libstagefright/binding/mp4parse/src/lib.rs
-index af62402..7c8e382 100644
---- a/media/libstagefright/binding/mp4parse/src/lib.rs
-+++ b/media/libstagefright/binding/mp4parse/src/lib.rs
-@@ -4,7 +4,7 @@
- // License, v. 2.0. If a copy of the MPL was not distributed with this
- // file, You can obtain one at https://mozilla.org/MPL/2.0/.
-
--extern crate byteorder;
-+mod byteorder; // 'extern crate' upstream.
- use byteorder::ReadBytesExt;
- use std::error::Error as ErrorTrait; // For Err(e) => e.description().
- use std::io::{Read, BufRead, Take};
--- a/media/libstagefright/binding/update-rust.sh
+++ b/media/libstagefright/binding/update-rust.sh
@@ -27,20 +27,19 @@ cp _upstream/mp4parse/include/mp4parse.h
# TODO: download deps from crates.io.
git clone https://github.com/BurntSushi/byteorder _upstream/byteorder
pushd _upstream/byteorder
git checkout 0.5.3
popd
rm -rf mp4parse/src/byteorder
mkdir mp4parse/src/byteorder
-cp _upstream/byteorder/src/lib.rs mp4parse/src/byteorder/mod.rs
-cp _upstream/byteorder/src/new.rs mp4parse/src/byteorder/new.rs
+cp _upstream/byteorder/Cargo.toml byteorder/
+cp _upstream/byteorder/src/lib.rs byteorder/src/
+cp _upstream/byteorder/src/new.rs byteorder/src/
echo "Applying patches..."
-patch -p4 < byteorder-mod.patch
-patch -p4 < mp4parse-mod.patch
patch -p4 < mp4parse-cargo.patch
echo "Cleaning up..."
rm -rf _upstream
echo "Updated to ${VER}."