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

Reply via email to