##// END OF EJS Templates
debian: support building a single deb for multiple py3 versions...
Kyle Lippincott -
r45543:36178b5c default
parent child Browse files
Show More
@@ -1,44 +1,88
1 #!/usr/bin/make -f
1 #!/usr/bin/make -f
2 # Uncomment this to turn on verbose mode.
2 # Uncomment this to turn on verbose mode.
3 # export DH_VERBOSE=1
3 # export DH_VERBOSE=1
4
4
5 # By default we build a .deb where the native components are built with the
6 # current "default" version of py3 on the build machine. If you wish to build a
7 # .deb that has native components built for multiple versions of py3:
8 #
9 # 1. install python3.x and python3.x-dev for each version you want
10 # 2. set DEB_HG_MULTI_VERSION=1 or DEB_HG_PYTHON_VERSIONS in your environment
11 # (if both are set, DEB_HG_PYTHON_VERSIONS has precedence)
12 #
13 # If you choose `DEB_HG_MULTI_VERSION=1`, it will build for every "supported"
14 # version of py3 that's installed on the build machine. This may not be equal to
15 # the actual versions that are installed, see the comment above where we set
16 # DEB_HG_PYTHON_VERSIONS below. If you choose to set `DEB_HG_PYTHON_VERSIONS`
17 # yourself, set it to a space-separated string of python version numbers, like:
18 # DEB_HG_PYTHON_VERSIONS="3.7 3.8" make deb
19 DEB_HG_MULTI_VERSION?=0
20
5 CPUS=$(shell cat /proc/cpuinfo | grep -E ^processor | wc -l)
21 CPUS=$(shell cat /proc/cpuinfo | grep -E ^processor | wc -l)
6
22
23 # By default, only build for the version of python3 that the system considers
24 # the 'default' (which should be the one invoked by just running 'python3'
25 # without a minor version). If DEB_HG_PYTHON_VERSIONS is set, this is ignored.
26 ifeq ($(DEB_HG_MULTI_VERSION), 1)
27 # If we're building for multiple versions, use all of the "supported" versions
28 # on the build machine. Note: the mechanism in use here (`py3versions`) is the
29 # recommended one, but it relies on a file written by the python3-minimal
30 # package, and this file is not dynamic and does not account for manual
31 # installations, just the ones that would be installed by `python3-all`. This
32 # includes the `-i` flag, which claims it's to list all "installed" versions,
33 # but it doesn't. This was quite confusing, hence this tale of woe. :)
34 DEB_HG_PYTHON_VERSIONS?=$(shell py3versions -vs)
35 else
36 # If we're building for only one version, identify the "default" version on
37 # the build machine and use that when building; this is just so that we don't
38 # have to duplicate the rules below for multi-version vs. single-version. The
39 # shebang line will still be /usr/bin/python3 (no minor version).
40 DEB_HG_PYTHON_VERSIONS?=$(shell py3versions -vd)
41 endif
42
7 export HGPYTHON3=1
43 export HGPYTHON3=1
8 export PYTHON=python3
44 export PYTHON=python3
9
45
10 %:
46 %:
11 dh $@ --with python3
47 dh $@ --with python3
12
48
49 # Note: testing can be disabled using the standard `DEB_BUILD_OPTIONS=nocheck`
13 override_dh_auto_test:
50 override_dh_auto_test:
14 http_proxy='' dh_auto_test -- TESTFLAGS="-j$(CPUS)"
51 http_proxy='' dh_auto_test -- TESTFLAGS="-j$(CPUS)"
15
52
16 override_dh_python3:
53 override_dh_python3:
17 dh_python3 --shebang=/usr/bin/python3
54 dh_python3 --shebang=/usr/bin/python3
18
55
19 override_dh_auto_clean:
56 override_dh_auto_clean:
20 $(MAKE) cleanbutpackages
57 $(MAKE) cleanbutpackages
21 $(MAKE) -C contrib/chg clean
58 $(MAKE) -C contrib/chg clean
22
59
23 override_dh_auto_build:
60 override_dh_auto_build:
24 $(MAKE) all
61 $(MAKE) all
25 $(MAKE) -C contrib/chg all
62 $(MAKE) -C contrib/chg all
26
63
27 override_dh_auto_install:
64 # Build the native extensions for a specfic python3 version (which must be
28 python3 setup.py install --root "$(CURDIR)"/debian/mercurial --install-layout=deb
65 # installed on the build machine).
66 install-python%:
67 python$* setup.py install --root "$(CURDIR)"/debian/mercurial --install-layout=deb
68
69 # Build the final package. This rule has a dependencies section that causes the
70 # native extensions to be compiled for every version of python3 listed in
71 # DEB_HG_PYTHON_VERSIONS.
72 override_dh_auto_install: $(DEB_HG_PYTHON_VERSIONS:%=install-python%)
29 # chg
73 # chg
30 make -C contrib/chg \
74 make -C contrib/chg \
31 DESTDIR="$(CURDIR)"/debian/mercurial \
75 DESTDIR="$(CURDIR)"/debian/mercurial \
32 PREFIX=/usr \
76 PREFIX=/usr \
33 install
77 install
34 make install-doc PREFIX="$(CURDIR)"/debian/mercurial/usr
78 make install-doc PREFIX="$(CURDIR)"/debian/mercurial/usr
35 cp contrib/hg-ssh "$(CURDIR)"/debian/mercurial/usr/bin
79 cp contrib/hg-ssh "$(CURDIR)"/debian/mercurial/usr/bin
36 mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/mercurial
80 mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/mercurial
37 cp contrib/hgk "$(CURDIR)"/debian/mercurial/usr/share/mercurial
81 cp contrib/hgk "$(CURDIR)"/debian/mercurial/usr/share/mercurial
38 mkdir -p "$(CURDIR)"/debian/mercurial/etc/mercurial/hgrc.d/
82 mkdir -p "$(CURDIR)"/debian/mercurial/etc/mercurial/hgrc.d/
39 cp contrib/packaging/debian/*.rc "$(CURDIR)"/debian/mercurial/etc/mercurial/hgrc.d/
83 cp contrib/packaging/debian/*.rc "$(CURDIR)"/debian/mercurial/etc/mercurial/hgrc.d/
40 # completions
84 # completions
41 mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/bash-completion/completions
85 mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/bash-completion/completions
42 cp contrib/bash_completion "$(CURDIR)"/debian/mercurial/usr/share/bash-completion/completions/hg
86 cp contrib/bash_completion "$(CURDIR)"/debian/mercurial/usr/share/bash-completion/completions/hg
43 mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/zsh/vendor-completions
87 mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/zsh/vendor-completions
44 cp contrib/zsh_completion "$(CURDIR)"/debian/mercurial/usr/share/zsh/vendor-completions/_hg
88 cp contrib/zsh_completion "$(CURDIR)"/debian/mercurial/usr/share/zsh/vendor-completions/_hg
General Comments 0
You need to be logged in to leave comments. Login now