[R-pkg-devel] set PKG_CONFIG_PATH before installing a package
Sameh M. Abdulah
@@meh@@bdu|@h @end|ng |rom k@u@t@edu@@@
Tue Apr 9 14:31:56 CEST 2019
Thanks Travers and Dirk for your feedbacks.
—Sameh
________________________________
From: Travers Ching <traversc using gmail.com>
Sent: Monday, April 8, 2019 10:52 PM
To: Dirk Eddelbuettel
Cc: Sameh M. Abdulah; r-package-devel using r-project.org
Subject: Re: [R-pkg-devel] set PKG_CONFIG_PATH before installing a package
What Dirk said! I'd also just add that it's useful to have a fallback
in case pkg-config fails, e.g., compile what you need from
source. The configure script in RcppRedis looks like a good example of that.
Travers
Travers
On Mon, Apr 8, 2019 at 12:14 PM Dirk Eddelbuettel <edd using debian.org> wrote:
>
>
> On 8 April 2019 at 10:59, Travers Ching wrote:
> | I think the correct way to do it is through the configure script. See
> | for example the Cairo package that uses pkg-config. Configure scripts
> | are slightly hard to work through in my experience, but are worth it
> | if you need customization of the installation environment.
>
> Or from the RcppRedis package you and I stand behind :)
>
> [...]
>
> ## ... but check for pkg-config
> AC_DEFUN([AC_PROG_PKGCONFIG], [AC_CHECK_PROG(PKGCONFIG,pkg-config,yes)])
> AC_PROG_PKGCONFIG
>
> ## use pkg-config for hiredis
> ##
> if test x"${PKGCONFIG}" == x"yes"; then
> ## check via pkg-config for hiredis
> if pkg-config --exists hiredis; then
> ## obtain cflags and obtain libs
> hiredis_cxxflags=`pkg-config --cflags hiredis`
> hiredis_libs=`pkg-config --libs hiredis`
> ## no need to build libhiredis.a
> hiredis_tgt=""
> else
> AC_MSG_WARN([pkg-config exists but hiredis is not available.])
> fi
> fi
>
> ## And make sure these flags are used for the tests below.
> CPPFLAGS="${hiredis_cxxflags} ${CPPFLAGS}"
> CXXFLAGS="${hiredis_cxxflags} ${CXXFLAGS}"
>
> [...]
>
> There is more at
> https://github.com/eddelbuettel/rcppredis/blob/master/configure.ac
> but is a key part.
>
>
> Another useful trick is to just write a shell script 'configure' as one does
> not have to use 'autoconf' to produce 'configure' see eg
> https://github.com/Rblp/Rblpapi/blob/master/configure
> for that approach, or one of Jeroen's packages.
>
>
> Last but not least you can call 'pkg-config' directly from src/Makevars too.
>
> Dirk
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list