public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 0/8] llvm-r1.eclass + llvm-utils.eclass: new eclasses to sort out LLVM mess
@ 2024-02-07 20:11 Michał Górny
  2024-02-07 20:11 ` [gentoo-dev] [PATCH 1/8] llvm-utils.eclass: Introduce an eclass for common helpers Michał Górny
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: Michał Górny @ 2024-02-07 20:11 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Michał Górny

Hi,

TL;DR: here's a series of patches adding llvm-r1.eclass that tries
to sort out LLVM dependency mess via using USE_EXPAND flags LLVM_SLOT.


Roughly, the problems with LLVM are that:

1. Every half a year there's a major release that's doing major breaking
   API changes.

2. Reverse dependencies are usually slow to adapt.

3. Often multiple packages in a depchain end up linking to LLVM,
   and you really shouldn't link more than one version at a time.

Because of the first two, we've started slotting LLVM.  However, our
current approach of combining || blocks with := deps turned out to be
messy.  It is inconvenient, it can't properly dep on two leaf LLVM
packages and it can't enforce linked slot match.

So I've figured out it's time to give in and switch to a USE flag-based
approach.  Funny enough, this makes both the eclass and the ebuilds
using it simpler.  This patch series does, in order:

1. Split out a llvm-utils.eclass that carries code from llvm.eclass
   that will be shared by llvm-r1.eclass, but also used by some LLVM
   ebuilds directly (they currently depend on llvm.eclass but they
   don't really need to).  This also involves splitting out the PATH
   mangling logic, fixing it and adding more tests for all
   the functions.

2. Add a USE_EXPAND="LLVM_SLOT" along with some initial masks.  We'll
   probably need to play with masks a bit more before llvm-r1.eclass
   is used in stable ebuilds.

3. Add a llvm-r1.eclass.  More design details below.

4. Convert some example ebuilds to the new eclasses.


The new eclass uses an approach that's a hybrid between python-single-r1
and slots.  It expects LLVM_COMPAT to declare supported LLVM versions,
and gives llvm_gen_dep to depend on slotted packages, and LLVM_USEDEP
to depend on non-slotted packages.  It sets IUSE, REQUIRED_USE
and exports pkg_setup() that takes care of tool adjustment and setting
PATH, similarly to what the old eclass did -- except it uses whatever
LLVM_SLOT was selected by the user rather than using a horribly
convoluted logic to guess one.

One original idea is that we don't set default LLVM_SLOT in profiles.
Instead, the eclass uses IUSE defaults to select the "newest stable"
slot that's supported by the package.  The rationale is that we have
too wide a span of LLVM versions supported by various packages to be
able to conveniently select just one.


A rough idea of how an ebuild using the eclass could look like:

  LLVM_COMPAT=( {15..18} )

  inherit llvm-r1

  IUSE="llvm"

  DEPEND="
    llvm? (
      dev-libs/my-dependency[${LLVM_USEDEP}]
      $(llvm_gen_dep '
        sys-devel/clang:${LLVM_SLOT}
        sys-devel/llvm:${LLVM_SLOT}
      ')
    )
  "

  pkg_setup() {
    use llvm && llvm-r1_pkg_setup
  }

  src_configure() {
    econf --if-path-doesnt-work="$(get_llvm_prefix)"
  }



Michał Górny (8):
  llvm-utils.eclass: Introduce an eclass for common helpers
  llvm-utils.eclass: Split out PATH prepending logic
  llvm-utils.eclass: Fix llvm_prepend_path to avoid duplicates
  profiles: Introduce LLVM_SLOT USE_EXPAND variable
  llvm-r1.eclass: Initial version
  dev-util/intel_clc: Migrate to llvm-r1
  media-libs/mesa: Migrate to llvm-r1
  sys-devel/lld: Migrate to llvm-utils.eclass

 dev-util/intel_clc/intel_clc-24.0.0.ebuild  |  48 +----
 dev-util/intel_clc/intel_clc-9999.ebuild    |  48 +----
 eclass/llvm-r1.eclass                       | 226 ++++++++++++++++++++
 eclass/llvm-utils.eclass                    | 151 +++++++++++++
 eclass/llvm.eclass                          | 117 +---------
 eclass/tests/llvm-r1.sh                     | 151 +++++++++++++
 eclass/tests/llvm-utils.sh                  | 112 ++++++++++
 media-libs/mesa/mesa-24.0.0.ebuild          |  53 +----
 media-libs/mesa/mesa-9999.ebuild            |  53 +----
 profiles/arch/base/use.mask                 |   5 +
 profiles/arch/loong/use.mask                |   6 +-
 profiles/base/make.defaults                 |   2 +-
 profiles/desc/llvm_slot.desc                |   8 +
 profiles/embedded/make.defaults             |   4 +-
 sys-devel/lld/lld-18.1.0_rc2.ebuild         |   5 +-
 sys-devel/lld/lld-19.0.0.9999.ebuild        |   5 +-
 sys-devel/lld/lld-19.0.0_pre20240203.ebuild |   5 +-
 17 files changed, 714 insertions(+), 285 deletions(-)
 create mode 100644 eclass/llvm-r1.eclass
 create mode 100644 eclass/llvm-utils.eclass
 create mode 100755 eclass/tests/llvm-r1.sh
 create mode 100755 eclass/tests/llvm-utils.sh
 create mode 100644 profiles/desc/llvm_slot.desc

-- 
2.43.0



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-02-09 23:50 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07 20:11 [gentoo-dev] [PATCH 0/8] llvm-r1.eclass + llvm-utils.eclass: new eclasses to sort out LLVM mess Michał Górny
2024-02-07 20:11 ` [gentoo-dev] [PATCH 1/8] llvm-utils.eclass: Introduce an eclass for common helpers Michał Górny
2024-02-07 20:11 ` [gentoo-dev] [PATCH 2/8] llvm-utils.eclass: Split out PATH prepending logic Michał Górny
2024-02-07 20:11 ` [gentoo-dev] [PATCH 3/8] llvm-utils.eclass: Fix llvm_prepend_path to avoid duplicates Michał Górny
2024-02-08 19:06   ` [gentoo-dev] [PATCH] " Michał Górny
2024-02-07 20:11 ` [gentoo-dev] [PATCH 4/8] profiles: Introduce LLVM_SLOT USE_EXPAND variable Michał Górny
2024-02-07 20:11 ` [gentoo-dev] [PATCH 5/8] llvm-r1.eclass: Initial version Michał Górny
2024-02-08 19:07   ` [gentoo-dev] [PATCH v2] " Michał Górny
2024-02-09 16:59   ` [gentoo-dev] [PATCH v3] " Michał Górny
2024-02-09 23:49     ` Sam James
2024-02-07 20:11 ` [gentoo-dev] [PATCH 6/8] dev-util/intel_clc: Migrate to llvm-r1 Michał Górny
2024-02-08  7:00   ` Sam James
2024-02-08 12:35     ` Arsen Arsenović
2024-02-07 20:11 ` [gentoo-dev] [PATCH 7/8] media-libs/mesa: " Michał Górny
2024-02-07 20:11 ` [gentoo-dev] [PATCH 8/8] sys-devel/lld: Migrate to llvm-utils.eclass Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox