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