Compare commits
No commits in common. "1056ae12f4c0eba3071eaac35a2f9336df51ec46" and "cb92386e4d0e421535c8f14d4fb30fbe6ad04555" have entirely different histories.
1056ae12f4
...
cb92386e4d
@ -1,209 +0,0 @@
|
|||||||
From d099ec11fc8c2eb97df2bf2fbb6996066eefca46 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Stanislav Ochotnicky <sochotnicky@redhat.com>
|
|
||||||
Date: Thu, 2 May 2013 10:43:47 +0200
|
|
||||||
Subject: [PATCH] Add generic GCC support for atomic operations
|
|
||||||
|
|
||||||
This is useful for architectures where no specialized code has been
|
|
||||||
written.
|
|
||||||
---
|
|
||||||
src/google/protobuf/stubs/atomicops.h | 2 +-
|
|
||||||
.../stubs/atomicops_internals_generic_gcc.h | 139 +++++++++++++++++++++
|
|
||||||
src/google/protobuf/stubs/platform_macros.h | 14 ++-
|
|
||||||
3 files changed, 153 insertions(+), 2 deletions(-)
|
|
||||||
create mode 100644 src/google/protobuf/stubs/atomicops_internals_generic_gcc.h
|
|
||||||
|
|
||||||
diff --git a/src/google/protobuf/stubs/atomicops.h b/src/google/protobuf/stubs/atomicops.h
|
|
||||||
index b8581fa..883b125 100644
|
|
||||||
--- a/src/google/protobuf/stubs/atomicops.h
|
|
||||||
+++ b/src/google/protobuf/stubs/atomicops.h
|
|
||||||
@@ -185,7 +185,7 @@ GOOGLE_PROTOBUF_ATOMICOPS_ERROR
|
|
||||||
#elif defined(__pnacl__)
|
|
||||||
#include <google/protobuf/stubs/atomicops_internals_pnacl.h>
|
|
||||||
#else
|
|
||||||
-GOOGLE_PROTOBUF_ATOMICOPS_ERROR
|
|
||||||
+#include <google/protobuf/stubs/atomicops_internals_generic_gcc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Unknown.
|
|
||||||
diff --git a/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h b/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..3fc2a9b
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h
|
|
||||||
@@ -0,0 +1,139 @@
|
|
||||||
+// Protocol Buffers - Google's data interchange format
|
|
||||||
+// Copyright 2013 Red Hat Inc. All rights reserved.
|
|
||||||
+// http://code.google.com/p/protobuf/
|
|
||||||
+//
|
|
||||||
+// Redistribution and use in source and binary forms, with or without
|
|
||||||
+// modification, are permitted provided that the following conditions are
|
|
||||||
+// met:
|
|
||||||
+//
|
|
||||||
+// * Redistributions of source code must retain the above copyright
|
|
||||||
+// notice, this list of conditions and the following disclaimer.
|
|
||||||
+// * Redistributions in binary form must reproduce the above
|
|
||||||
+// copyright notice, this list of conditions and the following disclaimer
|
|
||||||
+// in the documentation and/or other materials provided with the
|
|
||||||
+// distribution.
|
|
||||||
+// * Neither the name of Red Hat Inc. nor the names of its
|
|
||||||
+// contributors may be used to endorse or promote products derived from
|
|
||||||
+// this software without specific prior written permission.
|
|
||||||
+//
|
|
||||||
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
+
|
|
||||||
+// This file is an internal atomic implementation, use atomicops.h instead.
|
|
||||||
+
|
|
||||||
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_GENERIC_GCC_H_
|
|
||||||
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_GENERIC_GCC_H_
|
|
||||||
+
|
|
||||||
+namespace google {
|
|
||||||
+namespace protobuf {
|
|
||||||
+namespace internal {
|
|
||||||
+
|
|
||||||
+inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 old_value,
|
|
||||||
+ Atomic32 new_value) {
|
|
||||||
+ __atomic_compare_exchange_n(ptr, &old_value, new_value, true,
|
|
||||||
+ __ATOMIC_RELAXED, __ATOMIC_RELAXED);
|
|
||||||
+ return old_value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 new_value) {
|
|
||||||
+ return __atomic_exchange_n(ptr, new_value, __ATOMIC_RELAXED);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 increment) {
|
|
||||||
+ return __atomic_add_fetch(ptr, increment, __ATOMIC_RELAXED);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 increment) {
|
|
||||||
+ return __atomic_add_fetch(ptr, increment, __ATOMIC_SEQ_CST);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 old_value,
|
|
||||||
+ Atomic32 new_value) {
|
|
||||||
+ __atomic_compare_exchange(ptr, &old_value, &new_value, true,
|
|
||||||
+ __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);
|
|
||||||
+ return old_value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 old_value,
|
|
||||||
+ Atomic32 new_value) {
|
|
||||||
+ __atomic_compare_exchange_n(ptr, &old_value, new_value, true,
|
|
||||||
+ __ATOMIC_RELEASE, __ATOMIC_ACQUIRE);
|
|
||||||
+ return old_value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
|
|
||||||
+ __atomic_store_n(ptr, value, __ATOMIC_RELAXED);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void MemoryBarrier() {
|
|
||||||
+ __sync_synchronize();
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
|
|
||||||
+ __atomic_store_n(ptr, value, __ATOMIC_ACQUIRE);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
|
|
||||||
+ __atomic_store_n(ptr, value, __ATOMIC_RELEASE);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
|
|
||||||
+ return __atomic_load_n(ptr, __ATOMIC_RELAXED);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
|
|
||||||
+ return __atomic_load_n(ptr, __ATOMIC_ACQUIRE);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
|
|
||||||
+ return __atomic_load_n(ptr, __ATOMIC_RELEASE);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#ifdef __LP64__
|
|
||||||
+
|
|
||||||
+inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
|
|
||||||
+ __atomic_store_n(ptr, value, __ATOMIC_RELEASE);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
|
|
||||||
+ return __atomic_load_n(ptr, __ATOMIC_ACQUIRE);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
|
|
||||||
+ Atomic64 old_value,
|
|
||||||
+ Atomic64 new_value) {
|
|
||||||
+ __atomic_compare_exchange_n(ptr, &old_value, new_value, true,
|
|
||||||
+ __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);
|
|
||||||
+ return old_value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
|
|
||||||
+ Atomic64 old_value,
|
|
||||||
+ Atomic64 new_value) {
|
|
||||||
+ __atomic_compare_exchange_n(ptr, &old_value, new_value, true,
|
|
||||||
+ __ATOMIC_RELAXED, __ATOMIC_RELAXED);
|
|
||||||
+ return old_value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#endif // defined(__LP64__)
|
|
||||||
+
|
|
||||||
+} // namespace internal
|
|
||||||
+} // namespace protobuf
|
|
||||||
+} // namespace google
|
|
||||||
+
|
|
||||||
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_GENERIC_GCC_H_
|
|
||||||
diff --git a/src/google/protobuf/stubs/platform_macros.h b/src/google/protobuf/stubs/platform_macros.h
|
|
||||||
index b1df60e..db691d8 100644
|
|
||||||
--- a/src/google/protobuf/stubs/platform_macros.h
|
|
||||||
+++ b/src/google/protobuf/stubs/platform_macros.h
|
|
||||||
@@ -43,6 +43,9 @@
|
|
||||||
#elif defined(_M_IX86) || defined(__i386__)
|
|
||||||
#define GOOGLE_PROTOBUF_ARCH_IA32 1
|
|
||||||
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
|
|
||||||
+#elif defined(__aarch64__)
|
|
||||||
+#define GOOGLE_PROTOBUF_ARCH_AARCH64 1
|
|
||||||
+#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
|
|
||||||
#elif defined(__QNX__)
|
|
||||||
#define GOOGLE_PROTOBUF_ARCH_ARM_QNX 1
|
|
||||||
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
|
|
||||||
@@ -54,9 +57,18 @@
|
|
||||||
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
|
|
||||||
#elif defined(__pnacl__)
|
|
||||||
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
|
|
||||||
-#elif defined(__ppc__)
|
|
||||||
+#elif defined(__ppc64__) || defined(__PPC64__)
|
|
||||||
+#define GOOGLE_PROTOBUF_ARCH_PPC64 1
|
|
||||||
+#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
|
|
||||||
+#elif defined(__ppc__) || defined(__PPC__)
|
|
||||||
#define GOOGLE_PROTOBUF_ARCH_PPC 1
|
|
||||||
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
|
|
||||||
+#elif defined(__s390x__)
|
|
||||||
+#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
|
|
||||||
+#define GOOGLE_PROTOBUF_ARCH_S390X 1
|
|
||||||
+#elif defined(__s390__)
|
|
||||||
+#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
|
|
||||||
+#define GOOGLE_PROTOBUF_ARCH_S390 1
|
|
||||||
#else
|
|
||||||
#error Host architecture was not detected as supported by protobuf
|
|
||||||
#endif
|
|
||||||
--
|
|
||||||
1.8.1.4
|
|
||||||
|
|
||||||
@ -1,379 +0,0 @@
|
|||||||
From 9c9e1156d8e2e8e0e30c32669e3ca67d5b10c902 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jingyun Hua <huajingyun@loongson.cn>
|
|
||||||
Date: Tue, 23 May 2023 08:15:12 +0000
|
|
||||||
Subject: [PATCH] protobuf2: add support for loongarch64
|
|
||||||
|
|
||||||
Signed-off-by: Jingyun Hua <huajingyun@loongson.cn>
|
|
||||||
---
|
|
||||||
autogen.sh | 5 +-
|
|
||||||
configure.ac | 2 +-
|
|
||||||
src/Makefile.am | 1 +
|
|
||||||
src/google/protobuf/stubs/atomicops.h | 2 +
|
|
||||||
.../atomicops_internals_loongarch64_gcc.h | 286 ++++++++++++++++++
|
|
||||||
src/google/protobuf/stubs/platform_macros.h | 3 +
|
|
||||||
6 files changed, 296 insertions(+), 3 deletions(-)
|
|
||||||
create mode 100644 src/google/protobuf/stubs/atomicops_internals_loongarch64_gcc.h
|
|
||||||
|
|
||||||
diff --git a/autogen.sh b/autogen.sh
|
|
||||||
index c3e026d..d22d73c 100755
|
|
||||||
--- a/autogen.sh
|
|
||||||
+++ b/autogen.sh
|
|
||||||
@@ -19,8 +19,9 @@ fi
|
|
||||||
# directory is set up as an SVN external.
|
|
||||||
if test ! -e gtest; then
|
|
||||||
echo "Google Test not present. Fetching gtest-1.5.0 from the web..."
|
|
||||||
- curl http://googletest.googlecode.com/files/gtest-1.5.0.tar.bz2 | tar jx
|
|
||||||
- mv gtest-1.5.0 gtest
|
|
||||||
+# curl http://googletest.googlecode.com/files/gtest-1.5.0.tar.bz2 | tar jx
|
|
||||||
+ curl https://github.com/google/googletest/archive/release-1.5.0.tar.gz |tar jx
|
|
||||||
+ mv googletest-release-1.5.0 gtest
|
|
||||||
fi
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index b232529..48ef60a 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -29,7 +29,7 @@ AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],
|
|
||||||
|
|
||||||
AC_CANONICAL_TARGET
|
|
||||||
|
|
||||||
-AM_INIT_AUTOMAKE
|
|
||||||
+AM_INIT_AUTOMAKE([subdir-objects])
|
|
||||||
|
|
||||||
AC_ARG_WITH([zlib],
|
|
||||||
[AS_HELP_STRING([--with-zlib],
|
|
||||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
|
||||||
index 6f5c21d..00cce72 100644
|
|
||||||
--- a/src/Makefile.am
|
|
||||||
+++ b/src/Makefile.am
|
|
||||||
@@ -48,6 +48,7 @@ nobase_include_HEADERS = \
|
|
||||||
google/protobuf/stubs/atomicops_internals_pnacl.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_x86_gcc.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_x86_msvc.h \
|
|
||||||
+ google/protobuf/stubs/atomicops_internals_loongarch64_gcc.h \
|
|
||||||
google/protobuf/stubs/common.h \
|
|
||||||
google/protobuf/stubs/platform_macros.h \
|
|
||||||
google/protobuf/stubs/once.h \
|
|
||||||
diff --git a/src/google/protobuf/stubs/atomicops.h b/src/google/protobuf/stubs/atomicops.h
|
|
||||||
index 883b125..3c0e154 100644
|
|
||||||
--- a/src/google/protobuf/stubs/atomicops.h
|
|
||||||
+++ b/src/google/protobuf/stubs/atomicops.h
|
|
||||||
@@ -184,6 +184,8 @@ GOOGLE_PROTOBUF_ATOMICOPS_ERROR
|
|
||||||
#include <google/protobuf/stubs/atomicops_internals_mips_gcc.h>
|
|
||||||
#elif defined(__pnacl__)
|
|
||||||
#include <google/protobuf/stubs/atomicops_internals_pnacl.h>
|
|
||||||
+#elif defined(GOOGLE_PROTOBUF_ARCH_LOONGARCH64)
|
|
||||||
+#include <google/protobuf/stubs/atomicops_internals_loongarch64_gcc.h>
|
|
||||||
#else
|
|
||||||
#include <google/protobuf/stubs/atomicops_internals_generic_gcc.h>
|
|
||||||
#endif
|
|
||||||
diff --git a/src/google/protobuf/stubs/atomicops_internals_loongarch64_gcc.h b/src/google/protobuf/stubs/atomicops_internals_loongarch64_gcc.h
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..4bbdf70
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/google/protobuf/stubs/atomicops_internals_loongarch64_gcc.h
|
|
||||||
@@ -0,0 +1,286 @@
|
|
||||||
+// Protocol Buffers - Google's data interchange format
|
|
||||||
+// Copyright 2012 Google Inc. All rights reserved.
|
|
||||||
+// http://code.google.com/p/protobuf/
|
|
||||||
+//
|
|
||||||
+// Redistribution and use in source and binary forms, with or without
|
|
||||||
+// modification, are permitted provided that the following conditions are
|
|
||||||
+// met:
|
|
||||||
+//
|
|
||||||
+// * Redistributions of source code must retain the above copyright
|
|
||||||
+// notice, this list of conditions and the following disclaimer.
|
|
||||||
+// * Redistributions in binary form must reproduce the above
|
|
||||||
+// copyright notice, this list of conditions and the following disclaimer
|
|
||||||
+// in the documentation and/or other materials provided with the
|
|
||||||
+// distribution.
|
|
||||||
+// * Neither the name of Google Inc. nor the names of its
|
|
||||||
+// contributors may be used to endorse or promote products derived from
|
|
||||||
+// this software without specific prior written permission.
|
|
||||||
+//
|
|
||||||
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
+
|
|
||||||
+// This file is an internal atomic implementation, use atomicops.h instead.
|
|
||||||
+
|
|
||||||
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_LOONGARCH64_GCC_H_
|
|
||||||
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_LOONGARCH64_GCC_H_
|
|
||||||
+
|
|
||||||
+#define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory")
|
|
||||||
+
|
|
||||||
+namespace google {
|
|
||||||
+namespace protobuf {
|
|
||||||
+namespace internal {
|
|
||||||
+
|
|
||||||
+// Atomically execute:
|
|
||||||
+// result = *ptr;
|
|
||||||
+// if (*ptr == old_value)
|
|
||||||
+// *ptr = new_value;
|
|
||||||
+// return result;
|
|
||||||
+//
|
|
||||||
+// I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value".
|
|
||||||
+// Always return the old value of "*ptr"
|
|
||||||
+//
|
|
||||||
+// This routine implies no memory barriers.
|
|
||||||
+
|
|
||||||
+inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 old_value,
|
|
||||||
+ Atomic32 new_value) {
|
|
||||||
+ Atomic32 prev, tmp;
|
|
||||||
+ __asm__ __volatile__("1:\n"
|
|
||||||
+ "ll.w %0, %5\n" // prev = *ptr
|
|
||||||
+ "bne %0, %3, 2f\n" // if (prev != old_value) goto 2
|
|
||||||
+ "move %2, %4\n" // tmp = new_value
|
|
||||||
+ "sc.w %2, %1\n" // *ptr = tmp (with atomic check)
|
|
||||||
+ "beqz %2, 1b\n" // start again on atomic error
|
|
||||||
+ "2:\n"
|
|
||||||
+ : "=&r" (prev), "=m" (*ptr), "=&r" (tmp)
|
|
||||||
+ : "r" (old_value), "r" (new_value), "m" (*ptr)
|
|
||||||
+ : "memory");
|
|
||||||
+ return prev;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+// Atomically store new_value into *ptr, returning the previous value held in
|
|
||||||
+// *ptr. This routine implies no memory barriers.
|
|
||||||
+inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 new_value) {
|
|
||||||
+ Atomic32 temp, old;
|
|
||||||
+ __asm__ __volatile__("1:\n"
|
|
||||||
+ "ll.w %1, %2\n" // old = *ptr
|
|
||||||
+ "move %0, %3\n" // temp = new_value
|
|
||||||
+ "sc.w %0, %2\n" // *ptr = temp (with atomic check)
|
|
||||||
+ "beqz %0, 1b\n" // start again on atomic error
|
|
||||||
+ : "=&r" (temp), "=&r" (old), "=m" (*ptr)
|
|
||||||
+ : "r" (new_value), "m" (*ptr)
|
|
||||||
+ : "memory");
|
|
||||||
+
|
|
||||||
+ return old;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+// Atomically increment *ptr by "increment". Returns the new value of
|
|
||||||
+// *ptr with the increment applied. This routine implies no memory barriers.
|
|
||||||
+inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 increment) {
|
|
||||||
+ Atomic32 temp, temp2;
|
|
||||||
+
|
|
||||||
+ __asm__ __volatile__("1:\n"
|
|
||||||
+ "ll.w %0, %2\n" // temp = *ptr
|
|
||||||
+ "add.w %1, %0, %3\n" // temp2 = temp + increment
|
|
||||||
+ "sc.w %1, %2\n" // *ptr = temp2 (with atomic check)
|
|
||||||
+ "beqz %1, 1b\n" // start again on atomic error
|
|
||||||
+ "add.w %1, %0, %3\n" // temp2 = temp + increment
|
|
||||||
+ : "=&r" (temp), "=&r" (temp2), "=m" (*ptr)
|
|
||||||
+ : "r" (increment), "m" (*ptr)
|
|
||||||
+ : "memory");
|
|
||||||
+ // temp2 now holds the final value.
|
|
||||||
+ return temp2;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 increment) {
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ Atomic32 res = NoBarrier_AtomicIncrement(ptr, increment);
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ return res;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+// "Acquire" operations
|
|
||||||
+// ensure that no later memory access can be reordered ahead of the operation.
|
|
||||||
+// "Release" operations ensure that no previous memory access can be reordered
|
|
||||||
+// after the operation. "Barrier" operations have both "Acquire" and "Release"
|
|
||||||
+// semantics. A MemoryBarrier() has "Barrier" semantics, but does no memory
|
|
||||||
+// access.
|
|
||||||
+inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 old_value,
|
|
||||||
+ Atomic32 new_value) {
|
|
||||||
+ Atomic32 res = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ return res;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 old_value,
|
|
||||||
+ Atomic32 new_value) {
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
|
|
||||||
+ *ptr = value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
|
|
||||||
+ *ptr = value;
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ *ptr = value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
|
|
||||||
+ return *ptr;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
|
|
||||||
+ Atomic32 value = *ptr;
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ return value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ return *ptr;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+//64bit
|
|
||||||
+inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
|
|
||||||
+ Atomic64 old_value,
|
|
||||||
+ Atomic64 new_value) {
|
|
||||||
+ Atomic64 prev, tmp;
|
|
||||||
+ __asm__ __volatile__("1:\n"
|
|
||||||
+ "ll.w %0, %5\n" // prev = *ptr
|
|
||||||
+ "bne %0, %3, 2f\n" // if (prev != old_value) goto 2
|
|
||||||
+ "move %2, %4\n" // tmp = new_value
|
|
||||||
+ "sc.w %2, %1\n" // *ptr = tmp (with atomic check)
|
|
||||||
+ "beqz %2, 1b\n" // start again on atomic error
|
|
||||||
+ "2:\n"
|
|
||||||
+ : "=&r" (prev), "=m" (*ptr), "=&r" (tmp)
|
|
||||||
+ : "r" (old_value), "r" (new_value), "m" (*ptr)
|
|
||||||
+ : "memory");
|
|
||||||
+ return prev;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+// Atomically store new_value into *ptr, returning the previous value held in
|
|
||||||
+// *ptr. This routine implies no memory barriers.
|
|
||||||
+inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
|
|
||||||
+ Atomic64 new_value) {
|
|
||||||
+ Atomic64 temp, old;
|
|
||||||
+ __asm__ __volatile__("1:\n"
|
|
||||||
+ "ll.w %1, %2\n" // old = *ptr
|
|
||||||
+ "move %0, %3\n" // temp = new_value
|
|
||||||
+ "sc.w %0, %2\n" // *ptr = temp (with atomic check)
|
|
||||||
+ "beqz %0, 1b\n" // start again on atomic error
|
|
||||||
+ : "=&r" (temp), "=&r" (old), "=m" (*ptr)
|
|
||||||
+ : "r" (new_value), "m" (*ptr)
|
|
||||||
+ : "memory");
|
|
||||||
+
|
|
||||||
+ return old;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+// Atomically increment *ptr by "increment". Returns the new value of
|
|
||||||
+// *ptr with the increment applied. This routine implies no memory barriers.
|
|
||||||
+inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
|
|
||||||
+ Atomic64 increment) {
|
|
||||||
+ Atomic64 temp, temp2;
|
|
||||||
+
|
|
||||||
+ __asm__ __volatile__("1:\n"
|
|
||||||
+ "ll.w %0, %2\n" // temp = *ptr
|
|
||||||
+ "add.w %1, %0, %3\n" // temp2 = temp + increment
|
|
||||||
+ "sc.w %1, %2\n" // *ptr = temp2 (with atomic check)
|
|
||||||
+ "beqz %1, 1b\n" // start again on atomic error
|
|
||||||
+ "add.w %1, %0, %3\n" // temp2 = temp + increment
|
|
||||||
+ : "=&r" (temp), "=&r" (temp2), "=m" (*ptr)
|
|
||||||
+ : "r" (increment), "m" (*ptr)
|
|
||||||
+ : "memory");
|
|
||||||
+ // temp2 now holds the final value.
|
|
||||||
+ return temp2;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr,
|
|
||||||
+ Atomic64 increment) {
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ Atomic64 res = NoBarrier_AtomicIncrement(ptr, increment);
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ return res;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+// "Acquire" operations
|
|
||||||
+// ensure that no later memory access can be reordered ahead of the operation.
|
|
||||||
+// "Release" operations ensure that no previous memory access can be reordered
|
|
||||||
+// after the operation. "Barrier" operations have both "Acquire" and "Release"
|
|
||||||
+// semantics. A MemoryBarrier() has "Barrier" semantics, but does no memory
|
|
||||||
+// access.
|
|
||||||
+inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
|
|
||||||
+ Atomic64 old_value,
|
|
||||||
+ Atomic64 new_value) {
|
|
||||||
+ Atomic64 res = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ return res;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
|
|
||||||
+ Atomic64 old_value,
|
|
||||||
+ Atomic64 new_value) {
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
|
|
||||||
+ *ptr = value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void MemoryBarrier() {
|
|
||||||
+ __asm__ __volatile__("dbar 0x0" : : : "memory");
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
|
|
||||||
+ *ptr = value;
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ *ptr = value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
|
|
||||||
+ return *ptr;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
|
|
||||||
+ Atomic64 value = *ptr;
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ return value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ return *ptr;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+} // namespace internal
|
|
||||||
+} // namespace protobuf
|
|
||||||
+} // namespace google
|
|
||||||
+
|
|
||||||
+#undef ATOMICOPS_COMPILER_BARRIER
|
|
||||||
+
|
|
||||||
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_LOONGARCH64_GCC_H_
|
|
||||||
diff --git a/src/google/protobuf/stubs/platform_macros.h b/src/google/protobuf/stubs/platform_macros.h
|
|
||||||
index db691d8..3e17fea 100644
|
|
||||||
--- a/src/google/protobuf/stubs/platform_macros.h
|
|
||||||
+++ b/src/google/protobuf/stubs/platform_macros.h
|
|
||||||
@@ -69,6 +69,9 @@
|
|
||||||
#elif defined(__s390__)
|
|
||||||
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
|
|
||||||
#define GOOGLE_PROTOBUF_ARCH_S390 1
|
|
||||||
+#elif defined(_LOONGARCH_ARCH_LOONGARCH64)
|
|
||||||
+#define GOOGLE_PROTOBUF_ARCH_LOONGARCH64 1
|
|
||||||
+#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
|
|
||||||
#else
|
|
||||||
#error Host architecture was not detected as supported by protobuf
|
|
||||||
#endif
|
|
||||||
--
|
|
||||||
2.33.0
|
|
||||||
|
|
||||||
@ -1,355 +0,0 @@
|
|||||||
diff -ur --new-file protobuf-2.5.0/src/google/protobuf/stubs/atomicops.h protobuf-2.5.0/src/google/protobuf/stubs/atomicops.h
|
|
||||||
--- protobuf-2.5.0/src/google/protobuf/stubs/atomicops.h 2023-07-27 21:16:40.005186825 +0800
|
|
||||||
+++ protobuf-2.5.0/src/google/protobuf/stubs/atomicops.h 2023-07-27 21:24:31.862046665 +0800
|
|
||||||
@@ -184,6 +184,8 @@
|
|
||||||
#include <google/protobuf/stubs/atomicops_internals_mips_gcc.h>
|
|
||||||
#elif defined(__pnacl__)
|
|
||||||
#include <google/protobuf/stubs/atomicops_internals_pnacl.h>
|
|
||||||
+#elif defined(GOOGLE_PROTOBUF_ARCH_RISCV64)
|
|
||||||
+#include <google/protobuf/stubs/atomicops_internals_riscv64_gcc.h>
|
|
||||||
#else
|
|
||||||
#include <google/protobuf/stubs/atomicops_internals_generic_gcc.h>
|
|
||||||
#endif
|
|
||||||
diff -ur --new-file protobuf-2.5.0/src/google/protobuf/stubs/atomicops_internals_riscv64_gcc.h protobuf-2.5.0/src/google/protobuf/stubs/atomicops_internals_riscv64_gcc.h
|
|
||||||
--- protobuf-2.5.0/src/google/protobuf/stubs/atomicops_internals_riscv64_gcc.h 1970-01-01 08:00:00.000000000 +0800
|
|
||||||
+++ protobuf-2.5.0/src/google/protobuf/stubs/atomicops_internals_riscv64_gcc.h 2023-07-27 21:27:17.770362136 +0800
|
|
||||||
@@ -0,0 +1,295 @@
|
|
||||||
+// Protocol Buffers - Google's data interchange format
|
|
||||||
+// Copyright 2012 Google Inc. All rights reserved.
|
|
||||||
+// http://code.google.com/p/protobuf/
|
|
||||||
+//
|
|
||||||
+// Redistribution and use in source and binary forms, with or without
|
|
||||||
+// modification, are permitted provided that the following conditions are
|
|
||||||
+// met:
|
|
||||||
+//
|
|
||||||
+// * Redistributions of source code must retain the above copyright
|
|
||||||
+// notice, this list of conditions and the following disclaimer.
|
|
||||||
+// * Redistributions in binary form must reproduce the above
|
|
||||||
+// copyright notice, this list of conditions and the following disclaimer
|
|
||||||
+// in the documentation and/or other materials provided with the
|
|
||||||
+// distribution.
|
|
||||||
+// * Neither the name of Google Inc. nor the names of its
|
|
||||||
+// contributors may be used to endorse or promote products derived from
|
|
||||||
+// this software without specific prior written permission.
|
|
||||||
+//
|
|
||||||
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
+
|
|
||||||
+// This file is an internal atomic implementation, use atomicops.h instead.
|
|
||||||
+
|
|
||||||
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_RISCV64_GCC_H_
|
|
||||||
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_RISCV64_GCC_H_
|
|
||||||
+
|
|
||||||
+#define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory")
|
|
||||||
+
|
|
||||||
+namespace google {
|
|
||||||
+namespace protobuf {
|
|
||||||
+namespace internal {
|
|
||||||
+
|
|
||||||
+// Atomically execute:
|
|
||||||
+// result = *ptr;
|
|
||||||
+// if (*ptr == old_value)
|
|
||||||
+// *ptr = new_value;
|
|
||||||
+// return result;
|
|
||||||
+//
|
|
||||||
+// I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value".
|
|
||||||
+// Always return the old value of "*ptr"
|
|
||||||
+//
|
|
||||||
+// This routine implies no memory barriers.
|
|
||||||
+inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 old_value,
|
|
||||||
+ Atomic32 new_value) {
|
|
||||||
+ Atomic32 prev, tmp;
|
|
||||||
+ Atomic32 check;
|
|
||||||
+ __asm__ __volatile__(
|
|
||||||
+ "1:\n"
|
|
||||||
+ "lr.w %0, (%5)\n" // prev = *ptr
|
|
||||||
+ "bne %0, %3, 2f\n" // if (prev != old_value) goto 2
|
|
||||||
+ "move %1, %4\n" // tmp = new_value
|
|
||||||
+ "sc.w %2, %1, (%5)\n" // *ptr = tmp (with atomic check)
|
|
||||||
+ "bnez %2, 1b\n" // start again on atomic error
|
|
||||||
+ "nop\n" // delay slot nop
|
|
||||||
+ "2:\n"
|
|
||||||
+ : "=&r" (prev), "=&r" (tmp), "=&r"(check)
|
|
||||||
+ : "r" (old_value), "r" (new_value), "r" (ptr)
|
|
||||||
+ : "memory");
|
|
||||||
+ return prev;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
|
|
||||||
+ Atomic64 old_value,
|
|
||||||
+ Atomic64 new_value) {
|
|
||||||
+ Atomic64 prev, tmp;
|
|
||||||
+ Atomic64 check;
|
|
||||||
+ __asm__ __volatile__(
|
|
||||||
+ "1:\n"
|
|
||||||
+ "lr.d %0, (%5)\n" // prev = *ptr
|
|
||||||
+ "bne %0, %3, 2f\n" // if (prev != old_value) goto 2
|
|
||||||
+ "move %1, %4\n" // tmp = new_value
|
|
||||||
+ "sc.d %2, %1, (%5)\n" // *ptr = tmp (with atomic check)
|
|
||||||
+ "bnez %2, 1b\n" // start again on atomic error
|
|
||||||
+ "nop\n" // delay slot nop
|
|
||||||
+ "2:\n"
|
|
||||||
+ : "=&r" (prev), "=&r" (tmp), "=&r"(check)
|
|
||||||
+ : "r" (old_value), "r" (new_value), "r" (ptr)
|
|
||||||
+ : "memory");
|
|
||||||
+ return prev;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+// Atomically store new_value into *ptr, returning the previous value held in
|
|
||||||
+// *ptr. This routine implies no memory barriers.
|
|
||||||
+inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 new_value) {
|
|
||||||
+ Atomic32 temp, old;
|
|
||||||
+ Atomic32 check;
|
|
||||||
+ __asm__ __volatile__(
|
|
||||||
+ "1:\n"
|
|
||||||
+ "lr.w %1, (%4)\n" // old = *ptr
|
|
||||||
+ "move %0, %3\n" // temp = new_value
|
|
||||||
+ "sc.w %2, %0, (%4)\n" // *ptr = temp (with atomic check)
|
|
||||||
+ "bnez %2, 1b\n" // start again on atomic error
|
|
||||||
+ "nop\n" // delay slot nop
|
|
||||||
+ : "=&r" (temp), "=&r" (old), "=&r"(check)
|
|
||||||
+ : "r" (new_value), "r" (ptr)
|
|
||||||
+ : "memory");
|
|
||||||
+
|
|
||||||
+ return old;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
|
|
||||||
+ Atomic64 new_value) {
|
|
||||||
+ Atomic64 temp, old;
|
|
||||||
+ Atomic64 check;
|
|
||||||
+ __asm__ __volatile__(
|
|
||||||
+ "1:\n"
|
|
||||||
+ "lr.d %1, (%4)\n" // old = *ptr
|
|
||||||
+ "move %0, %3\n" // temp = new_value
|
|
||||||
+ "sc.d %2, %0, (%4)\n" // *ptr = temp (with atomic check)
|
|
||||||
+ "bnez %2, 1b\n" // start again on atomic error
|
|
||||||
+ "nop\n" // delay slot nop
|
|
||||||
+ : "=&r" (temp), "=&r" (old), "=&r"(check)
|
|
||||||
+ : "r" (new_value), "r" (ptr)
|
|
||||||
+ : "memory");
|
|
||||||
+
|
|
||||||
+ return old;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+// Atomically increment *ptr by "increment". Returns the new value of
|
|
||||||
+// *ptr with the increment applied. This routine implies no memory barriers.
|
|
||||||
+inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 increment) {
|
|
||||||
+ Atomic32 temp, temp2;
|
|
||||||
+ Atomic32 check;
|
|
||||||
+ __asm__ __volatile__(
|
|
||||||
+ "1:\n"
|
|
||||||
+ "lr.w %0, (%4)\n" // temp = *ptr
|
|
||||||
+ "addu %1, %0, %3\n" // temp2 = temp + increment
|
|
||||||
+ "sc.w %2, %1, (%4)\n" // *ptr = temp2 (with atomic check)
|
|
||||||
+ "bnez %2, 1b\n" // start again on atomic error
|
|
||||||
+ "addu %1, %0, %3\n" // temp2 = temp + increment
|
|
||||||
+ : "=&r" (temp), "=&r" (temp2), "=&r" (check)
|
|
||||||
+ : "r" (increment), "r" (ptr)
|
|
||||||
+ : "memory");
|
|
||||||
+ // temp2 now holds the final value.
|
|
||||||
+ return temp2;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
|
|
||||||
+ Atomic64 increment) {
|
|
||||||
+ Atomic64 temp, temp2;
|
|
||||||
+ Atomic64 check;
|
|
||||||
+ __asm__ __volatile__(
|
|
||||||
+ "1:\n"
|
|
||||||
+ "lr.d %0, (%4)\n" // temp = *ptr
|
|
||||||
+ "addu %1, %0, %3\n" // temp2 = temp + increment
|
|
||||||
+ "sc.d %2, %1, (%4)\n" // *ptr = temp2 (with atomic check)
|
|
||||||
+ "bnez %2, 1b\n" // start again on atomic error
|
|
||||||
+ "addu %1, %0, %3\n" // temp2 = temp + increment
|
|
||||||
+ : "=&r" (temp), "=&r" (temp2), "=&r" (check)
|
|
||||||
+ : "r" (increment), "r" (ptr)
|
|
||||||
+ : "memory");
|
|
||||||
+ // temp2 now holds the final value.
|
|
||||||
+ return temp2;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 increment) {
|
|
||||||
+ ATOMICOPS_COMPILER_BARRIER();
|
|
||||||
+ Atomic32 res = NoBarrier_AtomicIncrement(ptr, increment);
|
|
||||||
+ ATOMICOPS_COMPILER_BARRIER();
|
|
||||||
+ return res;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr,
|
|
||||||
+ Atomic64 increment) {
|
|
||||||
+ ATOMICOPS_COMPILER_BARRIER();
|
|
||||||
+ Atomic64 res = NoBarrier_AtomicIncrement(ptr, increment);
|
|
||||||
+ ATOMICOPS_COMPILER_BARRIER();
|
|
||||||
+ return res;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+// "Acquire" operations
|
|
||||||
+// ensure that no later memory access can be reordered ahead of the operation.
|
|
||||||
+// "Release" operations ensure that no previous memory access can be reordered
|
|
||||||
+// after the operation. "Barrier" operations have both "Acquire" and "Release"
|
|
||||||
+// semantics. A MemoryBarrier() has "Barrier" semantics, but does no memory
|
|
||||||
+// access.
|
|
||||||
+inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 old_value,
|
|
||||||
+ Atomic32 new_value) {
|
|
||||||
+ ATOMICOPS_COMPILER_BARRIER();
|
|
||||||
+ Atomic32 res = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
|
|
||||||
+ ATOMICOPS_COMPILER_BARRIER();
|
|
||||||
+ return res;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
|
|
||||||
+ Atomic64 old_value,
|
|
||||||
+ Atomic64 new_value) {
|
|
||||||
+ ATOMICOPS_COMPILER_BARRIER();
|
|
||||||
+ Atomic64 res = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
|
|
||||||
+ ATOMICOPS_COMPILER_BARRIER();
|
|
||||||
+ return res;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
|
|
||||||
+ Atomic32 old_value,
|
|
||||||
+ Atomic32 new_value) {
|
|
||||||
+ ATOMICOPS_COMPILER_BARRIER();
|
|
||||||
+ Atomic32 res = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
|
|
||||||
+ ATOMICOPS_COMPILER_BARRIER();
|
|
||||||
+ return res;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
|
|
||||||
+ Atomic64 old_value,
|
|
||||||
+ Atomic64 new_value) {
|
|
||||||
+ ATOMICOPS_COMPILER_BARRIER();
|
|
||||||
+ Atomic64 res = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
|
|
||||||
+ ATOMICOPS_COMPILER_BARRIER();
|
|
||||||
+ return res;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
|
|
||||||
+ *ptr = value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
|
|
||||||
+ *ptr = value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void MemoryBarrier() {
|
|
||||||
+ __asm__ __volatile__("fence rw, rw" : : : "memory");
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
|
|
||||||
+ *ptr = value;
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
|
|
||||||
+ *ptr = value;
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ *ptr = value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ *ptr = value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
|
|
||||||
+ return *ptr;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
|
|
||||||
+ return *ptr;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
|
|
||||||
+ Atomic32 value = *ptr;
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ return value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
|
|
||||||
+ Atomic64 value = *ptr;
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ return value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ return *ptr;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
|
|
||||||
+ MemoryBarrier();
|
|
||||||
+ return *ptr;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+} // namespace internal
|
|
||||||
+} // namespace protobuf
|
|
||||||
+} // namespace google
|
|
||||||
+
|
|
||||||
+#undef ATOMICOPS_COMPILER_BARRIER
|
|
||||||
+
|
|
||||||
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_RISCV_GCC_H_
|
|
||||||
\ No newline at end of file
|
|
||||||
diff -ur --new-file protobuf-2.5.0/src/google/protobuf/stubs/platform_macros.h protobuf-2.5.0/src/google/protobuf/stubs/platform_macros.h
|
|
||||||
--- protobuf-2.5.0/src/google/protobuf/stubs/platform_macros.h 2023-07-27 21:16:40.005186825 +0800
|
|
||||||
+++ protobuf-2.5.0/src/google/protobuf/stubs/platform_macros.h 2023-07-27 21:23:04.021886541 +0800
|
|
||||||
@@ -63,6 +63,9 @@
|
|
||||||
#elif defined(__ppc__) || defined(__PPC__)
|
|
||||||
#define GOOGLE_PROTOBUF_ARCH_PPC 1
|
|
||||||
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
|
|
||||||
+#elif defined(__riscv)
|
|
||||||
+#define GOOGLE_PROTOBUF_ARCH_RISCV64 1
|
|
||||||
+#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
|
|
||||||
#elif defined(__s390x__)
|
|
||||||
#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
|
|
||||||
#define GOOGLE_PROTOBUF_ARCH_S390X 1
|
|
||||||
diff -ur --new-file protobuf-2.5.0/src/Makefile.am protobuf-2.5.0/src/Makefile.am
|
|
||||||
--- protobuf-2.5.0/src/Makefile.am 2023-07-27 21:17:39.041294096 +0800
|
|
||||||
+++ protobuf-2.5.0/src/Makefile.am 2023-07-27 21:25:00.466098807 +0800
|
|
||||||
@@ -48,6 +48,7 @@
|
|
||||||
google/protobuf/stubs/atomicops_internals_pnacl.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_x86_gcc.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_x86_msvc.h \
|
|
||||||
+ google/protobuf/stubs/atomicops_internals_riscv64_gcc.h \
|
|
||||||
google/protobuf/stubs/common.h \
|
|
||||||
google/protobuf/stubs/platform_macros.h \
|
|
||||||
google/protobuf/stubs/once.h \
|
|
||||||
diff -ur --new-file protobuf-2.5.0/src/Makefile.in protobuf-2.5.0/src/Makefile.in
|
|
||||||
--- protobuf-2.5.0/src/Makefile.in 2023-07-27 21:17:39.041294096 +0800
|
|
||||||
+++ protobuf-2.5.0/src/Makefile.in 2023-07-27 21:25:59.362209523 +0800
|
|
||||||
@@ -313,6 +313,7 @@
|
|
||||||
google/protobuf/stubs/atomicops_internals_macosx.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_mips_gcc.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_pnacl.h \
|
|
||||||
+ google/protobuf/stubs/atomicops_internals_riscv64_gcc.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_x86_gcc.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_x86_msvc.h \
|
|
||||||
google/protobuf/stubs/common.h \
|
|
||||||
@@ -525,6 +526,7 @@
|
|
||||||
google/protobuf/stubs/atomicops_internals_pnacl.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_x86_gcc.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_x86_msvc.h \
|
|
||||||
+ google/protobuf/stubs/atomicops_internals_riscv64_gcc.h \
|
|
||||||
google/protobuf/stubs/common.h \
|
|
||||||
google/protobuf/stubs/platform_macros.h \
|
|
||||||
google/protobuf/stubs/once.h \
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
augroup filetype
|
|
||||||
au! BufRead,BufNewFile *.proto setfiletype proto
|
|
||||||
augroup end
|
|
||||||
|
|
||||||
@ -1,215 +0,0 @@
|
|||||||
--- protobuf-2.5.0/autogen.sh.orig 2013-02-26 09:56:44.000000000 -0800
|
|
||||||
+++ protobuf-2.5.0/autogen.sh 2013-03-09 19:21:52.512010330 -0800
|
|
||||||
@@ -1,41 +1,24 @@
|
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Run this script to generate the configure script and other files that will
|
|
||||||
# be included in the distribution. These files are not checked in because they
|
|
||||||
# are automatically generated.
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Check that we're being run from the right directory.
|
|
||||||
if test ! -f src/google/protobuf/stubs/common.h; then
|
|
||||||
cat >&2 << __EOF__
|
|
||||||
Could not find source code. Make sure you are running this script from the
|
|
||||||
root of the distribution tree.
|
|
||||||
__EOF__
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
-# Check that gtest is present. Usually it is already there since the
|
|
||||||
-# directory is set up as an SVN external.
|
|
||||||
-if test ! -e gtest; then
|
|
||||||
- echo "Google Test not present. Fetching gtest-1.5.0 from the web..."
|
|
||||||
- curl http://googletest.googlecode.com/files/gtest-1.5.0.tar.bz2 | tar jx
|
|
||||||
- mv gtest-1.5.0 gtest
|
|
||||||
-fi
|
|
||||||
-
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
-# Temporary hack: Must change C runtime library to "multi-threaded DLL",
|
|
||||||
-# otherwise it will be set to "multi-threaded static" when MSVC upgrades
|
|
||||||
-# the project file to MSVC 2005/2008. vladl of Google Test says gtest will
|
|
||||||
-# probably change their default to match, then this will be unnecessary.
|
|
||||||
-# One of these mappings converts the debug configuration and the other
|
|
||||||
-# converts the release configuration. I don't know which is which.
|
|
||||||
-sed -i -e 's/RuntimeLibrary="5"/RuntimeLibrary="3"/g;
|
|
||||||
- s/RuntimeLibrary="4"/RuntimeLibrary="2"/g;' gtest/msvc/*.vcproj
|
|
||||||
-
|
|
||||||
# TODO(kenton): Remove the ",no-obsolete" part and fix the resulting warnings.
|
|
||||||
autoreconf -f -i -Wall,no-obsolete
|
|
||||||
|
|
||||||
rm -rf autom4te.cache config.h.in~
|
|
||||||
exit 0
|
|
||||||
--- protobuf-2.5.0/Makefile.am.orig 2013-02-26 09:56:44.000000000 -0800
|
|
||||||
+++ protobuf-2.5.0/Makefile.am 2013-03-09 19:22:18.741692020 -0800
|
|
||||||
@@ -1,54 +1,33 @@
|
|
||||||
## Process this file with automake to produce Makefile.in
|
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = foreign
|
|
||||||
|
|
||||||
# Build . before src so that our all-local and clean-local hooks kicks in at
|
|
||||||
# the right time.
|
|
||||||
SUBDIRS = . src
|
|
||||||
|
|
||||||
# Always include gtest in distributions.
|
|
||||||
DIST_SUBDIRS = $(subdirs) src
|
|
||||||
|
|
||||||
-# Build gtest before we build protobuf tests. We don't add gtest to SUBDIRS
|
|
||||||
-# because then "make check" would also build and run all of gtest's own tests,
|
|
||||||
-# which takes a lot of time and is generally not useful to us. Also, we don't
|
|
||||||
-# want "make install" to recurse into gtest since we don't want to overwrite
|
|
||||||
-# the installed version of gtest if there is one.
|
|
||||||
-check-local:
|
|
||||||
- @echo "Making lib/libgtest.a lib/libgtest_main.a in gtest"
|
|
||||||
- @cd gtest && $(MAKE) $(AM_MAKEFLAGS) lib/libgtest.la lib/libgtest_main.la
|
|
||||||
-
|
|
||||||
-# We would like to clean gtest when "make clean" is invoked. But we have to
|
|
||||||
-# be careful because clean-local is also invoked during "make distclean", but
|
|
||||||
-# "make distclean" already recurses into gtest because it's listed among the
|
|
||||||
-# DIST_SUBDIRS. distclean will delete gtest/Makefile, so if we then try to
|
|
||||||
-# cd to the directory again and "make clean" it will fail. So, check that the
|
|
||||||
-# Makefile exists before recursing.
|
|
||||||
-clean-local:
|
|
||||||
- @if test -e gtest/Makefile; then \
|
|
||||||
- echo "Making clean in gtest"; \
|
|
||||||
- cd gtest && $(MAKE) $(AM_MAKEFLAGS) clean; \
|
|
||||||
- fi
|
|
||||||
-
|
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
|
||||||
pkgconfig_DATA = protobuf.pc protobuf-lite.pc
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
|
||||||
autogen.sh \
|
|
||||||
generate_descriptor_proto.sh \
|
|
||||||
README.txt \
|
|
||||||
INSTALL.txt \
|
|
||||||
COPYING.txt \
|
|
||||||
CONTRIBUTORS.txt \
|
|
||||||
CHANGES.txt \
|
|
||||||
editors/README.txt \
|
|
||||||
editors/proto.vim \
|
|
||||||
editors/protobuf-mode.el \
|
|
||||||
vsprojects/config.h \
|
|
||||||
vsprojects/extract_includes.bat \
|
|
||||||
vsprojects/libprotobuf.vcproj \
|
|
||||||
vsprojects/libprotobuf-lite.vcproj \
|
|
||||||
vsprojects/libprotoc.vcproj \
|
|
||||||
vsprojects/protobuf.sln \
|
|
||||||
--- protobuf-2.5.0/src/Makefile.am.orig 2013-02-26 09:56:43.000000000 -0800
|
|
||||||
+++ protobuf-2.5.0/src/Makefile.am 2013-03-09 19:25:09.076620571 -0800
|
|
||||||
@@ -286,44 +286,42 @@
|
|
||||||
# building out-of-tree.
|
|
||||||
unittest_proto_middleman: protoc$(EXEEXT) $(protoc_inputs)
|
|
||||||
oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/protoc$(EXEEXT) -I. --cpp_out=$$oldpwd $(protoc_inputs) )
|
|
||||||
touch unittest_proto_middleman
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(protoc_outputs): unittest_proto_middleman
|
|
||||||
|
|
||||||
COMMON_TEST_SOURCES = \
|
|
||||||
google/protobuf/test_util.cc \
|
|
||||||
google/protobuf/test_util.h \
|
|
||||||
google/protobuf/testing/googletest.cc \
|
|
||||||
google/protobuf/testing/googletest.h \
|
|
||||||
google/protobuf/testing/file.cc \
|
|
||||||
google/protobuf/testing/file.h
|
|
||||||
|
|
||||||
check_PROGRAMS = protoc protobuf-test protobuf-lazy-descriptor-test \
|
|
||||||
protobuf-lite-test test_plugin $(GZCHECKPROGRAMS)
|
|
||||||
protobuf_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \
|
|
||||||
- $(top_builddir)/gtest/lib/libgtest.la \
|
|
||||||
- $(top_builddir)/gtest/lib/libgtest_main.la
|
|
||||||
+ -lgtest -lgtest_main
|
|
||||||
-protobuf_test_CPPFLAGS = -I$(top_srcdir)/gtest/include \
|
|
||||||
- -I$(top_builddir)/gtest/include
|
|
||||||
+protobuf_test_CPPFLAGS =
|
|
||||||
# Disable optimization for tests unless the user explicitly asked for it,
|
|
||||||
# since test_util.cc takes forever to compile with optimization (with GCC).
|
|
||||||
# See configure.ac for more info.
|
|
||||||
protobuf_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
|
|
||||||
protobuf_test_SOURCES = \
|
|
||||||
google/protobuf/stubs/common_unittest.cc \
|
|
||||||
google/protobuf/stubs/once_unittest.cc \
|
|
||||||
google/protobuf/stubs/strutil_unittest.cc \
|
|
||||||
google/protobuf/stubs/structurally_valid_unittest.cc \
|
|
||||||
google/protobuf/stubs/stringprintf_unittest.cc \
|
|
||||||
google/protobuf/stubs/template_util_unittest.cc \
|
|
||||||
google/protobuf/stubs/type_traits_unittest.cc \
|
|
||||||
google/protobuf/descriptor_database_unittest.cc \
|
|
||||||
google/protobuf/descriptor_unittest.cc \
|
|
||||||
google/protobuf/dynamic_message_unittest.cc \
|
|
||||||
google/protobuf/extension_set_unittest.cc \
|
|
||||||
google/protobuf/generated_message_reflection_unittest.cc \
|
|
||||||
google/protobuf/message_unittest.cc \
|
|
||||||
google/protobuf/reflection_ops_unittest.cc \
|
|
||||||
google/protobuf/repeated_field_unittest.cc \
|
|
||||||
@@ -335,61 +333,58 @@
|
|
||||||
google/protobuf/io/printer_unittest.cc \
|
|
||||||
google/protobuf/io/tokenizer_unittest.cc \
|
|
||||||
google/protobuf/io/zero_copy_stream_unittest.cc \
|
|
||||||
google/protobuf/compiler/command_line_interface_unittest.cc \
|
|
||||||
google/protobuf/compiler/importer_unittest.cc \
|
|
||||||
google/protobuf/compiler/mock_code_generator.cc \
|
|
||||||
google/protobuf/compiler/mock_code_generator.h \
|
|
||||||
google/protobuf/compiler/parser_unittest.cc \
|
|
||||||
google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc \
|
|
||||||
google/protobuf/compiler/cpp/cpp_unittest.h \
|
|
||||||
google/protobuf/compiler/cpp/cpp_unittest.cc \
|
|
||||||
google/protobuf/compiler/cpp/cpp_plugin_unittest.cc \
|
|
||||||
google/protobuf/compiler/java/java_plugin_unittest.cc \
|
|
||||||
google/protobuf/compiler/java/java_doc_comment_unittest.cc \
|
|
||||||
google/protobuf/compiler/python/python_plugin_unittest.cc \
|
|
||||||
$(COMMON_TEST_SOURCES)
|
|
||||||
nodist_protobuf_test_SOURCES = $(protoc_outputs)
|
|
||||||
|
|
||||||
# Run cpp_unittest again with PROTOBUF_TEST_NO_DESCRIPTORS defined.
|
|
||||||
protobuf_lazy_descriptor_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la \
|
|
||||||
- $(top_builddir)/gtest/lib/libgtest.la \
|
|
||||||
- $(top_builddir)/gtest/lib/libgtest_main.la
|
|
||||||
+ -lgtest -lgtest_main
|
|
||||||
-protobuf_lazy_descriptor_test_CPPFLAGS = -I$(top_srcdir)/gtest/include \
|
|
||||||
- -I$(top_builddir)/gtest/include \
|
|
||||||
- -DPROTOBUF_TEST_NO_DESCRIPTORS
|
|
||||||
+protobuf_lazy_descriptor_test_CPPFLAGS = -DPROTOBUF_TEST_NO_DESCRIPTORS
|
|
||||||
protobuf_lazy_descriptor_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
|
|
||||||
protobuf_lazy_descriptor_test_SOURCES = \
|
|
||||||
google/protobuf/compiler/cpp/cpp_unittest.cc \
|
|
||||||
$(COMMON_TEST_SOURCES)
|
|
||||||
nodist_protobuf_lazy_descriptor_test_SOURCES = $(protoc_outputs)
|
|
||||||
|
|
||||||
# Build lite_unittest separately, since it doesn't use gtest.
|
|
||||||
protobuf_lite_test_LDADD = $(PTHREAD_LIBS) libprotobuf-lite.la
|
|
||||||
protobuf_lite_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
|
|
||||||
protobuf_lite_test_SOURCES = \
|
|
||||||
google/protobuf/lite_unittest.cc \
|
|
||||||
google/protobuf/test_util_lite.cc \
|
|
||||||
google/protobuf/test_util_lite.h
|
|
||||||
nodist_protobuf_lite_test_SOURCES = $(protoc_lite_outputs)
|
|
||||||
|
|
||||||
# Test plugin binary.
|
|
||||||
test_plugin_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \
|
|
||||||
- $(top_builddir)/gtest/lib/libgtest.la
|
|
||||||
+ -lgtest
|
|
||||||
test_plugin_CPPFLAGS = -I$(top_srcdir)/gtest/include \
|
|
||||||
-I$(top_builddir)/gtest/include
|
|
||||||
test_plugin_SOURCES = \
|
|
||||||
google/protobuf/compiler/mock_code_generator.cc \
|
|
||||||
google/protobuf/testing/file.cc \
|
|
||||||
google/protobuf/testing/file.h \
|
|
||||||
google/protobuf/compiler/test_plugin.cc
|
|
||||||
|
|
||||||
if HAVE_ZLIB
|
|
||||||
zcgzip_LDADD = $(PTHREAD_LIBS) libprotobuf.la
|
|
||||||
zcgzip_SOURCES = google/protobuf/testing/zcgzip.cc
|
|
||||||
|
|
||||||
zcgunzip_LDADD = $(PTHREAD_LIBS) libprotobuf.la
|
|
||||||
zcgunzip_SOURCES = google/protobuf/testing/zcgunzip.cc
|
|
||||||
endif
|
|
||||||
|
|
||||||
TESTS = protobuf-test protobuf-lazy-descriptor-test protobuf-lite-test \
|
|
||||||
google/protobuf/compiler/zip_output_unittest.sh $(GZTESTS)
|
|
||||||
@ -1,201 +0,0 @@
|
|||||||
--- protobuf-2.5.0/java/pom.xml.orig 2013-02-26 09:58:21.000000000 -0800
|
|
||||||
+++ protobuf-2.5.0/java/pom.xml 2013-03-09 19:16:29.581904896 -0800
|
|
||||||
@@ -1,152 +1,79 @@
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
- <parent>
|
|
||||||
- <groupId>com.google</groupId>
|
|
||||||
- <artifactId>google</artifactId>
|
|
||||||
- <version>1</version>
|
|
||||||
- </parent>
|
|
||||||
<groupId>com.google.protobuf</groupId>
|
|
||||||
<artifactId>protobuf-java</artifactId>
|
|
||||||
<version>2.5.0</version>
|
|
||||||
<packaging>bundle</packaging>
|
|
||||||
<name>Protocol Buffer Java API</name>
|
|
||||||
<description>
|
|
||||||
Protocol Buffers are a way of encoding structured data in an efficient yet
|
|
||||||
extensible format.
|
|
||||||
</description>
|
|
||||||
<inceptionYear>2008</inceptionYear>
|
|
||||||
<url>http://code.google.com/p/protobuf</url>
|
|
||||||
<licenses>
|
|
||||||
<license>
|
|
||||||
<name>New BSD license</name>
|
|
||||||
<url>http://www.opensource.org/licenses/bsd-license.php</url>
|
|
||||||
<distribution>repo</distribution>
|
|
||||||
</license>
|
|
||||||
</licenses>
|
|
||||||
<scm>
|
|
||||||
<url>http://code.google.com/p/protobuf/source/browse</url>
|
|
||||||
<connection>
|
|
||||||
scm:svn:http://protobuf.googlecode.com/svn/trunk/
|
|
||||||
</connection>
|
|
||||||
</scm>
|
|
||||||
- <dependencies>
|
|
||||||
- <dependency>
|
|
||||||
- <groupId>junit</groupId>
|
|
||||||
- <artifactId>junit</artifactId>
|
|
||||||
- <version>4.4</version>
|
|
||||||
- <scope>test</scope>
|
|
||||||
- </dependency>
|
|
||||||
- <dependency>
|
|
||||||
- <groupId>org.easymock</groupId>
|
|
||||||
- <artifactId>easymock</artifactId>
|
|
||||||
- <version>2.2</version>
|
|
||||||
- <scope>test</scope>
|
|
||||||
- </dependency>
|
|
||||||
- <dependency>
|
|
||||||
- <groupId>org.easymock</groupId>
|
|
||||||
- <artifactId>easymockclassextension</artifactId>
|
|
||||||
- <version>2.2.1</version>
|
|
||||||
- <scope>test</scope>
|
|
||||||
- </dependency>
|
|
||||||
- </dependencies>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>1.5</source>
|
|
||||||
<target>1.5</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
- <artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
- <configuration>
|
|
||||||
- <includes>
|
|
||||||
- <include>**/*Test.java</include>
|
|
||||||
- </includes>
|
|
||||||
- </configuration>
|
|
||||||
- </plugin>
|
|
||||||
- <plugin>
|
|
||||||
<artifactId>maven-antrun-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>generate-sources</id>
|
|
||||||
<phase>generate-sources</phase>
|
|
||||||
<configuration>
|
|
||||||
<tasks>
|
|
||||||
<mkdir dir="target/generated-sources" />
|
|
||||||
<exec executable="../src/protoc">
|
|
||||||
<arg value="--java_out=target/generated-sources" />
|
|
||||||
<arg value="--proto_path=../src" />
|
|
||||||
<arg value="../src/google/protobuf/descriptor.proto" />
|
|
||||||
</exec>
|
|
||||||
</tasks>
|
|
||||||
<sourceRoot>target/generated-sources</sourceRoot>
|
|
||||||
</configuration>
|
|
||||||
<goals>
|
|
||||||
<goal>run</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
- <execution>
|
|
||||||
- <id>generate-test-sources</id>
|
|
||||||
- <phase>generate-test-sources</phase>
|
|
||||||
- <configuration>
|
|
||||||
- <tasks>
|
|
||||||
- <mkdir dir="target/generated-test-sources" />
|
|
||||||
- <exec executable="../src/protoc">
|
|
||||||
- <arg value="--java_out=target/generated-test-sources" />
|
|
||||||
- <arg value="--proto_path=../src" />
|
|
||||||
- <arg value="--proto_path=src/test/java" />
|
|
||||||
- <arg value="../src/google/protobuf/unittest.proto" />
|
|
||||||
- <arg value="../src/google/protobuf/unittest_import.proto" />
|
|
||||||
- <arg value="../src/google/protobuf/unittest_import_public.proto" />
|
|
||||||
- <arg value="../src/google/protobuf/unittest_mset.proto" />
|
|
||||||
- <arg
|
|
||||||
- value="src/test/java/com/google/protobuf/multiple_files_test.proto" />
|
|
||||||
- <arg value="src/test/java/com/google/protobuf/nested_builders_test.proto" />
|
|
||||||
- <arg value="src/test/java/com/google/protobuf/nested_extension.proto" />
|
|
||||||
- <arg value="src/test/java/com/google/protobuf/nested_extension_lite.proto" />
|
|
||||||
- <arg value="src/test/java/com/google/protobuf/non_nested_extension.proto" />
|
|
||||||
- <arg value="src/test/java/com/google/protobuf/non_nested_extension_lite.proto" />
|
|
||||||
- <arg value="src/test/java/com/google/protobuf/test_bad_identifiers.proto" />
|
|
||||||
- <arg
|
|
||||||
- value="../src/google/protobuf/unittest_optimize_for.proto" />
|
|
||||||
- <arg
|
|
||||||
- value="../src/google/protobuf/unittest_custom_options.proto" />
|
|
||||||
- <arg value="../src/google/protobuf/unittest_lite.proto" />
|
|
||||||
- <arg value="../src/google/protobuf/unittest_import_lite.proto" />
|
|
||||||
- <arg value="../src/google/protobuf/unittest_import_public_lite.proto" />
|
|
||||||
- <arg value="../src/google/protobuf/unittest_lite_imports_nonlite.proto" />
|
|
||||||
- <arg value="../src/google/protobuf/unittest_enormous_descriptor.proto" />
|
|
||||||
- <arg value="../src/google/protobuf/unittest_no_generic_services.proto" />
|
|
||||||
- </exec>
|
|
||||||
- </tasks>
|
|
||||||
- <testSourceRoot>target/generated-test-sources</testSourceRoot>
|
|
||||||
- </configuration>
|
|
||||||
- <goals>
|
|
||||||
- <goal>run</goal>
|
|
||||||
- </goals>
|
|
||||||
- </execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.felix</groupId>
|
|
||||||
<artifactId>maven-bundle-plugin</artifactId>
|
|
||||||
<extensions>true</extensions>
|
|
||||||
<configuration>
|
|
||||||
<instructions>
|
|
||||||
<Export-Package>*</Export-Package>
|
|
||||||
</instructions>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>lite</id>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
@@ -161,45 +88,33 @@
|
|
||||||
<include>**/FieldSet.java</include>
|
|
||||||
<include>**/GeneratedMessageLite.java</include>
|
|
||||||
<include>**/Internal.java</include>
|
|
||||||
<include>**/InvalidProtocolBufferException.java</include>
|
|
||||||
<include>**/LazyStringArrayList.java</include>
|
|
||||||
<include>**/LazyStringList.java</include>
|
|
||||||
<include>**/MessageLite.java</include>
|
|
||||||
<include>**/MessageLiteOrBuilder.java</include>
|
|
||||||
<include>**/SmallSortedMap.java</include>
|
|
||||||
<include>**/UninitializedMessageException.java</include>
|
|
||||||
<include>**/UnmodifiableLazyStringList.java</include>
|
|
||||||
<include>**/WireFormat.java</include>
|
|
||||||
<include>**/Parser.java</include>
|
|
||||||
<include>**/AbstractParser.java</include>
|
|
||||||
<include>**/BoundedByteString.java</include>
|
|
||||||
<include>**/LiteralByteString.java</include>
|
|
||||||
<include>**/RopeByteString.java</include>
|
|
||||||
<include>**/Utf8.java</include>
|
|
||||||
<include>**/LazyField.java</include>
|
|
||||||
</includes>
|
|
||||||
- <testIncludes>
|
|
||||||
- <testInclude>**/LiteTest.java</testInclude>
|
|
||||||
- <testInclude>**/*Lite.java</testInclude>
|
|
||||||
- </testIncludes>
|
|
||||||
- </configuration>
|
|
||||||
- </plugin>
|
|
||||||
- <plugin>
|
|
||||||
- <artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
- <configuration>
|
|
||||||
- <includes>
|
|
||||||
- <include>**/LiteTest.java</include>
|
|
||||||
- </includes>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<classifier>lite</classifier>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
</project>
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
diff -up protobuf-2.5.0/src/Makefile.am.generic protobuf-2.5.0/src/Makefile.am
|
|
||||||
--- protobuf-2.5.0/src/Makefile.am.generic 2013-05-16 10:25:07.000000000 +0200
|
|
||||||
+++ protobuf-2.5.0/src/Makefile.am 2013-05-16 10:26:15.000000000 +0200
|
|
||||||
@@ -42,6 +42,7 @@ nobase_include_HEADERS =
|
|
||||||
google/protobuf/stubs/atomicops_internals_arm_gcc.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_arm_qnx.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_atomicword_compat.h \
|
|
||||||
+ google/protobuf/stubs/atomicops_internals_generic_gcc.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_macosx.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_mips_gcc.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_pnacl.h \
|
|
||||||
diff -up protobuf-2.5.0/src/Makefile.in.generic protobuf-2.5.0/src/Makefile.in
|
|
||||||
--- protobuf-2.5.0/src/Makefile.in.generic 2013-05-16 10:25:14.000000000 +0200
|
|
||||||
+++ protobuf-2.5.0/src/Makefile.in 2013-05-16 10:27:00.000000000 +0200
|
|
||||||
@@ -309,6 +309,7 @@ am__nobase_include_HEADERS_DIST = google
|
|
||||||
google/protobuf/stubs/atomicops_internals_arm_gcc.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_arm_qnx.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_atomicword_compat.h \
|
|
||||||
+ google/protobuf/stubs/atomicops_internals_generic_gcc.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_macosx.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_mips_gcc.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_pnacl.h \
|
|
||||||
@@ -518,6 +519,7 @@ nobase_include_HEADERS = \
|
|
||||||
google/protobuf/stubs/atomicops_internals_arm_gcc.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_arm_qnx.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_atomicword_compat.h \
|
|
||||||
+ google/protobuf/stubs/atomicops_internals_generic_gcc.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_macosx.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_mips_gcc.h \
|
|
||||||
google/protobuf/stubs/atomicops_internals_pnacl.h \
|
|
||||||
Binary file not shown.
@ -1,6 +0,0 @@
|
|||||||
; Protobuf major mode, init file by Tim Niemueller [www.niemueller.de], BSD
|
|
||||||
; Add mode to automatically recognized modes
|
|
||||||
(setq auto-mode-alist (cons '("\\.proto$" . protobuf-mode) auto-mode-alist))
|
|
||||||
(autoload 'protobuf-mode "protobuf-mode" "Google protobuf editing mode." t)
|
|
||||||
; Turn on colorization by default
|
|
||||||
(add-hook 'protobuf-mode-hook 'turn-on-font-lock)
|
|
||||||
265
protobuf2.spec
265
protobuf2.spec
@ -1,265 +0,0 @@
|
|||||||
%bcond_without java
|
|
||||||
%bcond_with gtest
|
|
||||||
%global emacs_version %(pkg-config emacs --modversion)
|
|
||||||
%global emacs_lispdir %(pkg-config emacs --variable sitepkglispdir)
|
|
||||||
%global emacs_startdir %(pkg-config emacs --variable sitestartdir)
|
|
||||||
Summary: Protocol Buffers - Google's data interchange format
|
|
||||||
Name: protobuf2
|
|
||||||
Version: 2.5.0
|
|
||||||
Release: 5
|
|
||||||
License: BSD
|
|
||||||
Source: http://protobuf.googlecode.com/files/protobuf-%{version}.tar.bz2
|
|
||||||
Source1: ftdetect-proto.vim
|
|
||||||
Source2: protobuf-init.el
|
|
||||||
Patch1: protobuf-2.5.0-gtest.patch
|
|
||||||
Patch2: protobuf-2.5.0-java-fixes.patch
|
|
||||||
Patch3: 0001-Add-generic-GCC-support-for-atomic-operations.patch
|
|
||||||
Patch4: protobuf-2.5.0-makefile.patch
|
|
||||||
Patch5: 0001-protobuf2-add-support-for-loongarch64.patch
|
|
||||||
Patch6: add-riscv64-support.patch
|
|
||||||
URL: http://code.google.com/p/protobuf/
|
|
||||||
BuildRequires: automake autoconf libtool pkgconfig zlib-devel emacs emacs-el >= 24.1 maven-plugin-bundle gcc-c++
|
|
||||||
%if %{with gtest}
|
|
||||||
BuildRequires: gtest-devel
|
|
||||||
%endif
|
|
||||||
%description
|
|
||||||
Protocol Buffers are a way of encoding structured data in an efficient
|
|
||||||
yet extensible format. Google uses Protocol Buffers for almost all of
|
|
||||||
its internal RPC protocols and file formats.
|
|
||||||
Protocol buffers are a flexible, efficient, automated mechanism for
|
|
||||||
serializing structured data – think XML, but smaller, faster, and
|
|
||||||
simpler. You define how you want your data to be structured once, then
|
|
||||||
you can use special generated source code to easily write and read
|
|
||||||
your structured data to and from a variety of data streams and using a
|
|
||||||
variety of languages. You can even update your data structure without
|
|
||||||
breaking deployed programs that are compiled against the "old" format.
|
|
||||||
|
|
||||||
%package compiler
|
|
||||||
Summary: Protocol Buffers compiler
|
|
||||||
Requires: %{name} = %{version}-%{release}
|
|
||||||
%description compiler
|
|
||||||
This package contains Protocol Buffers compiler for all programming
|
|
||||||
languages
|
|
||||||
|
|
||||||
%package devel
|
|
||||||
Summary: Protocol Buffers C++ headers and libraries
|
|
||||||
Requires: %{name} = %{version}-%{release} %{name}-compiler = %{version}-%{release}
|
|
||||||
Requires: zlib-devel pkgconfig
|
|
||||||
%description devel
|
|
||||||
This package contains Protocol Buffers compiler for all languages and
|
|
||||||
C++ headers and libraries
|
|
||||||
|
|
||||||
%package static
|
|
||||||
Summary: Static development files for %{name}
|
|
||||||
Requires: %{name} = %{version}-%{release}
|
|
||||||
%description static
|
|
||||||
Static libraries for Protocol Buffers
|
|
||||||
|
|
||||||
%package lite
|
|
||||||
Summary: Protocol Buffers LITE_RUNTIME libraries
|
|
||||||
%description lite
|
|
||||||
Protocol Buffers built with optimize_for = LITE_RUNTIME.
|
|
||||||
The "optimize_for = LITE_RUNTIME" option causes the compiler to generate code
|
|
||||||
which only depends libprotobuf-lite, which is much smaller than libprotobuf but
|
|
||||||
lacks descriptors, reflection, and some other features.
|
|
||||||
|
|
||||||
%package lite-devel
|
|
||||||
Summary: Protocol Buffers LITE_RUNTIME development libraries
|
|
||||||
Requires: %{name}-devel = %{version}-%{release} %{name}-lite = %{version}-%{release}
|
|
||||||
%description lite-devel
|
|
||||||
This package contains development libraries built with
|
|
||||||
optimize_for = LITE_RUNTIME.
|
|
||||||
The "optimize_for = LITE_RUNTIME" option causes the compiler to generate code
|
|
||||||
which only depends libprotobuf-lite, which is much smaller than libprotobuf but
|
|
||||||
lacks descriptors, reflection, and some other features.
|
|
||||||
|
|
||||||
%package lite-static
|
|
||||||
Summary: Static development files for %{name}-lite
|
|
||||||
Requires: %{name}-devel = %{version}-%{release}
|
|
||||||
%description lite-static
|
|
||||||
This package contains static development libraries built with
|
|
||||||
optimize_for = LITE_RUNTIME.
|
|
||||||
The "optimize_for = LITE_RUNTIME" option causes the compiler to generate code
|
|
||||||
which only depends libprotobuf-lite, which is much smaller than libprotobuf but
|
|
||||||
lacks descriptors, reflection, and some other features.
|
|
||||||
|
|
||||||
%package vim
|
|
||||||
Summary: Vim syntax highlighting for Google Protocol Buffers descriptions
|
|
||||||
Requires: vim-enhanced
|
|
||||||
%description vim
|
|
||||||
This package contains syntax highlighting for Google Protocol Buffers
|
|
||||||
descriptions in Vim editor
|
|
||||||
|
|
||||||
%package emacs
|
|
||||||
Summary: Emacs mode for Google Protocol Buffers descriptions
|
|
||||||
Requires: emacs >= 0%{emacs_version}
|
|
||||||
%description emacs
|
|
||||||
This package contains syntax highlighting for Google Protocol Buffers
|
|
||||||
descriptions in the Emacs editor.
|
|
||||||
|
|
||||||
%package emacs-el
|
|
||||||
Summary: Elisp source files for Google protobuf Emacs mode
|
|
||||||
Requires: %{name}-emacs = %{version}
|
|
||||||
%description emacs-el
|
|
||||||
This package contains the elisp source files for %{name}-emacs
|
|
||||||
under GNU Emacs. You do not need to install this package to use
|
|
||||||
%{name}-emacs.
|
|
||||||
%if %{with java}
|
|
||||||
|
|
||||||
%package java
|
|
||||||
Summary: Java Protocol Buffers runtime library
|
|
||||||
BuildRequires: java-devel >= 1.6 jpackage-utils maven-local maven-compiler-plugin
|
|
||||||
BuildRequires: maven-install-plugin maven-jar-plugin maven-javadoc-plugin
|
|
||||||
BuildRequires: maven-resources-plugin maven-surefire-plugin maven-antrun-plugin
|
|
||||||
Conflicts: %{name}-compiler > %{version}
|
|
||||||
Conflicts: %{name}-compiler < %{version}
|
|
||||||
%description java
|
|
||||||
This package contains Java Protocol Buffers runtime library.
|
|
||||||
|
|
||||||
%package javadoc
|
|
||||||
Summary: Javadocs for %{name}-java
|
|
||||||
Requires: %{name}-java = %{version}-%{release}
|
|
||||||
%description javadoc
|
|
||||||
This package contains the API documentation for %{name}-java.
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -q -n protobuf-2.5.0
|
|
||||||
%if %{with gtest}
|
|
||||||
rm -rf gtest
|
|
||||||
%patch1 -p1 -b .gtest
|
|
||||||
%endif
|
|
||||||
chmod 644 examples/*
|
|
||||||
%if %{with java}
|
|
||||||
%patch2 -p1 -b .java-fixes
|
|
||||||
rm -rf java/src/test
|
|
||||||
%endif
|
|
||||||
%patch3 -p1 -b .generic-atomics
|
|
||||||
%patch4 -p1 -b .generic-atomics-makefile
|
|
||||||
%ifarch loongarch64
|
|
||||||
%patch5 -p1
|
|
||||||
%endif
|
|
||||||
%ifarch riscv64
|
|
||||||
%patch6 -p1
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%build
|
|
||||||
iconv -f iso8859-1 -t utf-8 CONTRIBUTORS.txt > CONTRIBUTORS.txt.utf8
|
|
||||||
mv CONTRIBUTORS.txt.utf8 CONTRIBUTORS.txt
|
|
||||||
export PTHREAD_LIBS="-lpthread"
|
|
||||||
./autogen.sh
|
|
||||||
%configure
|
|
||||||
make %{?_smp_mflags}
|
|
||||||
%if %{with java}
|
|
||||||
pushd java
|
|
||||||
%mvn_file : %{name}
|
|
||||||
%mvn_build
|
|
||||||
popd
|
|
||||||
%endif
|
|
||||||
emacs -batch -f batch-byte-compile editors/protobuf-mode.el
|
|
||||||
|
|
||||||
%check
|
|
||||||
|
|
||||||
%install
|
|
||||||
rm -rf %{buildroot}
|
|
||||||
make %{?_smp_mflags} install DESTDIR=%{buildroot} STRIPBINARIES=no INSTALL="%{__install} -p" CPPROG="cp -p"
|
|
||||||
find %{buildroot} -type f -name "*.la" -exec rm -f {} \;
|
|
||||||
install -p -m 644 -D %{SOURCE1} %{buildroot}%{_datadir}/vim/vimfiles/ftdetect/proto.vim
|
|
||||||
install -p -m 644 -D editors/proto.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax/proto.vim
|
|
||||||
%if %{with java}
|
|
||||||
pushd java
|
|
||||||
%mvn_install
|
|
||||||
popd
|
|
||||||
%endif
|
|
||||||
mkdir -p $RPM_BUILD_ROOT%{emacs_lispdir}
|
|
||||||
mkdir -p $RPM_BUILD_ROOT%{emacs_startdir}
|
|
||||||
install -p -m 0644 editors/protobuf-mode.el $RPM_BUILD_ROOT%{emacs_lispdir}
|
|
||||||
install -p -m 0644 editors/protobuf-mode.elc $RPM_BUILD_ROOT%{emacs_lispdir}
|
|
||||||
install -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{emacs_startdir}
|
|
||||||
|
|
||||||
%post -p /sbin/ldconfig
|
|
||||||
|
|
||||||
%postun -p /sbin/ldconfig
|
|
||||||
|
|
||||||
%post lite -p /sbin/ldconfig
|
|
||||||
|
|
||||||
%postun lite -p /sbin/ldconfig
|
|
||||||
|
|
||||||
%post compiler -p /sbin/ldconfig
|
|
||||||
|
|
||||||
%postun compiler -p /sbin/ldconfig
|
|
||||||
|
|
||||||
%files
|
|
||||||
%defattr(-, root, root, -)
|
|
||||||
%{_libdir}/libprotobuf.so.*
|
|
||||||
%doc CHANGES.txt CONTRIBUTORS.txt COPYING.txt README.txt
|
|
||||||
|
|
||||||
%files compiler
|
|
||||||
%defattr(-, root, root, -)
|
|
||||||
%{_bindir}/protoc
|
|
||||||
%{_libdir}/libprotoc.so.*
|
|
||||||
%doc COPYING.txt README.txt
|
|
||||||
|
|
||||||
%files devel
|
|
||||||
%defattr(-, root, root, -)
|
|
||||||
%dir %{_includedir}/google
|
|
||||||
%{_includedir}/google/protobuf/
|
|
||||||
%{_libdir}/libprotobuf.so
|
|
||||||
%{_libdir}/libprotoc.so
|
|
||||||
%{_libdir}/pkgconfig/protobuf.pc
|
|
||||||
%doc examples/add_person.cc examples/addressbook.proto examples/list_people.cc examples/Makefile examples/README.txt
|
|
||||||
|
|
||||||
%files static
|
|
||||||
%defattr(-, root, root, -)
|
|
||||||
%{_libdir}/libprotobuf.a
|
|
||||||
%{_libdir}/libprotoc.a
|
|
||||||
|
|
||||||
%files lite
|
|
||||||
%defattr(-, root, root, -)
|
|
||||||
%{_libdir}/libprotobuf-lite.so.*
|
|
||||||
|
|
||||||
%files lite-devel
|
|
||||||
%defattr(-, root, root, -)
|
|
||||||
%{_libdir}/libprotobuf-lite.so
|
|
||||||
%{_libdir}/pkgconfig/protobuf-lite.pc
|
|
||||||
|
|
||||||
%files lite-static
|
|
||||||
%defattr(-, root, root, -)
|
|
||||||
%{_libdir}/libprotobuf-lite.a
|
|
||||||
|
|
||||||
%files vim
|
|
||||||
%defattr(-, root, root, -)
|
|
||||||
%{_datadir}/vim/vimfiles/ftdetect/proto.vim
|
|
||||||
%{_datadir}/vim/vimfiles/syntax/proto.vim
|
|
||||||
|
|
||||||
%files emacs
|
|
||||||
%defattr(-,root,root,-)
|
|
||||||
%{emacs_startdir}/protobuf-init.el
|
|
||||||
%{emacs_lispdir}/protobuf-mode.elc
|
|
||||||
|
|
||||||
%files emacs-el
|
|
||||||
%defattr(-,root,root,-)
|
|
||||||
%{emacs_lispdir}/protobuf-mode.el
|
|
||||||
%if %{with java}
|
|
||||||
|
|
||||||
%files java -f java/.mfiles
|
|
||||||
%doc examples/AddPerson.java examples/ListPeople.java
|
|
||||||
|
|
||||||
%files javadoc -f java/.mfiles-javadoc
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%changelog
|
|
||||||
* Mon Jul 17 2023 zhangxiang <zhangxiang@iscas.ac.cn> - 2.5.0-5
|
|
||||||
- add riscv64 support
|
|
||||||
|
|
||||||
* Tue May 23 2023 huajingyun <huajingyun@loongson.cn> - 2.5.0-4
|
|
||||||
- Add loongarch64 support
|
|
||||||
|
|
||||||
* Wed Aug 18 2021 lingsheng <lingsheng@huawei.com> - 2.5.0-3
|
|
||||||
- Modify subpackage's install require
|
|
||||||
|
|
||||||
* Mon May 31 2021 huanghaitao <huanghaitao8@huawei.com> - 2.5.0-2
|
|
||||||
- Completing build dependencies
|
|
||||||
|
|
||||||
* Fri Feb 26 2021 Ge Wang <wangge20@huawei.com> - 2.5.0-1
|
|
||||||
- Package init
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
version_control: NA
|
|
||||||
src_repo: NA
|
|
||||||
tag_prefix: NA
|
|
||||||
separator: NA
|
|
||||||
Loading…
x
Reference in New Issue
Block a user