| 1 |
#!/usr/bin/make -f |
| 2 |
# -*- makefile -*- |
| 3 |
|
| 4 |
# Uncomment this to turn on verbose mode. |
| 5 |
#export DH_VERBOSE=1 |
| 6 |
#export DH_OPTIONS=-v |
| 7 |
|
| 8 |
include /usr/share/dpkg/pkg-info.mk |
| 9 |
include /usr/share/ocaml/ocamlvars.mk |
| 10 |
|
| 11 |
PACKAGE := ocaml-dune |
| 12 |
ALL_PACKAGES := $(shell dh_listpackages) |
| 13 |
DISTDIR = $(PACKAGE)-$(DEB_VERSION_UPSTREAM) |
| 14 |
UPSTREAM_TARBALL = $(wildcard ../$(PACKAGE)_$(DEB_VERSION_UPSTREAM).orig.tar.*) |
| 15 |
SRCTARBALL = $(PACKAGE)-source-$(DEB_VERSION_UPSTREAM).tar |
| 16 |
BUILD_DATE := $(shell date -d@$(DEB_TIMESTAMP) -R) |
| 17 |
|
| 18 |
ifneq (,$(findstring ocaml-dune-source,$(ALL_PACKAGES))) |
| 19 |
TARBALL_TARGET = debian/$(SRCTARBALL) |
| 20 |
endif |
| 21 |
|
| 22 |
DESTDIR=$(CURDIR)/debian/tmp |
| 23 |
|
| 24 |
DEB_DUNE_OTHER_PACKAGES := dune-build-info ordering xdg fs-io top-closure |
| 25 |
|
| 26 |
%: |
| 27 |
dh $@ --with ocaml |
| 28 |
|
| 29 |
override_dh_auto_configure: $(TARBALL_TARGET) |
| 30 |
./configure --libdir $(OCAML_STDLIB_DIR) |
| 31 |
|
| 32 |
override_dh_auto_build: |
| 33 |
ocaml boot/bootstrap.ml |
| 34 |
./dune.exe build --release --profile dune-bootstrap dune.install |
| 35 |
./dune.exe build --release $(addsuffix .install,$(DEB_DUNE_OTHER_PACKAGES)) |
| 36 |
|
| 37 |
override_dh_auto_install: |
| 38 |
./dune.exe install --release --destdir=$(DESTDIR) --prefix=/usr --libdir=$(OCAML_STDLIB_DIR) dune $(DEB_DUNE_OTHER_PACKAGES) |
| 39 |
rm -rf $(addprefix debian/tmp/usr/doc/,$(DEB_DUNE_OTHER_PACKAGES)) |
| 40 |
rm -f debian/tmp/usr/doc/dune/LICENSE.md |
| 41 |
|
| 42 |
override_dh_auto_test: |
| 43 |
# Upstream tests have many dependencies; rely on autopkgtest instead |
| 44 |
|
| 45 |
ifneq (,$(TARBALL_TARGET)) |
| 46 |
$(TARBALL_TARGET): $(UPSTREAM_TARBALL) |
| 47 |
mkdir -p debian/$(DISTDIR) |
| 48 |
# Copy upstream tarball |
| 49 |
cp $< debian/$(DISTDIR) |
| 50 |
# Copy debian/patches and set permissions (workaround for #796257) |
| 51 |
if [ -d debian/patches ]; then \ |
| 52 |
cp -a debian/patches debian/$(DISTDIR)/debian-patches; \ |
| 53 |
chmod 755 debian/$(DISTDIR)/debian-patches; \ |
| 54 |
chmod 644 debian/$(DISTDIR)/debian-patches/*; \ |
| 55 |
fi |
| 56 |
# Create the tarball and cleanup |
| 57 |
cd debian && find $(DISTDIR) -not -type d -print0 | \ |
| 58 |
LC_ALL=C sort --zero-terminated | \ |
| 59 |
tar --create --null --files-from=- \ |
| 60 |
--file=$(abspath $@) --mtime="$(BUILD_DATE)" \ |
| 61 |
--owner=root --group=root --numeric-owner |
| 62 |
rm -Rf debian/$(DISTDIR) |
| 63 |
|
| 64 |
execute_after_dh_auto_install-indep: |
| 65 |
mkdir -p debian/ocaml-dune-source/usr/src |
| 66 |
cp $(TARBALL_TARGET) debian/ocaml-dune-source/usr/src |
| 67 |
endif |