我可以使用基于 ExtUtils::MakeMaker 的构建系统“从树中”构建 Perl 模块吗?
我不想在解压 Perl 模块源的目录中添加或修改文件,而是想在单独的目录中构建所有内容。通过使用 ExtUtils::MakeMaker
的相当标准的 Makefile.PL
可以轻松实现这一点吗? (简单地说,我的意思是一个或几个命令行参数之类的东西。)如果没有,其他构建系统是否支持这一点?
更新/原因: Perl 模块绑定到构建系统为 autoconf
/automake
/libtool
的库-基于。 Perl 模块与该库一起提供,并且在顶级目录中调用 make
最终也会构建 Perl 库。我有兴趣在单独的构建树中构建整个项目。目前,我做了类似于 runrig 建议的事情,仅使用符号链接。 (cp -sru $(srcdir)/.$(builddir)/.
)。到目前为止,这已经有效,但如果有更优雅的解决方案,我想阅读一下。
Instead of adding or modifying files in the directory where the sources of a Perl module are unpacked, I would like to build everything in a separate directory. Is this easily achievable with a fairly standard Makefile.PL
that uses ExtUtils::MakeMaker
? (By easy, I mean something like one or a few command line parameters.) If no, does any of the other build systems support this?
Update / Reason: The Perl module is a binding to a library whose build system is autoconf
/automake
/libtool
-based. The Perl module is shipped together with this library and calling make
in the top directory eventually also builds the Perl library. I am interested in building the entire project in a separate build tree. At the moment I do something similar to what runrig suggested, only using symlinks. (cp -sru $(srcdir)/. $(builddir)/.
). This has worked so far, but if there is a more elegant solution, I'd like to read about it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
MakeMaker 已经复制了源代码并将它们构建在一个单独的目录中(这就是
blib/
所在的目录)。您可以使用WriteMakefile()
的INST_*
参数集控制构建位置。此示例将位置从blib/
更改为foo/
。此外,您还必须告诉 MakeMaker 清理新的构建目录。
请参阅 “确定 Perl 库和安装位置”。 ="http://search.cpan.org/perldoc?ExtUtils%3a%3aMakeMaker" rel="nofollow">ExtUtils::MakeMaker 文档以获取更多信息。
MakeMaker already copies the sources and builds them in a separate directory (that's what
blib/
is). You can control the build location with theINST_*
set of arguments toWriteMakefile()
. This example changes the location fromblib/
tofoo/
.In addition you have to tell MakeMaker to cleanup the new build directory.
See "Determination of Perl Library and Installation Locations" in the ExtUtils::MakeMaker docs for more info.
我最终使用了符号链接:
Perl 模块提供绑定的库使用
基于
autoconf
/automake
/libtool
的构建系统。Makefile.PL
是通过
configure
从Makefile.PL.in
生成。Makefile.PL
生成
Makefile-pl
(Makefile
已被autoconf
/automake
)。这是
Makefile.am
的相关部分:我将第二个目标更改为:
只要构建或安装 Perl 模块,它就应该有效
不会导致任何文件被就地修改。
I ended up using symlinks:
The library to which the Perl module provides bindings uses an
autoconf
/automake
/libtool
-based build system.Makefile.PL
isgenerated from
Makefile.PL.in
byconfigure
.Makefile.PL
generates
Makefile-pl
(Makefile
has already been taken byautoconf
/automake
).This is the relevant part of
Makefile.am
:I changed the second target to:
This should work as long as building or installing the Perl module
does not result in any files being modified in-place.