zstd: added compression and decompression as packageconfig

Message ID 20220606141056.2054477-1-jan.vermaete@gmail.com
State New
Headers show
Series zstd: added compression and decompression as packageconfig | expand

Commit Message

Jan Vermaete June 6, 2022, 2:10 p.m. UTC
The default is the same as before.
So both target and native can do compression and decompression.

Native will probably always needed both.  E.g. to create rpm packages.
Target could have enough with decompression only.  E.g. for OTA systems.

The difference between default and decompression only:
  packages/cortexa72-poky-linux/zstd/libzstd: PKGSIZE changed from 661912 to 210776 (-68%)
  packages/cortexa72-poky-linux/zstd/zstd: PKGSIZE changed from 1430839 to 785007 (-45%)

Signed-off-by: Jan Vermaete <jan.vermaete@gmail.com>
---
 meta/recipes-extended/zstd/zstd_1.5.2.bb | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

Comments

Alexander Kanavin June 6, 2022, 3:25 p.m. UTC | #1
pzstd changes need to be either explained or split into a separate patch.

Alex

On Mon, 6 Jun 2022 at 16:11, Jan Vermaete <jan.vermaete@gmail.com> wrote:
>
> The default is the same as before.
> So both target and native can do compression and decompression.
>
> Native will probably always needed both.  E.g. to create rpm packages.
> Target could have enough with decompression only.  E.g. for OTA systems.
>
> The difference between default and decompression only:
>   packages/cortexa72-poky-linux/zstd/libzstd: PKGSIZE changed from 661912 to 210776 (-68%)
>   packages/cortexa72-poky-linux/zstd/zstd: PKGSIZE changed from 1430839 to 785007 (-45%)
>
> Signed-off-by: Jan Vermaete <jan.vermaete@gmail.com>
> ---
>  meta/recipes-extended/zstd/zstd_1.5.2.bb | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/meta/recipes-extended/zstd/zstd_1.5.2.bb b/meta/recipes-extended/zstd/zstd_1.5.2.bb
> index 3887f31ecf..924e7db7f7 100644
> --- a/meta/recipes-extended/zstd/zstd_1.5.2.bb
> +++ b/meta/recipes-extended/zstd/zstd_1.5.2.bb
> @@ -18,22 +18,31 @@ CVE_PRODUCT = "zstandard"
>
>  S = "${WORKDIR}/git"
>
> -PACKAGECONFIG ??= ""
> +PACKAGECONFIG:class-native ??= "compression decompression pzstd"
> +PACKAGECONFIG:class-target ??= "compression decompression pzstd"
> +PACKAGECONFIG[compression] = "ZSTD_LIB_COMPRESSION=1,ZSTD_LIB_COMPRESSION=0"
> +PACKAGECONFIG[decompression] = "ZSTD_LIB_DECOMPRESSION=1,ZSTD_LIB_DECOMPRESSION=0"
>  PACKAGECONFIG[lz4] = "HAVE_LZ4=1,HAVE_LZ4=0,lz4"
>  PACKAGECONFIG[lzma] = "HAVE_LZMA=1,HAVE_LZMA=0,xz"
> +PACKAGECONFIG[pzstd] = ""
>  PACKAGECONFIG[zlib] = "HAVE_ZLIB=1,HAVE_ZLIB=0,zlib"
>
> +
>  # See programs/README.md for how to use this
>  ZSTD_LEGACY_SUPPORT ??= "4"
>
>  do_compile () {
>      oe_runmake ${PACKAGECONFIG_CONFARGS} ZSTD_LEGACY_SUPPORT=${ZSTD_LEGACY_SUPPORT}
> -    oe_runmake ${PACKAGECONFIG_CONFARGS} ZSTD_LEGACY_SUPPORT=${ZSTD_LEGACY_SUPPORT} -C contrib/pzstd
> +    if ${@bb.utils.contains('PACKAGECONFIG', 'pzstd', 'true', 'false', d)}; then
> +        oe_runmake ${PACKAGECONFIG_CONFARGS} ZSTD_LEGACY_SUPPORT=${ZSTD_LEGACY_SUPPORT} -C contrib/pzstd
> +    fi
>  }
>
>  do_install () {
>      oe_runmake install 'DESTDIR=${D}'
> -    oe_runmake install 'DESTDIR=${D}' PREFIX=${prefix} -C contrib/pzstd
> +    if ${@bb.utils.contains('PACKAGECONFIG', 'pzstd', 'true', 'false', d)}; then
> +        oe_runmake install 'DESTDIR=${D}' PREFIX=${prefix} -C contrib/pzstd
> +    fi
>  }
>
>  PACKAGE_BEFORE_PN = "libzstd"
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#166632): https://lists.openembedded.org/g/openembedded-core/message/166632
> Mute This Topic: https://lists.openembedded.org/mt/91577767/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Jan Vermaete June 6, 2022, 6:38 p.m. UTC | #2
Hi Alexander,

As far as I know, pzstd is used in the scripting of Yocto/OE.  Or at least
it's useful to have it there.
So having it at native it a kind of must.

But for target, it's best to have it as an option for those who have to
have it tiny.

Is this info added to the commit message enough?
Or is PACKAGECONFIG not the correct way to create this option.  After all,
it's not an option for the configure stage but for the compile stage.

br

On Mon, Jun 6, 2022 at 5:25 PM Alexander Kanavin <alex.kanavin@gmail.com>
wrote:

> pzstd changes need to be either explained or split into a separate patch.
>
> Alex
>
> On Mon, 6 Jun 2022 at 16:11, Jan Vermaete <jan.vermaete@gmail.com> wrote:
> >
> > The default is the same as before.
> > So both target and native can do compression and decompression.
> >
> > Native will probably always needed both.  E.g. to create rpm packages.
> > Target could have enough with decompression only.  E.g. for OTA systems.
> >
> > The difference between default and decompression only:
> >   packages/cortexa72-poky-linux/zstd/libzstd: PKGSIZE changed from
> 661912 to 210776 (-68%)
> >   packages/cortexa72-poky-linux/zstd/zstd: PKGSIZE changed from 1430839
> to 785007 (-45%)
> >
> > Signed-off-by: Jan Vermaete <jan.vermaete@gmail.com>
> > ---
> >  meta/recipes-extended/zstd/zstd_1.5.2.bb | 15 ++++++++++++---
> >  1 file changed, 12 insertions(+), 3 deletions(-)
> >
> > diff --git a/meta/recipes-extended/zstd/zstd_1.5.2.bb
> b/meta/recipes-extended/zstd/zstd_1.5.2.bb
> > index 3887f31ecf..924e7db7f7 100644
> > --- a/meta/recipes-extended/zstd/zstd_1.5.2.bb
> > +++ b/meta/recipes-extended/zstd/zstd_1.5.2.bb
> > @@ -18,22 +18,31 @@ CVE_PRODUCT = "zstandard"
> >
> >  S = "${WORKDIR}/git"
> >
> > -PACKAGECONFIG ??= ""
> > +PACKAGECONFIG:class-native ??= "compression decompression pzstd"
> > +PACKAGECONFIG:class-target ??= "compression decompression pzstd"
> > +PACKAGECONFIG[compression] =
> "ZSTD_LIB_COMPRESSION=1,ZSTD_LIB_COMPRESSION=0"
> > +PACKAGECONFIG[decompression] =
> "ZSTD_LIB_DECOMPRESSION=1,ZSTD_LIB_DECOMPRESSION=0"
> >  PACKAGECONFIG[lz4] = "HAVE_LZ4=1,HAVE_LZ4=0,lz4"
> >  PACKAGECONFIG[lzma] = "HAVE_LZMA=1,HAVE_LZMA=0,xz"
> > +PACKAGECONFIG[pzstd] = ""
> >  PACKAGECONFIG[zlib] = "HAVE_ZLIB=1,HAVE_ZLIB=0,zlib"
> >
> > +
> >  # See programs/README.md for how to use this
> >  ZSTD_LEGACY_SUPPORT ??= "4"
> >
> >  do_compile () {
> >      oe_runmake ${PACKAGECONFIG_CONFARGS}
> ZSTD_LEGACY_SUPPORT=${ZSTD_LEGACY_SUPPORT}
> > -    oe_runmake ${PACKAGECONFIG_CONFARGS}
> ZSTD_LEGACY_SUPPORT=${ZSTD_LEGACY_SUPPORT} -C contrib/pzstd
> > +    if ${@bb.utils.contains('PACKAGECONFIG', 'pzstd', 'true', 'false',
> d)}; then
> > +        oe_runmake ${PACKAGECONFIG_CONFARGS}
> ZSTD_LEGACY_SUPPORT=${ZSTD_LEGACY_SUPPORT} -C contrib/pzstd
> > +    fi
> >  }
> >
> >  do_install () {
> >      oe_runmake install 'DESTDIR=${D}'
> > -    oe_runmake install 'DESTDIR=${D}' PREFIX=${prefix} -C contrib/pzstd
> > +    if ${@bb.utils.contains('PACKAGECONFIG', 'pzstd', 'true', 'false',
> d)}; then
> > +        oe_runmake install 'DESTDIR=${D}' PREFIX=${prefix} -C
> contrib/pzstd
> > +    fi
> >  }
> >
> >  PACKAGE_BEFORE_PN = "libzstd"
> > --
> > 2.25.1
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#166632):
> https://lists.openembedded.org/g/openembedded-core/message/166632
> > Mute This Topic: https://lists.openembedded.org/mt/91577767/1686489
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
Alexander Kanavin June 6, 2022, 7:06 p.m. UTC | #3
I don't mind the option itself, the problem is that it needs to be in
its own commit and not squashed with compression/decompression options
into a single change. Or you need to say 'added
compression/decompression/pzstd as PACKAGECONFIG options' and add to
the commit message too.

