Use pcre2 on Fedora 30+

This commit is contained in:
sagitter 2019-02-05 15:26:36 +01:00
parent e01be20279
commit c6dfe41d4e
2 changed files with 49 additions and 12 deletions

22
metis-pcre2.patch Normal file
View File

@ -0,0 +1,22 @@
--- GKlib/GKlib.orig.h 2013-03-30 17:24:45.000000000 +0100
+++ GKlib/GKlib.h 2019-02-05 14:45:44.051629682 +0100
@@ -43,7 +43,7 @@
#include <sys/stat.h>
#if defined(__WITHPCRE__)
- #include <pcreposix.h>
+ #include <pcre2posix.h>
#else
#if defined(USE_GKREGEX)
#include "gkregex.h"
--- GKlib/test/Makefile.in.orig.old 2013-03-30 17:24:45.000000000 +0100
+++ GKlib/test/Makefile.in.old 2019-02-05 15:04:35.009847901 +0100
@@ -196,7 +196,7 @@
#Libraries needed for linking
LIBSDIR = -L$(BUILDDIR) -L$(GKLIBBUILDDIR) -L$(HOME)/local/lib
- LIBS = -lGKlib -lpcreposix -lpcre -lz -lm
+ LIBS = -lGKlib -lpcre2-posix -lz -lm
# Standard file extensions
OBJEXT = .o

View File

@ -1,9 +1,3 @@
%undefine _ld_as_needed
%if 0%{?rhel} && 0%{?rhel} < 7
%{!?__global_ldflags: %global __global_ldflags -Wl,-z,relro}
%endif
%if %{?__isa_bits:%{__isa_bits}}%{!?__isa_bits:32} == 64 %if %{?__isa_bits:%{__isa_bits}}%{!?__isa_bits:32} == 64
%global arch64 1 %global arch64 1
%else %else
@ -38,8 +32,14 @@ Patch3: %{name}-GKREGEX-GKRAND-LIBSUFFIX-fix.patch
## Rename library of 64 integer version ## Rename library of 64 integer version
Patch4: %{name}_lib64.patch Patch4: %{name}_lib64.patch
Patch5: %{name}-pcre2.patch
BuildRequires: cmake3, gcc, gcc-c++ BuildRequires: cmake3, gcc, gcc-c++
%if 0%{?rhel} && 0%{?fedora} < 30
BuildRequires: pcre-devel BuildRequires: pcre-devel
%else
BuildRequires: pcre2-devel
%endif
BuildRequires: help2man BuildRequires: help2man
BuildRequires: chrpath BuildRequires: chrpath
@ -88,6 +88,9 @@ pushd %{name}-%{version}
%patch0 -p0 %patch0 -p0
%patch1 -p0 %patch1 -p0
%patch3 -p0 %patch3 -p0
%if 0%{?fedora} > 29
%patch5 -p0
%endif
## Remove default compiler flag ## Remove default compiler flag
sed -e 's|-O3||g' -i GKlib/GKlibSystem.cmake sed -e 's|-O3||g' -i GKlib/GKlibSystem.cmake
@ -99,14 +102,20 @@ cp -a %{name}-%{version} metis64
%build %build
pushd %{name}-%{version}/build pushd %{name}-%{version}/build
%if 0%{?rhel} && 0%{?fedora} < 30
PCRE_LDFLAGS="-lpcreposix"
%else
PCRE_LDFLAGS="-lpcre2-posix"
%endif
%cmake3 \ %cmake3 \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DGKLIB_PATH=../GKlib \ -DGKLIB_PATH=../GKlib \
-DSHARED:BOOL=TRUE \ -DSHARED:BOOL=TRUE \
-DOPENMP:BOOL=ON \ -DOPENMP:BOOL=ON \
-DPCRE:BOOL=ON \ -DPCRE:BOOL=ON \
-DCMAKE_C_FLAGS:STRING="%{optflags} -Wl,-z,relro -fPIC -pie -Wl,-z,now -pthread" \ -DCMAKE_C_FLAGS:STRING="%{optflags} -pthread" \
-DCMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING="%{__global_ldflags} -fPIC -pie -Wl,-z,now" \ -DCMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING="%{__global_ldflags} $PCRE_LDFLAGS" \
-DCMAKE_EXE_LINKER_FLAGS_RELEASE:STRING="%{__global_ldflags} -fPIC -pie -Wl,-z,now" \ -DCMAKE_EXE_LINKER_FLAGS_RELEASE:STRING="%{__global_ldflags} $PCRE_LDFLAGS" \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \
-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} .. -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} ..
%make_build %make_build
@ -118,14 +127,20 @@ patch -p0 < %{PATCH2}
patch -p0 < %{PATCH4} patch -p0 < %{PATCH4}
mkdir -p build64 mkdir -p build64
pushd build64 pushd build64
%if 0%{?rhel} && 0%{?fedora} < 30
PCRE_LDFLAGS="-lpcreposix"
%else
PCRE_LDFLAGS="-lpcre2-posix"
%endif
%cmake3 \ %cmake3 \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DGKLIB_PATH=../GKlib \ -DGKLIB_PATH=../GKlib \
-DSHARED:BOOL=TRUE \ -DSHARED:BOOL=TRUE \
-DOPENMP:BOOL=ON \ -DOPENMP:BOOL=ON \
-DPCRE:BOOL=ON \ -DPCRE:BOOL=ON \
-DCMAKE_C_FLAGS:STRING="%{optflags} -Wl,-z,relro -fPIC -pie -Wl,-z,now -pthread" \ -DCMAKE_C_FLAGS:STRING="%{optflags} -pthread" \
-DCMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING="%{__global_ldflags} -fPIC -pie -Wl,-z,now" \ -DCMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING="%{__global_ldflags} $PCRE_LDFLAGS" \
-DCMAKE_EXE_LINKER_FLAGS_RELEASE:STRING="%{__global_ldflags} -fPIC -pie -Wl,-z,now" \ -DCMAKE_EXE_LINKER_FLAGS_RELEASE:STRING="%{__global_ldflags} $PCRE_LDFLAGS" \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \
-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} .. -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} ..
%make_build %make_build