Mercurial > hgrepos > Python2 > PyMuPDF
annotate Makefile.freebsd @ 21:2f43e400f144
Provide an "all" target to build both the sdist and the wheel
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 19 Sep 2025 10:28:53 +0200 |
| parents | eb3dd22fef2c |
| children | baeb8bdeff3a |
| rev | line source |
|---|---|
|
6
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
1 # -*- mode: makefile; coding: utf-8 -*- |
|
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
2 # |
|
10
76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
Franz Glasner <fzglas.hg@dom66.de>
parents:
9
diff
changeset
|
3 # Needs GNU make (aka gmake) and binutils/ar or LLVM/ar |
|
76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
Franz Glasner <fzglas.hg@dom66.de>
parents:
9
diff
changeset
|
4 # (instead of FreeBSD /usr/bin/ar). |
|
8
bf1744083a54
Some documentation notes into Makefile.freebsd
Franz Glasner <fzglas.hg@dom66.de>
parents:
6
diff
changeset
|
5 # |
|
bf1744083a54
Some documentation notes into Makefile.freebsd
Franz Glasner <fzglas.hg@dom66.de>
parents:
6
diff
changeset
|
6 # Building against an installed mupdf package fails because the libmupdfcpp.so |
|
bf1744083a54
Some documentation notes into Makefile.freebsd
Franz Glasner <fzglas.hg@dom66.de>
parents:
6
diff
changeset
|
7 # is missing. |
|
bf1744083a54
Some documentation notes into Makefile.freebsd
Franz Glasner <fzglas.hg@dom66.de>
parents:
6
diff
changeset
|
8 # |
|
bf1744083a54
Some documentation notes into Makefile.freebsd
Franz Glasner <fzglas.hg@dom66.de>
parents:
6
diff
changeset
|
9 # Prepare: |
|
bf1744083a54
Some documentation notes into Makefile.freebsd
Franz Glasner <fzglas.hg@dom66.de>
parents:
6
diff
changeset
|
10 # |
|
bf1744083a54
Some documentation notes into Makefile.freebsd
Franz Glasner <fzglas.hg@dom66.de>
parents:
6
diff
changeset
|
11 # - Create a Python venv and activate it |
|
bf1744083a54
Some documentation notes into Makefile.freebsd
Franz Glasner <fzglas.hg@dom66.de>
parents:
6
diff
changeset
|
12 # |
|
10
76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
Franz Glasner <fzglas.hg@dom66.de>
parents:
9
diff
changeset
|
13 # - Install a LLVM package that has the same version as the libclang |
|
76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
Franz Glasner <fzglas.hg@dom66.de>
parents:
9
diff
changeset
|
14 # Python package that will be used/installed |
|
76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
Franz Glasner <fzglas.hg@dom66.de>
parents:
9
diff
changeset
|
15 # (e.g. pkg install llvm18 because of libclang>=18,<19) |
|
76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
Franz Glasner <fzglas.hg@dom66.de>
parents:
9
diff
changeset
|
16 # |
|
76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
Franz Glasner <fzglas.hg@dom66.de>
parents:
9
diff
changeset
|
17 # - In the "bin"-directory of the venv symlink "make" to /usr/local/bin/gmake |
|
76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
Franz Glasner <fzglas.hg@dom66.de>
parents:
9
diff
changeset
|
18 # and "ar" to /usr/local/llvm18/bin/llvm-ar |
|
8
bf1744083a54
Some documentation notes into Makefile.freebsd
Franz Glasner <fzglas.hg@dom66.de>
parents:
6
diff
changeset
|
19 # |
|
bf1744083a54
Some documentation notes into Makefile.freebsd
Franz Glasner <fzglas.hg@dom66.de>
parents:
6
diff
changeset
|
20 # * Makefiles have GNU syntax |
|
10
76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
Franz Glasner <fzglas.hg@dom66.de>
parents:
9
diff
changeset
|
21 # * ar is called with @-response-files -- which are a GNU feature (also |
|
76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
Franz Glasner <fzglas.hg@dom66.de>
parents:
9
diff
changeset
|
22 # implemented by LLVM's ar) |
|
8
bf1744083a54
Some documentation notes into Makefile.freebsd
Franz Glasner <fzglas.hg@dom66.de>
parents:
6
diff
changeset
|
23 # |
|
bf1744083a54
Some documentation notes into Makefile.freebsd
Franz Glasner <fzglas.hg@dom66.de>
parents:
6
diff
changeset
|
24 # - At first to not build with tesseract (OCR) |
|
bf1744083a54
Some documentation notes into Makefile.freebsd
Franz Glasner <fzglas.hg@dom66.de>
parents:
6
diff
changeset
|
25 # |
|
bf1744083a54
Some documentation notes into Makefile.freebsd
Franz Glasner <fzglas.hg@dom66.de>
parents:
6
diff
changeset
|
26 # export PYMUPDF_SETUP_MUPDF_TESSERACT=0 |
|
bf1744083a54
Some documentation notes into Makefile.freebsd
Franz Glasner <fzglas.hg@dom66.de>
parents:
6
diff
changeset
|
27 # |
|
6
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
28 |
|
21
2f43e400f144
Provide an "all" target to build both the sdist and the wheel
Franz Glasner <fzglas.hg@dom66.de>
parents:
20
diff
changeset
|
29 .PHONY: all wheel sdist populate-venv check |
|
16
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
30 |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
31 .SILENT: check |
|
6
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
32 |
|
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
33 THIS_MAKEFILE_JUSTNAME:= $(firstword $(MAKEFILE_LIST)) |
|
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
34 THIS_MAKEFILE_DIR:= $(abspath $(dir $(THIS_MAKEFILE_JUSTNAME))) |
|
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
35 |
|
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
36 PYMUPDF_SETUP_MUPDF_BUILD?= $(THIS_MAKEFILE_DIR)/mupdf-source |
|
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
37 PYMUPDF_SETUP_MUPDF_TESSERACT?= 0 |
|
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
38 LIBCLANG_LIBRARY_PATH?= $(CLANG_DIR)/lib |
|
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
39 |
|
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
40 TEST= /bin/test |
|
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
41 LOCALBASE?= /usr/local |
|
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
42 SYMLINK?= /bin/ln -s |
|
15
393e55ef9200
Explicitely use python3 instead of python
Franz Glasner <fzglas.hg@dom66.de>
parents:
13
diff
changeset
|
43 PYTHON?= python3 |
|
6
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
44 PYTHON_PREFIXES!= $(PYTHON) -c 'import sys; print(sys.prefix); print(sys.base_prefix)' |
|
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
45 CLANG_DIR?= /usr/local/llvm18 |
|
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
46 |
|
10
76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
Franz Glasner <fzglas.hg@dom66.de>
parents:
9
diff
changeset
|
47 # |
|
76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
Franz Glasner <fzglas.hg@dom66.de>
parents:
9
diff
changeset
|
48 # Setting these does not work for some parts built by sub-makes. |
|
76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
Franz Glasner <fzglas.hg@dom66.de>
parents:
9
diff
changeset
|
49 # Symlink in the venv instead. |
|
76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
Franz Glasner <fzglas.hg@dom66.de>
parents:
9
diff
changeset
|
50 # |
|
6
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
51 #CC= $(CLANG_DIR)/bin/clang |
|
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
52 #CXX= $(CLANG_DIR)/bin/clang++ |
|
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
53 |
|
21
2f43e400f144
Provide an "all" target to build both the sdist and the wheel
Franz Glasner <fzglas.hg@dom66.de>
parents:
20
diff
changeset
|
54 |
|
2f43e400f144
Provide an "all" target to build both the sdist and the wheel
Franz Glasner <fzglas.hg@dom66.de>
parents:
20
diff
changeset
|
55 all: sdist wheel |
|
2f43e400f144
Provide an "all" target to build both the sdist and the wheel
Franz Glasner <fzglas.hg@dom66.de>
parents:
20
diff
changeset
|
56 |
|
2f43e400f144
Provide an "all" target to build both the sdist and the wheel
Franz Glasner <fzglas.hg@dom66.de>
parents:
20
diff
changeset
|
57 |
|
19
c3ef899c5e56
Rename the "build" target to "wheel"
Franz Glasner <fzglas.hg@dom66.de>
parents:
18
diff
changeset
|
58 wheel: check |
|
6
b5f06508363a
PyMuPDF builds on FreeBSD now with "gmake -f Makefile.freebsd".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
59 $(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/make || $(SYMLINK) $(LOCALBASE)/bin/gmake $(firstword $(PYTHON_PREFIXES))/bin/make |
|
10
76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
Franz Glasner <fzglas.hg@dom66.de>
parents:
9
diff
changeset
|
60 $(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/ar || $(SYMLINK) $(CLANG_DIR)/bin/llvm-ar $(firstword $(PYTHON_PREFIXES))/bin/ar |
|
9
b2d41d02518f
Use the LLVM compilers by symlinking them in the venv.
Franz Glasner <fzglas.hg@dom66.de>
parents:
8
diff
changeset
|
61 $(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/cc || $(SYMLINK) $(CLANG_DIR)/bin/clang $(firstword $(PYTHON_PREFIXES))/bin/cc |
|
b2d41d02518f
Use the LLVM compilers by symlinking them in the venv.
Franz Glasner <fzglas.hg@dom66.de>
parents:
8
diff
changeset
|
62 $(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/c++ || $(SYMLINK) $(CLANG_DIR)/bin/clang++ $(firstword $(PYTHON_PREFIXES))/bin/c++ |
|
10
76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
Franz Glasner <fzglas.hg@dom66.de>
parents:
9
diff
changeset
|
63 $(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/ld || $(SYMLINK) $(CLANG_DIR)/bin/ld.lld $(firstword $(PYTHON_PREFIXES))/bin/ld |
|
13
d6cbc8049ab0
Increase verbosity level for builds
Franz Glasner <fzglas.hg@dom66.de>
parents:
11
diff
changeset
|
64 PIPCL_VERBOSE=2 LIBCLANG_LIBRARY_PATH=$(LIBCLANG_LIBRARY_PATH) PYMUPDF_SETUP_MUPDF_BUILD=$(PYMUPDF_SETUP_MUPDF_BUILD) PYMUPDF_SETUP_MUPDF_TESSERACT=$(PYMUPDF_SETUP_MUPDF_TESSERACT) $(PYTHON) -m build --wheel --verbose --no-isolation |
|
11
f704f0a78213
A make target to populate the Python virtual environment
Franz Glasner <fzglas.hg@dom66.de>
parents:
10
diff
changeset
|
65 |
|
f704f0a78213
A make target to populate the Python virtual environment
Franz Glasner <fzglas.hg@dom66.de>
parents:
10
diff
changeset
|
66 |
|
18
dd663470c57c
Make building an sdist work on FreeBSD and with Mercurial as SCM.
Franz Glasner <fzglas.hg@dom66.de>
parents:
16
diff
changeset
|
67 sdist: check |
|
dd663470c57c
Make building an sdist work on FreeBSD and with Mercurial as SCM.
Franz Glasner <fzglas.hg@dom66.de>
parents:
16
diff
changeset
|
68 PIPCL_VERBOSE=2 LIBCLANG_LIBRARY_PATH=$(LIBCLANG_LIBRARY_PATH) PYMUPDF_SETUP_MUPDF_BUILD=$(PYMUPDF_SETUP_MUPDF_BUILD) PYMUPDF_SETUP_MUPDF_TESSERACT=$(PYMUPDF_SETUP_MUPDF_TESSERACT) $(PYTHON) -m build --sdist --verbose --no-isolation |
|
dd663470c57c
Make building an sdist work on FreeBSD and with Mercurial as SCM.
Franz Glasner <fzglas.hg@dom66.de>
parents:
16
diff
changeset
|
69 |
|
dd663470c57c
Make building an sdist work on FreeBSD and with Mercurial as SCM.
Franz Glasner <fzglas.hg@dom66.de>
parents:
16
diff
changeset
|
70 |
|
11
f704f0a78213
A make target to populate the Python virtual environment
Franz Glasner <fzglas.hg@dom66.de>
parents:
10
diff
changeset
|
71 populate-venv: |
|
f704f0a78213
A make target to populate the Python virtual environment
Franz Glasner <fzglas.hg@dom66.de>
parents:
10
diff
changeset
|
72 ifneq ($(firstword $(PYTHON_PREFIXES)),$(lastword $(PYTHON_PREFIXES))) |
|
f704f0a78213
A make target to populate the Python virtual environment
Franz Glasner <fzglas.hg@dom66.de>
parents:
10
diff
changeset
|
73 $(PYTHON) -m pip install -U -r requirements-build.txt |
|
f704f0a78213
A make target to populate the Python virtual environment
Franz Glasner <fzglas.hg@dom66.de>
parents:
10
diff
changeset
|
74 else |
|
f704f0a78213
A make target to populate the Python virtual environment
Franz Glasner <fzglas.hg@dom66.de>
parents:
10
diff
changeset
|
75 $(error Not in a Python virtual environment) |
|
f704f0a78213
A make target to populate the Python virtual environment
Franz Glasner <fzglas.hg@dom66.de>
parents:
10
diff
changeset
|
76 endif |
|
16
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
77 |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
78 |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
79 check: |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
80 ifneq ($(firstword $(PYTHON_PREFIXES)),$(lastword $(PYTHON_PREFIXES))) |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
81 $(PYTHON) -m pip freeze | grep -E '^\s*setuptools-scm==' >/dev/null |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
82 $(PYTHON) -m pip freeze | grep -E '^\s*build==' >/dev/null |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
83 $(PYTHON) -m pip freeze | grep -E '^\s*swig==' >/dev/null |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
84 $(PYTHON) -m pip freeze | grep -E '^\s*libclang==18\.' >/dev/null |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
85 $(TEST) -x $(LOCALBASE)/bin/gmake |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
86 $(TEST) -x $(LOCALBASE)/bin/cmake |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
87 $(TEST) -x $(CLANG_DIR)/bin/llvm-ar |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
88 $(TEST) -x $(CLANG_DIR)/bin/clang |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
89 $(TEST) -x $(CLANG_DIR)/bin/clang++ |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
90 $(TEST) -x $(CLANG_DIR)/bin/ld.lld |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
91 else |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
92 $(error Not in a Python virtual environment) |
|
bd5bb0742cc3
A "check" target that checks for all venv and host prerequisites
Franz Glasner <fzglas.hg@dom66.de>
parents:
15
diff
changeset
|
93 endif |
