From 2fc2675b66162c40328c1827bc9c864bb49ccc5dcfad4d5a2c9d0af167b81801 Mon Sep 17 00:00:00 2001 From: Mariusz Fik Date: Fri, 22 Aug 2014 21:45:10 +0000 Subject: [PATCH] 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 --- antlr-64bit.diff | 88 +++++++++++++++++++++++++++++++++++++++++++ antlr-libversion.diff | 22 +++++++++++ antlr3c.spec | 17 +++++---- 3 files changed, 120 insertions(+), 7 deletions(-) create mode 100644 antlr-64bit.diff create mode 100644 antlr-libversion.diff diff --git a/antlr-64bit.diff b/antlr-64bit.diff new file mode 100644 index 0000000..0a22d59 --- /dev/null +++ b/antlr-64bit.diff @@ -0,0 +1,88 @@ +Date: 2014-08-17 03:38:36.721411308 +0200 +From: Jan Engelhardt + +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 diff --git a/antlr-libversion.diff b/antlr-libversion.diff new file mode 100644 index 0000000..b87b13d --- /dev/null +++ b/antlr-libversion.diff @@ -0,0 +1,22 @@ +Date: 2014-08-17 03:44:06.100706672 +0200 +From: Jan Engelhardt + +"-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 + diff --git a/antlr3c.spec b/antlr3c.spec index c2b5c90..f1281ed 100644 --- a/antlr3c.spec +++ b/antlr3c.spec @@ -16,7 +16,7 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -%define soname libantlr3c +%define soname libantlr3c3_4 Name: antlr3c Version: 3.4 @@ -25,8 +25,11 @@ License: BSD-3-Clause Summary: C runtime for the ANTLR parsing library Url: http://www.antlr3.org/ Group: Development/Libraries/C and C++ + 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 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -39,7 +42,7 @@ translation, error recovery, and error reporting. %package -n %{soname} Summary: C runtime for the ANTLR parsing library -Group: Development/Libraries/C and C++ +Group: System/Libraries %description -n %{soname} ANTLR, ANother Tool for Language Recognition, is a language tool that provides a @@ -65,12 +68,11 @@ develop programs using the antlr3c library. %prep %setup -q -n lib%{name}-%{version} +%patch -P 1 -P 2 -p1 %build +autoreconf -fi %configure \ - %ifarch x86_64 - --enable-64bit \ - %endif --disable-static make %{?_smp_mflags} @@ -83,12 +85,13 @@ make %{?_smp_mflags} %files -n %{soname} %defattr(-,root,root) -%{_libdir}/libantlr3c.so +%{_libdir}/libantlr3c-%version.so %exclude %{_libdir}/libantlr3c.la %files devel %defattr(-,root,root,-) %doc AUTHORS ChangeLog COPYING NEWS README %{_includedir}/antlr3* +%{_libdir}/libantlr3c.so %changelog