Follow Debian naming convention in /usr/src

This commit is contained in:
Ximin Luo 2017-07-28 13:25:50 +02:00
parent 84050b3a56
commit b5dfb68c5e
6 changed files with 31 additions and 25 deletions

2
debian/.gitignore vendored
View File

@ -11,6 +11,8 @@
/rust-gdb/
/rust-lldb/
/rust-src/
/rust-src.install
/rust-src.links
/rustc/
/tmp/
/patches/*~

30
debian/rules vendored
View File

@ -4,10 +4,17 @@
include /usr/share/dpkg/pkg-info.mk
include /usr/share/dpkg/vendor.mk
include /usr/share/dpkg/architecture.mk
SED_VERSION_SHORT := sed -re 's/([^.]+)\.([^.]+)\..*/\1.\2/'
RUST_VERSION := $(shell echo '$(DEB_VERSION_UPSTREAM)' | $(SED_VERSION_SHORT))
RUST_LONG_VERSION := $(shell echo '$(DEB_VERSION_UPSTREAM)' | sed -re 's/([^+]+).*/\1/')
LIBSTD_PKG := libstd-rust-$(RUST_VERSION)
# Sed expression that matches the "rustc" we have in our Build-Depends field
SED_RUSTC_BUILDDEP := sed -ne "/^Build-Depends:/,/^[^[:space:]\#]/{/^ *rustc:native .*,/p}" debian/control
include /usr/share/dpkg/buildflags.mk
# TODO: more correct to use `[build] rustflags = []` list syntax in Cargo.toml
RUSTFLAGS = $(addprefix -C link-args=,$(LDFLAGS)) \
-Zremap-path-prefix-from=$(CURDIR) -Zremap-path-prefix-to=/usr/src/rust
-Zremap-path-prefix-from=$(CURDIR) -Zremap-path-prefix-to=/usr/src/rustc-$(RUST_LONG_VERSION)
export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS RUSTFLAGS
# Defines DEB_*_RUST_TYPE triples
@ -30,13 +37,6 @@ RELEASE_CHANNEL := stable
DEB_DESTDIR := $(CURDIR)/debian/tmp
SED_VERSION_SHORT := sed -re 's/([^.]+)\.([^.]+)\..*/\1.\2/'
RUST_VERSION := $(shell echo '$(DEB_VERSION_UPSTREAM)' | $(SED_VERSION_SHORT))
RUST_LONG_VERSION := $(shell echo '$(DEB_VERSION_UPSTREAM)' | sed -re 's/([^+]+).*/\1/')
LIBSTD_PKG := libstd-rust-$(RUST_VERSION)
# Sed expression that matches the "rustc" we have in our Build-Depends field
SED_RUSTC_BUILDDEP := sed -ne "/^Build-Depends:/,/^[^[:space:]\#]/{/^ *rustc:native .*,/p}" debian/control
# These are the normal build flags. Upstream is moving to debian/config.toml
# but at the current version not all of these flags are available in that file.
# Certain flags also need to be kept here *as well as* debian/config.toml.in
@ -151,6 +151,10 @@ debian/config.toml: debian/config.toml.in
-DLLVM_VERSION="$(LLVM_VERSION)" \
"$<" > "$@"
debian/rust-src.%: debian/rust-src.%.in
m4 -DRUST_LONG_VERSION="$(RUST_LONG_VERSION)" \
"$<" > "$@"
override_dh_auto_configure: debian/config.toml
# fail the build if we have any instances of OLD_LLVM_VERSION in debian, except for debian/changelog
! grep --color=always -i 'll...\?$(subst .,\.,$(OLD_LLVM_VERSION))' --exclude=changelog -R debian
@ -174,7 +178,7 @@ override_dh_auto_configure: debian/config.toml
override_dh_auto_clean:
$(RM) -rf ./build ./tmp ./.cargo config.stamp config.mk Makefile
$(RM) -rf $(SRC_CLEAN) debian/config.toml
$(RM) -rf $(SRC_CLEAN) debian/config.toml debian/rust-src.install debian/rust-src.links
# upstream bundles this in the source, but in Debian we rebuild everything yo
generate-sources:
@ -262,21 +266,21 @@ override_dh_install-arch:
dh_install
dh_install -p$(LIBSTD_PKG) usr/lib/$(DEB_HOST_MULTIARCH)/
override_dh_install-indep:
override_dh_install-indep: debian/rust-src.install debian/rust-src.links
dh_install
chmod -x \
debian/rust-gdb/usr/share/rust-gdb/*.py \
debian/rust-lldb/usr/share/rust-lldb/*.py
$(RM) -rf $(SRC_CLEAN:%=debian/rust-src/usr/src/rust/%)
$(RM) -rf $(SRC_CLEAN:%=debian/rust-src/usr/src/rustc-$(RUST_LONG_VERSION)/%)
# Get rid of lintian warnings
find debian/rust-src/usr/src/rust \
find debian/rust-src/usr/src/rustc-$(RUST_LONG_VERSION) \
\( -name .gitignore \
-o -name 'LICENSE*' \
-o -name 'LICENCE' \
-o -name 'license' \
-o -name 'COPYING*' \
\) -delete
cd debian/rust-src/usr/src/rust && chmod -x \
cd debian/rust-src/usr/src/rustc-$(RUST_LONG_VERSION) && chmod -x \
src/etc/gdb_rust_pretty_printing.py \
src/compiler-rt/test/builtins/Unit/ppc/test

View File

@ -1,11 +0,0 @@
# from src/bootstrap/dist.rs:370 onwards
COPYRIGHT usr/src/rust
LICENSE-APACHE usr/src/rust
LICENSE-MIT usr/src/rust
CONTRIBUTING.md usr/src/rust
README.md usr/src/rust
RELEASES.md usr/src/rust
configure usr/src/rust
x.py usr/src/rust
man usr/src/rust
src usr/src/rust

11
debian/rust-src.install.in vendored Normal file
View File

@ -0,0 +1,11 @@
# from src/bootstrap/dist.rs:370 onwards
COPYRIGHT usr/src/rustc-RUST_LONG_VERSION
LICENSE-APACHE usr/src/rustc-RUST_LONG_VERSION
LICENSE-MIT usr/src/rustc-RUST_LONG_VERSION
CONTRIBUTING.md usr/src/rustc-RUST_LONG_VERSION
README.md usr/src/rustc-RUST_LONG_VERSION
RELEASES.md usr/src/rustc-RUST_LONG_VERSION
configure usr/src/rustc-RUST_LONG_VERSION
x.py usr/src/rustc-RUST_LONG_VERSION
man usr/src/rustc-RUST_LONG_VERSION
src usr/src/rustc-RUST_LONG_VERSION

View File

@ -1 +0,0 @@
usr/src/rust usr/lib/rustlib/src/rust

1
debian/rust-src.links.in vendored Normal file
View File

@ -0,0 +1 @@
usr/src/rustc-RUST_LONG_VERSION usr/lib/rustlib/src/rust