vy32
vy32

Reputation: 29635

Specify CPPFLAGS when building with CPAN

I have a CPAN module I am attempting to build. It requires compiling a small C program. I don't have root on the system, so I have a complete parallel source tree in $HOME/local/src installed at $HOME/local/lib and $HOME/local/include, etc.

How do I pass CPPFLAGS=-I$HOME/local/include LDFLAGS=-L$HOME/local/lib to the CPAN module so that it will be properly built?

Upvotes: 1

Views: 1102

Answers (1)

mrk
mrk

Reputation: 5117

You can pass CPPFLAGS and LDFLAGS to the CPAN module build process by setting these as environment variables. I had luck with a local tidy and tidyp install after setting these, in Bash).

Steps:

 Installed tidy and tidyp with prefix $HOME/local
 export CPPFLAGS=-I$HOME/local/include
 export LDFLAGS=-L$HOME/local/lib
 export LD_LIBRARY_PATH=$HOME/lib
 cpan
 cpan> install HTML::Tidy

I added the LD_LIBRARY_PATH setting above to get -ltidyp picked up correctly for HTML::Tidy install.

Upvotes: 2

Related Questions