public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 0/4] llvm.eclass: EAPI 7 support
@ 2019-04-30  5:38 Michał Górny
  2019-04-30  5:38 ` [gentoo-dev] [PATCH 1/4] llvm.eclass: Remove unnecessary '_rc' from < example Michał Górny
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Michał Górny @ 2019-04-30  5:38 UTC (permalink / raw
  To: gentoo-dev; +Cc: chewi, Michał Górny

Hi,

Here's my proposed EAPI 7 support for llvm.eclass.  I think it should
conceptually work with cross but I haven't tested it.  The main problem
is that we have multiple distinct ways of building LLVM, and AFAIU
when using CMake modules, you should be able to get away without having
LLVM in CBUILD.  However, when using llvm-config you obviously need
it CBUILD-executable.

To support both scenarios, get_llvm_prefix is now provided with '-b'
and '-d' options (matching those to has_version).  Using them, you can
choose the behavior suitable for your package.

I've left the default at '-d'.  I don't really know which is better
for the generic cross case but either way should work for non-cross
setups.

--
Best regards,
Michał Górny

Michał Górny (4):
  llvm.eclass: Remove unnecessary '_rc' from < example
  llvm.eclass: Update examples for newer LLVM versions
  llvm.eclass: Add EAPI 7 API to get_llvm_prefix
  llvm.eclass: Enable EAPI 7

 eclass/llvm.eclass | 65 +++++++++++++++++++++++++++++++++++++---------
 1 file changed, 53 insertions(+), 12 deletions(-)

-- 
2.21.0



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

* [gentoo-dev] [PATCH 1/4] llvm.eclass: Remove unnecessary '_rc' from < example
  2019-04-30  5:38 [gentoo-dev] [PATCH 0/4] llvm.eclass: EAPI 7 support Michał Górny
@ 2019-04-30  5:38 ` Michał Górny
  2019-04-30  5:38 ` [gentoo-dev] [PATCH 2/4] llvm.eclass: Update examples for newer LLVM versions Michał Górny
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2019-04-30  5:38 UTC (permalink / raw
  To: gentoo-dev; +Cc: chewi, Michał Górny

Since LLVM versions use three components, 'x.0.0_rcN' will be always
greater than 'x'.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/llvm.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass
index ca10e742f1b1..618a924bbb87 100644
--- a/eclass/llvm.eclass
+++ b/eclass/llvm.eclass
@@ -22,7 +22,7 @@
 # inherit cmake-utils llvm
 #
 # RDEPEND="
-#	<sys-devel/llvm-6_rc:=
+#	<sys-devel/llvm-6:=
 #	|| (
 #		sys-devel/llvm:5
 #		sys-devel/llvm:4
-- 
2.21.0



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

* [gentoo-dev] [PATCH 2/4] llvm.eclass: Update examples for newer LLVM versions
  2019-04-30  5:38 [gentoo-dev] [PATCH 0/4] llvm.eclass: EAPI 7 support Michał Górny
  2019-04-30  5:38 ` [gentoo-dev] [PATCH 1/4] llvm.eclass: Remove unnecessary '_rc' from < example Michał Górny
@ 2019-04-30  5:38 ` Michał Górny
  2019-04-30 16:57   ` Haelwenn (lanodan) Monnier
  2019-04-30  5:38 ` [gentoo-dev] [PATCH 3/4] llvm.eclass: Add EAPI 7 API to get_llvm_prefix Michał Górny
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Michał Górny @ 2019-04-30  5:38 UTC (permalink / raw
  To: gentoo-dev; +Cc: chewi, Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/llvm.eclass | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass
index 618a924bbb87..e4052a6400c0 100644
--- a/eclass/llvm.eclass
+++ b/eclass/llvm.eclass
@@ -17,18 +17,19 @@
 # a proper dependency string yourself to guarantee that appropriate
 # version of LLVM is installed.
 #
-# Example use for a package supporting LLVM 3.8 to 5:
+# Example use for a package supporting LLVM 5 to 7:
 # @CODE
 # inherit cmake-utils llvm
 #
 # RDEPEND="
-#	<sys-devel/llvm-6:=
+#	<sys-devel/llvm-8:=
 #	|| (
+#		sys-devel/llvm:7
+#		sys-devel/llvm:6
 #		sys-devel/llvm:5
-#		sys-devel/llvm:4
-#		>=sys-devel/llvm-3.8:0
 #	)
 # "
+# DEPEND=${RDEPEND}
 #
 # LLVM_MAX_SLOT=5
 #
@@ -46,8 +47,9 @@
 # # note: do not use := on both clang and llvm, it can match different
 # # slots then. clang pulls llvm in, so we can skip the latter.
 # RDEPEND="
-#	>=sys-devel/clang-4:=[llvm_targets_AMDGPU(+)]
+#	>=sys-devel/clang-6:=[llvm_targets_AMDGPU(+)]
 # "
+# DEPEND=${RDEPEND}
 #
 # llvm_check_deps() {
 #	has_version "sys-devel/clang:${LLVM_SLOT}[llvm_targets_AMDGPU(+)]"
-- 
2.21.0



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

* [gentoo-dev] [PATCH 3/4] llvm.eclass: Add EAPI 7 API to get_llvm_prefix
  2019-04-30  5:38 [gentoo-dev] [PATCH 0/4] llvm.eclass: EAPI 7 support Michał Górny
  2019-04-30  5:38 ` [gentoo-dev] [PATCH 1/4] llvm.eclass: Remove unnecessary '_rc' from < example Michał Górny
  2019-04-30  5:38 ` [gentoo-dev] [PATCH 2/4] llvm.eclass: Update examples for newer LLVM versions Michał Górny
@ 2019-04-30  5:38 ` Michał Górny
  2019-04-30  5:38 ` [gentoo-dev] [PATCH 4/4] llvm.eclass: Enable EAPI 7 Michał Górny
  2019-05-24  4:59 ` [gentoo-dev] [PATCH 0/4] llvm.eclass: EAPI 7 support Michał Górny
  4 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2019-04-30  5:38 UTC (permalink / raw
  To: gentoo-dev; +Cc: chewi, Michał Górny

Add two switches to get_llvm_prefix(), '-b' and '-d' to enable use
of LLVM API cross support.  '-b' is intended to be used whenever prefix
to CBUILD llvm-config is needed, and '-d' (the default) is intended
to be used whenever prefix to CHOST bindir is needed (to find CMake
modules).

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/llvm.eclass | 51 ++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 45 insertions(+), 6 deletions(-)

diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass
index e4052a6400c0..6f6e2939a17b 100644
--- a/eclass/llvm.eclass
+++ b/eclass/llvm.eclass
@@ -52,7 +52,7 @@
 # DEPEND=${RDEPEND}
 #
 # llvm_check_deps() {
-#	has_version "sys-devel/clang:${LLVM_SLOT}[llvm_targets_AMDGPU(+)]"
+#	has_version -d "sys-devel/clang:${LLVM_SLOT}[llvm_targets_AMDGPU(+)]"
 # }
 # @CODE
 
@@ -84,11 +84,19 @@ if [[ ! ${_LLVM_ECLASS} ]]; then
 declare -g -r _LLVM_KNOWN_SLOTS=( 9 8 7 6 5 4 )
 
 # @FUNCTION: get_llvm_prefix
-# @USAGE: [<max_slot>]
+# @USAGE: [-b|-d] [<max_slot>]
 # @DESCRIPTION:
 # Find the newest LLVM install that is acceptable for the package,
 # and print an absolute path to it.
 #
+# If -b is specified, the checks are performed relative to BROOT,
+# and BROOT-path is returned.  This is appropriate when your package
+# calls llvm-config executable.  -b is supported since EAPI 7.
+#
+# If -d is specified, the checks are performed relative to ESYSROOT,
+# and ESYSROOT-path is returned.  This is appropriate when your package
+# uses CMake find_package(LLVM).  -d is the default.
+#
 # If <max_slot> is specified, then only LLVM versions that are not newer
 # than <max_slot> will be considered. Otherwise, all LLVM versions would
 # be considered acceptable. The function does not support specifying
@@ -105,6 +113,37 @@ declare -g -r _LLVM_KNOWN_SLOTS=( 9 8 7 6 5 4 )
 get_llvm_prefix() {
 	debug-print-function ${FUNCNAME} "${@}"
 
+	local hv_switch=-d
+	while [[ ${1} == -* ]]; do
+		case ${1} in
+			-b|-d) hv_switch=${1};;
+			*) break;;
+		esac
+		shift
+	done
+
+	local prefix=
+	if [[ ${EAPI} != 6 ]]; then
+		case ${hv_switch} in
+			-b)
+				prefix=${BROOT}
+				;;
+			-d)
+				prefix=${ESYSROOT}
+				;;
+		esac
+	else
+		case ${hv_switch} in
+			-b)
+				die "${FUNCNAME} -b is not supported in EAPI ${EAPI}"
+				;;
+			-d)
+				prefix=${EPREFIX}
+				hv_switch=
+				;;
+		esac
+	fi
+
 	local max_slot=${1}
 	local slot
 	for slot in "${_LLVM_KNOWN_SLOTS[@]}"; do
@@ -122,10 +161,10 @@ get_llvm_prefix() {
 			llvm_check_deps || continue
 		else
 			# check if LLVM package is installed
-			has_version "sys-devel/llvm:${slot}" || continue
+			has_version ${hv_switch} "sys-devel/llvm:${slot}" || continue
 		fi
 
-		echo "${EPREFIX}/usr/lib/llvm/${slot}"
+		echo "${prefix}/usr/lib/llvm/${slot}"
 		return
 	done
 
@@ -136,8 +175,8 @@ get_llvm_prefix() {
 
 	# fallback to :0
 	# assume it's always <= 4 (the lower max_slot allowed)
-	if has_version "sys-devel/llvm:0"; then
-		echo "${EPREFIX}/usr"
+	if has_version ${hv_switch} "sys-devel/llvm:0"; then
+		echo "${prefix}/usr"
 		return
 	fi
 
-- 
2.21.0



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

* [gentoo-dev] [PATCH 4/4] llvm.eclass: Enable EAPI 7
  2019-04-30  5:38 [gentoo-dev] [PATCH 0/4] llvm.eclass: EAPI 7 support Michał Górny
                   ` (2 preceding siblings ...)
  2019-04-30  5:38 ` [gentoo-dev] [PATCH 3/4] llvm.eclass: Add EAPI 7 API to get_llvm_prefix Michał Górny
@ 2019-04-30  5:38 ` Michał Górny
  2019-05-24  4:59 ` [gentoo-dev] [PATCH 0/4] llvm.eclass: EAPI 7 support Michał Górny
  4 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2019-04-30  5:38 UTC (permalink / raw
  To: gentoo-dev; +Cc: chewi, Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/llvm.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass
index 6f6e2939a17b..1417f4e2f1d7 100644
--- a/eclass/llvm.eclass
+++ b/eclass/llvm.eclass
@@ -60,7 +60,7 @@ case "${EAPI:-0}" in
 	0|1|2|3|4|5)
 		die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
 		;;
-	6)
+	6|7)
 		;;
 	*)
 		die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
-- 
2.21.0



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

* Re: [gentoo-dev] [PATCH 2/4] llvm.eclass: Update examples for newer LLVM versions
  2019-04-30  5:38 ` [gentoo-dev] [PATCH 2/4] llvm.eclass: Update examples for newer LLVM versions Michał Górny
@ 2019-04-30 16:57   ` Haelwenn (lanodan) Monnier
  2019-04-30 17:13     ` Michał Górny
  0 siblings, 1 reply; 9+ messages in thread
From: Haelwenn (lanodan) Monnier @ 2019-04-30 16:57 UTC (permalink / raw
  To: gentoo-dev

[2019-04-30 07:38:56+0200] Michał Górny:
> Signed-off-by: Michał Górny <mgorny@gentoo.org>
> ---
>  eclass/llvm.eclass | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass
> index 618a924bbb87..e4052a6400c0 100644
> --- a/eclass/llvm.eclass
> +++ b/eclass/llvm.eclass
> @@ -17,18 +17,19 @@
>  # a proper dependency string yourself to guarantee that appropriate
>  # version of LLVM is installed.
>  #
> -# Example use for a package supporting LLVM 3.8 to 5:
> +# Example use for a package supporting LLVM 5 to 7:
>  # @CODE
>  # inherit cmake-utils llvm
>  #
>  # RDEPEND="
> -#	<sys-devel/llvm-6:=
> +#	<sys-devel/llvm-8:=
>  #	|| (
> +#		sys-devel/llvm:7
> +#		sys-devel/llvm:6
>  #		sys-devel/llvm:5
> -#		sys-devel/llvm:4
> -#		>=sys-devel/llvm-3.8:0
>  #	)
>  # "
> +# DEPEND=${RDEPEND}
>  #
>  # LLVM_MAX_SLOT=5

Shouldn’t LLVM_MAX_SLOT be set to 7 as well?

>  #
> @@ -46,8 +47,9 @@
>  # # note: do not use := on both clang and llvm, it can match different
>  # # slots then. clang pulls llvm in, so we can skip the latter.
>  # RDEPEND="
> -#	>=sys-devel/clang-4:=[llvm_targets_AMDGPU(+)]
> +#	>=sys-devel/clang-6:=[llvm_targets_AMDGPU(+)]
>  # "
> +# DEPEND=${RDEPEND}
>  #
>  # llvm_check_deps() {
>  #	has_version "sys-devel/clang:${LLVM_SLOT}[llvm_targets_AMDGPU(+)]"
> -- 
> 2.21.0
> 
> 


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

* Re: [gentoo-dev] [PATCH 2/4] llvm.eclass: Update examples for newer LLVM versions
  2019-04-30 16:57   ` Haelwenn (lanodan) Monnier
@ 2019-04-30 17:13     ` Michał Górny
  0 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2019-04-30 17:13 UTC (permalink / raw
  To: gentoo-dev

On Tue, 2019-04-30 at 18:57 +0200, Haelwenn (lanodan) Monnier wrote:
> [2019-04-30 07:38:56+0200] Michał Górny:
> > Signed-off-by: Michał Górny <mgorny@gentoo.org>
> > ---
> >  eclass/llvm.eclass | 12 +++++++-----
> >  1 file changed, 7 insertions(+), 5 deletions(-)
> > 
> > diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass
> > index 618a924bbb87..e4052a6400c0 100644
> > --- a/eclass/llvm.eclass
> > +++ b/eclass/llvm.eclass
> > @@ -17,18 +17,19 @@
> >  # a proper dependency string yourself to guarantee that appropriate
> >  # version of LLVM is installed.
> >  #
> > -# Example use for a package supporting LLVM 3.8 to 5:
> > +# Example use for a package supporting LLVM 5 to 7:
> >  # @CODE
> >  # inherit cmake-utils llvm
> >  #
> >  # RDEPEND="
> > -#	<sys-devel/llvm-6:=
> > +#	<sys-devel/llvm-8:=
> >  #	|| (
> > +#		sys-devel/llvm:7
> > +#		sys-devel/llvm:6
> >  #		sys-devel/llvm:5
> > -#		sys-devel/llvm:4
> > -#		>=sys-devel/llvm-3.8:0
> >  #	)
> >  # "
> > +# DEPEND=${RDEPEND}
> >  #
> >  # LLVM_MAX_SLOT=5
> 
> Shouldn’t LLVM_MAX_SLOT be set to 7 as well?
> 

Indeed.  Thanks for catching that.

-- 
Best regards,
Michał Górny




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

* Re: [gentoo-dev] [PATCH 0/4] llvm.eclass: EAPI 7 support
  2019-04-30  5:38 [gentoo-dev] [PATCH 0/4] llvm.eclass: EAPI 7 support Michał Górny
                   ` (3 preceding siblings ...)
  2019-04-30  5:38 ` [gentoo-dev] [PATCH 4/4] llvm.eclass: Enable EAPI 7 Michał Górny
@ 2019-05-24  4:59 ` Michał Górny
  2019-05-24 17:50   ` James Le Cuirot
  4 siblings, 1 reply; 9+ messages in thread
From: Michał Górny @ 2019-05-24  4:59 UTC (permalink / raw
  To: gentoo-dev; +Cc: chewi

[-- Attachment #1: Type: text/plain, Size: 1275 bytes --]

On Tue, 2019-04-30 at 07:38 +0200, Michał Górny wrote:
> Hi,
> 
> Here's my proposed EAPI 7 support for llvm.eclass.  I think it should
> conceptually work with cross but I haven't tested it.  The main problem
> is that we have multiple distinct ways of building LLVM, and AFAIU
> when using CMake modules, you should be able to get away without having
> LLVM in CBUILD.  However, when using llvm-config you obviously need
> it CBUILD-executable.
> 
> To support both scenarios, get_llvm_prefix is now provided with '-b'
> and '-d' options (matching those to has_version).  Using them, you can
> choose the behavior suitable for your package.
> 
> I've left the default at '-d'.  I don't really know which is better
> for the generic cross case but either way should work for non-cross
> setups.
> 
> --
> Best regards,
> Michał Górny
> 
> Michał Górny (4):
>   llvm.eclass: Remove unnecessary '_rc' from < example
>   llvm.eclass: Update examples for newer LLVM versions
>   llvm.eclass: Add EAPI 7 API to get_llvm_prefix
>   llvm.eclass: Enable EAPI 7
> 
>  eclass/llvm.eclass | 65 +++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 53 insertions(+), 12 deletions(-)
> 

Merged.

-- 
Best regards,
Michał Górny


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

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

* Re: [gentoo-dev] [PATCH 0/4] llvm.eclass: EAPI 7 support
  2019-05-24  4:59 ` [gentoo-dev] [PATCH 0/4] llvm.eclass: EAPI 7 support Michał Górny
