2) `wget http://crates.io/api/v1/crates/foocrate/version/download -O foocrate-version.tar.gz`
Then follow 1.1)
+Alternatively you can do it directly in the build directory with
+[quilt](https://wiki.debian.org/UsingQuilt):
+
+1. In the root directory of `debcargo-conf`, `cd build/foo`
+2. `quilt series` to check existing patches, `quilt push -a` to test apply all
+ of them, and `quilt pop -a` to unapply them
+3. `quilt new patch-name.patch` to create a new patch, `quilt edit
+path/to/file` to edit a file with changes saved in current patch, `quilt
+header -e --dep3` to add a DEP-3 patch header
+4. `quilt refresh` to update current patch and prevent fuzz (we don't allow
+fuzzes when building)
+5. `cp -r debian/patches ../../src/foo/debian/` to copy updated patches over
+6. In root directory, run `./update.sh foo` to update the build directory
+
+Note that `update.sh` deletes and re-creates `build/foo`, so an open terminal
+in it needs to go up and down into the new directory.
+
capitol did a nice writeup which can be read here:
https://blog.hackeriet.no/packaging-rust-part-II/
+## built-using-dh-cargo
-
+If you get an error like this:
+```
+You must patch build.rs of CRATE to output 'println!(\"dh-cargo:deb-built-using=$lib=\$s={}\", env::var(\"CARGO_MANIFEST_DIR\").unwrap());'
+where: $s is 1 if the license(s) of the included static libs require source distribution alongside binaries, otherwise 0"
+```
+when building a FFi rust library you need to patch build.rs like stated above. $s is 0 for BSD-like licenses such as MIT and 1 for copyleft licenses like GPL.
## Skipping tests / special d/rules overrides