• Single source with multiple interdependent cmake packages

    From Enrico Zini@21:1/5 to All on Fri Dec 20 19:40:01 2024
    Hello,

    I'm trying to make a Debian package out of https://gitlab.eumetsat.int/open-source/data-tailor-plugins/fcidecomp

    I managed to build it this way:

    $ cd src/fcidecomp

    $ # Build and install fcicomp-jpegls first
    $ rm -r build/fcicomp-jpegls/
    $ gen/build.sh fcicomp-jpegls/ release

    $ # fcicomp-H5Zjpegls seems to need fcicomp-jpegls installed in order to build $ (cd build/fcicomp-jpegls && make install DESTDIR=/tmp/fcicomp-jpegls)
    $ rm -r build/fcicomp-H5Zjpegls/
    $ CMAKE_PREFIX_PATH=/tmp/fcicomp-jpegls/usr/local/share/cmake/fcicomp_jpegls/ gen/build.sh fcicomp-H5Zjpegls/ release
    $ (cd build/fcicomp-H5Zjpegls/ && make install DESTDIR=/tmp/fcicomp-H5Zjpegls)

    (gen/build.sh is a wrapper that calls cmake, and can be replaced by a
    cmake invocation)

    From here to a Debian package the way doesn't seem to be
    straightforward, as I can't install the first component before building
    the second one, and probably there are better ways to do it.

    Questions:

    * Is there a way to tell cmake to build the two things together, or to
    point at the build dir of the first one to build the second one,
    without installing it first?
    * Is there a clean way to tell debhelper that cmake and make need to be
    called multiple times?
    * Is there a better way to approach all this?

    Thanks!

    Enrico

    --
    GPG key: 4096R/634F4BD1E7AD5568 2009-05-08 Enrico Zini <enrico@enricozini.org>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jochen Sprickerhof@21:1/5 to All on Fri Dec 20 20:40:01 2024
    Hi Enrico,

    * Enrico Zini <enrico@enricozini.org> [2024-12-20 19:29]:
    * Is there a way to tell cmake to build the two things together, or to
    point at the build dir of the first one to build the second one,
    without installing it first?

    I had a similar problem with the ros- packages and solved it with a top
    level CMakeLists.txt doing add_subdirectory() for every project. Here is
    an example:

    https://sources.debian.org/src/ros-image-transport-plugins/1.15.0-3/debian/patches/0001-Add-CMakeLists.txt.patch/

    * Is there a clean way to tell debhelper that cmake and make need to be
    called multiple times?

    That's also possible but you would need to override all targets in
    d/rules with the duplicated commands.

    Cheers Jochen

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEc7KZy9TurdzAF+h6W//cwljmlDMFAmdlxawACgkQW//cwljm lDOtNA/8DEEwe+Eb2D8RqSUswAVwiiQj6LHOXnFzZ3gSyFoNxXaJzpoiCa6XkvbI aIli/qxJPjs7gWhKLlq9deFnjpBDF4e/UFr9Jb4qA7by/WqJhxHhxOk+u8yJ+4AY /UYKKSIcGFpC5LpXyzuj6QommTUQUBqa7syHyYb3/TWJNwKxJuyCh1BqN+kRsyXD 4vG0qXu5Emv6VKAETTAJMO3YPLItQV9yTSec4R2a2Q4NOOFP7O2gPBnS8yuk02SA Av5r5/rw329RTnvfLdcR0STwcRdeUma0PUz1kHU8D3cOWK74ekqBuEKI034bARW+ r/XVwR354QvxlyiTvHvUBgw/UYM63aldT+2L8UwCar4cRjKBtUtw9BX8WMmsUTML GZyMBzH8mHDQWCY7//hsWGnWyaGSAbgwnfwx691mhkEF9k41GG6Jtz/PW6hHCaGf W5gN2jGP3ZFQa58JgRxdRr8RJVHKOD6fGu3YnAK0rsyxZJUrXBbApkEfxm9PfKJe 7kGGkBD9pIxeaWKM7V+QCbcYf66zT3Wm51I2PEeOzRinqtXfK5RYKjlMtrOzAFrR tpmNmQhTxfFb+eoxy1v7YE7CmagnV+nITk017FPx4UKXt+sErEq6k8ROBmMG73iw 2KidLhhmY0smbn53Pq5KjEnZ3alzHZONoIMOWbbmJ897+WlSxT0=
    =o54R
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Grohne@21:1/5 to Enrico Zini on Sun Dec 22 08:50:01 2024
    Hi Enrico,

    On Fri, Dec 20, 2024 at 07:29:28PM +0100, Enrico Zini wrote:
    Hello,

    I'm trying to make a Debian package out of https://gitlab.eumetsat.int/open-source/data-tailor-plugins/fcidecomp

    I managed to build it this way:

    $ cd src/fcidecomp

    $ # Build and install fcicomp-jpegls first
    $ rm -r build/fcicomp-jpegls/
    $ gen/build.sh fcicomp-jpegls/ release

    $ # fcicomp-H5Zjpegls seems to need fcicomp-jpegls installed in order to build
    $ (cd build/fcicomp-jpegls && make install DESTDIR=/tmp/fcicomp-jpegls)
    $ rm -r build/fcicomp-H5Zjpegls/
    $ CMAKE_PREFIX_PATH=/tmp/fcicomp-jpegls/usr/local/share/cmake/fcicomp_jpegls/ gen/build.sh fcicomp-H5Zjpegls/ release
    $ (cd build/fcicomp-H5Zjpegls/ && make install DESTDIR=/tmp/fcicomp-H5Zjpegls)

    (gen/build.sh is a wrapper that calls cmake, and can be replaced by a
    cmake invocation)

    From here to a Debian package the way doesn't seem to be
    straightforward, as I can't install the first component before building
    the second one, and probably there are better ways to do it.

    Questions:

    * Is there a way to tell cmake to build the two things together, or to
    point at the build dir of the first one to build the second one,
    without installing it first?

    In principle, there is. Jochen already pointed out that a subproject can
    be added using add_subdirectory. If that doesn't work, the heavier
    hammer is ExternalProject_Add. At that point your build will configure
    and build the other CMake project (and you're responsible for forwarding
    all the relevant variables including compiler and compiler flags).

    * Is there a clean way to tell debhelper that cmake and make need to be
    called multiple times?

    No. The closest thing solving this problem I encountered thus far is
    cdbs, but I no longer remember how it solved that and I don't think we
    want to revive it. However, Niels is working on such functionality as
    part of his debputy work. The relevant issue is https://salsa.debian.org/debian/debputy/-/issues/31. As far as I
    understand your problem, it is vaguely similar to cmake vs
    emacs-cmake-mode. Timo split the emacs-cmake-mode source package off the
    cmake package for bootstrapping concerns (effectively duplicating the
    source package). In your case, doing two source packages sharing the
    same orig.tar would also solve your issues (at the inconvenience of
    doing two uploads). There is no silver bullet at this time.

    If continuing with debhelper, I suspect your best bet is to configure,
    build, and install the first project in an
    execute_before_dh_auto_configure handling the second one. I appreciate
    if you continue calling cmake through dh_auto_configure, because that
    tends to makes cross building just work.

    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Enrico Zini@21:1/5 to Jochen Sprickerhof on Fri Dec 27 14:30:01 2024
    On Fri, Dec 20, 2024 at 08:30:00PM +0100, Jochen Sprickerhof wrote:

    I had a similar problem with the ros- packages and solved it with a top
    level CMakeLists.txt doing add_subdirectory() for every project. Here is an example: https://sources.debian.org/src/ros-image-transport-plugins/1.15.0-3/debian/patches/0001-Add-CMakeLists.txt.patch/

    Thanks, that approach worked for me! The relevant cmake patchery is at: https://salsa.debian.org/science-team/fcidecomp/-/commit/08ef2f18a6af813043a34d97b8bd9939b8f836f6


    On Sun, Dec 22, 2024 at 07:13:17AM +0100, Helmut Grohne wrote:

    If continuing with debhelper, I suspect your best bet is to configure,
    build, and install the first project in an
    execute_before_dh_auto_configure handling the second one. I appreciate
    if you continue calling cmake through dh_auto_configure, because that
    tends to makes cross building just work.

    Thanks! In the end I managed to turn everything into a hopefully
    well-behaved toplevel CMakeLists.txt, and go ahead with a standard debian/rules: https://salsa.debian.org/science-team/fcidecomp


    Enrico

    --
    GPG key: 4096R/634F4BD1E7AD5568 2009-05-08 Enrico Zini <enrico@enricozini.org>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)