@ 2019-05-24 17:50   ` James Le Cuirot
  0 siblings, 0 replies; 9+ messages in thread
From: James Le Cuirot @ 2019-05-24 17:50 UTC (permalink / raw
  To: gentoo-dev

On 24 May 2019 05:59:29 BST, "Michał Górny" <mgorny@gentoo.org> wrote:
>On Tue, 2019-04-30 at 07:38 +0200, Michał Górny wrote:
>> Hi,
>> 
>> Here's my proposed EAPI 7 support for llvm.eclass.  I think it should
>> conceptually work with cross but I haven't tested it.  The main
>problem
>> is that we have multiple distinct ways of building LLVM, and AFAIU
>> when using CMake modules, you should be able to get away without
>having
>> LLVM in CBUILD.  However, when using llvm-config you obviously need
>> it CBUILD-executable.
>> 
>> To support both scenarios, get_llvm_prefix is now provided with '-b'
>> and '-d' options (matching those to has_version).  Using them, you
>can
>> choose the behavior suitable for your package.
>> 
>> I've left the default at '-d'.  I don't really know which is better
>> for the generic cross case but either way should work for non-cross
>> setups.
>> 
>> --
>> Best regards,
>> Michał Górny
>> 
>> Michał Górny (4):
>>   llvm.eclass: Remove unnecessary '_rc' from < example
>>   llvm.eclass: Update examples for newer LLVM versions
>>   llvm.eclass: Add EAPI 7 API to get_llvm_prefix
>>   llvm.eclass: Enable EAPI 7
>> 
>>  eclass/llvm.eclass | 65
>+++++++++++++++++++++++++++++++++++++---------
>>  1 file changed, 53 insertions(+), 12 deletions(-)
>> 
>
>Merged.

I know you made the necessary change in PMS for SYSROOT to work in pkg_setup but I don't think it's been fixed in Portage yet?
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


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

end of thread, other threads:[~2019-05-24 17:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-30  5:38 [gentoo-dev] [PATCH 0/4] llvm.eclass: EAPI 7 support Michał Górny
2019-04-30  5:38 ` [gentoo-dev] [PATCH 1/4] llvm.eclass: Remove unnecessary '_rc' from < example Michał Górny
2019-04-30  5:38 ` [gentoo-dev] [PATCH 2/4] llvm.eclass: Update examples for newer LLVM versions Michał Górny
2019-04-30 16:57   ` Haelwenn (lanodan) Monnier
2019-04-30 17:13     ` Michał Górny
2019-04-30  5:38 ` [gentoo-dev] [PATCH 3/4] llvm.eclass: Add EAPI 7 API to get_llvm_prefix Michał Górny
2019-04-30  5:38 ` [gentoo-dev] [PATCH 4/4] llvm.eclass: Enable EAPI 7 Michał Górny
2019-05-24  4:59 ` [gentoo-dev] [PATCH 0/4] llvm.eclass: EAPI 7 support Michał Górny
2019-05-24 17:50   ` James Le Cuirot

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