aboutsummaryrefslogtreecommitdiffstats
path: root/main/source-highlight
diff options
context:
space:
mode:
Diffstat (limited to 'main/source-highlight')
-rw-r--r--main/source-highlight/APKBUILD44
-rw-r--r--main/source-highlight/gcc11.patch35
-rw-r--r--main/source-highlight/gcc12.patch82
3 files changed, 161 insertions, 0 deletions
diff --git a/main/source-highlight/APKBUILD b/main/source-highlight/APKBUILD
new file mode 100644
index 00000000000..505b68f62b5
--- /dev/null
+++ b/main/source-highlight/APKBUILD
@@ -0,0 +1,44 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=source-highlight
+pkgver=3.1.9
+pkgrel=12
+pkgdesc="Produces a document with syntax highlighting"
+url="https://www.gnu.org/software/src-highlite/"
+arch="all"
+license="GPL-3.0-or-later"
+depends_dev="boost-dev"
+makedepends="bison flex $depends_dev"
+checkdepends="diffutils"
+subpackages="$pkgname-dev $pkgname-doc"
+source="https://ftp.gnu.org/gnu/src-highlite/source-highlight-$pkgver.tar.gz
+ gcc11.patch
+ gcc12.patch
+ "
+
+prepare() {
+ default_prepare
+ update_config_sub
+}
+
+build() {
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --disable-static
+ make
+}
+
+check() {
+ make -j1 check
+}
+
+package() {
+ make DESTDIR="$pkgdir" install
+}
+
+sha512sums="
+d8e154e9a5d62c77807e4e5d36c0faed5ce2964291be5f8b83e2968a6de52229503689a4ca2109a717ae2632a14b63ec937ca0430c91684c72063f6bc0294195 source-highlight-3.1.9.tar.gz
+91b009a754648a32a6332ffcac99853f12bd3b88a462b524180bfd366d736fac79570401599ca67c820117768aea781c96931c730f6fe757a471cf83f1110eb7 gcc11.patch
+1348aa9eaf4167b65e197b82e7e21897e4a0290181a08999450dcac7a060f589fa9b644ecb7786a654f2fba216d2cab405955f506ab7da96ac1ff36f2b641156 gcc12.patch
+"
diff --git a/main/source-highlight/gcc11.patch b/main/source-highlight/gcc11.patch
new file mode 100644
index 00000000000..278e3c1d473
--- /dev/null
+++ b/main/source-highlight/gcc11.patch
@@ -0,0 +1,35 @@
+Patch-Source: https://github.com/archlinux/svntogit-packages/blob/6594be43e84dfa33f9fcf2b2c51f0ab13e89b710/trunk/source-highlight-gcc11.patch
+From 904949c9026cb772dc93fbe0947a252ef47127f4 Mon Sep 17 00:00:00 2001
+From: Tom Tromey <tom@tromey.com>
+Date: Wed, 10 Jun 2020 20:38:27 -0600
+Subject: Remove "throw" specifications
+
+diff --git a/lib/srchilite/fileutil.cc b/lib/srchilite/fileutil.cc
+index 59a6d64..963178c 100644
+--- a/lib/srchilite/fileutil.cc
++++ b/lib/srchilite/fileutil.cc
+@@ -48,7 +48,7 @@ void set_file_util_verbose(bool b) {
+ // FIXME avoid using a global variable
+ std::string start_path;
+
+-string readFile(const string &fileName) throw (IOException) {
++string readFile(const string &fileName) {
+ ifstream file(fileName.c_str());
+
+ if (!file.is_open()) {
+diff --git a/lib/srchilite/fileutil.h b/lib/srchilite/fileutil.h
+index 7335a9b..042eb56 100644
+--- a/lib/srchilite/fileutil.h
++++ b/lib/srchilite/fileutil.h
+@@ -27,7 +27,7 @@ extern std::string start_path;
+ * @return the contents of the file
+ * @throw IOException
+ */
+-string readFile(const string &fileName) throw (IOException);
++string readFile(const string &fileName);
+
+ //char *read_file(const string &fileName);
+
+--
+cgit v1.2.1
+
diff --git a/main/source-highlight/gcc12.patch b/main/source-highlight/gcc12.patch
new file mode 100644
index 00000000000..b062f5df057
--- /dev/null
+++ b/main/source-highlight/gcc12.patch
@@ -0,0 +1,82 @@
+Patch-Source: https://git.savannah.gnu.org/cgit/src-highlite.git/commit/?id=ab9fe5cb9b85c5afab94f2a7f4b6d7d473c14ee9
+From ab9fe5cb9b85c5afab94f2a7f4b6d7d473c14ee9 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyich@gmail.com>
+Date: Mon, 8 Nov 2021 23:30:42 +0000
+Subject: Fix tests build failure on clang and gcc-12
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Both gcc-12 and clang can't find ostream<<(..., std::pair<...>)
+overload when compile lib/tests/test_wordtokenizer_main.cpp and
+fail as:
+
+ ./../srchilite/tostringcollection.h:103:9:
+ error no match for «operator<<» (operand types are «std::ostringstream»
+ {aka «std::__cxx11::basic_ostringstream<char>»}
+ and «const std::pair<std::__cxx11::basic_string<char>,
+ std::__cxx11::basic_string<char> >»)
+ 103 | buf << (*it);
+ | ~~~~^~~~~~~~
+
+We fix it by placing overload to std namespace where std::pair<...>
+is defined to make ADL work predictably.
+
+clang also has a trouble compiling lib/tests/stdboosterror.h as:
+
+ ./stdboosterror.h:7:72: error: parameter declarator cannot be qualified
+ std_boost_exception(boost::regex_error(boost::regex_constants::error_bad_pattern));
+ ~~~~~~~~~~~~~~~~~~~~~~~~^
+
+gcc compiles it by accident: https://gcc.gnu.org/PR86564
+
+Let's disambiguate syntax by making it an explicit constructor call.
+---
+ lib/tests/stdboosterror.h | 2 +-
+ lib/tests/test_wordtokenizer_main.cpp | 10 ++++++++++
+ 2 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/lib/tests/stdboosterror.h b/lib/tests/stdboosterror.h
+index 568545b..d59bfa6 100644
+--- a/lib/tests/stdboosterror.h
++++ b/lib/tests/stdboosterror.h
+@@ -4,7 +4,7 @@
+ #include <boost/regex/pattern_except.hpp>
+
+ static boost::regex_error
+- std_boost_exception(boost::regex_error(boost::regex_constants::error_bad_pattern));
++ std_boost_exception = boost::regex_error(boost::regex_constants::error_bad_pattern);
+
+ /**
+ * returns the string representing a standard exception (which
+diff --git a/lib/tests/test_wordtokenizer_main.cpp b/lib/tests/test_wordtokenizer_main.cpp
+index 40e23b1..11ba389 100644
+--- a/lib/tests/test_wordtokenizer_main.cpp
++++ b/lib/tests/test_wordtokenizer_main.cpp
+@@ -11,6 +11,14 @@
+ using namespace std;
+ using namespace srchilite;
+
++/*
++ * We have to use 'std' namespaces because 'WordTokenizer::WordTokenizerResults::value_type'
++ * is an std::pair<std::string, std::string> in disguise. We have to place 'operator<<()'
++ * into the same namespace for ADL to work. Otherwise gcc-12 or clang-13 can't find the
++ * overload.
++ */
++namespace std {
++
+ static ostream &operator <<(ostream &os, const WordTokenizer::WordTokenizerResults::value_type &);
+
+ ostream &operator <<(ostream &os, const WordTokenizer::WordTokenizerResults::value_type &token) {
+@@ -23,6 +31,8 @@ ostream &operator <<(ostream &os, const WordTokenizer::WordTokenizerResults::val
+ return os;
+ }
+
++}
++
+ int main() {
+ WordTokenizer::WordTokenizerResults tokens;
+
+--
+cgit v1.1
+