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