3

This is to compile and link a static library (so only a build time dependency) that the source is fetched from a repository (just like the source of the main program) on a ubuntu launchpad build bot.

currently i am doing:

    #!/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...

But it fails with:

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

The idea is to install a static library dependency that is is not packaged in the ubuntu repositories in the launchpad pbuilder env, so it can be used as if it was a system dependency already.

If i try to do 'sudo make install' (and add sudo to the build-deps in debian/control), it asks me for the 'pbuilder' password when testing locally, which i'm assuming will hang the machine on the ubuntu buildbots.

edit: it actually fails on the buildbots because 'no tty present and no askpass program specified'.

i30817
  • 1,356
  • 2
  • 13
  • 26

3 Answers3

2

There are several things you can do to clean up your rules file, especially when you are using dh.

In the % target, all of the dh command take a parameter builddirectory, which specifies what directory you are building in. This tells the builder to cd to that directory and then call commands (make, cmake, etc.).

In addition, you should just let dh install the files for you. This is done automatically. You shouldn't have to call make install manually.

Here's a slightly easier-to-read rules file:

#!/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...
saiarcot895
  • 554
  • 5
  • 16
0

Is this just a permissions issue? (i.e. -- must use 'sudo' to install to '/usr/local'?)

Must you install it to '/usr/local'?

If it's just a static library, purely needed for the build of the "the program that depends on mt32emu" then you could put it anywhere, and just tell the dependent program where it is.

To install somewhere else, use -DCMAKE_INSTALL_PREFIX=/directory/where/you/have/write/privileges. Or use DESTDIR= with the make install.

DLRdave
  • 13,876
  • 4
  • 53
  • 70
0

I eventually 'solved' this by depending on launchpad repository dependencies, that is, building a whole package for the library and building that on launchpad and then importing the archive where that was placed to my other builds. Made it explicit i guess.

i30817
  • 1,356
  • 2
  • 13
  • 26