diff --git a/3000-etcd-3.4.14-sw.patch b/3000-etcd-3.4.14-sw.patch new file mode 100644 index 0000000000000000000000000000000000000000..38056ba3d15b211ccc096b0b2e0a682a75b0ee27 --- /dev/null +++ b/3000-etcd-3.4.14-sw.patch @@ -0,0 +1,16 @@ +diff -Naur etcd-3.4.14.org/vendor/go.etcd.io/bbolt/bolt_sw64.go etcd-3.4.14.sw/vendor/go.etcd.io/bbolt/bolt_sw64.go +--- etcd-3.4.14.org/vendor/go.etcd.io/bbolt/bolt_sw64.go 1970-01-01 08:00:00.000000000 +0800 ++++ etcd-3.4.14.sw/vendor/go.etcd.io/bbolt/bolt_sw64.go 2022-09-16 15:23:18.290000000 +0800 +@@ -0,0 +1,12 @@ ++// +build sw64 ++ ++package bbolt ++ ++// maxMapSize represents the largest mmap size supported by Bolt. ++const maxMapSize = 0xFFFFFFFFFFFF // 256TB ++ ++// maxAllocSize is the size used when creating array pointers. ++const maxAllocSize = 0x7FFFFFFF ++ ++// Are unaligned load/stores broken on this arch? ++var brokenUnaligned = false diff --git a/bbolt-1.3.7.tar.gz b/bbolt-1.3.7.tar.gz new file mode 100755 index 0000000000000000000000000000000000000000..b13fbae54ed814ee01a20d6efdece1a6dc70788e Binary files /dev/null and b/bbolt-1.3.7.tar.gz differ diff --git a/etcd.spec b/etcd.spec index c236d6d8100b6a3907f9b4a7d5d5676b5974ca4b..74700ecf3798521c1bde3299c9cd96f1adf61796 100644 --- a/etcd.spec +++ b/etcd.spec @@ -31,7 +31,7 @@ system.} %global gosupfiles integration/fixtures/* etcdserver/api/v2http/testdata/* Name: etcd -Release: 4 +Release: 5 Summary: Distributed reliable key-value store for the most critical data of a distributed system # Upstream license specification: Apache-2.0 @@ -43,10 +43,13 @@ Source2: %{name}.conf Source3: man-%{man_version}.tar.gz # sh genmanpages.sh path_to_built_source Source10: genmanpages.sh +# add support for loongarch64 +Source3000: bbolt-1.3.7.tar.gz # update grpc-go version to v1.32.0 Patch1: 0001-Convert-int-to-string-using-strconv.Itoa.patch -Patch2: 0002-Etcd-on-unsupported-platform-without-ETCD_UNSUPPORTED_ARCH=arm64-set.patch - +Patch2: 0002-Etcd-on-unsupported-platform-without-ETCD_UNSUPPORTED_ARCH=arm64-set.patch +# add support for sw_64 +Patch3000: 3000-etcd-3.4.14-sw.patch BuildRequires: golang BuildRequires: python3-devel %{?systemd_requires} @@ -63,6 +66,7 @@ Requires(pre): shadow-utils %forgesetup %patch1 -p1 %patch2 -p1 +%patch3000 -p1 # For compatibility cp -aR etcdserver/api/snap snap cp -aR etcdserver/api/membership etcdserver/membership @@ -76,20 +80,39 @@ mv etcdctl/READMEv2.md READMEv2-etcdctl.md mkdir -p man/man1 cp ../man-%{man_version}/*.1 man/man1/. +%ifarch loongarch64 sw_64 +cp -af %{_prefix}/lib/golang/src/cmd/vendor/golang.org/x/sys vendor/golang.org/x/ +%endif +%ifarch loongarch64 +tar xf %{SOURCE3000} -C vendor/go.etcd.io/bbolt/ +%endif + %if %{without bootstrap} %build CGO_CFLAGS="-fstack-protector-strong -fPIE -D_FORTIFY_SOURCE=2 -O2" \ CGO_LDFLAGS_ALLOW="-Wl,-z,relro,-z,now" \ CGO_LDFLAGS="-Wl,-z,relro,-z,now -Wl,-z,noexecstack" \ GO111MODULE=on GOFLAGS=-mod=vendor \ -go build -buildmode=pie -ldflags "-linkmode=external -w -s" \ +go build \ +%ifnarch sw_64 + -buildmode=pie \ +%else + -buildmode=exe \ +%endif +-ldflags "-linkmode=external -w -s" \ -o %{gobuilddir}/bin/etcd %{goipath} for cmd in etcdctl; do CGO_CFLAGS="-fstack-protector-strong -fPIE -D_FORTIFY_SOURCE=2 -O2" \ CGO_LDFLAGS_ALLOW="-Wl,-z,relro,-z,now" \ CGO_LDFLAGS="-Wl,-z,relro,-z,now -Wl,-z,noexecstack" \ GO111MODULE=on GOFLAGS=-mod=vendor \ - go build -buildmode=pie -ldflags "-linkmode=external -w -s" \ + go build \ +%ifnarch sw_64 + -buildmode=pie \ +%else + -buildmode=exe \ +%endif + -ldflags "-linkmode=external -w -s" \ -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd done %endif @@ -148,6 +171,9 @@ getent passwd %{name} >/dev/null || useradd -r -g %{name} -d %{_sharedstatedir}/ %endif %changelog +* Mon Aug 14 2023 herengui - 3.4.14-5 +- add support for loongarch64 and sw_64 + * Wed Sep 2021 jikui - 3.4.14-4 - modify build flags for secure compilation options