Accepting request 244976 from home:jengelh:branches:network:telephony

Throw out upstream's stupid 64-bit switch.
openSUSE shlib naming guidelines.

OBS-URL: https://build.opensuse.org/request/show/244976
OBS-URL: https://build.opensuse.org/package/show/network:telephony/antlr3c?expand=0&rev=2
This commit is contained in:
Mariusz Fik 2014-08-22 21:45:10 +00:00 committed by Git OBS Bridge
parent 34cb6d6bd1
commit 2fc2675b66
3 changed files with 120 additions and 7 deletions

88
antlr-64bit.diff Normal file
View File

@ -0,0 +1,88 @@
Date: 2014-08-17 03:38:36.721411308 +0200
From: Jan Engelhardt <jengelh@inai.de>
Do not unconditionally add _ANY_ -m32/-m64 onto the command line.
Instead, default to what the compiler uses (which may be influenced
by the user thorugh CFLAGS).
Use uintptr_t instead of guessing the size of pointers, which is a
lot more portable than this type mess.
With this done, one can see that USE_64BIT reduces to a choice of
size model which seems independent of pointer size.
---
configure.ac | 12 +++++++-----
include/antlr3defs.h | 12 ++++++------
2 files changed, 13 insertions(+), 11 deletions(-)
Index: libantlr3c-3.4/configure.ac
===================================================================
--- libantlr3c-3.4.orig/configure.ac
+++ libantlr3c-3.4/configure.ac
@@ -40,8 +40,8 @@ AC_ARG_ENABLE([debuginfo],
[], [enable_debuginfo=no])
AC_ARG_ENABLE([64bit],
- [AS_HELP_STRING([--enable-64bit], [Turns on flags that produce 64 bit object code if any are required (default --disable-64bit)])],
- [], [enable_64bit=no])
+ [AS_HELP_STRING([--enable-64bit], [Turns on flags that produce 64 bit object code if any are required (default: use compiler default)])],
+ [enable_64bit="$enableval"], [enable_64bit="auto"])
AC_ARG_ENABLE([abiflags],
[AS_HELP_STRING([--disable-abiflags], [Does not add ABI flags -m32 or -m64 for older versions of gcc, such as itanium 3.x (default --enable-abiflags=yes)])],
@@ -70,7 +70,7 @@ xlc*)
if test x"$enable_64bit" = xyes; then
CCFLAGS64="-q64 -Wl,-b64"
OBJECT_MODE="64"
- else
+ elif test x"$enable_64bit" = xno; then
OBJECT_MODE="32"
fi
OPTIMFLAGS="-O2"
@@ -94,7 +94,7 @@ gcc*)
CPPCMNTFLAGS=
if test x"$enable_64bit" = xyes; then
GCCABIFLAGS="-m64"
- else
+ elif test x"$enable_64bit" = xno; then
GCCABIFLAGS="-m32"
fi
if test x"$enable_abiflags" = xyes; then
@@ -139,7 +139,9 @@ AC_MSG_RESULT([$CFLAGS])
AC_SUBST([OBJECT_MODE])
AS_IF([test "x$enable_antlrdebug" = xno], [AC_DEFINE([ANTLR3_NODEBUGGER], [1], [Define if ANTLR debugger not required])], [])
-AS_IF([test x"$enable_64bit" = xyes], [AC_DEFINE([ANTLR3_USE_64BIT], [1], [Define if 64 bit mode required])], [])
+AC_CHECK_SIZEOF([void *])
+AC_CHECK_SIZEOF([long])
+AS_IF([test "$ac_cv_sizeof_void_p" = "$ac_cv_sizeof_long"], [AC_DEFINE([ANTLR3_USE_64BIT], [1], [Define if 64 bit model wanted])], [])
AC_PROG_INSTALL
AC_PROG_LN_S
Index: libantlr3c-3.4/include/antlr3defs.h
===================================================================
--- libantlr3c-3.4.orig/include/antlr3defs.h
+++ libantlr3c-3.4/include/antlr3defs.h
@@ -414,15 +414,15 @@ typedef FILE * ANTLR3_FDSC;
typedef struct stat ANTLR3_FSTAT_STRUCT;
#ifdef ANTLR3_USE_64BIT
-#define ANTLR3_FUNC_PTR(ptr) (void *)((ANTLR3_UINT64)(ptr))
-#define ANTLR3_UINT64_CAST(ptr) (ANTLR3_UINT64)(ptr))
-#define ANTLR3_UINT32_CAST(ptr) (ANTLR3_UINT32)((ANTLR3_UINT64)(ptr))
+#define ANTLR3_FUNC_PTR(ptr) ((void *)(uintptr_t)(ptr))
+#define ANTLR3_UINT64_CAST(ptr) ((ANTLR3_UINT64)(uintptr_t)(ptr))
+#define ANTLR3_UINT32_CAST(ptr) ((ANTLR3_UINT32)(uintptr_t)(ptr))
typedef ANTLR3_INT64 ANTLR3_MARKER;
typedef ANTLR3_UINT64 ANTLR3_INTKEY;
#else
-#define ANTLR3_FUNC_PTR(ptr) (void *)((ANTLR3_UINT32)(ptr))
-#define ANTLR3_UINT64_CAST(ptr) (ANTLR3_UINT64)((ANTLR3_UINT32)(ptr))
-#define ANTLR3_UINT32_CAST(ptr) (ANTLR3_UINT32)(ptr)
+#define ANTLR3_FUNC_PTR(ptr) ((void *)(uintptr_t)(ptr))
+#define ANTLR3_UINT64_CAST(ptr) ((ANTLR3_UINT64)(uintptr_t)(ptr))
+#define ANTLR3_UINT32_CAST(ptr) ((ANTLR3_UINT32)(uintptr_t)(ptr))
typedef ANTLR3_INT32 ANTLR3_MARKER;
typedef ANTLR3_UINT32 ANTLR3_INTKEY;
#endif

