-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add libs multivalued variants to lzo, lz4, xz, binutils #23474
Add libs multivalued variants to lzo, lz4, xz, binutils #23474
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
variant('shared', default=True, description='Build shared library') | ||
variant('static', default=True, description='Build static library') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not convinced of this modeling as lz4~shared~static
doesn't make much sense. Can we use either a multi-valued variant or just shared as many packages do (and assume ~shared
is equivalent to ask for static)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, it maps directly to the autotools flags --[enable|disable]-static
and --[enable|disable]-shared
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example:
$ spack install lzo~shared~static
[ ... ]
$ tree /home/culpo/PycharmProjects/spack/opt/spack/linux-ubuntu18.04-broadwell/gcc-10.3.0/lzo-2.10-q3odxvlthiprpuxgv426djmokueg2ulz
/home/culpo/PycharmProjects/spack/opt/spack/linux-ubuntu18.04-broadwell/gcc-10.3.0/lzo-2.10-q3odxvlthiprpuxgv426djmokueg2ulz
├── include
│ └── lzo
│ ├── lzo1a.h
│ ├── lzo1b.h
│ ├── lzo1c.h
│ ├── lzo1f.h
│ ├── lzo1.h
│ ├── lzo1x.h
│ ├── lzo1y.h
│ ├── lzo1z.h
│ ├── lzo2a.h
│ ├── lzo_asm.h
│ ├── lzoconf.h
│ ├── lzodefs.h
│ └── lzoutil.h
├── lib
│ ├── liblzo2.a
│ └── pkgconfig
│ └── lzo2.pc
└── share
└── doc
└── lzo
├── AUTHORS
├── COPYING
├── LZOAPI.TXT
├── LZO.FAQ
├── LZO.TXT
├── NEWS
└── THANKS
This doesn't seem consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually i think it's better to have 2 flags, so that packages can always to depends_on('lz4 +shared') if they need shared libs, and another can do depends_on('lz4 +static'), and it won't lead to conflicts, whereas depends_on('lz4 ~shared') would be a concretization failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and it won't lead to conflicts, whereas depends_on('lz4 ~shared') would be a concretization failure.
Yes, but they would need to conflict with ~shared~static
. I think the best way to model what you say is a multi-valued variant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alalazo the github ui hadn't added your reply inbetween my 2 replies :p I agree that it's not entirely consistent
@alalazo I'm afraid I must disagree. Suppose I use package Suppose there's a 3-valued variant.
How do I write depends_on? If I say
So, you have to drop
Now I can say But what does this accomplish? This is really just a complicated version The advantage of separate |
@mwkrentel What you say above is a single-valued variant, what I was proposing is a multi-valued variant:
If you say:
it will match both |
Is there any advantage of the multi-valued variant? The separate |
@mwkrentel With 2 boolean variants we have 4 choices. What would be the meaning of |
I don't think they are really widely used in the same package (which is my point, most packages have only one of the two and behave as the other is always on). @haampie Besides theoretical discussions on modelling, what would be the disadvantage in this PR if we build both but don't add variants? |
Linking #5269 since the topic was really opinionated also years ago 😆 |
Probably the same as Anyway, this is a distraction. If it's a problem, then add a conflict.
However common it is to use both I still don't see the added value of packaging them into a list. I think one of the problems in #5269 is that it doesn't consider the Anyway, if this has been discussed for 4 years without a clear I was just arguing that separate variants is simpler than a list. For Personally, I'm fine with always building both shared and static. The |
You can't specify that, that's the point for using multi-valued variant. Sometimes ago, for cases where an empty set had to be used, we started giving that meaning to the string |
That would be a practical solution for this specific PR, if possible. Don't add variants but always build both. |
I want to be able to build static libs only s.t. I can easily build tiny executables for squashfuse and the appimage runtime (~100kb). If there are shared and static libs it's more work to make the compiler pick the static lib. |
Some more thoughts: (1)
So, just (2) The upside of (3) (4) |
A case like: depends_on('libfoo +static~shared') with boolean variants translates to: depends_on('libfoo libs=static')
conflicts('libfoo libs=shared') with multi-valued variants. The only downside for more complex variants is that you can't express easily, in the package declaring the mv variant itself, that if one value is in then another must be in too: # This can't be done at the moment
conflicts('libs=A', when='libs= not B') in general we lack a way to express the absence of a value in a directive but, if I am not overlooking anything, that shouldn't matter in this use case. |
@alalazo So, what is the syntax for removing an item from a @haampie If what you really want is to build without shared, then you But I caution you, I think it's a bad idea in general to require that In this case, if your build system insists on using shared over static What package is this? |
It's not clear to me what "removing" means in this context. Do you mean preventing a value to be in a concretized spec? In that case you can use a |
fb34a8f
to
0f5e193
Compare
So, at the end of the day I would be a fan of
will not override the default but extend it, so if the default is |
Issue will be solved in #23542 |
I guess I'm still at a loss to identify a use case where the But it doesn't block me from building xz the way I need it, |
The upside is mainly there's no need to add a conflict for |
No description provided.