opensp: fix build with clang 16

There are two issues preventing a build with clang 16:
* The configure scripts are too old and generate invalid `config.h`.
This is fixed by using `autoreconfHook` with clang.
* Use of the `register` storage class specifier, which is not allowed in
C++17 (the default when building with clang 16). This is fixed by
removing that usage.

+19 -1
+8 -1
pkgs/tools/text/sgml/opensp/default.nix
··· 1 { lib, stdenv, fetchurl, fetchpatch, xmlto, docbook_xml_dtd_412 2 , libxslt, docbook_xsl, autoconf, automake, gettext, libiconv, libtool 3 }: 4 5 stdenv.mkDerivation rec { ··· 21 url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-text/opensp/files/opensp-1.5.2-c11-using.patch?id=688d9675782dfc162d4e6cff04c668f7516118d0"; 22 sha256 = "04q14s8qsad0bkjmj067dn831i0r6v7742rafdlnbfm5y249m2q6"; 23 }) 24 ]; 25 26 setupHook = ./setup-hook.sh; ··· 41 xmlto 42 docbook_xml_dtd_412 43 docbook_xsl 44 - ] ++ lib.optionals stdenv.isCygwin [ autoconf automake libtool ]; 45 46 doCheck = false; # fails 47
··· 1 { lib, stdenv, fetchurl, fetchpatch, xmlto, docbook_xml_dtd_412 2 , libxslt, docbook_xsl, autoconf, automake, gettext, libiconv, libtool 3 + , autoreconfHook 4 }: 5 6 stdenv.mkDerivation rec { ··· 22 url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-text/opensp/files/opensp-1.5.2-c11-using.patch?id=688d9675782dfc162d4e6cff04c668f7516118d0"; 23 sha256 = "04q14s8qsad0bkjmj067dn831i0r6v7742rafdlnbfm5y249m2q6"; 24 }) 25 + # Clang 16 defaults to C++17, which does not allow `register` as a storage class specifier. 26 + ./fix-register-storage-class.patch 27 ]; 28 29 setupHook = ./setup-hook.sh; ··· 44 xmlto 45 docbook_xml_dtd_412 46 docbook_xsl 47 + ] 48 + # Clang 16 fails to build due to inappropriate definitions in the `config.h` generated by the 49 + # existing configure scripts. Regenerate them to make sure they detect its features correctly. 50 + ++ lib.optional stdenv.cc.isClang autoreconfHook 51 + ++ lib.optionals stdenv.isCygwin [ autoconf automake libtool ]; 52 53 doCheck = false; # fails 54
+11
pkgs/tools/text/sgml/opensp/fix-register-storage-class.patch
···
··· 1 + --- a/lib/Recognizer.cxx 2005-11-05 04:05:20.000000000 -0500 2 + +++ b/lib/Recognizer.cxx 2023-06-03 11:45:04.497116217 -0400 3 + @@ -39,7 +39,7 @@ 4 + } 5 + else 6 + in->startTokenNoMulticode(); 7 + - register const Trie *pos = trie_.pointer(); 8 + + const Trie *pos = trie_.pointer(); 9 + do { 10 + pos = pos->next(map_[in->tokenChar(mgr)]); 11 + } while (pos->hasNext());