BLAKE2 / libb2

C library providing BLAKE2b, BLAKE2s, BLAKE2bp, BLAKE2sp
Creative Commons Zero v1.0 Universal
132 stars 47 forks source link

WIP add support for pkg-config by emmiting a libb2.pc #23

Closed RonnyPfannschmidt closed 5 years ago

RonnyPfannschmidt commented 5 years ago

in this pr i simply bring together what i found on

as far i can tell it installs a pkgconfig file in the right location

i tested by $ ./autogen.sh && ./configure --prefix=$PWD/dest && make install

which resulted in

$ tree dest/
dest/
├── include
│   └── blake2.h
└── lib
    ├── libb2.a
    ├── libb2.la
    ├── libb2.so -> libb2.so.1.0.3
    ├── libb2.so.1 -> libb2.so.1.0.3
    ├── libb2.so.1.0.3
    └── pkgconfig
        └── libb2.pc

$ cat dest/lib/pkgconfig/libb2.pc 
prefix=/home/ronny/Projects/BLAKE2/libb2/dest
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: Blake2
Description: C library providing BLAKE2b, BLAKE2s, BLAKE2bp, BLAKE2sp
URL: https://github.com/BLAKE2/libb2
Version: 0.98
Requires: 
Cflags: -I${includedir}
Libs: -L${libdir} -lbb2

$ PKG_CONFIG_PATH=dest/lib/pkgconfig/ pkg-config --cflags --libs libb2
-I/home/ronny/Projects/BLAKE2/libb2/dest/include -L/home/ronny/Projects/BLAKE2/libb2/dest/lib -lbb2 

Fixes #22

RonnyPfannschmidt commented 5 years ago

since i'm pretty new to this as well i asked in the #autotools channel on freenode if someone with deeper experience in the topic could have a look and see if i did it well (its a low traffic channel so it may take a while)

so if we are lucky someone has actually time for this and we get a review by someone with an actual clue on this ^^

RonnyPfannschmidt commented 5 years ago

i forgot to add the libb2.pc.in before and noted that the flag should be -lb2 instead of -lbb2

ThomasWaldmann commented 5 years ago

having no clue about pkgconfig, the only thing i found to improve here is to have a single linefeed at the end of files, so github / diff does not complain (see the red markers in the diff view).

QuLogic commented 5 years ago

I'm not sure the changes to the m4/ directory are related to this one.

I think you can leave out Requires: if it's empty.

RonnyPfannschmidt commented 5 years ago

those happened as part of the tooling, i can undo them if necessary

ThomasWaldmann commented 5 years ago

can we accelerate review/merge/release of this a bit?

i'ld like to switch borgbackup to pkg-config, but it would be bad if i had to support another method just for libb2.

sneves commented 5 years ago

OK, as far as I could tell this is working as advertised, so I merged it. Thank you.