`make install` 复制了哪些文件,复制到哪里?
有没有办法获取 make install
复制到文件系统的文件名/路径列表?有些软件包附带 MANIFEST 文件,但我正在使用的软件包则没有。
Is there a way to get a list of filenames/paths that make install
copies to the filesystem? Some packages come with a MANIFEST file, but not the ones that I am working with.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我只是在编译 QEMU 的自定义版本时自己对此进行了调查。我使用以下方法来确定安装的内容和位置(以及将其用作 .deb 文件的基础):
Tree 是一个实用程序,它以视觉上吸引人的方式递归显示目录的内容 -
sudo apt-get install tree
适用于 Debian / Ubuntu 用户希望对某人有所帮助...我花了一些时间才弄清楚,但我发现这是一个非常有用的方法想象正在发生的事情。
I was just investigating this myself while compiling a custom version of QEMU. I used the following method to work out what was installed and where (as well as using it as a basis for a .deb file):
Tree is a utility that recursively displays the contents of a directory in a visually appealing manner -
sudo apt-get install tree
for Debian / Ubuntu usersHope that helps someone... it took me a bit of poking around to nut it out, but I found it quite a useful way of visualising what was going on.
最简单的方法是使用 chroot:在 chroot 监狱内运行“make install”;计算安装前的文件列表,并将其与安装后的文件列表进行比较。
许多安装将支持 --prefix 配置选项和/或 DESTDIR 环境变量。您可以将它们用于 chroot 的更轻等待版本(相信如果您以相当无特权的用户身份运行安装,则如果尝试写入这些之外的位置,安装将会失败)。
另一种方法是替换安装程序。许多软件包支持 INSTALL 环境变量,它是要使用的安装程序;周围有安装的跟踪版本。
The most fool-proof way is to use chroot: have "make install" run inside a chroot jail; compute a list of the files that you had before the installation, and compare that to the list of files after the installation.
Many installations will support either a --prefix configuration option, and/or a DESTDIR environment variable. You can use those for a lighter-wait version of chroot (trusting that the installation will fail if it tries to write to a location outside these if you run installation as a fairly unprivileged user).
Another approach is to replace the install program. Many packages support an INSTALL environment variable that, well, is the install program to use; there are tracing versions of install around.
如果编译说明的作者提供了允许卸载的信息,
make uninstall
可能会在删除文件时显示这些文件(自从我完成卸载以来已经有一段时间了,所以我不能肯定地说) 。此外,
make -n install
将对安装过程进行“dry run”,从其结果中提取信息可能是合理的。make uninstall
might show the files as it removes them if the author of the compiling instructions provides the information to allow an uninstall (it has been awhile since I have done one so I can't say for sure).Also
make -n install
will do a "dry run" of the install process and it may be reasonable to extract the information from its results.对于您运行“make install”的每个项目,它都不同。安装的文件由正在使用的 Makefile 中的安装目标控制。最好的办法是打开 Makefile 并搜索“install:” - 从那里您可以看到哪些文件将被复制到您的系统中。
It differs for every project that you run 'make install' on. The files which are installed are controlled by the install target in the Makefile being used. Your best bet is to open the Makefile and search for 'install:' - from there you can see what files will be copied out to your system.
例子:
Example:
如果您使用的安装程序不支持 DESTDIR 或 --prefix (或等效项),我发现可以按如下方式识别新文件:
sudo find / -mmin -5 -type f
(find 命令有大量参数用于根据文件修改/创建时间进行查询,但这效果很好对我来说;你只需要缩小时间跨度,这样你就可以获取安装程序创建的文件,而不是其他的)。If the install program you're using doesn't support DESTDIR or --prefix (or an equivalent), I have found that it may be possible to identify new files as follows:
sudo find / -mmin -5 -type f
(the find command has a ton of parameters for querying based on file modification / creation times, but this worked pretty well for me; you just need to narrow the time span so that you pick up the files created by the installer but nothing else).