[Bug 296324] devel/llvm*: Install environment modulefiles

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 27 Jun 2026 14:54:42 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296324

            Bug ID: 296324
           Summary: devel/llvm*: Install environment modulefiles
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: laurent@FreeBSD.org
                CC: brooks@FreeBSD.org
 Attachment #272188 maintainer-approval?(brooks@FreeBSD.org)
             Flags:
             Flags: maintainer-feedback?(brooks@FreeBSD.org)
                CC: brooks@FreeBSD.org

Created attachment 272188
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=272188&action=edit
Add environment modulefiles to llvm{12..22}

devel/llvm*: Install environment modulefiles

- Add modulefiles for llvm12-llvm22 under
  etc/modulefiles/llvm/<version>.

- Clang and LLD-specific environment variables are protected using the
  existing options so custom builds do not export paths to tools that
  were not installed.

- Bump PORTREVISION.


HOW TO USE:

The use of modules requires sysutils/modules to be installed. The first step is
to install it.

If your login shell is /bin/sh, you can use modules right away in a new shell.
If it's not, then source /usr/local/Modules/*/init/profile.sh

To see what modules are available:
laurent@freebsd:~/.config/zsh $ module avail
-------------------------------------------------
/usr/local/Modules/5.6.1/modulefiles
--------------------------------------------------
dot  module-git  module-info  modules  null  use.own

------------------------------------------------------
/usr/local/etc/modulefiles
-------------------------------------------------------
llvm/19  llvm/20  llvm/21  llvm/22  mpi/mpich  mpi/openmpi

Key:
modulepath

In my case I have llvm19, 20, 21 and 22 available.

To load and unload llvm environment for different versions, you then do
something like: 

laurent@freebsd:~ $ which clang
/usr/bin/clang
laurent@freebsd:~ $ module load llvm/19
laurent@freebsd:~ $ which clang
/usr/local/llvm19/bin/clang
laurent@freebsd:~ $ echo $CC
/usr/local/llvm19/bin/clang
laurent@freebsd:~ $ module switch llvm/20
laurent@freebsd:~ $ which clang
/usr/local/llvm20/bin/clang
laurent@freebsd:~ $ echo $CC
/usr/local/llvm20/bin/clang
laurent@freebsd:~ $ module unload llvm/20
laurent@freebsd:~ $ which clang
/usr/bin/clang

"module help" for more options.

-- 
You are receiving this mail because:
You are the assignee for the bug.