Show More
@@ -1,103 +1,103 b'' | |||||
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 |
|
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 |
|
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: |
|
7 | # .deb that has native components built for multiple versions of py3: | |
8 | # |
|
8 | # | |
9 | # 1. install python3.x and python3.x-dev for each version you want |
|
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 |
|
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) |
|
11 | # (if both are set, DEB_HG_PYTHON_VERSIONS has precedence) | |
12 | # |
|
12 | # | |
13 | # If you choose `DEB_HG_MULTI_VERSION=1`, it will build for every "supported" |
|
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 |
|
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 |
|
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` |
|
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: |
|
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 |
|
18 | # DEB_HG_PYTHON_VERSIONS="3.7 3.8" make deb | |
19 | DEB_HG_MULTI_VERSION?=0 |
|
19 | DEB_HG_MULTI_VERSION?=0 | |
20 |
|
20 | |||
21 | # Set to 1 to make /usr/bin/hg a symlink to chg, and move hg to |
|
21 | # Set to 1 to make /usr/bin/hg a symlink to chg, and move hg to | |
22 | # /usr/lib/mercurial/hg. |
|
22 | # /usr/lib/mercurial/hg. | |
23 | DEB_HG_CHG_BY_DEFAULT?=0 |
|
23 | DEB_HG_CHG_BY_DEFAULT?=0 | |
24 |
|
24 | |||
25 | CPUS=$(shell cat /proc/cpuinfo | grep -E ^processor | wc -l) |
|
25 | CPUS=$(shell cat /proc/cpuinfo | grep -E ^processor | wc -l) | |
26 |
|
26 | |||
27 | # By default, only build for the version of python3 that the system considers |
|
27 | # By default, only build for the version of python3 that the system considers | |
28 | # the 'default' (which should be the one invoked by just running 'python3' |
|
28 | # the 'default' (which should be the one invoked by just running 'python3' | |
29 | # without a minor version). If DEB_HG_PYTHON_VERSIONS is set, this is ignored. |
|
29 | # without a minor version). If DEB_HG_PYTHON_VERSIONS is set, this is ignored. | |
30 | ifeq ($(DEB_HG_MULTI_VERSION), 1) |
|
30 | ifeq ($(DEB_HG_MULTI_VERSION), 1) | |
31 | # If we're building for multiple versions, use all of the "supported" versions |
|
31 | # If we're building for multiple versions, use all of the "supported" versions | |
32 | # on the build machine. Note: the mechanism in use here (`py3versions`) is the |
|
32 | # on the build machine. Note: the mechanism in use here (`py3versions`) is the | |
33 | # recommended one, but it relies on a file written by the python3-minimal |
|
33 | # recommended one, but it relies on a file written by the python3-minimal | |
34 | # package, and this file is not dynamic and does not account for manual |
|
34 | # package, and this file is not dynamic and does not account for manual | |
35 | # installations, just the ones that would be installed by `python3-all`. This |
|
35 | # installations, just the ones that would be installed by `python3-all`. This | |
36 | # includes the `-i` flag, which claims it's to list all "installed" versions, |
|
36 | # includes the `-i` flag, which claims it's to list all "installed" versions, | |
37 | # but it doesn't. This was quite confusing, hence this tale of woe. :) |
|
37 | # but it doesn't. This was quite confusing, hence this tale of woe. :) | |
38 | DEB_HG_PYTHON_VERSIONS?=$(shell py3versions -vs) |
|
38 | DEB_HG_PYTHON_VERSIONS?=$(shell py3versions -vs) | |
39 | else |
|
39 | else | |
40 | # If we're building for only one version, identify the "default" version on |
|
40 | # If we're building for only one version, identify the "default" version on | |
41 | # the build machine and use that when building; this is just so that we don't |
|
41 | # the build machine and use that when building; this is just so that we don't | |
42 | # have to duplicate the rules below for multi-version vs. single-version. The |
|
42 | # have to duplicate the rules below for multi-version vs. single-version. The | |
43 | # shebang line will still be /usr/bin/python3 (no minor version). |
|
43 | # shebang line will still be /usr/bin/python3 (no minor version). | |
44 | DEB_HG_PYTHON_VERSIONS?=$(shell py3versions -vd) |
|
44 | DEB_HG_PYTHON_VERSIONS?=$(shell py3versions -vd) | |
45 | endif |
|
45 | endif | |
46 |
|
46 | |||
47 | ifeq ($(DEB_HG_CHG_BY_DEFAULT), 1) |
|
47 | ifeq ($(DEB_HG_CHG_BY_DEFAULT), 1) | |
48 | # Important: the "real" hg must have a 'basename' of 'hg'. Otherwise, hg |
|
48 | # Important: the "real" hg must have a 'basename' of 'hg'. Otherwise, hg | |
49 | # behaves differently when setting $HG and breaks aliases that use that. |
|
49 | # behaves differently when setting $HG and breaks aliases that use that. | |
50 | export HGPATH=/usr/lib/mercurial/hg |
|
50 | export HGPATH=/usr/lib/mercurial/hg | |
51 | endif |
|
51 | endif | |
52 |
|
52 | |||
53 | export HGPYTHON3=1 |
|
53 | export HGPYTHON3=1 | |
54 | export PYTHON=python3 |
|
54 | export PYTHON=python3 | |
55 |
|
55 | |||
56 | %: |
|
56 | %: | |
57 | dh $@ --with python3 |
|
57 | dh $@ --with python3 | |
58 |
|
58 | |||
59 | # Note: testing can be disabled using the standard `DEB_BUILD_OPTIONS=nocheck` |
|
59 | # Note: testing can be disabled using the standard `DEB_BUILD_OPTIONS=nocheck` | |
60 | override_dh_auto_test: |
|
60 | override_dh_auto_test: | |
61 | http_proxy='' dh_auto_test -- TESTFLAGS="-j$(CPUS)" |
|
61 | http_proxy='' dh_auto_test -- TESTFLAGS="-j$(CPUS)" | |
62 |
|
62 | |||
63 | override_dh_python3: |
|
63 | override_dh_python3: | |
64 | dh_python3 --shebang=/usr/bin/python3 |
|
64 | dh_python3 --shebang=/usr/bin/python3 | |
65 |
|
65 | |||
66 | override_dh_auto_clean: |
|
66 | override_dh_auto_clean: | |
67 | $(MAKE) cleanbutpackages |
|
67 | $(MAKE) cleanbutpackages | |
68 | $(MAKE) -C contrib/chg clean |
|
68 | $(MAKE) -C contrib/chg clean | |
69 |
|
69 | |||
70 | override_dh_auto_build: |
|
70 | override_dh_auto_build: | |
71 | $(MAKE) all |
|
71 | $(MAKE) all | |
72 | $(MAKE) -C contrib/chg all |
|
72 | $(MAKE) -C contrib/chg all | |
73 |
|
73 | |||
74 | # Build the native extensions for a specfic python3 version (which must be |
|
74 | # Build the native extensions for a specfic python3 version (which must be | |
75 | # installed on the build machine). |
|
75 | # installed on the build machine). | |
76 | install-python%: |
|
76 | install-python%: | |
77 | python$* setup.py install --root "$(CURDIR)"/debian/mercurial --install-layout=deb |
|
77 | python$* setup.py install --root "$(CURDIR)"/debian/mercurial --install-layout=deb | |
78 |
|
78 | |||
79 | # Build the final package. This rule has a dependencies section that causes the |
|
79 | # Build the final package. This rule has a dependencies section that causes the | |
80 | # native extensions to be compiled for every version of python3 listed in |
|
80 | # native extensions to be compiled for every version of python3 listed in | |
81 | # DEB_HG_PYTHON_VERSIONS. |
|
81 | # DEB_HG_PYTHON_VERSIONS. | |
82 | override_dh_auto_install: $(DEB_HG_PYTHON_VERSIONS:%=install-python%) |
|
82 | override_dh_auto_install: $(DEB_HG_PYTHON_VERSIONS:%=install-python%) | |
83 | # chg |
|
83 | # chg | |
84 | make -C contrib/chg \ |
|
84 | make -C contrib/chg \ | |
85 | DESTDIR="$(CURDIR)"/debian/mercurial \ |
|
85 | DESTDIR="$(CURDIR)"/debian/mercurial \ | |
86 | PREFIX=/usr \ |
|
86 | PREFIX=/usr \ | |
87 | install |
|
87 | install | |
88 | make install-doc PREFIX="$(CURDIR)"/debian/mercurial/usr |
|
88 | make install-doc PREFIX="$(CURDIR)"/debian/mercurial/usr | |
89 | cp contrib/hg-ssh "$(CURDIR)"/debian/mercurial/usr/bin |
|
89 | cp contrib/hg-ssh "$(CURDIR)"/debian/mercurial/usr/bin | |
90 | mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/mercurial |
|
90 | mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/mercurial | |
91 | cp contrib/hgk "$(CURDIR)"/debian/mercurial/usr/share/mercurial |
|
91 | cp contrib/hgk "$(CURDIR)"/debian/mercurial/usr/share/mercurial | |
92 | mkdir -p "$(CURDIR)"/debian/mercurial/etc/mercurial/hgrc.d/ |
|
92 | mkdir -p "$(CURDIR)"/debian/mercurial/etc/mercurial/hgrc.d/ | |
93 | cp contrib/packaging/debian/*.rc "$(CURDIR)"/debian/mercurial/etc/mercurial/hgrc.d/ |
|
93 | cp contrib/packaging/debian/*.rc "$(CURDIR)"/debian/mercurial/etc/mercurial/hgrc.d/ | |
94 | # completions |
|
94 | # completions | |
95 | mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/bash-completion/completions |
|
95 | mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/bash-completion/completions | |
96 | cp contrib/bash_completion "$(CURDIR)"/debian/mercurial/usr/share/bash-completion/completions/hg |
|
96 | cp contrib/bash_completion "$(CURDIR)"/debian/mercurial/usr/share/bash-completion/completions/hg | |
97 | mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/zsh/vendor-completions |
|
97 | mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/zsh/vendor-completions | |
98 | cp contrib/zsh_completion "$(CURDIR)"/debian/mercurial/usr/share/zsh/vendor-completions/_hg |
|
98 | cp contrib/zsh_completion "$(CURDIR)"/debian/mercurial/usr/share/zsh/vendor-completions/_hg | |
99 |
if [ |
|
99 | if [ "$(DEB_HG_CHG_BY_DEFAULT)" -eq 1 ]; then \ | |
100 | mkdir -p "$(CURDIR)"/debian/mercurial/usr/lib/mercurial; \ |
|
100 | mkdir -p "$(CURDIR)"/debian/mercurial/usr/lib/mercurial; \ | |
101 | mv "$(CURDIR)"/debian/mercurial/usr/bin/hg "$(CURDIR)"/debian/mercurial/usr/lib/mercurial/hg; \ |
|
101 | mv "$(CURDIR)"/debian/mercurial/usr/bin/hg "$(CURDIR)"/debian/mercurial/usr/lib/mercurial/hg; \ | |
102 | ln -s chg "$(CURDIR)"/debian/mercurial/usr/bin/hg; \ |
|
102 | ln -s chg "$(CURDIR)"/debian/mercurial/usr/bin/hg; \ | |
103 | fi |
|
103 | fi |
General Comments 0
You need to be logged in to leave comments.
Login now