开发者

Make install, but not to default directories?

开发者 https://www.devze.com 2023-01-06 20:09 出处:网络
I want to run \'make install\' so I have everything I need, but I\'d like it to install the things in their own folder as opposed to the syste开发者_开发百科m\'s /usr/bin etc. is that possible? even i

I want to run 'make install' so I have everything I need, but I'd like it to install the things in their own folder as opposed to the syste开发者_开发百科m's /usr/bin etc. is that possible? even if it references tools in the /usr/bin etc.?


It depends on the package. If the Makefile is generated by GNU autotools (./configure) you can usually set the target location like so:

./configure --prefix=/somewhere/else/than/usr/local

If the Makefile is not generated by autotools, but distributed along with the software, simply open it up in an editor and change it. The install target directory is probably defined in a variable somewhere.


Since don't know which version of automake you can use DESTDIR environment variable.
See Makefile to be sure.

For example:

 export DESTDIR="$HOME/Software/LocalInstall" && make -j4 install


make DESTDIR=./new/customized/path install

This quick command worked for me for opencv release 3.2.0 installation on Ubuntu 16. DESTDIR path can be relative as well as absolute.

Such redirection can also be useful in case user does not have admin privileges as long as DESTDIR location has right access for the user. e.g /home//


It could be dependent upon what is supported by the module you are trying to compile. If your makefile is generated by using autotools, use:

--prefix=<myinstalldir>

when running the ./configure

some packages allow you to also override when running:

make prefix=<myinstalldir>

however, if your not using ./configure, only way to know for sure is to open up the makefile and check. It should be one of the first few variables at the top.


If the package provides a Makefile.PL - one can use:

perl Makefile.PL PREFIX=/home/my/local/lib LIB=/home/my/local/lib
make
make test
make install

* further explanation: https://www.perlmonks.org/?node_id=564720


I tried the above solutions. None worked.

In the end I opened Makefile file and manually changed prefix path to desired installation path like below.

PREFIX ?= "installation path"

When I tried --prefix, "make" complained that there is not such command input. However, perhaps some packages accepts --prefix which is of course a cleaner solution.


try using INSTALL_ROOT.

make install INSTALL_ROOT=$INSTALL_DIRECTORY
0

精彩评论

暂无评论...
验证码 换一张
取 消