Mercurial > hgrepos > Python2 > PyMuPDF
comparison Makefile.freebsd @ 10:76e05e28f6a8
Also use the LLVM linker by symlinking and use LLVM's ar now
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 17 Sep 2025 06:30:46 +0200 |
| parents | b2d41d02518f |
| children | f704f0a78213 |
comparison
equal
deleted
inserted
replaced
| 9:b2d41d02518f | 10:76e05e28f6a8 |
|---|---|
| 1 # -*- mode: makefile; coding: utf-8 -*- | 1 # -*- mode: makefile; coding: utf-8 -*- |
| 2 # | 2 # |
| 3 # Needs GNU make (aka gmake) and binutils/ar (instead of FreeBSD /usr/bin/ar). | 3 # Needs GNU make (aka gmake) and binutils/ar or LLVM/ar |
| 4 # (instead of FreeBSD /usr/bin/ar). | |
| 4 # | 5 # |
| 5 # Building against an installed mupdf package fails because the libmupdfcpp.so | 6 # Building against an installed mupdf package fails because the libmupdfcpp.so |
| 6 # is missing. | 7 # is missing. |
| 7 # | 8 # |
| 8 # Prepare: | 9 # Prepare: |
| 9 # | 10 # |
| 10 # - Create a Python venv and activate it | 11 # - Create a Python venv and activate it |
| 11 # | 12 # |
| 12 # - In the "bin"-directory of the venv symlink "make" to /usr/local/bin/ggmake | 13 # - Install a LLVM package that has the same version as the libclang |
| 13 # and "ar" to /usr/local/bin/ar | 14 # Python package that will be used/installed |
| 15 # (e.g. pkg install llvm18 because of libclang>=18,<19) | |
| 16 # | |
| 17 # - In the "bin"-directory of the venv symlink "make" to /usr/local/bin/gmake | |
| 18 # and "ar" to /usr/local/llvm18/bin/llvm-ar | |
| 14 # | 19 # |
| 15 # * Makefiles have GNU syntax | 20 # * Makefiles have GNU syntax |
| 16 # * ar is called with @-response-files -- which are a GNU feature | 21 # * ar is called with @-response-files -- which are a GNU feature (also |
| 22 # implemented by LLVM's ar) | |
| 17 # | 23 # |
| 18 # - At first to not build with tesseract (OCR) | 24 # - At first to not build with tesseract (OCR) |
| 19 # | 25 # |
| 20 # export PYMUPDF_SETUP_MUPDF_TESSERACT=0 | 26 # export PYMUPDF_SETUP_MUPDF_TESSERACT=0 |
| 21 # | |
| 22 # - Install a LLVM package that has the same version as the libclang | |
| 23 # Python package that will be used/installed | |
| 24 # (e.g. pkg install llvm18 because of libclang>=18,<19) | |
| 25 # | 27 # |
| 26 | 28 |
| 27 .PHONY: build | 29 .PHONY: build |
| 28 | 30 |
| 29 THIS_MAKEFILE_JUSTNAME:= $(firstword $(MAKEFILE_LIST)) | 31 THIS_MAKEFILE_JUSTNAME:= $(firstword $(MAKEFILE_LIST)) |
| 38 SYMLINK?= /bin/ln -s | 40 SYMLINK?= /bin/ln -s |
| 39 PYTHON?= python | 41 PYTHON?= python |
| 40 PYTHON_PREFIXES!= $(PYTHON) -c 'import sys; print(sys.prefix); print(sys.base_prefix)' | 42 PYTHON_PREFIXES!= $(PYTHON) -c 'import sys; print(sys.prefix); print(sys.base_prefix)' |
| 41 CLANG_DIR?= /usr/local/llvm18 | 43 CLANG_DIR?= /usr/local/llvm18 |
| 42 | 44 |
| 43 # Setting these does not work for some parts built by sub-makes | 45 # |
| 46 # Setting these does not work for some parts built by sub-makes. | |
| 47 # Symlink in the venv instead. | |
| 48 # | |
| 44 #CC= $(CLANG_DIR)/bin/clang | 49 #CC= $(CLANG_DIR)/bin/clang |
| 45 #CXX= $(CLANG_DIR)/bin/clang++ | 50 #CXX= $(CLANG_DIR)/bin/clang++ |
| 46 | 51 |
| 47 build: | 52 build: |
| 48 ifneq ($(firstword $(PYTHON_PREFIXES)),$(lastword $(PYTHON_PREFIXES))) | 53 ifneq ($(firstword $(PYTHON_PREFIXES)),$(lastword $(PYTHON_PREFIXES))) |
| 49 $(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/make || $(SYMLINK) $(LOCALBASE)/bin/gmake $(firstword $(PYTHON_PREFIXES))/bin/make | 54 $(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/make || $(SYMLINK) $(LOCALBASE)/bin/gmake $(firstword $(PYTHON_PREFIXES))/bin/make |
| 50 $(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/ar || $(SYMLINK) $(LOCALBASE)/bin/ar $(firstword $(PYTHON_PREFIXES))/bin/ar | 55 # $(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/ar || $(SYMLINK) $(LOCALBASE)/bin/ar $(firstword $(PYTHON_PREFIXES))/bin/ar |
| 56 $(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/ar || $(SYMLINK) $(CLANG_DIR)/bin/llvm-ar $(firstword $(PYTHON_PREFIXES))/bin/ar | |
| 51 $(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/cc || $(SYMLINK) $(CLANG_DIR)/bin/clang $(firstword $(PYTHON_PREFIXES))/bin/cc | 57 $(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/cc || $(SYMLINK) $(CLANG_DIR)/bin/clang $(firstword $(PYTHON_PREFIXES))/bin/cc |
| 52 $(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/c++ || $(SYMLINK) $(CLANG_DIR)/bin/clang++ $(firstword $(PYTHON_PREFIXES))/bin/c++ | 58 $(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/c++ || $(SYMLINK) $(CLANG_DIR)/bin/clang++ $(firstword $(PYTHON_PREFIXES))/bin/c++ |
| 59 $(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/ld || $(SYMLINK) $(CLANG_DIR)/bin/ld.lld $(firstword $(PYTHON_PREFIXES))/bin/ld | |
| 53 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 | 60 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 |
| 54 else | 61 else |
| 55 $(error Not in a Python virtual environment) | 62 $(error Not in a Python virtual environment) |
| 56 endif | 63 endif |
