ImageOptim / libimagequant

Palette quantization library that powers pngquant and other PNG optimizers
https://pngquant.org/lib
Other
780 stars 132 forks source link

Add the cargo-c metadata #70

Closed lu-zero closed 2 years ago

lu-zero commented 2 years ago

Fixes #68

It produces

   |- usr/
      |- local/
         |- include/
            |- imagequant/
               |- libimagequant.h
         |- lib/
            |- pkgconfig/
               |- imagequant.pc
            |- libimagequant.a
            |- libimagequant.{dylib/so}
            |- libimagequant.4.{dylib/so}
            |- libimagequant.4.0.0.{dylib/so}

On unix-like and

   |- usr/
      |- local/
         |- bin/
            |- imagequant.dll
         |- include/
            |- imagequant/
               |- libimagequant.h
         |- lib/
            |- pkgconfig/
               |- imagequant.pc
            |- imagequant.def
            |- imagequant.dll.a
            |- libimagequant.a

On windows.

kornelski commented 2 years ago

edit: Name clash with cargo check is unfortunate.

kornelski commented 2 years ago

Can I override sover? The ABI version is not going to match the crate's semver-major. I think the library is still at sover 0.

Can I use my own .h file? The autogenerated one is not syntactically valid (I've used Box in FFI function types, which is FFI-compatible, but needs to be translated to a pointer in C, which the generator doesn't do). Also it used to be just libimagequant.h, without a subdirectory.

The .pc file includes multi-line description, which probably breaks its syntax.

lu-zero commented 2 years ago

Can I override sover? The ABI version is not going to match the crate's semver-major. I think the library is still at sover 0.

Sure, there is a version override also for the pkg-config file if needed.

Can I use my own .h file? The autogenerated one is not syntactically valid (I've used Box in FFI function types, which is FFI-compatible, but needs to be translated to a pointer in C, which the generator doesn't do). Also it used to be just libimagequant.h, without a subdirectory.

You can, by default it looks into the assets/ directory, so you have to tell it where it is through the additional key.

The .pc file includes multi-line description, which probably breaks its syntax.

Interesting enough pkg-config did not seem to care since no : were present. I opened an issue about it, luckily there is already an override.

kornelski commented 2 years ago

Thanks.

libimagequant.0.0.0 is a bit overly specific, but it'll do.