On 4/2/20 8:03 AM, Niels Möller wrote:
ni...@lysator.liu.se (Niels Möller) writes:

Nikos Mavrogiannopoulos <n.mavrogiannopou...@gmail.com> writes:

We may want to install nettle somewhere separately and instruct gnutls
to use it from there rather than the default locations.

That seems to be the right solution to the immediate problem.

Below patch seems to work. See
https://gitlab.com/gnutls/nettle/-/jobs/495327357. Does it look right?
Some questions:

1. Gnutls' configure uses pkg-config to check for existence and version
    of nettle, but it doesn't use flags provided by pkg-config. We
    therefore need to set *both* PKG_CONFIG_PATH and CPPFLAGS/LDFLAGS to
    use a Nettle library in a custom location. Is it supposed to work
    that way? I would expect most things to either rely exclusively on
    pkg-config, or use other means of configuration. Except that I don't
    know if pkg-config can or should be used to supply options like
    -Wl,-rpath,...

When installed to a custom location, you have to set PKG_CONFIG_PATH
correctly. And the configure.ac code for nettle should be something like
(taken from wget2):
  PKG_CHECK_MODULES([NETTLE], nettle, [
    with_libnettle=yes
    LIBS="$NETTLE_LIBS $LIBS"
    CFLAGS="$NETTLE_CFLAGS $CFLAGS"
    AC_DEFINE([WITH_LIBNETTLE], [1], [Use libnettle])
  ], [
     with_libnettle=no
     AC_MSG_WARN(*** LIBNETTLE was not found. Fallback to libgcrypt for
hashing and checksumming.)
  ])


*BUT* I had some issues with just setting PKG_CONFIG_PATH alone on
Debian unstable a while ago. I had to adjust to something different.

This is from my current MinGW recipe:
unset CC
unset CXX

PREFIX=x86_64-w64-mingw32

export PATH="/usr/$PREFIX/bin:$PATH"
export INSTALLDIR="$PWD/$PREFIX"
export PKG_CONFIG_PATH=$INSTALLDIR/lib/pkgconfig:/usr/$PREFIX/lib/pkgconfig
export PKG_CONFIG_LIBDIR="$INSTALLDIR/lib/pkgconfig"
export PKG_CONFIG="/usr/bin/${PREFIX}-pkg-config"
export CPPFLAGS="-I$INSTALLDIR/include"
export LDFLAGS="-L$INSTALLDIR/lib"

cd nettle
bash .bootstrap
./configure --build=x86_64-pc-linux-gnu --host=$PREFIX --enable-mini-gmp
--enable-shared --disable-documentation --prefix=$INSTALLDIR
make clean
make -j$(nproc)
make install


Hope that helps a bit.

2. What's the right way to add line breaks for the very long configure
    command in .gitlab-ci.yml?

Just breaking the line (linefeed) is enough, as long as the continuation
line doesn't start with a dash '-'. What is also ok and used in many
places is adding a '\' plus linefeed.

Regards, Tim
_______________________________________________
nettle-bugs mailing list
nettle-bugs@lists.lysator.liu.se
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs

Reply via email to