Best way to patch a public header file before installation

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Best way to patch a public header file before installation

Mathieu Malaterre-4
[CC me please]

Hi there,

I'd like to patch a header file just before it gets installed. In
particular I'd like to remove a line that contains
ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT (it is either #define or #undef
depending on the arch). This way I make sure that my header files are
arch independent.

Thanks for suggestion

-M

Reply | Threaded
Open this post in threaded view
|

Re: Best way to patch a public header file before installation

Paul Wise via nm
On Thu, Nov 8, 2018 at 4:14 AM Mathieu Malaterre wrote:

> I'd like to patch a header file just before it gets installed. In
> particular I'd like to remove a line that contains
> ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT (it is either #define or #undef
> depending on the arch). This way I make sure that my header files are
> arch independent.

Sounds like something that should be fixed upstream.

As a workaround, run this in override_dh_auto_install:

sed -i /ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT/ debian/*/usr/include/*.h

BTW, there are multi-arch dirs for arch-specific headers:

/usr/include/x86_64-linux-gnu/

--
bye,
pabs

https://wiki.debian.org/PaulWise

Reply | Threaded
Open this post in threaded view
|

Re: Best way to patch a public header file before installation

Mathieu Malaterre-4
Hi Paul,

On Thu, Nov 8, 2018 at 2:53 AM Paul Wise <[hidden email]> wrote:

>
> On Thu, Nov 8, 2018 at 4:14 AM Mathieu Malaterre wrote:
>
> > I'd like to patch a header file just before it gets installed. In
> > particular I'd like to remove a line that contains
> > ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT (it is either #define or #undef
> > depending on the arch). This way I make sure that my header files are
> > arch independent.
>
> Sounds like something that should be fixed upstream.

I reported that already, but needed a fix for an existing release.

> As a workaround, run this in override_dh_auto_install:
>
> sed -i /ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT/ debian/*/usr/include/*.h

Thanks, I should have thought about this myself.

> BTW, there are multi-arch dirs for arch-specific headers:
>
> /usr/include/x86_64-linux-gnu/

Long story short, I believe this fixes the symptoms and not the actual
bug. I would even go one step further and make that arch specific
include be restricted (Debian policy) to only a subset of packages
(gcc, libc...), since I fail to understand why there would be arch
specific information in public header (obviously for a package not
dealing with low level arch specific).
In my case, and I suspect in the vast majority of packages, this is
just lazy programming where a public header contains an implementation
detail that was used during the build but is meaningless to expose to
the final user.

-M

Reply | Threaded
Open this post in threaded view
|

Re: Best way to patch a public header file before installation

Paul Wise via nm
On Thu, Nov 8, 2018 at 3:20 PM Mathieu Malaterre wrote:

> Long story short, I believe this fixes the symptoms and not the actual
> bug. I would even go one step further and make that arch specific
> include be restricted (Debian policy) to only a subset of packages
> (gcc, libc...), since I fail to understand why there would be arch
> specific information in public header (obviously for a package not
> dealing with low level arch specific).

On my system most of them look fairly low-levelish (see below).

The dedup.d.n service and the multi-arch hinter can tell you when
there are the same/different header files in the same place on
different arches.

https://dedup.debian.net/
https://wiki.debian.org/MultiArch/Hints

> In my case, and I suspect in the vast majority of packages, this is
> just lazy programming where a public header contains an implementation
> detail that was used during the build but is meaningless to expose to
> the final user.

I think it would be interesting to explore this and or add some code
to the multi-arch hinter to show header diffs between arches in
/usr/include and the multi-arch subdirs of it.

$ find /usr/include/x86_64-linux-gnu/ -print0 | xargs -0 dpkg -S | cut
-f 1 -d: | sort -u
libc6-dev
libcurl4-gnutls-dev
libexpat1-dev
libffi-dev
libgmp-dev
libgpg-error-dev
libjpeg62-turbo-dev
libpython2.7-dbg
libpython2.7-dev
libpython3.6-dbg
libpython3.6-dev
libpython3.7-dev
libssl-dev
libstdc++-7-dev
libstdc++-8-dev
libtiff5-dev
linux-libc-dev
qtbase5-dev
ruby2.5-dev

--
bye,
pabs

https://wiki.debian.org/PaulWise