Alex

On Mon, 6 Jun 2022 at 20:38, jan vermaete <jan.vermaete@gmail.com> wrote:
>
> Hi Alexander,
>
> As far as I know, pzstd is used in the scripting of Yocto/OE.  Or at least it's useful to have it there.
> So having it at native it a kind of must.
>
> But for target, it's best to have it as an option for those who have to have it tiny.
>
> Is this info added to the commit message enough?
> Or is PACKAGECONFIG not the correct way to create this option.  After all, it's not an option for the configure stage but for the compile stage.
>
> br
>
> On Mon, Jun 6, 2022 at 5:25 PM Alexander Kanavin <alex.kanavin@gmail.com> wrote:
>>
>> pzstd changes need to be either explained or split into a separate patch.
>>
>> Alex
>>
>> On Mon, 6 Jun 2022 at 16:11, Jan Vermaete <jan.vermaete@gmail.com> wrote:
>> >
>> > The default is the same as before.
>> > So both target and native can do compression and decompression.
>> >
>> > Native will probably always needed both.  E.g. to create rpm packages.
>> > Target could have enough with decompression only.  E.g. for OTA systems.
>> >
>> > The difference between default and decompression only:
>> >   packages/cortexa72-poky-linux/zstd/libzstd: PKGSIZE changed from 661912 to 210776 (-68%)
>> >   packages/cortexa72-poky-linux/zstd/zstd: PKGSIZE changed from 1430839 to 785007 (-45%)
>> >
>> > Signed-off-by: Jan Vermaete <jan.vermaete@gmail.com>
>> > ---
>> >  meta/recipes-extended/zstd/zstd_1.5.2.bb | 15 ++++++++++++---
>> >  1 file changed, 12 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/meta/recipes-extended/zstd/zstd_1.5.2.bb b/meta/recipes-extended/zstd/zstd_1.5.2.bb
>> > index 3887f31ecf..924e7db7f7 100644
>> > --- a/meta/recipes-extended/zstd/zstd_1.5.2.bb
>> > +++ b/meta/recipes-extended/zstd/zstd_1.5.2.bb
>> > @@ -18,22 +18,31 @@ CVE_PRODUCT = "zstandard"
>> >
>> >  S = "${WORKDIR}/git"
>> >
>> > -PACKAGECONFIG ??= ""
>> > +PACKAGECONFIG:class-native ??= "compression decompression pzstd"
>> > +PACKAGECONFIG:class-target ??= "compression decompression pzstd"
>> > +PACKAGECONFIG[compression] = "ZSTD_LIB_COMPRESSION=1,ZSTD_LIB_COMPRESSION=0"
>> > +PACKAGECONFIG[decompression] = "ZSTD_LIB_DECOMPRESSION=1,ZSTD_LIB_DECOMPRESSION=0"
>> >  PACKAGECONFIG[lz4] = "HAVE_LZ4=1,HAVE_LZ4=0,lz4"
>> >  PACKAGECONFIG[lzma] = "HAVE_LZMA=1,HAVE_LZMA=0,xz"
>> > +PACKAGECONFIG[pzstd] = ""
>> >  PACKAGECONFIG[zlib] = "HAVE_ZLIB=1,HAVE_ZLIB=0,zlib"
>> >
>> > +
>> >  # See programs/README.md for how to use this
>> >  ZSTD_LEGACY_SUPPORT ??= "4"
>> >
>> >  do_compile () {
>> >      oe_runmake ${PACKAGECONFIG_CONFARGS} ZSTD_LEGACY_SUPPORT=${ZSTD_LEGACY_SUPPORT}
>> > -    oe_runmake ${PACKAGECONFIG_CONFARGS} ZSTD_LEGACY_SUPPORT=${ZSTD_LEGACY_SUPPORT} -C contrib/pzstd
>> > +    if ${@bb.utils.contains('PACKAGECONFIG', 'pzstd', 'true', 'false', d)}; then
>> > +        oe_runmake ${PACKAGECONFIG_CONFARGS} ZSTD_LEGACY_SUPPORT=${ZSTD_LEGACY_SUPPORT} -C contrib/pzstd
>> > +    fi
>> >  }
>> >
>> >  do_install () {
>> >      oe_runmake install 'DESTDIR=${D}'
>> > -    oe_runmake install 'DESTDIR=${D}' PREFIX=${prefix} -C contrib/pzstd
>> > +    if ${@bb.utils.contains('PACKAGECONFIG', 'pzstd', 'true', 'false', d)}; then
>> > +        oe_runmake install 'DESTDIR=${D}' PREFIX=${prefix} -C contrib/pzstd
>> > +    fi
>> >  }
>> >
>> >  PACKAGE_BEFORE_PN = "libzstd"
>> > --
>> > 2.25.1
>> >
>> >
>> > -=-=-=-=-=-=-=-=-=-=-=-
>> > Links: You receive all messages sent to this group.
>> > View/Reply Online (#166632): https://lists.openembedded.org/g/openembedded-core/message/166632
>> > Mute This Topic: https://lists.openembedded.org/mt/91577767/1686489
>> > Group Owner: openembedded-core+owner@lists.openembedded.org
>> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
>> > -=-=-=-=-=-=-=-=-=-=-=-
>> >
>
>
>
> --
> Jan Vermaete
> “Success is a self-correcting phenomenom.” -- Gary Hamel

Patch

diff --git a/meta/recipes-extended/zstd/zstd_1.5.2.bb b/meta/recipes-extended/zstd/zstd_1.5.2.bb
index 3887f31ecf..924e7db7f7 100644
--- a/meta/recipes-extended/zstd/zstd_1.5.2.bb
+++ b/meta/recipes-extended/zstd/zstd_1.5.2.bb
@@ -18,22 +18,31 @@  CVE_PRODUCT = "zstandard"
 
 S = "${WORKDIR}/git"
 
-PACKAGECONFIG ??= ""
+PACKAGECONFIG:class-native ??= "compression decompression pzstd"
+PACKAGECONFIG:class-target ??= "compression decompression pzstd"
+PACKAGECONFIG[compression] = "ZSTD_LIB_COMPRESSION=1,ZSTD_LIB_COMPRESSION=0"
+PACKAGECONFIG[decompression] = "ZSTD_LIB_DECOMPRESSION=1,ZSTD_LIB_DECOMPRESSION=0"
 PACKAGECONFIG[lz4] = "HAVE_LZ4=1,HAVE_LZ4=0,lz4"
 PACKAGECONFIG[lzma] = "HAVE_LZMA=1,HAVE_LZMA=0,xz"
+PACKAGECONFIG[pzstd] = ""
 PACKAGECONFIG[zlib] = "HAVE_ZLIB=1,HAVE_ZLIB=0,zlib"
 
+
 # See programs/README.md for how to use this
 ZSTD_LEGACY_SUPPORT ??= "4"
 
 do_compile () {
     oe_runmake ${PACKAGECONFIG_CONFARGS} ZSTD_LEGACY_SUPPORT=${ZSTD_LEGACY_SUPPORT}
-    oe_runmake ${PACKAGECONFIG_CONFARGS} ZSTD_LEGACY_SUPPORT=${ZSTD_LEGACY_SUPPORT} -C contrib/pzstd
+    if ${@bb.utils.contains('PACKAGECONFIG', 'pzstd', 'true', 'false', d)}; then
+        oe_runmake ${PACKAGECONFIG_CONFARGS} ZSTD_LEGACY_SUPPORT=${ZSTD_LEGACY_SUPPORT} -C contrib/pzstd
+    fi
 }
 
 do_install () {
     oe_runmake install 'DESTDIR=${D}'
-    oe_runmake install 'DESTDIR=${D}' PREFIX=${prefix} -C contrib/pzstd
+    if ${@bb.utils.contains('PACKAGECONFIG', 'pzstd', 'true', 'false', d)}; then
+        oe_runmake install 'DESTDIR=${D}' PREFIX=${prefix} -C contrib/pzstd
+    fi
 }
 
 PACKAGE_BEFORE_PN = "libzstd"