[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: packaging issue of a custom Ada runtime using gnat-gpl-2021


Inspired by this thread, I have started https://wiki.debian.org/Ada to
collect information that does not fit into the Debian Policy for Ada.
I hope reading it will answer your concern.
Feel free to improve it.

> we will fix it by specifying the CFLAGS value in our upstream Makefile

Please don’t. Such variables are intended for override at build time.
The differences that you describe reflect the fact that Debian uses
that possibility.

CFLAGS contains options like -Wformat that are irrelevant for Ada
because it is intended for the C language.

If you really need to reduce the difference between a non-Debian build
and a Debian build, here are some possible work-arounds.

> 1. Different ali file content
> ===
> Both versions have V "GNAT Lib v2021", so that gpl 2021 driver seems to be used in both cases.
> The ali file are the same, to the exception of the additional lines below when build using dpkg-buildpackage:
> A -fdebug-prefix-map=/home/[...]/packaging/[...]/rts-adalabs/librts-adalabs-0.0.10=.
> A -fstack-protector-strong

   DEB_BUILD_MAINT_OPTIONS=hardening=-stackprotector in debian/rules
or set -fstack-protector-strong by default in the upstream build system

   DEB_BUILD_MAINT_OPTIONS=reproductible=-fixdebugpath in debian/rules
or strip the debug-prefix-map lines from the ALI file after the build
   (dh-ada-library does this automatically)

> 2. Extra compilation warnings
> ===
> While no warnings are present when build directly, additional compilation warnings are present when build using dpkg-buildpackage::
> gnat1: warning: command-line option '-Wformat=1' is valid for C/C++/ObjC/ObjC++ but not for Ada
> gnat1: warning: '-Werror=' argument '-Werror=format-security' is not valid for Ada

   DEB_BUILD_MAINT_OPTIONS=hardening=-format in debian/rules
or     let the upstream build system handle ADAFLAGS
   and include debian_packaging*.mk

By the way, https://gitlab.com/adalabs/gnatgpr sets
-XXMLADA_BUILD=static, so you are probably using the projects
installed by AdaCore’s XMLAda Makefile.
If you intend to package gnatgpr, it should depend only on other
.debs, and the /usr/share/gpr/*.gpr projects installed by the
libxmlada*-dev packages only manage relocatable libraries.
Depending on your use case, a possible work-around may be to set
Gnatgpr.Linker.Linker_Options to ("-lxmlada_unicode.a",
"-lxmlada_sax.a", ...) so that these objects are appended to the
linker command line of each reverse dependency.

Reply to: