changeset 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
files Makefile.freebsd
diffstat 1 files changed, 17 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.freebsd	Wed Sep 17 06:11:34 2025 +0200
+++ b/Makefile.freebsd	Wed Sep 17 06:30:46 2025 +0200
@@ -1,6 +1,7 @@
 # -*- mode: makefile; coding: utf-8 -*-
 #
-# Needs GNU make (aka gmake) and binutils/ar (instead of FreeBSD /usr/bin/ar).
+# Needs GNU make (aka gmake) and binutils/ar or LLVM/ar
+# (instead of FreeBSD /usr/bin/ar).
 #
 # Building against an installed mupdf package fails because the libmupdfcpp.so
 # is missing.
@@ -9,20 +10,21 @@
 #
 # - Create a Python  venv and activate it
 #
-# - In the "bin"-directory of the venv symlink "make" to /usr/local/bin/ggmake
-#   and "ar" to /usr/local/bin/ar
+# - Install a LLVM package that has the same version as the libclang
+#   Python package that will be used/installed
+#   (e.g. pkg install llvm18 because of libclang>=18,<19)
+#
+# - In the "bin"-directory of the venv symlink "make" to /usr/local/bin/gmake
+#   and "ar" to /usr/local/llvm18/bin/llvm-ar
 #
 #   * Makefiles have GNU syntax
-#   * ar is called with @-response-files -- which are a GNU feature
+#   * ar is called with @-response-files -- which are a GNU feature (also
+#     implemented by LLVM's ar)
 #
 # - At first to not build with tesseract (OCR)
 #
 #     export PYMUPDF_SETUP_MUPDF_TESSERACT=0
 #
-# - Install a LLVM package that has the same version as the libclang
-#   Python package that will be used/installed
-#   (e.g. pkg install llvm18 because of libclang>=18,<19)
-#
 
 .PHONY: build
 
@@ -40,16 +42,21 @@
 PYTHON_PREFIXES!=		$(PYTHON) -c 'import sys; print(sys.prefix); print(sys.base_prefix)'
 CLANG_DIR?=			/usr/local/llvm18
 
-# Setting these does not work for some parts built by sub-makes
+#
+# Setting these does not work for some parts built by sub-makes.
+# Symlink in the venv instead.
+#
 #CC=	$(CLANG_DIR)/bin/clang
 #CXX=	$(CLANG_DIR)/bin/clang++
 
 build:
 ifneq ($(firstword $(PYTHON_PREFIXES)),$(lastword $(PYTHON_PREFIXES)))
 	$(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/make || $(SYMLINK) $(LOCALBASE)/bin/gmake $(firstword $(PYTHON_PREFIXES))/bin/make
-	$(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/ar || $(SYMLINK) $(LOCALBASE)/bin/ar $(firstword $(PYTHON_PREFIXES))/bin/ar
+#	$(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/ar || $(SYMLINK) $(LOCALBASE)/bin/ar $(firstword $(PYTHON_PREFIXES))/bin/ar
+	$(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/ar || $(SYMLINK) $(CLANG_DIR)/bin/llvm-ar $(firstword $(PYTHON_PREFIXES))/bin/ar
 	$(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/cc || $(SYMLINK) $(CLANG_DIR)/bin/clang $(firstword $(PYTHON_PREFIXES))/bin/cc
 	$(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/c++ || $(SYMLINK) $(CLANG_DIR)/bin/clang++ $(firstword $(PYTHON_PREFIXES))/bin/c++
+	$(TEST) -e $(firstword $(PYTHON_PREFIXES))/bin/ld || $(SYMLINK) $(CLANG_DIR)/bin/ld.lld $(firstword $(PYTHON_PREFIXES))/bin/ld
 	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
 else
 	$(error Not in a Python virtual environment)