diff mbox series

[v2,1/2] zlib: split SRC_URI into inc file

Message ID 20220715115515.4012984-1-sean@geanix.com
State New
Headers show
Series [v2,1/2] zlib: split SRC_URI into inc file | expand

Commit Message

Sean Nyekjaer July 15, 2022, 11:55 a.m. UTC
This is done in preparation for adding packages from the zlib contrib
directory.
Unfortunatly it's not possible to add these via pkgconfig.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
---
With this we are maintaining the same verison number for both zlib and
minizip in the recipe name. Would it be better to have it in the inc
file?

PV = "1.2.12" ?

 meta/recipes-core/zlib/zlib.inc       |  4 ++++
 meta/recipes-core/zlib/zlib_1.2.12.bb | 18 +++++++++---------
 2 files changed, 13 insertions(+), 9 deletions(-)
 create mode 100644 meta/recipes-core/zlib/zlib.inc

Comments

Ross Burton July 18, 2022, 4:12 p.m. UTC | #1
This still seems overkill.  You can build minizip from inside the zlib recipe by fixing the minizip Makefile (fix posted to https://github.com/madler/zlib/pull/681) and then adding one line to do_compile:

    oe_runmake -C contrib/minizip CC="${CC}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"

A corresponding manual do_install too, obviously.

Ross

> On 15 Jul 2022, at 12:55, Sean Nyekjaer via lists.openembedded.org <sean=geanix.com@lists.openembedded.org> wrote:
> 
> This is done in preparation for adding packages from the zlib contrib
> directory.
> Unfortunatly it's not possible to add these via pkgconfig.
> 
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> ---
> With this we are maintaining the same verison number for both zlib and
> minizip in the recipe name. Would it be better to have it in the inc
> file?
> 
> PV = "1.2.12" ?
> 
> meta/recipes-core/zlib/zlib.inc       |  4 ++++
> meta/recipes-core/zlib/zlib_1.2.12.bb | 18 +++++++++---------
> 2 files changed, 13 insertions(+), 9 deletions(-)
> create mode 100644 meta/recipes-core/zlib/zlib.inc
> 
> diff --git a/meta/recipes-core/zlib/zlib.inc b/meta/recipes-core/zlib/zlib.inc
> new file mode 100644
> index 0000000000..b607a82312
> --- /dev/null
> +++ b/meta/recipes-core/zlib/zlib.inc
> @@ -0,0 +1,4 @@
> +SRC_URI = "https://zlib.net/zlib-${PV}.tar.xz"
> +UPSTREAM_CHECK_URI = "http://zlib.net/"
> +
> +SRC_URI[sha256sum] = "7db46b8d7726232a621befaab4a1c870f00a90805511c0e0090441dac57def18"
> diff --git a/meta/recipes-core/zlib/zlib_1.2.12.bb b/meta/recipes-core/zlib/zlib_1.2.12.bb
> index e921703137..ba986d8cf2 100644
> --- a/meta/recipes-core/zlib/zlib_1.2.12.bb
> +++ b/meta/recipes-core/zlib/zlib_1.2.12.bb
> @@ -6,16 +6,16 @@ SECTION = "libs"
> LICENSE = "Zlib"
> LIC_FILES_CHKSUM = "file://zlib.h;beginline=6;endline=23;md5=5377232268e952e9ef63bc555f7aa6c0"
> 
> -SRC_URI = "https://zlib.net/${BP}.tar.xz \
> -           file://cc.patch \
> -           file://ldflags-tests.patch \
> -           file://0001-configure-Pass-LDFLAGS-to-link-tests.patch \
> -           file://run-ptest \
> -           file://0001-Correct-incorrect-inputs-provided-to-the-CRC-functio.patch \
> -           "
> -UPSTREAM_CHECK_URI = "http://zlib.net/"
> +include zlib.inc
> +
> +SRC_URI += "file://cc.patch \
> +            file://ldflags-tests.patch \
> +            file://0001-configure-Pass-LDFLAGS-to-link-tests.patch \
> +            file://run-ptest \
> +            file://0001-Correct-incorrect-inputs-provided-to-the-CRC-functio.patch \
> +"
> 
> -SRC_URI[sha256sum] = "7db46b8d7726232a621befaab4a1c870f00a90805511c0e0090441dac57def18"
> +UPSTREAM_CHECK_URI = "http://zlib.net/"
> 
> CFLAGS += "-D_REENTRANT"
> 
> -- 
> 2.37.0
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#168059): https://lists.openembedded.org/g/openembedded-core/message/168059
> Mute This Topic: https://lists.openembedded.org/mt/92398812/6875888
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ross.burton@arm.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Alexandre Belloni July 23, 2022, 12:27 p.m. UTC | #2
Hello,

This doesn't pass the selftests:

https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/3865/steps/14/logs/stdio

2022-07-23 10:00:43,013 - oe-selftest - INFO - pkgdata.OePkgdataUtilTests.test_find_path (subunit.RemotedTestCase)
2022-07-23 10:00:43,026 - oe-selftest - INFO -  ... FAIL
Stderr:
2022-07-23 08:46:34,614 - oe-selftest - INFO - Adding: "include selftest.inc" in /home/pokybuild/yocto-worker/oe-selftest-centos/build/build-st-2078751/conf/local.conf
2022-07-23 08:46:34,615 - oe-selftest - INFO - Adding: "include bblayers.inc" in bblayers.conf
2022-07-23 10:00:17,568 - oe-selftest - INFO - Running bitbake to generate pkgdata
2022-07-23 10:00:43,026 - oe-selftest - INFO - 3: 49/59 163/494 (3.69s) (pkgdata.OePkgdataUtilTests.test_find_path)
2022-07-23 10:00:43,026 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/oe-selftest-centos/build/meta/lib/oeqa/selftest/cases/pkgdata.py", line 50, in test_find_path
    result = runCmd('oe-pkgdata-util find-path /lib/libz.so.1')
  File "/home/pokybuild/yocto-worker/oe-selftest-centos/build/meta/lib/oeqa/utils/commands.py", line 207, in runCmd
    raise AssertionError("Command '%s' returned non-zero exit status %d:\n%s" % (command, result.status, exc_output))
AssertionError: Command 'oe-pkgdata-util find-path /lib/libz.so.1' returned non-zero exit status 1:
ERROR: Unable to find any package producing path /lib/libz.so.1
Stderr:
2022-07-23 08:46:34,614 - oe-selftest - INFO - Adding: "include selftest.inc" in /home/pokybuild/yocto-worker/oe-selftest-centos/build/build-st-2078751/conf/local.conf
2022-07-23 08:46:34,615 - oe-selftest - INFO - Adding: "include bblayers.inc" in bblayers.conf
2022-07-23 10:00:17,568 - oe-selftest - INFO - Running bitbake to generate pkgdata
2022-07-23 10:00:47,408 - oe-selftest - INFO - pkgdata.OePkgdataUtilTests.test_glob (subunit.RemotedTestCase)
2022-07-23 10:00:47,408 - oe-selftest - INFO -  ... ok
2022-07-23 10:00:47,408 - oe-selftest - INFO - 3: 50/59 164/494 (4.39s) (pkgdata.OePkgdataUtilTests.test_glob)
2022-07-23 10:00:53,202 - oe-selftest - INFO - pkgdata.OePkgdataUtilTests.test_list_pkg_files (subunit.RemotedTestCase)
2022-07-23 10:00:53,202 - oe-selftest - INFO -  ... FAIL
Stderr:
2022-07-23 08:46:34,614 - oe-selftest - INFO - Adding: "include selftest.inc" in /home/pokybuild/yocto-worker/oe-selftest-centos/build/build-st-2078751/conf/local.conf
2022-07-23 08:46:34,615 - oe-selftest - INFO - Adding: "include bblayers.inc" in bblayers.conf
2022-07-23 10:00:17,568 - oe-selftest - INFO - Running bitbake to generate pkgdata
2022-07-23 10:00:53,202 - oe-selftest - INFO - 3: 51/59 165/494 (5.79s) (pkgdata.OePkgdataUtilTests.test_list_pkg_files)
2022-07-23 10:00:53,202 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/oe-selftest-centos/build/meta/lib/oeqa/selftest/cases/pkgdata.py", line 147, in test_list_pkg_files
    self.assertTrue(found, 'Could not find zlib library file %s in libz1 package file list: %s' % (libspec, files['libz1']))
  File "/usr/lib64/python3.9/unittest/case.py", line 688, in assertTrue
    raise self.failureException(msg)
AssertionError: False is not true : Could not find zlib library file /lib/libz.so.1.* in libz1 package file list: ['/usr/lib/libz.so.1', '/usr/lib/libz.so.1.2.12']


On 15/07/2022 13:55:14+0200, Sean Nyekjaer wrote:
> This is done in preparation for adding packages from the zlib contrib
> directory.
> Unfortunatly it's not possible to add these via pkgconfig.
> 
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> ---
> With this we are maintaining the same verison number for both zlib and
> minizip in the recipe name. Would it be better to have it in the inc
> file?
> 
> PV = "1.2.12" ?
> 
>  meta/recipes-core/zlib/zlib.inc       |  4 ++++
>  meta/recipes-core/zlib/zlib_1.2.12.bb | 18 +++++++++---------
>  2 files changed, 13 insertions(+), 9 deletions(-)
>  create mode 100644 meta/recipes-core/zlib/zlib.inc
> 
> diff --git a/meta/recipes-core/zlib/zlib.inc b/meta/recipes-core/zlib/zlib.inc
> new file mode 100644
> index 0000000000..b607a82312
> --- /dev/null
> +++ b/meta/recipes-core/zlib/zlib.inc
> @@ -0,0 +1,4 @@
> +SRC_URI = "https://zlib.net/zlib-${PV}.tar.xz"
> +UPSTREAM_CHECK_URI = "http://zlib.net/"
> +
> +SRC_URI[sha256sum] = "7db46b8d7726232a621befaab4a1c870f00a90805511c0e0090441dac57def18"
> diff --git a/meta/recipes-core/zlib/zlib_1.2.12.bb b/meta/recipes-core/zlib/zlib_1.2.12.bb
> index e921703137..ba986d8cf2 100644
> --- a/meta/recipes-core/zlib/zlib_1.2.12.bb
> +++ b/meta/recipes-core/zlib/zlib_1.2.12.bb
> @@ -6,16 +6,16 @@ SECTION = "libs"
>  LICENSE = "Zlib"
>  LIC_FILES_CHKSUM = "file://zlib.h;beginline=6;endline=23;md5=5377232268e952e9ef63bc555f7aa6c0"
>  
> -SRC_URI = "https://zlib.net/${BP}.tar.xz \
> -           file://cc.patch \
> -           file://ldflags-tests.patch \
> -           file://0001-configure-Pass-LDFLAGS-to-link-tests.patch \
> -           file://run-ptest \
> -           file://0001-Correct-incorrect-inputs-provided-to-the-CRC-functio.patch \
> -           "
> -UPSTREAM_CHECK_URI = "http://zlib.net/"
> +include zlib.inc
> +
> +SRC_URI += "file://cc.patch \
> +            file://ldflags-tests.patch \
> +            file://0001-configure-Pass-LDFLAGS-to-link-tests.patch \
> +            file://run-ptest \
> +            file://0001-Correct-incorrect-inputs-provided-to-the-CRC-functio.patch \
> +"
>  
> -SRC_URI[sha256sum] = "7db46b8d7726232a621befaab4a1c870f00a90805511c0e0090441dac57def18"
> +UPSTREAM_CHECK_URI = "http://zlib.net/"
>  
>  CFLAGS += "-D_REENTRANT"
>  
> -- 
> 2.37.0
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#168059): https://lists.openembedded.org/g/openembedded-core/message/168059
> Mute This Topic: https://lists.openembedded.org/mt/92398812/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Richard Purdie July 23, 2022, 12:28 p.m. UTC | #3
On Sat, 2022-07-23 at 14:27 +0200, Alexandre Belloni wrote:
> Hello,
> 
> This doesn't pass the selftests:
> 
> https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/3865/steps/14/logs/stdio
> 
> 2022-07-23 10:00:43,013 - oe-selftest - INFO - pkgdata.OePkgdataUtilTests.test_find_path (subunit.RemotedTestCase)
> 2022-07-23 10:00:43,026 - oe-selftest - INFO -  ... FAIL
> Stderr:
> 2022-07-23 08:46:34,614 - oe-selftest - INFO - Adding: "include selftest.inc" in /home/pokybuild/yocto-worker/oe-selftest-centos/build/build-st-2078751/conf/local.conf
> 2022-07-23 08:46:34,615 - oe-selftest - INFO - Adding: "include bblayers.inc" in bblayers.conf
> 2022-07-23 10:00:17,568 - oe-selftest - INFO - Running bitbake to generate pkgdata
> 2022-07-23 10:00:43,026 - oe-selftest - INFO - 3: 49/59 163/494 (3.69s) (pkgdata.OePkgdataUtilTests.test_find_path)
> 2022-07-23 10:00:43,026 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
>   File "/home/pokybuild/yocto-worker/oe-selftest-centos/build/meta/lib/oeqa/selftest/cases/pkgdata.py", line 50, in test_find_path
>     result = runCmd('oe-pkgdata-util find-path /lib/libz.so.1')
>   File "/home/pokybuild/yocto-worker/oe-selftest-centos/build/meta/lib/oeqa/utils/commands.py", line 207, in runCmd
>     raise AssertionError("Command '%s' returned non-zero exit status %d:\n%s" % (command, result.status, exc_output))
> AssertionError: Command 'oe-pkgdata-util find-path /lib/libz.so.1' returned non-zero exit status 1:
> ERROR: Unable to find any package producing path /lib/libz.so.1
> Stderr:
> 2022-07-23 08:46:34,614 - oe-selftest - INFO - Adding: "include selftest.inc" in /home/pokybuild/yocto-worker/oe-selftest-centos/build/build-st-2078751/conf/local.conf
> 2022-07-23 08:46:34,615 - oe-selftest - INFO - Adding: "include bblayers.inc" in bblayers.conf
> 2022-07-23 10:00:17,568 - oe-selftest - INFO - Running bitbake to generate pkgdata
> 2022-07-23 10:00:47,408 - oe-selftest - INFO - pkgdata.OePkgdataUtilTests.test_glob (subunit.RemotedTestCase)
> 2022-07-23 10:00:47,408 - oe-selftest - INFO -  ... ok
> 2022-07-23 10:00:47,408 - oe-selftest - INFO - 3: 50/59 164/494 (4.39s) (pkgdata.OePkgdataUtilTests.test_glob)
> 2022-07-23 10:00:53,202 - oe-selftest - INFO - pkgdata.OePkgdataUtilTests.test_list_pkg_files (subunit.RemotedTestCase)
> 2022-07-23 10:00:53,202 - oe-selftest - INFO -  ... FAIL
> Stderr:
> 2022-07-23 08:46:34,614 - oe-selftest - INFO - Adding: "include selftest.inc" in /home/pokybuild/yocto-worker/oe-selftest-centos/build/build-st-2078751/conf/local.conf
> 2022-07-23 08:46:34,615 - oe-selftest - INFO - Adding: "include bblayers.inc" in bblayers.conf
> 2022-07-23 10:00:17,568 - oe-selftest - INFO - Running bitbake to generate pkgdata
> 2022-07-23 10:00:53,202 - oe-selftest - INFO - 3: 51/59 165/494 (5.79s) (pkgdata.OePkgdataUtilTests.test_list_pkg_files)
> 2022-07-23 10:00:53,202 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
>   File "/home/pokybuild/yocto-worker/oe-selftest-centos/build/meta/lib/oeqa/selftest/cases/pkgdata.py", line 147, in test_list_pkg_files
>     self.assertTrue(found, 'Could not find zlib library file %s in libz1 package file list: %s' % (libspec, files['libz1']))
>   File "/usr/lib64/python3.9/unittest/case.py", line 688, in assertTrue
>     raise self.failureException(msg)
> AssertionError: False is not true : Could not find zlib library file /lib/libz.so.1.* in libz1 package file list: ['/usr/lib/libz.so.1', '/usr/lib/libz.so.1.2.12']

FWIW I agree with Ross, we should be able to handle minizip in the
existing recipe so this patch needs to be reworked anyway.

Cheers,

Richard
Sean Nyekjaer Aug. 8, 2022, 10:20 a.m. UTC | #4
On Mon, Jul 18, 2022 at 04:12:25PM +0000, Ross Burton wrote:
> This still seems overkill.  You can build minizip from inside the zlib recipe by fixing the minizip Makefile (fix posted to https://github.com/madler/zlib/pull/681) and then adding one line to do_compile:
> 
>     oe_runmake -C contrib/minizip CC="${CC}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
> 
> A corresponding manual do_install too, obviously.
> 
> Ross
>

Hi Ross,

Thanks for the patch :)

However this will create a minizip that is statically linked with zlib :(

Guess we need to add some more to the Makefile (or just use the
autotools generated one)

Something along this:

diff --git a/contrib/minizip/Makefile b/contrib/minizip/Makefile
index 4a0465f..cf9e79a 100644
--- a/contrib/minizip/Makefile
+++ b/contrib/minizip/Makefile
@@ -1,13 +1,26 @@
 CPPFLAGS = -I../..
 
-UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
-ZIP_OBJS = minizip.o zip.o   ioapi.o ../../libz.a
+libminizip_so_SOURCES = \
+	ioapi.c \
+	mztools.c \
+	unzip.c \
+	zip.c
 
-all: miniunz minizip
+miniunzip_SOURCES = miniunz.c
+miniunzip_LDADD = libminizip.so
+minizip_SOURCES = minizip.c
+minizip_LDADD = libminizip.so -lz
 
-miniunz:  $(UNZ_OBJS)
+all: libminizip.so miniunz minizip
 
-minizip:  $(ZIP_OBJS)
+libminizip.so:
+	$(CC) -fPIC -shared $(libminizip_so_SOURCES) -o libminizip.so
+
+miniunz: libminizip.so
+	$(CC) $(miniunzip_SOURCES) $(miniounzip_LDADD) -o miniunz
+
+minizip: libminizip.so
+	$(CC) $(minizip_SOURCES) $(minizip_LDADD) -o minizip
 
 test:	miniunz minizip
 	@rm -f test.*

Or?

/Sean
Sean Nyekjaer Aug. 25, 2022, 7:33 a.m. UTC | #5
On 08/08/2022 12.20, Sean Nyekjaer wrote:
> On Mon, Jul 18, 2022 at 04:12:25PM +0000, Ross Burton wrote:
>> This still seems overkill.  You can build minizip from inside the zlib recipe by fixing the minizip Makefile (fix posted to https://github.com/madler/zlib/pull/681) and then adding one line to do_compile:
>>
>>      oe_runmake -C contrib/minizip CC="${CC}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
>>
>> A corresponding manual do_install too, obviously.
>>
>> Ross
>>
> 
> Hi Ross,
> 
> Thanks for the patch :)
> 
> However this will create a minizip that is statically linked with zlib :(
> 
> Guess we need to add some more to the Makefile (or just use the
> autotools generated one)
> 
> Something along this:
> 
> diff --git a/contrib/minizip/Makefile b/contrib/minizip/Makefile
> index 4a0465f..cf9e79a 100644
> --- a/contrib/minizip/Makefile
> +++ b/contrib/minizip/Makefile
> @@ -1,13 +1,26 @@
>   CPPFLAGS = -I../..
>   
> -UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
> -ZIP_OBJS = minizip.o zip.o   ioapi.o ../../libz.a
> +libminizip_so_SOURCES = \
> +	ioapi.c \
> +	mztools.c \
> +	unzip.c \
> +	zip.c
>   
> -all: miniunz minizip
> +miniunzip_SOURCES = miniunz.c
> +miniunzip_LDADD = libminizip.so
> +minizip_SOURCES = minizip.c
> +minizip_LDADD = libminizip.so -lz
>   
> -miniunz:  $(UNZ_OBJS)
> +all: libminizip.so miniunz minizip
>   
> -minizip:  $(ZIP_OBJS)
> +libminizip.so:
> +	$(CC) -fPIC -shared $(libminizip_so_SOURCES) -o libminizip.so
> +
> +miniunz: libminizip.so
> +	$(CC) $(miniunzip_SOURCES) $(miniounzip_LDADD) -o miniunz
> +
> +minizip: libminizip.so
> +	$(CC) $(minizip_SOURCES) $(minizip_LDADD) -o minizip
>   
>   test:	miniunz minizip
>   	@rm -f test.*
> 
> Or?
> 
Hi Ross, Richard

Back from vacation? :)

/Sean
diff mbox series

Patch

diff --git a/meta/recipes-core/zlib/zlib.inc b/meta/recipes-core/zlib/zlib.inc
new file mode 100644
index 0000000000..b607a82312
--- /dev/null
+++ b/meta/recipes-core/zlib/zlib.inc
@@ -0,0 +1,4 @@ 
+SRC_URI = "https://zlib.net/zlib-${PV}.tar.xz"
+UPSTREAM_CHECK_URI = "http://zlib.net/"
+
+SRC_URI[sha256sum] = "7db46b8d7726232a621befaab4a1c870f00a90805511c0e0090441dac57def18"
diff --git a/meta/recipes-core/zlib/zlib_1.2.12.bb b/meta/recipes-core/zlib/zlib_1.2.12.bb
index e921703137..ba986d8cf2 100644
--- a/meta/recipes-core/zlib/zlib_1.2.12.bb
+++ b/meta/recipes-core/zlib/zlib_1.2.12.bb
@@ -6,16 +6,16 @@  SECTION = "libs"
 LICENSE = "Zlib"
 LIC_FILES_CHKSUM = "file://zlib.h;beginline=6;endline=23;md5=5377232268e952e9ef63bc555f7aa6c0"
 
-SRC_URI = "https://zlib.net/${BP}.tar.xz \
-           file://cc.patch \
-           file://ldflags-tests.patch \
-           file://0001-configure-Pass-LDFLAGS-to-link-tests.patch \
-           file://run-ptest \
-           file://0001-Correct-incorrect-inputs-provided-to-the-CRC-functio.patch \
-           "
-UPSTREAM_CHECK_URI = "http://zlib.net/"
+include zlib.inc
+
+SRC_URI += "file://cc.patch \
+            file://ldflags-tests.patch \
+            file://0001-configure-Pass-LDFLAGS-to-link-tests.patch \
+            file://run-ptest \
+            file://0001-Correct-incorrect-inputs-provided-to-the-CRC-functio.patch \
+"
 
-SRC_URI[sha256sum] = "7db46b8d7726232a621befaab4a1c870f00a90805511c0e0090441dac57def18"
+UPSTREAM_CHECK_URI = "http://zlib.net/"
 
 CFLAGS += "-D_REENTRANT"