Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmlto: fix build with clang 16 #240644

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions pkgs/tools/typesetting/xmlto/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ fetchurl, lib, stdenv, libxml2, libxslt
, docbook_xml_dtd_45, docbook_xsl, w3m
{ fetchurl, fetchpatch, lib, stdenv, libxml2, libxslt
, docbook_xml_dtd_45, docbook_xsl, flex, w3m
, bash, getopt, makeWrapper }:

stdenv.mkDerivation rec {
Expand All @@ -10,6 +10,20 @@ stdenv.mkDerivation rec {
sha256 = "0xhj8b2pwp4vhl9y16v3dpxpsakkflfamr191mprzsspg4xdyc0i";
};

# Note: These patches modify `xmlif/xmlif.l`, which requires `flex` to be rerun.
patches = [
# Fixes implicit `int` on `main`, which is an error with clang 16.
(fetchpatch {
url = "https://pagure.io/xmlto/c/8e34f087bf410bcc5fe445933d6ad9bae54f24b5.patch";
hash = "sha256-z5riDBZBVuFeBcjI++dAl3nTIgOPau4Gag0MJbYt+cc=";
})
# Fixes implicit `int` on `ifsense`, which is also an error with clang 16.
(fetchpatch {
url = "https://pagure.io/xmlto/c/1375e2df75530cd198bd16ac3de38e2b0d126276.patch";
hash = "sha256-fM6ZdTigrcC9cbXiKu6oa5Hs71mrREockB1wRlw6nDk=";
})
];

postPatch = ''
patchShebangs xmlif/test/run-test

Expand All @@ -23,7 +37,7 @@ stdenv.mkDerivation rec {

# `libxml2' provides `xmllint', needed at build-time and run-time.
# `libxslt' provides `xsltproc', used by `xmlto' at run-time.
nativeBuildInputs = [ makeWrapper getopt ];
nativeBuildInputs = [ makeWrapper flex getopt ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is flex here mandatory?

Copy link
Contributor Author

@reckenrode reckenrode Jul 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patch changes a .l file, so flex needs to be run again.

This issue is actually fixed upstream, but there hasn’t been a release. I’ve pushed an updated PR that uses the commits from upstream instead of vendoring the patch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also added a comment explaining why flex is required.

buildInputs = [ libxml2 libxslt docbook_xml_dtd_45 docbook_xsl ];

postInstall = ''
Expand Down