mirror of
https://git.proxmox.com/git/rustc
synced 2026-01-17 23:39:19 +00:00
These files are referenced by name in HTML/CSS - which breaks if the files have been compressed.
155 lines
4.8 KiB
Makefile
Executable File
155 lines
4.8 KiB
Makefile
Executable File
#!/usr/bin/make -f
|
|
# -*- makefile -*-
|
|
|
|
include /usr/share/dpkg/pkg-info.mk
|
|
include /usr/share/dpkg/architecture.mk
|
|
include /usr/share/dpkg/buildflags.mk
|
|
RUSTFLAGS = -C link-args="$(LDFLAGS)"
|
|
export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS RUSTFLAGS
|
|
|
|
# Defines DEB_*_RUST_TYPE triples
|
|
include debian/architecture.mk
|
|
|
|
# Uncomment this to turn on verbose mode.
|
|
#export DH_VERBOSE=1
|
|
|
|
# When using sudo pbuilder, this will cause mk/install.mk to run sudo,
|
|
# but we don't need sudo as a build-dep for the package if we unexport
|
|
# the SUDO_USER variable.
|
|
unexport SUDO_USER
|
|
|
|
# Debhelper clears MAKEFLAGS, so we have to do this again for any
|
|
# target where we call $(MAKE) directly. Boo.
|
|
DEB_PARALLEL_JOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
|
|
PMAKE = $(MAKE) $(if $(DEB_PARALLEL_JOBS),-j$(DEB_PARALLEL_JOBS))
|
|
|
|
# Release type (one of beta, stable or nightly)
|
|
RELEASE_CHANNEL := stable
|
|
|
|
DEB_DESTDIR := $(CURDIR)/debian/tmp
|
|
|
|
RUST_HASH := $(shell printf '%s' $(DEB_VERSION_UPSTREAM) | sed -e 's/\+dfsg[0-9]*$$//' | md5sum | head -c 8)
|
|
LIBSTD_PKG := libstd-rust-$(RUST_HASH)
|
|
|
|
# These are the normal build flags
|
|
DEB_CONFIGURE_FLAGS = \
|
|
--host=$(DEB_HOST_RUST_TYPE) \
|
|
--target=$(DEB_TARGET_RUST_TYPE) \
|
|
--disable-manage-submodules \
|
|
--release-channel=$(RELEASE_CHANNEL) \
|
|
--prefix=/usr
|
|
|
|
# Use system LLVM (comment out to use vendored LLVM)
|
|
DEB_CONFIGURE_FLAGS += --llvm-root=/usr/lib/llvm-3.6
|
|
|
|
ifeq (,$(findstring dlstage0,$(DEB_BUILD_PROFILES)))
|
|
# Without these options, a pre-built stage0 will be downloaded from
|
|
# rust-lang.org at build time (or looked for in dl/).
|
|
#DEB_CONFIGURE_FLAGS += --enable-local-rust --local-rust-root=/usr
|
|
endif
|
|
|
|
BUILD_DOCS = 1
|
|
ifneq (,$(findstring nodoc,$(DEB_BUILD_PROFILES)))
|
|
DEB_CONFIGURE_FLAGS += --disable-docs
|
|
BUILD_DOCS =
|
|
endif
|
|
|
|
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
|
DEB_CONFIGURE_FLAGS += --disable-optimize --disable-optimize-cxx --disable-optimize-llvm
|
|
endif
|
|
|
|
|
|
%:
|
|
dh $@ --parallel
|
|
|
|
# Note: SHELL is not set by dash, but the configure script wants to use it
|
|
override_dh_auto_configure:
|
|
SHELL=/bin/sh \
|
|
./configure $(DEB_CONFIGURE_FLAGS)
|
|
|
|
|
|
override_dh_auto_clean:
|
|
set -e; \
|
|
if [ -f Makefile ]; then \
|
|
$(PMAKE) clean-all; \
|
|
$(RM) Makefile config.stamp; \
|
|
fi
|
|
|
|
override_dh_auto_build-arch:
|
|
dh_auto_build -- all VERBOSE=1
|
|
|
|
override_dh_auto_build-indep:
|
|
$(if $(BUILD_DOCS),dh_auto_build -- docs)
|
|
|
|
override_dh_auto_install:
|
|
dh_auto_install --destdir=$(DEB_DESTDIR)
|
|
|
|
mkdir -p $(DEB_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/
|
|
mv $(DEB_DESTDIR)/usr/lib/lib*.so $(DEB_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/
|
|
|
|
# Replace duplicated compile-time/run-time dylibs with symlinks
|
|
@set -e; \
|
|
for f in $(DEB_DESTDIR)/usr/lib/rustlib/$(DEB_HOST_RUST_TYPE)/lib/lib*.so; do \
|
|
name=$${f##*/}; \
|
|
if [ -f "$(DEB_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/$$name" ]; then \
|
|
echo "ln -sf ../../../$(DEB_HOST_MULTIARCH)/$$name $$f"; \
|
|
ln -sf ../../../$(DEB_HOST_MULTIARCH)/$$name $$f; \
|
|
fi; \
|
|
done
|
|
|
|
ifneq (,$(BUILD_DOCS))
|
|
# Brute force to remove privacy-breach-logo lintian warning.
|
|
# We could have updated the upstream sources but it would complexify
|
|
# the rebase
|
|
@set -e; \
|
|
find $(DEB_DESTDIR)/usr/share/doc/rust/html -iname '*.html' | \
|
|
while read file; do \
|
|
topdir=$$(echo "$$file" | sed 's,^$(DEB_DESTDIR)/usr/share/doc/rust/html/,,; s,/[^/]*$$,/,; s,^[^/]*$$,,; s,[^/]\+/,../,g'); \
|
|
sed -i "s,http://www.rust-lang.org/\(favicon.ico\|logos/rust-logo-32x32-blk.png\),$${topdir}rust-logo-32x32-blk.png," "$$file"; \
|
|
done
|
|
|
|
find $(DEB_DESTDIR) \( -iname '*.html' -empty -o -name .lock -o -name '*.inc' \) -delete
|
|
|
|
find $(DEB_DESTDIR)/usr/share/doc -name jquery.js \
|
|
-exec ln -sf /usr/share/javascript/jquery/jquery.js '{}' \;
|
|
endif
|
|
|
|
override_dh_install:
|
|
dh_install
|
|
dh_install -p$(LIBSTD_PKG) usr/lib/$(DEB_HOST_MULTIARCH)/
|
|
|
|
chmod -x \
|
|
debian/rust-gdb/usr/share/rust-gdb/*.py \
|
|
debian/rust-lldb/usr/share/rust-lldb/*.py
|
|
|
|
override_dh_installchangelogs:
|
|
dh_installchangelogs RELEASES.md
|
|
|
|
override_dh_installdocs:
|
|
dh_installdocs -X.tex -X.aux -X.log -X.out -X.toc
|
|
|
|
override_dh_compress:
|
|
dh_compress -X.woff
|
|
|
|
override_dh_auto_test:
|
|
ifeq (, $(filter nocheck,$(DEB_BUILD_OPTIONS)))
|
|
$(PMAKE) check-notidy
|
|
endif
|
|
|
|
override_dh_makeshlibs:
|
|
dh_makeshlibs -V
|
|
|
|
# dh_makeshlibs doesn't support our "libfoo-version.so" naming
|
|
# structure, so we have to do this ourselves.
|
|
install -o 0 -g 0 -d debian/$(LIBSTD_PKG)/DEBIAN
|
|
ls debian/$(LIBSTD_PKG)/usr/lib/$(DEB_HOST_MULTIARCH)/lib*.so | \
|
|
sed -n 's,^.*/\(lib.*\)-\(.\+\)\.so$$,\1 \2,p' | \
|
|
while read name version; do \
|
|
echo "$$name $$version $(LIBSTD_PKG) (>= $(DEB_VERSION_UPSTREAM))"; \
|
|
done > debian/$(LIBSTD_PKG)/DEBIAN/shlibs
|
|
chmod 644 debian/$(LIBSTD_PKG)/DEBIAN/shlibs
|
|
chown 0:0 debian/$(LIBSTD_PKG)/DEBIAN/shlibs
|
|
|
|
override_dh_shlibdeps:
|
|
dh_shlibdeps -- -x$(LIBSTD_PKG)
|