22
antlr-libversion.diff Normal file
View File

@ -0,0 +1,22 @@
Date: 2014-08-17 03:44:06.100706672 +0200
From: Jan Engelhardt <jengelh@inai.de>
"-avoid-version" does not count for compatibility guarantees.
Use one of -version-info, -release or -Wl,--version-script!
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: libantlr3c-3.4/Makefile.am
===================================================================
--- libantlr3c-3.4.orig/Makefile.am
+++ libantlr3c-3.4/Makefile.am
@@ -62,7 +62,7 @@ include_HEADERS = include/antlr3.h
include/antlr3treeparser.h \
antlr3config.h
-libantlr3c_la_LDFLAGS = -avoid-version
+libantlr3c_la_LDFLAGS = -release ${PACKAGE_VERSION}
INCLUDES = -Iinclude

View File

@ -16,7 +16,7 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via http://bugs.opensuse.org/
# #
%define soname libantlr3c %define soname libantlr3c3_4
Name: antlr3c Name: antlr3c
Version: 3.4 Version: 3.4
@ -25,8 +25,11 @@ License: BSD-3-Clause
Summary: C runtime for the ANTLR parsing library Summary: C runtime for the ANTLR parsing library
Url: http://www.antlr3.org/ Url: http://www.antlr3.org/
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Source: http://www.antlr3.org/download/C/lib%{name}-%{version}.tar.gz Source: http://www.antlr3.org/download/C/lib%{name}-%{version}.tar.gz
BuildRequires: gcc Patch1: antlr-64bit.diff
Patch2: antlr-libversion.diff
BuildRequires: gcc autoconf automake libtool
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -39,7 +42,7 @@ translation, error recovery, and error reporting.
%package -n %{soname} %package -n %{soname}
Summary: C runtime for the ANTLR parsing library Summary: C runtime for the ANTLR parsing library
Group: Development/Libraries/C and C++ Group: System/Libraries
%description -n %{soname} %description -n %{soname}
ANTLR, ANother Tool for Language Recognition, is a language tool that provides a ANTLR, ANother Tool for Language Recognition, is a language tool that provides a
@ -65,12 +68,11 @@ develop programs using the antlr3c library.
%prep %prep
%setup -q -n lib%{name}-%{version} %setup -q -n lib%{name}-%{version}
%patch -P 1 -P 2 -p1
%build %build
autoreconf -fi
%configure \ %configure \
%ifarch x86_64
--enable-64bit \
%endif
--disable-static --disable-static
make %{?_smp_mflags} make %{?_smp_mflags}
@ -83,12 +85,13 @@ make %{?_smp_mflags}
%files -n %{soname} %files -n %{soname}
%defattr(-,root,root) %defattr(-,root,root)
%{_libdir}/libantlr3c.so %{_libdir}/libantlr3c-%version.so
%exclude %{_libdir}/libantlr3c.la %exclude %{_libdir}/libantlr3c.la
%files devel %files devel
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README %doc AUTHORS ChangeLog COPYING NEWS README
%{_includedir}/antlr3* %{_includedir}/antlr3*
%{_libdir}/libantlr3c.so
%changelog %changelog