Compare commits
11 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff5ec82f73 | ||
|
|
395ebbf9e8 | ||
|
|
bbbd864519 | ||
|
|
9e28c9aadf | ||
|
|
0836ab4d31 | ||
|
|
9a3bcee35e | ||
|
|
ebea401352 | ||
|
|
1decd93a29 | ||
|
|
fc0fa19b50 | ||
|
|
edc0d8f4e4 | ||
|
|
fb4af6f646 |
4 changed files with 299 additions and 7 deletions
192
clover2-11.0.0-0001-port-to-pcre2.patch
Normal file
192
clover2-11.0.0-0001-port-to-pcre2.patch
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
From 4b2ce8ab238fb961c07cf6d87b771ad5eef1b141 Mon Sep 17 00:00:00 2001
|
||||
From: clover2 Fedora maintainer <clover2-owner@fedoraproject.org>
|
||||
Date: Fri, 16 Aug 2024 21:23:04 +0900
|
||||
Subject: [PATCH] port to pcre2
|
||||
|
||||
---
|
||||
configure | 15 ++++++++++-----
|
||||
configure.in | 9 +++++++--
|
||||
src/class_system.c | 13 +++++++------
|
||||
src/common.h | 5 +++--
|
||||
src/regex.c | 16 ++++++++++------
|
||||
5 files changed, 37 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index b1bfbdf..f1fc2a4 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -4419,21 +4419,26 @@ then
|
||||
LIBS="$LIBS -liconv"
|
||||
fi
|
||||
|
||||
-ac_fn_c_check_header_compile "$LINENO" "pcre.h" "ac_cv_header_pcre_h" "$ac_includes_default"
|
||||
+CFLAGS_ORIG="$CFLAGS"
|
||||
+CFLAGS="$CFLAGS_ORIG -DPCRE2_CODE_UNIT_WIDTH=8"
|
||||
+export CFLAGS
|
||||
+ac_fn_c_check_header_compile "$LINENO" "pcre2.h" "ac_cv_header_pcre_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_pcre_h" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_PCRE_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
+CFLAGS="$CFLAGS_ORIG"
|
||||
+export CFLAGS
|
||||
|
||||
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for main in -lpcre" >&5
|
||||
-printf %s "checking for main in -lpcre... " >&6; }
|
||||
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for main in -lpcre2-8" >&5
|
||||
+printf %s "checking for main in -lpcre2-8... " >&6; }
|
||||
if test ${ac_cv_lib_pcre_main+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
-LIBS="-lpcre $LIBS"
|
||||
+LIBS="-lpcre2-8 $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
@@ -4460,7 +4465,7 @@ fi
|
||||
printf "%s\n" "$ac_cv_lib_pcre_main" >&6; }
|
||||
if test "x$ac_cv_lib_pcre_main" = xyes
|
||||
then :
|
||||
- LIBS="$LIBS -lpcre";
|
||||
+ LIBS="$LIBS -lpcre2-8";
|
||||
else $as_nop
|
||||
eixt
|
||||
fi
|
||||
diff --git a/configure.in b/configure.in
|
||||
index 335c1d7..d54d2a2 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -242,8 +242,13 @@ then
|
||||
LIBS="$LIBS -liconv"
|
||||
fi
|
||||
|
||||
-AC_CHECK_HEADER(pcre.h, [AC_DEFINE(HAVE_PCRE_H,1)], [])
|
||||
-AC_HAVE_LIBRARY(pcre, [ LIBS="$LIBS -lpcre"; ], [ eixt ])
|
||||
+CFLAGS_ORIG="$CFLAGS"
|
||||
+CFLAGS="$CFLAGS_ORIG -DPCRE2_CODE_UNIT_WIDTH=8"
|
||||
+export CFLAGS
|
||||
+AC_CHECK_HEADER(pcre2.h, [AC_DEFINE(HAVE_PCRE_H,1)], [])
|
||||
+CFLAGS="$CFLAGS_ORIG"
|
||||
+export CFLAGS
|
||||
+AC_HAVE_LIBRARY(pcre2-8, [ LIBS="$LIBS -lpcre2-8"; ], [ eixt ])
|
||||
|
||||
AC_HAVE_LIBRARY(rt, [ LIBS="$LIBS -lrt"; ], [])
|
||||
|
||||
diff --git a/src/class_system.c b/src/class_system.c
|
||||
index 907b41a..3fd5c33 100644
|
||||
--- a/src/class_system.c
|
||||
+++ b/src/class_system.c
|
||||
@@ -902,7 +902,7 @@ BOOL System_pcre_exec(CLVALUE** stack_ptr, CLVALUE* lvar, sVMInfo* info)
|
||||
/// convert Clover value to C value ///
|
||||
sRegexObject* regex_object_data = CLREGEX(regex->mObjectValue);
|
||||
|
||||
- pcre* regex_value = regex_object_data->mRegex;
|
||||
+ pcre2_code* regex_value = regex_object_data->mRegex;
|
||||
|
||||
sCLObject* object_data = CLOBJECT(str->mObjectValue);
|
||||
|
||||
@@ -910,13 +910,14 @@ BOOL System_pcre_exec(CLVALUE** stack_ptr, CLVALUE* lvar, sVMInfo* info)
|
||||
int len = object_data->mFields[1].mULongValue;
|
||||
|
||||
int ovec_max_value = ovec_max->mIntValue;
|
||||
- int* ovec_value = MCALLOC(1, sizeof(int)*ovec_max_value * 3);
|
||||
+ PCRE2_SIZE* ovec_value = NULL;
|
||||
|
||||
int offset_value = offset->mIntValue;
|
||||
|
||||
/// go ///
|
||||
- int options = PCRE_NEWLINE_LF;
|
||||
- int result = pcre_exec(regex_value, 0, str_value, len, offset_value, options, ovec_value, ovec_max_value*3);
|
||||
+ pcre2_match_data *match_data = pcre2_match_data_create_from_pattern(regex_value, NULL);
|
||||
+ int result = pcre2_match(regex_value, (PCRE2_SPTR)str_value, len, offset_value, 0, match_data, NULL);
|
||||
+ ovec_value = pcre2_get_ovector_pointer(match_data);
|
||||
|
||||
/// set result data on ovec object ///
|
||||
CLObject pcre_ovec_object = pcre_ovec->mObjectValue;
|
||||
@@ -938,7 +939,7 @@ BOOL System_pcre_exec(CLVALUE** stack_ptr, CLVALUE* lvar, sVMInfo* info)
|
||||
sCLObject* pcre_ovec_end_array_data = CLOBJECT(pcre_ovec_end_array);
|
||||
|
||||
int i;
|
||||
- for(i=0; i<ovec_max_value; i++) {
|
||||
+ for(i=0; i<result; i++) {
|
||||
if(i < pcre_ovec_start_array_data->mArrayNum) {
|
||||
pcre_ovec_start_array_data->mFields[i].mIntValue = ovec_value[i*2];
|
||||
}
|
||||
@@ -950,7 +951,7 @@ BOOL System_pcre_exec(CLVALUE** stack_ptr, CLVALUE* lvar, sVMInfo* info)
|
||||
(*stack_ptr)->mIntValue = result;
|
||||
(*stack_ptr)++;
|
||||
|
||||
- MFREE(ovec_value);
|
||||
+ pcre2_match_data_free(match_data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
diff --git a/src/common.h b/src/common.h
|
||||
index cd3ef23..bf457a5 100644
|
||||
--- a/src/common.h
|
||||
+++ b/src/common.h
|
||||
@@ -18,7 +18,8 @@
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <locale.h>
|
||||
-#include <pcre.h>
|
||||
+#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
+#include <pcre2.h>
|
||||
#include <dlfcn.h>
|
||||
#ifndef __USE_XOPEN
|
||||
#define __USE_XOPEN
|
||||
@@ -2209,7 +2210,7 @@ struct sRegexObjectStruct
|
||||
char* mType;
|
||||
int mSize;
|
||||
int mArrayNum;
|
||||
- pcre* mRegex;
|
||||
+ pcre2_code* mRegex;
|
||||
char* mRegexString;
|
||||
BOOL mGlobal;
|
||||
BOOL mIgnoreCase;
|
||||
diff --git a/src/regex.c b/src/regex.c
|
||||
index 135d142..26b6a56 100644
|
||||
--- a/src/regex.c
|
||||
+++ b/src/regex.c
|
||||
@@ -16,7 +16,7 @@ void regex_free_fun(CLObject obj)
|
||||
{
|
||||
sRegexObject* object_data = CLREGEX(obj);
|
||||
|
||||
- pcre_free(object_data->mRegex);
|
||||
+ pcre2_code_free(object_data->mRegex);
|
||||
MFREE(object_data->mRegexString);
|
||||
}
|
||||
|
||||
@@ -32,17 +32,21 @@ CLObject create_regex_object(char* regex, BOOL global, BOOL ignore_case, BOOL mu
|
||||
|
||||
sRegexObject* object_data = CLREGEX(obj);
|
||||
|
||||
- int option = ignore_case ? PCRE_CASELESS:0;
|
||||
+ int option = ignore_case ? PCRE2_CASELESS:0;
|
||||
|
||||
- const char* err;
|
||||
- int erro_ofs;
|
||||
+ int err;
|
||||
+ PCRE2_SIZE erro_ofs;
|
||||
|
||||
- int options = PCRE_UTF8 | (ignore_case ? PCRE_CASELESS:0) | (multiline ? PCRE_MULTILINE : 0) | (extended ? PCRE_EXTENDED :0) | (dotall ? PCRE_DOTALL :0) | (dollar_endonly ? PCRE_DOLLAR_ENDONLY:0) | (ungreedy ? PCRE_UNGREEDY:0);
|
||||
+ int options = PCRE2_UTF | (ignore_case ? PCRE2_CASELESS:0) | (multiline ? PCRE2_MULTILINE : 0) | (extended ? PCRE2_EXTENDED :0) | (dotall ? PCRE2_DOTALL :0) | (dollar_endonly ? PCRE2_DOLLAR_ENDONLY:0) | (ungreedy ? PCRE2_UNGREEDY:0);
|
||||
//int options = PCRE_UTF8 | (ignore_case ? PCRE_CASELESS:0) | (multiline ? PCRE_MULTILINE : 0) | (extended ? PCRE_EXTENDED :0) | (dotall ? PCRE_DOTALL :0) | (anchored ? PCRE_ANCHORED : 0) | (dollar_endonly ? PCRE_DOLLAR_ENDONLY) | (ungreedy ? PCRE_UNGREEDY);
|
||||
|
||||
object_data->mRegexString = MSTRDUP(regex);
|
||||
|
||||
- object_data->mRegex = pcre_compile(regex, options,&err, &erro_ofs, NULL);
|
||||
+ pcre2_compile_context *context = pcre2_compile_context_create(NULL);
|
||||
+ pcre2_set_newline(context, PCRE2_NEWLINE_LF);
|
||||
+ object_data->mRegex = pcre2_compile((PCRE2_SPTR)regex, PCRE2_ZERO_TERMINATED ,options,&err, &erro_ofs, context);
|
||||
+ pcre2_compile_context_free(context);
|
||||
+
|
||||
object_data->mGlobal = global;
|
||||
object_data->mIgnoreCase = ignore_case;
|
||||
object_data->mMultiline = multiline;
|
||||
--
|
||||
2.46.0
|
||||
|
||||
32
clover2-11.0.0-0002-block-TCGETA-usage-on-ppc64le.patch
Normal file
32
clover2-11.0.0-0002-block-TCGETA-usage-on-ppc64le.patch
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
From 420d0a508202a31cef8ae052f6b144ebea0d7804 Mon Sep 17 00:00:00 2001
|
||||
From: clover2 Fedora maintainer <clover2-owner@fedoraproject.org>
|
||||
Date: Thu, 8 May 2025 16:29:54 +0900
|
||||
Subject: [PATCH] block TCGETA usage on ppc64le
|
||||
|
||||
---
|
||||
src/class_system.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/class_system.c b/src/class_system.c
|
||||
index 3fd5c33..9eb6bea 100644
|
||||
--- a/src/class_system.c
|
||||
+++ b/src/class_system.c
|
||||
@@ -5203,6 +5203,7 @@ BOOL System_initialize_system_calls_system(CLVALUE** stack_ptr, CLVALUE* lvar, s
|
||||
#ifdef TCSETSF
|
||||
system->mClassFields[LAST_INITIALIZE_FIELD_NUM_ON_COMMAND_SYSTEM+125].mValue.mIntValue = TCSETSF;
|
||||
#endif
|
||||
+#ifndef __powerpc64__
|
||||
#ifdef TCGETA
|
||||
system->mClassFields[LAST_INITIALIZE_FIELD_NUM_ON_COMMAND_SYSTEM+126].mValue.mIntValue = TCGETA;
|
||||
#endif
|
||||
@@ -5215,6 +5216,7 @@ BOOL System_initialize_system_calls_system(CLVALUE** stack_ptr, CLVALUE* lvar, s
|
||||
#ifdef TCSETAF
|
||||
system->mClassFields[LAST_INITIALIZE_FIELD_NUM_ON_COMMAND_SYSTEM+129].mValue.mIntValue = TCSETAF;
|
||||
#endif
|
||||
+#endif
|
||||
#ifdef TCSBRK
|
||||
system->mClassFields[LAST_INITIALIZE_FIELD_NUM_ON_COMMAND_SYSTEM+130].mValue.mIntValue = TCSBRK;
|
||||
#endif
|
||||
--
|
||||
2.49.0
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
From 73f9fe3d40d3881223f3a9776732e31bdc8a459f Mon Sep 17 00:00:00 2001
|
||||
From: Tom Stellard <tstellar@redhat.com>
|
||||
Date: Sat, 8 Nov 2025 15:45:20 +0000
|
||||
Subject: [PATCH] Fix [-Wincompatible-pointer-types] warning
|
||||
|
||||
This fixes the build with clang >= 22 which has this warning as an
|
||||
error by default.
|
||||
---
|
||||
src/interpreter.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/interpreter.c b/src/interpreter.c
|
||||
index 44dfaa6..4708e7c 100644
|
||||
--- a/src/interpreter.c
|
||||
+++ b/src/interpreter.c
|
||||
@@ -945,7 +945,7 @@ void command_completion()
|
||||
struct stat stat_;
|
||||
if(stat(path2, &stat_) == 0) {
|
||||
if(stat_.st_mode & S_IXUSR) {
|
||||
- char* entry_d_name[PATH_MAX];
|
||||
+ char entry_d_name[PATH_MAX];
|
||||
|
||||
char* p = entry->d_name;
|
||||
char* p2 = entry_d_name;
|
||||
--
|
||||
2.50.1
|
||||
|
||||
55
clover2.spec
55
clover2.spec
|
|
@ -9,26 +9,33 @@
|
|||
%global tarballdate 20221008
|
||||
%global tarballtime 2308
|
||||
|
||||
%global toolchain clang
|
||||
%global toolchain clang
|
||||
|
||||
Name: clover2
|
||||
|
||||
# For Version, see README.md and so on
|
||||
Version: %{mainver}
|
||||
#Release: 10.D%{gitdate}git%{shortcommit}%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Release: 13%{?dist}
|
||||
Summary: Yet another compiler language
|
||||
|
||||
License: GPLv2
|
||||
# app-sample/ unused
|
||||
# SPDX confirmed
|
||||
License: GPL-2.0-only
|
||||
URL: https://github.com/ab25cq/clover2/wiki
|
||||
#Source0: https://github.com/ab25cq/%{name}/archive/%{gitcommit}/%{name}-%{version}-git%{shortcommit}.tar.gz
|
||||
Source0: %{name}-%{tarballdate}T%{tarballtime}.tar.gz
|
||||
Source1: create-clover-git-bare-tarball.sh
|
||||
# Port to pcre2 (bug 2128279)
|
||||
Patch1: clover2-11.0.0-0001-port-to-pcre2.patch
|
||||
# block TCGETA usage on ppc64le for now on 2.42
|
||||
Patch2: clover2-11.0.0-0002-block-TCGETA-usage-on-ppc64le.patch
|
||||
# Fix build with clang >= 22.
|
||||
Patch3: clover2-11.0.0-0003-Fix-Wincompatible-pointer-types-warning.patch
|
||||
|
||||
# Upstream suggests to use clang
|
||||
BuildRequires: clang
|
||||
BuildRequires: readline-devel
|
||||
BuildRequires: pcre-devel
|
||||
BuildRequires: pcre2-devel
|
||||
BuildRequires: gc-devel
|
||||
|
||||
BuildRequires: git
|
||||
|
|
@ -53,14 +60,12 @@ Regular expressions, lambda, closure etc are first class objects.
|
|||
|
||||
%package libs
|
||||
Summary: Library package needed for %{name}
|
||||
License: GPLv2
|
||||
|
||||
%description libs
|
||||
This package contains libraries needed for clover2.
|
||||
|
||||
%package devel
|
||||
Summary: Development files for %{name}
|
||||
License: GPLv2
|
||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||
|
||||
%description devel
|
||||
|
|
@ -80,6 +85,9 @@ git checkout -b %{version}-fedora %{gitcommit}
|
|||
cp -a [A-Z]* ..
|
||||
|
||||
# honor cflags, toolchain
|
||||
git rm --cached configure~
|
||||
git commit -m "untrack configure~" -a
|
||||
|
||||
sed -i.cflags configure.in configure \
|
||||
-e '\@CFLAGS=.*-DPREFIX=@s|-DPREFIX=|%build_cflags -DPREFIX=|' \
|
||||
-e 's|-O3|-O2|' \
|
||||
|
|
@ -90,6 +98,9 @@ sed -i.lib configure.in configure -e 's|/lib |/%{_lib} |'
|
|||
sed -i.lib Makefile.in -e 's|/lib$|/%{_lib}|'
|
||||
|
||||
git commit -m "Apply Fedora specific configuration" -a
|
||||
cat %PATCH1 | git am
|
||||
cat %PATCH2 | git am
|
||||
cat %PATCH3 | git am
|
||||
|
||||
%build
|
||||
cd clover2
|
||||
|
|
@ -144,6 +155,36 @@ LANG=C.utf8 make -C clover2 test
|
|||
%{_includedir}/clover2/
|
||||
|
||||
%changelog
|
||||
* Sat Nov 08 2025 Tom Stellard <tstellar@redhat.com> - 11.0.0-13
|
||||
- Fix build with clang >=22
|
||||
|
||||
* Wed Jul 23 2025 Fedora Release Engineering <releng@fedoraproject.org> - 11.0.0-12
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
|
||||
|
||||
* Thu May 08 2025 Mamoru TASAKA <mtasaka@fedoraproject.org> - 11.0.0-11
|
||||
- block TCGETA usage on ppc64le for now on 2.42
|
||||
|
||||
* Thu Jan 16 2025 Fedora Release Engineering <releng@fedoraproject.org> - 11.0.0-10
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
|
||||
|
||||
* Fri Aug 16 2024 Mamoru TASAKA <mtasaka@fedoraproject.org> - 11.0.0-9
|
||||
- Port to pcre2 (bug 2128279)
|
||||
|
||||
* Wed Jul 17 2024 Fedora Release Engineering <releng@fedoraproject.org> - 11.0.0-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
|
||||
|
||||
* Wed Mar 27 2024 Mamoru TASAKA <mtasaka@fedoraproject.org> - 11.0.0-7
|
||||
- Remove unneeded subpackge License tag
|
||||
|
||||
* Thu Feb 29 2024 Mamoru TASAKA <mtasaka@fedoraproject.org> - 11.0.0-6
|
||||
- SPDX migration
|
||||
|
||||
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 11.0.0-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 11.0.0-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 11.0.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue