Files
guru/dev-octave/strings/files/strings-1.2.0-157.patch
Alessandro Barbieri 990e89e133 dev-octave/strings: add 1.2.0_p20211128, drop 1.2.0
Signed-off-by: Alessandro Barbieri <lssndrbarbieri@gmail.com>
2022-05-28 23:19:44 +02:00

352 lines
10 KiB
Diff

changeset: 157:e1a7916b66a9
user: John Donoghue
date: Thu Jan 09 16:37:00 2020 -0500
summary: Add configure scripts to detect new octave functionality (Bug #55385)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+Summary of important user-visible changes for strings 1.2.1+:
+-------------------------------------------------------------------
+
+ ** Update package to compile in GNU Octave 5+
+
Summary of important user-visible changes for strings 1.2.1:
-------------------------------------------------------------------
@@ -5,7 +10,6 @@
trailing zeros which have been introduced by padding (bug #38974), returns
uint8 vectors instead of binary64 vectors, and should perform faster.
-
Summary of important user-visible changes for strings 1.2.0:
-------------------------------------------------------------------
--- a/src/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-OCTAVE ?= octave
-MKOCTFILE ?= mkoctfile -Wall
-
-PCRE_SWITCHES := $(shell $(OCTAVE) \
- --no-gui --no-init-file --no-site-file --silent --no-history \
- --eval 'disp (octave_config_info ("PCRE_LIBS"));' \
- --eval 'disp (octave_config_info ("PCRE_CPPFLAGS"));' \
- )
-
-pcregexp.oct: %.oct: %.cc
- $(MKOCTFILE) $(PCRE_SWITCHES) -o $@ $<
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,42 @@
+# Makefile for strings package for Octave
+#
+# Copyright (C) 2019 John Donoghue
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+
+# before cross building, pre-build at least $(TEXIFILE) natively,
+# e.g. with targets 'doc', 'html', or 'prebuild'
+
+PCRE_CXXFLAGS ?= @PCRE_CFLAGS@
+PCRE_LIBS ?= @PCRE_LIBS@
+
+MKOCTFILE ?= @MKOCTFILE@
+
+.PHONY: all clean distclean maintainer-clean
+
+all: pcregexp.oct
+
+%.oct: %.cc
+ $(MKOCTFILE) -o $@ $< $(PCRE_CXXFLAGS) $(PCRE_LIBS)
+
+clean:
+ $(RM) *.o octave-core *.oct *~
+
+distclean: clean
+ $(RM) config.h config.log config.status Makefile oct-alt-includes.h
+ $(RM) -r autom4te.cache
+
+maintainer-clean: distclean
+ $(RM) configure config.h.in aclocal.m4
--- /dev/null
+++ b/src/bootstrap
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+aclocal
+
+autoconf
+
+autoheader -f
--- /dev/null
+++ b/src/configure.ac
@@ -0,0 +1,102 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+#
+### Copyright (C) 2015-2018 Olaf Till <i7tiol@t-online.de>
+### Copyright (C) 2019 John Donoghue <john.donoghue@ieee.org>
+###
+### This program is free software; you can redistribute it and/or
+### modify it under the terms of the GNU General Public License as
+### published by the Free Software Foundation; either version 3 of the
+### License, or (at your option) any later version.
+###
+### This program is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+### General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with this program; if not, see
+### <http://www.gnu.org/licenses/>.
+
+AC_PREREQ([2.67])
+AC_INIT([strings], [1.2.0])
+AC_CONFIG_SRCDIR([pcregexp.cc])
+AC_CONFIG_HEADERS([config.h])
+
+# Avoid warnings for redefining AH-generated preprocessor symbols of
+# Octave.
+AH_TOP([#include "undef-ah-octave.h"])
+
+AC_CONFIG_MACRO_DIRS([m4])
+
+# Checks for programs.
+AC_CHECK_PROG(MKOCTFILE, mkoctfile, mkoctfile)
+if test -z "$MKOCTFILE"; then
+AC_MSG_ERROR([mkoctfile not found], 1);
+fi
+AC_CHECK_PROG(OCTAVE_CONFIG, octave-config, octave-config)
+if test -z "$OCTAVE_CONFIG"; then
+AC_MSG_ERROR([octave-config not found], 1);
+fi
+
+#AC_CHECK_TOOL(PKG_CONFIG, pkg-config, [])
+#if test -z "$PKG_CONFIG"; then
+# AC_MSG_ERROR([pkg-config not found], 1);
+#fi
+
+
+# The same value of CXX as Octave was compiled with is supposed to be used.
+CXX=${CXX:-`${MKOCTFILE} -p CXX`}
+AC_PROG_CXX
+
+AC_PROG_CXXCPP
+
+# Checks for typedefs, structures, and compiler characteristics.
+
+# Checks for library functions.
+PKG_CHECK_MODULES([PCRE],[libpcre],
+ [],
+ [AC_MSG_ERROR([libpcre not found])]
+)
+
+
+# Start of checks for Octave features, preparations for checks.
+OCTLIBDIR=${OCTLIBDIR:-`$OCTAVE_CONFIG -p OCTLIBDIR`}
+## We need Octaves include path both with and without '/octave'
+## appended. The path without '/octave' is needed to selectively test
+## for Octave headers, like octave/....h. The path with '/octave' is
+## needed since some Octave headers contain include directives for
+## other Octave headers with <> instead of "".
+OCTINCLUDEDIR=${OCTINCLUDEDIR:-`$MKOCTFILE -p INCFLAGS`}
+AC_LANG_PUSH([C++])
+TCXXFLAGS=$CXXFLAGS
+TLDFLAGS=$LDFLAGS
+TLIBS=$LIBS
+TCPPFLAGS=$CPPFLAGS
+LDFLAGS="-L$OCTLIBDIR $LDFLAGS"
+LIBS="-loctinterp $LIBS"
+# CXXFLAGS=
+CPPFLAGS="$OCTINCLUDEDIR $CPPFLAGS"
+
+## Simple symbol alternatives of different Octave versions.
+OF_OCTAVE_LIST_ALT_SYMS([
+[dnl
+ [gripe_wrong_type_arg],
+ [err_wrong_type_arg],
+ [[err_wrong_type_arg("test");]],
+ [OCTAVE__WRONG_TYPE_ARG],
+ [],
+ []
+]
+],
+ [oct-alt-includes.h])
+
+LIBS=$TLIBS
+LDFLAGS=$TLDFLAGS
+CXXFLAGS=$TCXXFLAGS
+CPPFLAGS=$TCPPFLAGS
+AC_LANG_POP([C++])
+# End of checks for Octave features.
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
--- /dev/null
+++ b/src/m4/octave-forge.m4
@@ -0,0 +1,93 @@
+# Copyright (C) 2017-2018 Olaf Till <i7tiol@t-online.de>
+# Modifications to print what is searching for by JohnD
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+# arguments of OF_OCTAVE_ALT_SYMS (see also description of
+# OF_OCTAVE_LIST_ALT_SYMS below):
+#
+# $1: symbol version 1
+# $2: symbol version 2
+# $3: test for symbol version 2
+# $4: macro name to access alternative symbols
+# $5: include directives for symbol version 1
+# $6: include directives for symbol version 2
+# (a list of lists of args 1--6 is $1 of OF_OCTAVE_LIST_ALT_SYMS)
+# $7: name of generated include file with alternatives of Octave headers
+# (arg7 is $2 of OF_OCTAVE_LIST_ALT_SYMS)
+AC_DEFUN([OF_OCTAVE_ALT_SYMS], [
+AC_MSG_CHECKING([$1 or $2])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[#include <octave/oct.h>]
+ $6],
+ [$3])],
+ [AC_DEFINE($4,
+ [[$2]],
+ [macro for alternative Octave symbols])
+ AC_MSG_RESULT([$2])
+ echo '$6' >> $7],
+ [AC_DEFINE($4,
+ [[$1]],
+ [macro for alternative Octave symbols])
+ AC_MSG_RESULT([$1])
+ echo '$5' >> $7]
+)
+])
+
+
+# OF_OCTAVE_LIST_ALT_SYMS is called in the following way:
+#
+# OF_OCTAVE_LIST_ALT_SYMS([
+# [dnl
+# [old_octave_symbol],
+# [new_octave_symbol],
+# [[compilation test]
+# [for new_octave_symbol]],
+# [NAME_OF_GENERATED_MACRO____WILL_EXPAND_TO_OLD_OR_NEW_SYMBOL],
+# [[include directives]
+# [except #include <octave/oct.h>]
+# [necessary to compile with old_octave_symbol]],
+# [[include directives]
+# [except #include <octave/oct.h>]
+# [nessary to compile with new_octave_symbol]
+# [and to compile the test]]
+# ],
+#
+# ... further such lists as the above
+#
+# ],
+#
+# [name-of-header-file-for-alternative-octave-iclude-directives.h])
+#
+#
+# This file should be put into src/m4/, and the line
+#
+# AC_CONFIG_MACRO_DIRS([m4])
+#
+# should be put into src/configure.ac. The package should use
+# autoheader to generate config.h.in (src/bootstrap should contain the
+# lines 'aclocal', 'autoconf', and 'autoheader -f'). Package code
+# should include config.h and use the generated macros to access the
+# alternative symbols of Octave. An example of a call to
+# OF_OCTAVE_LIST_ALT_SYMS in src/configure.ac is available together
+# with this file.
+AC_DEFUN([OF_OCTAVE_LIST_ALT_SYMS], [
+
+echo '/* generated by configure */' > $2
+
+m4_foreach([it], [$1], [m4_apply([OF_OCTAVE_ALT_SYMS], [it, $2])])
+
+AH_BOTTOM([#include "$2"])
+
+])
--- a/src/pcregexp.cc
+++ b/src/pcregexp.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004 Stefan van der Walt <stefan@sun.ac.za>
+// Copyright (C) 2004-2019 Stefan van der Walt <stefan@sun.ac.za>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -26,6 +26,8 @@
#include <iostream>
#include <vector>
+#include "config.h"
+
//FIXME This function needs some documentation
DEFUN_DLD(pcregexp, args, nargout, "\
-*- texinfo -*-\n\
@@ -49,7 +51,7 @@
std::string pattern = args(0).string_value();
std::string input = args(1).string_value();
if (error_state) {
- gripe_wrong_type_arg("pcregexp", args(0));
+ OCTAVE__WRONG_TYPE_ARG("pcregexp", args(0));
return retval;
}
--- /dev/null
+++ b/src/undef-ah-octave.h
@@ -0,0 +1,27 @@
+/* To be included at the top of config.h (by autoheader). Avoid
+ warnings for redefining AH-generated preprocessor symbols of
+ Octave. */
+
+#ifdef PACKAGE_BUGREPORT
+#undef PACKAGE_BUGREPORT
+#endif
+
+#ifdef PACKAGE_NAME
+#undef PACKAGE_NAME
+#endif
+
+#ifdef PACKAGE_STRING
+#undef PACKAGE_STRING
+#endif
+
+#ifdef PACKAGE_TARNAME
+#undef PACKAGE_TARNAME
+#endif
+
+#ifdef PACKAGE_URL
+#undef PACKAGE_URL
+#endif
+
+#ifdef PACKAGE_VERSION
+#undef PACKAGE_VERSION
+#endif