]> git.proxmox.com Git - rustc.git/blobdiff - debian/README.source
add wasm32 libc patch
[rustc.git] / debian / README.source
index 53d4cb49e44065940b74db15a196e05faa300727..3495c255f0b7daa7b9cfef1fa7cb2401a78d013d 100644 (file)
@@ -6,90 +6,22 @@ rate of language changes still ongoing.
 
 We try to describe here inner packaging details and the reasons behind them.
 
-
-Import of a new upstream version
-================================
-
-$ uscan --verbose
-$ ver=UPDATE-ME # whatever it is, X.YY.0 probably
-$ tar xf ../rustc-$ver-src.tar.gz && ( cd rustc-$ver-src/ && ../debian/prune-unused-deps ) && rm -rf rustc-$ver-src/
-$ git commit -m "Update Files-Excluded for new upstream version $ver" debian/copyright
-$ uscan --verbose # yes, again, to pick up the new Files-Excluded stuff
-
-# Now `tar tf ../rustc_$ver+dfsg1.orig.tar.xz | less` and look for any extra
-# stuff like new embedded C libraries. If so, add them to Files-Excluded: and
-# run uscan again. Repeat until there's no more issues. Some good stuff to run:
-$ tar xf ../rustc_$ver+dfsg1.orig.tar.xz && cd rustc-$ver-src/
-$ find . -type f -and -not -name '.cargo-checksum.json' -exec file '{}' \; | \
-    sed -e 's/\btext\b\(.*\), with very long lines/verylongtext\1/g' | \
-    grep -v '\b\(text\|empty\)\b' || true
-$ find src/vendor/ -name '*.c' -o -name '*.js'
-$ suspicious-source
-
-$ gbp import-orig ../rustc_$ver+dfsg1.orig.tar.xz
-$ dch -v $ver+dfsg1-1
-$ debian/rules update-version
-# might also need to bump the version of the cargo Build-Depends
-# then refresh patches, etc etc
-
-# If you need to repack again, bump the 'repacksuffix' in d/watch then run
-$ uscan --verbose --force-download
-# This will do a local repack using the new Files-Excluded rules, without
-# redownloading the orig tarball (despite the slightly misleading flag).
-
-
-Comparing Debian rustc vs upstream rustc
-========================================
-
-This package does things the Debian way, which differs significantly from
-upstream practices. If you find a bug, you might want to check if it is present
-in the upstream package. Run "debian/rules debian/configure-upstream" to
-generate a script, that you can then run in an unpacked upstream directory.
-
-This will configure it in a "halfway" style between upstream and Debian.
-Specifically, it will not build LLVM nor download stuff from crates.io, yet
-Debian patches are *not* applied. These specific settings were chosen as a
-tradeoff between convenience vs being close to what upstream does - so that the
-chances of a bug here being a genuine upstream issue rather than a Debian bug,
-is much higher. Also, with the exception of LLVM, these are non-default modes
-*supported by* upstream so they would be happy to receive bug reports about it
-even if your issue only occurs here.
-
-OTOH if you need to test a completely clean upstream build, including all the
-annoying stuff like building LLVM and downloading dependencies from crates.io,
-simply unpack the tarball and run `./configure && ./x.py build` etc as normal.
-This can be useful for confirming that an issue is caused by Debian's LLVM.
+If you are looking to help maintain this package, be sure to read the "Notes
+for package maintainers" section further below.
 
 
 Embedded libraries
 ==================
 
-This source package embeds several external libraries (foeked and managed
-by rust upstream as git submodules).
-In early stages, many more libraries were forked/emebedded but we are steadily
-progressing in splitting them out.
-
-Here below the remaining ones, with the technical reasons.
-
- * jemalloc from https://github.com/rust-lang/jemalloc
-   -> system-wide one can't be used due to rust using a "je_" prefix.
-
-   This is intentional upstream design and won't change soon, see:
-    - https://github.com/rust-lang/rust/pull/18678
-    - http://smallcultfollowing.com/babysteps/blog/2014/11/14/allocators-in-rust/
+The upstream source package embeds many external libraries. We make a great
+effort to remove them and use system versions where possible, but there are a
+few more remaining:
 
- * compiler-rt from https://github.com/rust-lang/compiler-rt
-   -> system-wide compiler-rt fails during linkage
+ * vendor/backtrace-sys, vendor/dlmalloc, vendor/walkdir
 
-   Bug reported upstream, still to be fixed, see:
-    - https://github.com/rust-lang/rust/issues/15054
-    - https://github.com/rust-lang/rust/issues/15708
-
-As a summary, we plan to:
- * keep embedding jemalloc (probably forever)
- * work with upstream to fix compiler-rt linkage soon.
-
- -- Sylvestre Ledru <sylvestre@debian.org>  Sat, 06 May 2017 13:26:08 +0200
+   These are small C libraries designed to be statically linked; their upstream
+   does not support building them as a shared library and they are too small to
+   justify their own Debian package.
 
 
 Building from source
@@ -192,18 +124,114 @@ nothing was backdoored along the way.
 [2] http://www.dwheeler.com/trusting-trust/
 
 
+Maintaining this package
+========================
+
+Import of a new upstream version
+--------------------------------
+
+$ apt install equivs python3-magic
+$ sudo mk-build-deps -irt 'aptitude -R'
+$ uscan --verbose                       # or debian/rules source_orig-beta, for beta
+$ ver=UPDATE-ME                         # whatever it is, probably X.YY.Z or X.YY.Z~beta.N
+
+$ tar xf ../rustc-${ver/\~/-}-src.tar.xz && ( cd rustc-${ver/*~*/beta}-src/ && pwd && ../debian/prune-unused-deps ) && rm -rf rustc-${ver/*~*/beta}-src/
+# ^ If this fails, you probably need to refresh the patches used by debian/prune-unused-deps
+$ git diff
+# Review the diff. If it removes too much stuff, it could mean that rustc
+# pulled in new unnecessary dependencies in this newer version. See if you can
+# drop them by amending the patch "d-0000-ignore-removed-submodules.patch".
+# Rerun the above "tar ..." commands again and check that your patch works.
+# For example, there is absolutely no reason why rustc should need openssl.
+
+$ git commit -m "Update Files-Excluded for new upstream version ${ver/\~/-}" debian/copyright
+$ uscan --verbose                       # yes, again, to pick up the new Files-Excluded stuff
+                                        # or debian/rules source_orig-beta, for beta
+
+# Keep running this and follow its instructions, until it gives no output:
+$ debian/check-orig-suspicious.sh $ver
+# When you are satisfied with the above, proceed:
+
+$ git checkout debian/experimental
+$ gbp import-orig ../rustc_$ver+dfsg1.orig.tar.xz
+$ dch -v $ver+dfsg1-1~exp1 "New upstream release."
+$ debian/rules update-version
+# might also need to bump the version of the cargo Build-Depends
+# then refresh patches, etc etc
+# Use /usr/share/cargo/scripts/guess-crate-copyright to help update d/copyright quickly
+
+# If you need to repack again, bump the 'repacksuffix' in d/watch then run
+$ uscan --verbose --force-download
+# This will do a local repack using the new Files-Excluded rules, without
+# redownloading the orig tarball (despite the slightly misleading flag).
+
+
+Proceeding after build failure
+------------------------------
+
+If your build fails, don't run `./x.py` directly as that will detect it's being
+run with different settings, and run the build from scratch all over again.
+overwriting all intermediate files. Instead, do:
+
+$ debian/rules run_rustbuild X_CMD="build|test|install" X_FLAGS="whatever"
+
+Hopefully, this will directly proceed to the step that failed, without
+rebuilding everything in between.
+
+
+Comparing Debian rustc vs upstream rustc
+----------------------------------------
+
+This package does things the Debian way, which differs significantly from
+upstream practices. If you find a bug, you might want to check if it is present
+in the upstream package. Run "debian/rules debian/config.toml" to generate our
+config.toml that you can then use in an upstream directory **unpacked from the
+release tarball*. (It is more complex to get this working with their git repo.)
+
+This will configure it in a "halfway" style between upstream and Debian.
+Specifically, it will not build LLVM nor download stuff from crates.io, yet
+Debian patches are *not* applied. These specific settings were chosen as a
+tradeoff between convenience vs being close to what upstream does - so that the
+chances of a bug here being a genuine upstream issue rather than a Debian bug,
+is much higher. Also, with the exception of LLVM, these are non-default modes
+*supported by* upstream so they would be happy to receive bug reports about it
+even if your issue only occurs here.
+
+OTOH if you need to test a completely clean upstream build, including all the
+annoying stuff like building LLVM and downloading dependencies from crates.io,
+simply unpack the tarball and run `./configure && ./x.py build` etc as normal.
+This can be useful for confirming that an issue is caused by Debian's LLVM.
+
+If you need to test a LLVM patch, do something like this:
+
+# build your patched LLVM debs, then:
+$ mkdir -p llvm-destdir && cd llvm-destdir
+$ ver=4.0; VERSION=FIXME
+$ for i in llvm-$ver llvm-$ver-dev llvm-$ver-runtime llvm-$ver-tools libllvm$ver; do \
+    dpkg -x ../"$i"_*${VERSION}_*.deb .; done
+$ cd ../rustc
+$ debian/rules LLVM_DESTDIR=$PWD/../llvm-destdir build
+
+If you need to test a patch to the stage0 rustc, do something like this:
+
+# build your patched rustc debs or upstream rustc, then:
+$ mkdir -p rust-destdir && cd rust-destdir
+$ ver=1.20; VERSION=FIXME;
+$ for i in rustc libstd-rust-$ver libstd-rust-dev; do \
+    dpkg -x ../"$i"_*${VERSION}_*.deb .; done
+$ cd ../rustc
+$ debian/rules RUST_DESTDIR=$PWD/../rust-destdir build
+
+
 Useful links
-============
+------------
 
 The Fedora rust team is more active than the Debian one. Here are their links:
 
 Source code
-https://src.fedoraproject.org/cgit/rpms/rust.git/tree/
+https://src.fedoraproject.org/rpms/rust/tree/
 
 Binary packages and test logs
 https://kojipkgs.fedoraproject.org//packages/rust/
 If the same test fails both on Fedora and Debian it's a good indication that
 we're not Doing It Wrong and can file a valid bug upstream.
-
-Package metadata
-https://admin.fedoraproject.org/pkgdb/package/rpms/rust/