如何使用cmake';s';进行安装';从pbuilder env debian/rules脚本?
这是编译和链接一个静态库(因此只有一个构建时依赖项),该库的源代码是从ubuntu launchpad build bot上的存储库(就像主程序的源代码一样)获取的 目前我正在做:如何使用cmake';s';进行安装';从pbuilder env debian/rules脚本?,cmake,launchpad,make-install,pbuilder,Cmake,Launchpad,Make Install,Pbuilder,这是编译和链接一个静态库(因此只有一个构建时依赖项),该库的源代码是从ubuntu launchpad build bot上的存储库(就像主程序的源代码一样)获取的 目前我正在做: #!/usr/bin/make -f export PREFIX=/usr export CFLAGS= -O3 -fomit-frame-pointer -flto -fwhole-program export CXXFLAGS= -O3 -fomit-frame-pointer -
#!/usr/bin/make -f
export PREFIX=/usr
export CFLAGS= -O3 -fomit-frame-pointer -flto -fwhole-program
export CXXFLAGS= -O3 -fomit-frame-pointer -flto -fwhole-program
%:
dh $@
override_dh_auto_configure:
cd src/munt;cmake -DCMAKE_CXX_FLAGS="-O3 -fomit-frame-pointer -flto" mt32emu;make;make install
#...compile of the program that depends on mt32emu...
但它在以下方面失败了:
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/libmt32emu.a
CMake Error at cmake_install.cmake:36 (FILE):
file INSTALL cannot copy file
"/tmp/buildd/dosbox-0.74+20121225/src/munt/libmt32emu.a" to
"/usr/local/lib/libmt32emu.a".
make[2]: *** [install] Error 1
make[2]: Leaving directory `/tmp/buildd/dosbox-0.74+20121225/src/munt'
make[1]: *** [override_dh_auto_configure] Error 2
make[1]: Leaving directory `/tmp/buildd/dosbox-0.74+20121225'
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
E: Failed autobuilding of package
I: unmounting /var/cache/pbuilder/ccache filesystem
I: unmounting dev/pts filesystem
I: unmounting proc filesystem
I: cleaning the build env
I: removing directory /var/cache/pbuilder/build//2751 and its subdirectories
我们的想法是安装一个静态库依赖项,该依赖项不打包在launchpad pbuilder env中的ubuntu存储库中,因此可以像使用系统依赖项一样使用它
如果我尝试执行“sudo make install”(并将sudo添加到debian/control中的build deps),在本地测试时,它会要求我输入“pbuilder”密码,我假设这会将机器挂在ubuntu buildbots上
编辑:它实际上在BuildBot上失败,因为“没有tty存在,也没有指定askpass程序”。这只是权限问题吗?(即——必须使用“sudo”安装到“/usr/local”?) 必须将其安装到“/usr/local”吗 如果它只是一个静态库,纯粹是构建“依赖于mt32emu的程序”所需要的,那么您可以将它放在任何地方,并告诉依赖程序它在哪里
要在其他地方安装,请使用-DCMAKE\u install\u PREFIX=/directory/where/you/have/write/privileges。或者在make install中使用DESTDIR=。您可以做一些事情来清理
规则
文件,尤其是在使用dh
时
在%
目标中,所有dh
命令都采用一个参数builddirectory
,该参数指定要在其中生成的目录。这会告诉构建器将cd
放入该目录,然后调用命令(make
,cmake
,等等)
此外,您应该让dh
为您安装文件。这是自动完成的。您不必手动调用makeinstall
下面是一个稍微容易阅读的规则
文件:
#!/usr/bin/make -f
export PREFIX=/usr
export CFLAGS= -O3 -fomit-frame-pointer -flto -fwhole-program
export CXXFLAGS= -O3 -fomit-frame-pointer -flto -fwhole-program
%:
dh $@ --builddirectory=src/munt
override_dh_auto_configure:
cd src/munt && cmake -DCMAKE_CXX_FLAGS="-O3 -fomit-frame-pointer -flto" mt32emu
#...compile of the program that depends on mt32emu...
我最终通过依赖于launchpad存储库的依赖关系来“解决”这个问题,也就是说,为库构建一个完整的包,并在launchpad上构建它,然后导入将其放置到其他构建中的存档。我想是说得很清楚