Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 816990 - dev-libs/miniz-2.1.0-r2 - sources not amalgamated into miniz.h
Summary: dev-libs/miniz-2.1.0-r2 - sources not amalgamated into miniz.h
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Matthew Smith
URL: https://github.com/richgel999/miniz/b...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-08 19:00 UTC by Marian Kyral
Modified: 2022-06-04 07:50 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
miniz-2.2.0.ebuild (miniz-2.2.0.ebuild,692 bytes, text/plain)
2021-10-09 11:11 UTC, Marian Kyral
Details
files/build-shared-libs.patch (build-shared-libs.patch,3.28 KB, patch)
2021-10-09 11:14 UTC, Marian Kyral
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marian Kyral 2021-10-08 19:00:04 UTC
As stated in readme.md:

"
Usage

Please use the files from the releases page in your projects. Do not use the git checkout directly! The different source and header files are amalgamated into one miniz.c/miniz.h pair in a build step (amalgamate.sh). Include miniz.c and miniz.h in your project to use Miniz.
"



Reproducible: Always

Steps to Reproduce:
1. Install dev-libs/miniz
Actual Results:  
Include folder contains several miniz headers:

$ ls -la /usr/include/miniz
celkem 112
drwxr-xr-x   2 root root  4096  8. říj 20.24 .
drwxr-xr-x 459 root root 36864  8. říj 16.06 ..
-rw-r--r--   1 root root  2516 11. dub  2019 miniz_common.h
-rw-r--r--   1 root root 23264 11. dub  2019 miniz.h
-rw-r--r--   1 root root  9871 11. dub  2019 miniz_tdef.h
-rw-r--r--   1 root root  8030 11. dub  2019 miniz_tinfl.h
-rw-r--r--   1 root root 24049 11. dub  2019 miniz_zip.h


Expected Results:  
Only amalgamated miniz.h is present

I'm trying to compile latest development version of prusaslicer and it fails on undeclared mz_zip_archive type

Only "miniz.h" is included in source code.

[ 30%] Building CXX object src/libslic3r/CMakeFiles/libslic3r.dir/Format/OBJ.cpp.o
In file included from /home/marian/programy/PrusaSlicer-version_2.4.0-alpha3/src/libslic3r/Format/AMF.cpp:30:
/home/marian/programy/PrusaSlicer-version_2.4.0-alpha3/src/libslic3r/miniz_extension.hpp:9:22: error: ‘mz_zip_archive’ was not declared in this scope
    9 | bool open_zip_reader(mz_zip_archive *zip, const std::string &fname_utf8);
      |                      ^~~~~~~~~~~~~~
/home/marian/programy/PrusaSlicer-version_2.4.0-alpha3/src/libslic3r/miniz_extension.hpp:9:38: error: ‘zip’ was not declared in this scope
    9 | bool open_zip_reader(mz_zip_archive *zip, const std::string &fname_utf8);
      |                                      ^~~
/home/marian/programy/PrusaSlicer-version_2.4.0-alpha3/src/libslic3r/miniz_extension.hpp:9:43: error: expected primary-expression before ‘const’
    9 | bool open_zip_reader(mz_zip_archive *zip, const std::string &fname_utf8);
Comment 1 Marian Kyral 2021-10-09 11:11:34 UTC
Created attachment 744072 [details]
miniz-2.2.0.ebuild

Updated and bumped ebuild
Comment 2 Marian Kyral 2021-10-09 11:14:48 UTC
Created attachment 744075 [details, diff]
files/build-shared-libs.patch

By default amalgamated source part builds only static libs regardless to  BUILD_SHARED_LIBS setting. Should be fixed by upstream.

I'm not sure if proposed patch is correct, but works for me ;-)
Comment 3 Marian Kyral 2021-10-09 11:58:53 UTC
Update:

Prusa-slicer still does not compile. As per https://github.com/prusa3d/PrusaSlicer/blob/master/src/miniz/README-Prusa.txt - they did some changes to the miniz package, so it does not compile with upstream version. But cmake prefers system miniz and compillation fails.


```
PrusaResearch (Vojtech) homebrewed the following:

mz_zip_writer_add_staged_open(), mz_zip_writer_add_staged_data() and mz_zip_writer_add_staged_finish() 
were derived from mz_zip_writer_add_read_buf_callback() by splitting it and passing a new mz_zip_writer_staged_context between them.
```

https://github.com/prusa3d/PrusaSlicer/issues/7080
Comment 4 Marian Kyral 2021-10-15 19:17:33 UTC
Just a note. System miniz is no more used: https://github.com/prusa3d/PrusaSlicer/commit/94843bb6bf1a99af6fafcc21a81912dd3dff71e7
Comment 5 Matthew Smith gentoo-dev 2022-06-04 07:50:39 UTC
I don't think that this is a problem (at least, not any more):

- We don't want to build the header-only version of the library, it's effectively just static linking.
- We don't need to concatenate all of the headers together, the main miniz.h includes the other header files so consumers shouldn't care if they get the amalgamation or the individual files.