--- hogweed.pc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hogweed.pc.in b/hogweed.pc.in index 457f5f2..839f7d0 100644 --- a/hogweed.pc.in +++ b/hogweed.pc.in @@ -13,6 +13,6 @@ URL: http://www.lysator.liu.se/~nisse/nettle Version: @PACKAGE_VERSION@ Requires.private: nettle Libs: -L${libdir} -lhogweed -Libs.private: -lgmp +Libs.private: @LIBS@ Cflags: -I${includedir}
Ignore the newly generated bignum.h, also ignore OS X dylibs and lib{nettle,hogweed}.stamp. --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore index 9fb025e..2af4d2d 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ TAGS *.so *.exe *.dll +*.dylib core /*.d /*.po @@ -20,6 +21,7 @@ core /.lib /*.asm /Makefile +/bignum.h /config.cache /config.h /config.h.in @@ -37,7 +39,7 @@ core /aesdata /desdata /eccdata -/eccdata.stamp +/*.stamp /gcmdata /shadata /twofishdata
When a user invokes pkg-config to get the necessary linker flags for linking to libhogweed, the user can add --static to get the private dependencies included, which are necessary for static linking. If the hogweed build contains both static and shared libraries, this works as intended - if the user explicitly passes -static to the linker to have it favor static libs over shared ones, the same user also needs to tell pkg-config about this intention.
If the hogweed build happens to be static-only, the user of the library might not be aware of this, and might not realize needing to pass --static to pkg-config. (This is even more an issue in setups with a large number of libraries, where only a few of them are built static-only.)
For these cases, where a library is built as only a static library, one fairly common convention (not used everywhere, but at least in some libraries I regularly use) is to include the private dependencies in the non-private section. This makes sure a user of the library doesn't need to be concerned about which way this library was built (unless the user intentionally overrides defaults by passing flags such as -static to the linker). --- configure.ac | 3 +++ hogweed.pc.in | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac index 2ea5866..6923d3a 100644 --- a/configure.ac +++ b/configure.ac @@ -757,8 +757,10 @@ fi
if test "x$enable_shared" = xyes ; then IF_SHARED='' + IF_NOT_SHARED='#' else IF_SHARED='#' + IF_NOT_SHARED='' fi
# Documentation tools @@ -792,6 +794,7 @@ fi AC_SUBST(IF_HOGWEED) AC_SUBST(IF_STATIC) AC_SUBST(IF_SHARED) +AC_SUBST(IF_NOT_SHARED) AC_SUBST(IF_DOCUMENTATION) AC_SUBST(IF_DLL) AC_SUBST(IF_MINI_GMP) diff --git a/hogweed.pc.in b/hogweed.pc.in index 839f7d0..97fb9d4 100644 --- a/hogweed.pc.in +++ b/hogweed.pc.in @@ -11,8 +11,9 @@ Name: Hogweed Description: Nettle low-level cryptographic library (public-key algorithms) URL: http://www.lysator.liu.se/~nisse/nettle Version: @PACKAGE_VERSION@ -Requires.private: nettle -Libs: -L${libdir} -lhogweed -Libs.private: @LIBS@ +Requires: @IF_NOT_SHARED@ nettle +Requires.private: @IF_SHARED@ nettle +Libs: -L${libdir} -lhogweed @IF_NOT_SHARED@ @LIBS@ +Libs.private: @IF_SHARED@ @LIBS@ Cflags: -I${includedir}
Martin Storsjö martin@martin.st writes:
For these cases, where a library is built as only a static library, one fairly common convention (not used everywhere, but at least in some libraries I regularly use) is to include the private dependencies in the non-private section. This makes sure a user of the library doesn't need to be concerned about which way this library was built (unless the user intentionally overrides defaults by passing flags such as -static to the linker).
Makes some sense to me. Is there any reasonable way to test these things? If not part of the ordinary make check, perhaps part of make distcheck or some other separate target.
If you feel like it, it would be nice with a short description of how it's intended to work, in the node "Linking" in the manual.
Regards, /Niels
All three patches pushed on the master branch. Thanks.
/Niels
nettle-bugs@lists.lysator.liu.se