##// END OF EJS Templates
pyoxidized: add a copy of the `contrib` directory in the right location...
marmoute -
r48647:a24e813d stable
parent child Browse files
Show More
@@ -1,292 +1,294 b''
1 1 # If you want to change PREFIX, do not just edit it below. The changed
2 2 # value wont get passed on to recursive make calls. You should instead
3 3 # override the variable on the command like:
4 4 #
5 5 # % make PREFIX=/opt/ install
6 6
7 7 export PREFIX=/usr/local
8 8
9 9 # Default to Python 3.
10 10 #
11 11 # Windows ships Python 3 as `python.exe`, which may not be on PATH. py.exe is.
12 12 ifeq ($(OS),Windows_NT)
13 13 PYTHON?=py -3
14 14 else
15 15 PYTHON?=python3
16 16 endif
17 17
18 18 PYOXIDIZER?=pyoxidizer
19 19
20 20 $(eval HGROOT := $(shell pwd))
21 21 HGPYTHONS ?= $(HGROOT)/build/pythons
22 22 PURE=
23 23 PYFILESCMD=find mercurial hgext doc -name '*.py'
24 24 PYFILES:=$(shell $(PYFILESCMD))
25 25 DOCFILES=mercurial/helptext/*.txt
26 26 export LANGUAGE=C
27 27 export LC_ALL=C
28 28 TESTFLAGS ?= $(shell echo $$HGTESTFLAGS)
29 29 OSXVERSIONFLAGS ?= $(shell echo $$OSXVERSIONFLAGS)
30 30 CARGO = cargo
31 31
32 32 # Set this to e.g. "mingw32" to use a non-default compiler.
33 33 COMPILER=
34 34
35 35 COMPILERFLAG_tmp_ =
36 36 COMPILERFLAG_tmp_${COMPILER} ?= -c $(COMPILER)
37 37 COMPILERFLAG=${COMPILERFLAG_tmp_${COMPILER}}
38 38
39 39 help:
40 40 @echo 'Commonly used make targets:'
41 41 @echo ' all - build program and documentation'
42 42 @echo ' install - install program and man pages to $$PREFIX ($(PREFIX))'
43 43 @echo ' install-home - install with setup.py install --home=$$HOME ($(HOME))'
44 44 @echo ' local - build for inplace usage'
45 45 @echo ' tests - run all tests in the automatic test suite'
46 46 @echo ' test-foo - run only specified tests (e.g. test-merge1.t)'
47 47 @echo ' dist - run all tests and create a source tarball in dist/'
48 48 @echo ' clean - remove files created by other targets'
49 49 @echo ' (except installed files or dist source tarball)'
50 50 @echo ' update-pot - update i18n/hg.pot'
51 51 @echo
52 52 @echo 'Example for a system-wide installation under /usr/local:'
53 53 @echo ' make all && su -c "make install" && hg version'
54 54 @echo
55 55 @echo 'Example for a local installation (usable in this directory):'
56 56 @echo ' make local && ./hg version'
57 57
58 58 all: build doc
59 59
60 60 local:
61 61 $(PYTHON) setup.py $(PURE) \
62 62 build_py -c -d . \
63 63 build_ext $(COMPILERFLAG) -i \
64 64 build_hgexe $(COMPILERFLAG) -i \
65 65 build_mo
66 66 env HGRCPATH= $(PYTHON) hg version
67 67
68 68 build:
69 69 $(PYTHON) setup.py $(PURE) build $(COMPILERFLAG)
70 70
71 71 build-chg:
72 72 make -C contrib/chg
73 73
74 74 build-rhg:
75 75 (cd rust/rhg; cargo build --release)
76 76
77 77 wheel:
78 78 FORCE_SETUPTOOLS=1 $(PYTHON) setup.py $(PURE) bdist_wheel $(COMPILERFLAG)
79 79
80 80 doc:
81 81 $(MAKE) -C doc
82 82
83 83 cleanbutpackages:
84 84 rm -f hg.exe
85 85 -$(PYTHON) setup.py clean --all # ignore errors from this command
86 86 find contrib doc hgext hgext3rd i18n mercurial tests hgdemandimport \
87 87 \( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
88 88 rm -f MANIFEST MANIFEST.in hgext/__index__.py tests/*.err
89 89 rm -f mercurial/__modulepolicy__.py
90 90 if test -d .hg; then rm -f mercurial/__version__.py; fi
91 91 rm -rf build mercurial/locale
92 92 $(MAKE) -C doc clean
93 93 $(MAKE) -C contrib/chg distclean
94 94 rm -rf rust/target
95 95 rm -f mercurial/rustext.so
96 96
97 97 clean: cleanbutpackages
98 98 rm -rf packages
99 99
100 100 install: install-bin install-doc
101 101
102 102 install-bin: build
103 103 $(PYTHON) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force
104 104
105 105 install-chg: build-chg
106 106 make -C contrib/chg install PREFIX="$(PREFIX)"
107 107
108 108 install-doc: doc
109 109 cd doc && $(MAKE) $(MFLAGS) install
110 110
111 111 install-home: install-home-bin install-home-doc
112 112
113 113 install-home-bin: build
114 114 $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --prefix="" --force
115 115
116 116 install-home-doc: doc
117 117 cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
118 118
119 119 install-rhg: build-rhg
120 120 install -m 755 rust/target/release/rhg "$(PREFIX)"/bin/
121 121
122 122 MANIFEST-doc:
123 123 $(MAKE) -C doc MANIFEST
124 124
125 125 MANIFEST.in: MANIFEST-doc
126 126 hg manifest | sed -e 's/^/include /' > MANIFEST.in
127 127 echo include mercurial/__version__.py >> MANIFEST.in
128 128 sed -e 's/^/include /' < doc/MANIFEST >> MANIFEST.in
129 129
130 130 dist: tests dist-notests
131 131
132 132 dist-notests: doc MANIFEST.in
133 133 TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
134 134
135 135 check: tests
136 136
137 137 tests:
138 138 # Run Rust tests if cargo is installed
139 139 if command -v $(CARGO) >/dev/null 2>&1; then \
140 140 $(MAKE) rust-tests; \
141 141 fi
142 142 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
143 143
144 144 test-%:
145 145 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
146 146
147 147 testpy-%:
148 148 @echo Looking for Python $* in $(HGPYTHONS)
149 149 [ -e $(HGPYTHONS)/$*/bin/python ] || ( \
150 150 cd $$(mktemp --directory --tmpdir) && \
151 151 $(MAKE) -f $(HGROOT)/contrib/Makefile.python PYTHONVER=$* PREFIX=$(HGPYTHONS)/$* python )
152 152 cd tests && $(HGPYTHONS)/$*/bin/python run-tests.py $(TESTFLAGS)
153 153
154 154 rust-tests: py_feature = $(shell $(PYTHON) -c \
155 155 'import sys; print(["python27-bin", "python3-bin"][sys.version_info[0] >= 3])')
156 156 rust-tests:
157 157 cd $(HGROOT)/rust/hg-cpython \
158 158 && $(CARGO) test --quiet --all \
159 159 --no-default-features --features "$(py_feature) $(HG_RUST_FEATURES)"
160 160
161 161 check-code:
162 162 hg manifest | xargs python contrib/check-code.py
163 163
164 164 format-c:
165 165 clang-format --style file -i \
166 166 `hg files 'set:(**.c or **.cc or **.h) and not "listfile:contrib/clang-format-ignorelist"'`
167 167
168 168 update-pot: i18n/hg.pot
169 169
170 170 i18n/hg.pot: $(PYFILES) $(DOCFILES) i18n/posplit i18n/hggettext
171 171 $(PYTHON) i18n/hggettext mercurial/commands.py \
172 172 hgext/*.py hgext/*/__init__.py \
173 173 mercurial/fileset.py mercurial/revset.py \
174 174 mercurial/templatefilters.py \
175 175 mercurial/templatefuncs.py \
176 176 mercurial/templatekw.py \
177 177 mercurial/filemerge.py \
178 178 mercurial/hgweb/webcommands.py \
179 179 mercurial/util.py \
180 180 $(DOCFILES) > i18n/hg.pot.tmp
181 181 # All strings marked for translation in Mercurial contain
182 182 # ASCII characters only. But some files contain string
183 183 # literals like this '\037\213'. xgettext thinks it has to
184 184 # parse them even though they are not marked for translation.
185 185 # Extracting with an explicit encoding of ISO-8859-1 will make
186 186 # xgettext "parse" and ignore them.
187 187 $(PYFILESCMD) | xargs \
188 188 xgettext --package-name "Mercurial" \
189 189 --msgid-bugs-address "<mercurial-devel@mercurial-scm.org>" \
190 190 --copyright-holder "Olivia Mackall <olivia@selenic.com> and others" \
191 191 --from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \
192 192 -d hg -p i18n -o hg.pot.tmp
193 193 $(PYTHON) i18n/posplit i18n/hg.pot.tmp
194 194 # The target file is not created before the last step. So it never is in
195 195 # an intermediate state.
196 196 mv -f i18n/hg.pot.tmp i18n/hg.pot
197 197
198 198 %.po: i18n/hg.pot
199 199 # work on a temporary copy for never having a half completed target
200 200 cp $@ $@.tmp
201 201 msgmerge --no-location --update $@.tmp $^
202 202 mv -f $@.tmp $@
203 203
204 204 # Packaging targets
205 205
206 206 packaging_targets := \
207 207 centos7 \
208 208 centos8 \
209 209 deb \
210 210 docker-centos7 \
211 211 docker-centos8 \
212 212 docker-debian-bullseye \
213 213 docker-debian-buster \
214 214 docker-debian-stretch \
215 215 docker-fedora \
216 216 docker-ubuntu-xenial \
217 217 docker-ubuntu-xenial-ppa \
218 218 docker-ubuntu-bionic \
219 219 docker-ubuntu-bionic-ppa \
220 220 docker-ubuntu-focal \
221 221 docker-ubuntu-focal-ppa \
222 222 fedora \
223 223 linux-wheels \
224 224 linux-wheels-x86_64 \
225 225 linux-wheels-i686 \
226 226 ppa
227 227
228 228 # Forward packaging targets for convenience.
229 229 $(packaging_targets):
230 230 $(MAKE) -C contrib/packaging $@
231 231
232 232 osx:
233 233 rm -rf build/mercurial
234 234 /usr/bin/python2.7 setup.py install --optimize=1 \
235 235 --root=build/mercurial/ --prefix=/usr/local/ \
236 236 --install-lib=/Library/Python/2.7/site-packages/
237 237 make -C doc all install DESTDIR="$(PWD)/build/mercurial/"
238 238 # Place a bogon .DS_Store file in the target dir so we can be
239 239 # sure it doesn't get included in the final package.
240 240 touch build/mercurial/.DS_Store
241 241 # install zsh completions - this location appears to be
242 242 # searched by default as of macOS Sierra.
243 243 install -d build/mercurial/usr/local/share/zsh/site-functions/
244 244 install -m 0644 contrib/zsh_completion build/mercurial/usr/local/share/zsh/site-functions/_hg
245 245 # install bash completions - there doesn't appear to be a
246 246 # place that's searched by default for bash, so we'll follow
247 247 # the lead of Apple's git install and just put it in a
248 248 # location of our own.
249 249 install -d build/mercurial/usr/local/hg/contrib/
250 250 install -m 0644 contrib/bash_completion build/mercurial/usr/local/hg/contrib/hg-completion.bash
251 251 make -C contrib/chg \
252 252 HGPATH=/usr/local/bin/hg \
253 253 PYTHON=/usr/bin/python2.7 \
254 254 DESTDIR=../../build/mercurial \
255 255 PREFIX=/usr/local \
256 256 clean install
257 257 mkdir -p $${OUTPUTDIR:-dist}
258 258 HGVER=$$(python contrib/genosxversion.py $(OSXVERSIONFLAGS) build/mercurial/Library/Python/2.7/site-packages/mercurial/__version__.py) && \
259 259 OSXVER=$$(sw_vers -productVersion | cut -d. -f1,2) && \
260 260 pkgbuild --filter \\.DS_Store --root build/mercurial/ \
261 261 --identifier org.mercurial-scm.mercurial \
262 262 --version "$${HGVER}" \
263 263 build/mercurial.pkg && \
264 264 productbuild --distribution contrib/packaging/macosx/distribution.xml \
265 265 --package-path build/ \
266 266 --version "$${HGVER}" \
267 267 --resources contrib/packaging/macosx/ \
268 268 "$${OUTPUTDIR:-dist/}"/Mercurial-"$${HGVER}"-macosx"$${OSXVER}".pkg
269 269
270 270 pyoxidizer:
271 271 $(PYOXIDIZER) build --path ./rust/hgcli --release
272 272
273 273
274 274 PYOX_DIR=build/pyoxidizer/x86_64-pc-windows-msvc/release/app
275 275
276 276 # a temporary target to setup all we need for run-tests.py --pyoxidizer
277 277 # (should go away as the run-tests implementation improves
278 278 pyoxidizer-windows-tests: pyoxidizer
279 279 rm -rf $(PYOX_DIR)/templates
280 280 cp -ar $(PYOX_DIR)/lib/mercurial/templates $(PYOX_DIR)/templates
281 281 rm -rf $(PYOX_DIR)/helptext
282 282 cp -ar $(PYOX_DIR)/lib/mercurial/helptext $(PYOX_DIR)/helptext
283 283 rm -rf $(PYOX_DIR)/defaultrc
284 284 cp -ar $(PYOX_DIR)/lib/mercurial/defaultrc $(PYOX_DIR)/defaultrc
285 rm -rf $(PYOX_DIR)/contrib
286 cp -ar contrib $(PYOX_DIR)/contrib
285 287
286 288
287 289 .PHONY: help all local build doc cleanbutpackages clean install install-bin \
288 290 install-doc install-home install-home-bin install-home-doc \
289 291 dist dist-notests check tests rust-tests check-code format-c \
290 292 update-pot pyoxidizer pyoxidizer-windows-tests \
291 293 $(packaging_targets) \
292 294 osx
General Comments 0
You need to be logged in to leave comments. Login now