-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherigon2.spec
182 lines (162 loc) · 7.41 KB
/
erigon2.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# Disable the debug package as we don't provide it:
%global debug_package %{nil}
# TODO: rig up debug package support with golang.
# Upstream, the repo and makefile targets are still called erigon, go account
# for that:
%global original_name erigon
# The following conditional determine which version of Erigon we're building. They
# may be overrode by invoking rpmbuild with -D 'macroname "macro value here"'.
# Erigon version, buildable branch, & commit hash:
# Current values:
# GIT_TAG=v2022.10.01
# GIT_COMMIT=d0337242c6e5913553e9e1c0949be1e5e871e01e
%define spec_pkgver %{?pkgver}%{!?pkgver:2022.10.01}
%define spec_commit %{?commit}%{!?commit:d0337242c6e5913553e9e1c0949be1e5e871e01e}
%define spec_branch %{?branch}%{!?branch:%{original_name}-v%{spec_pkgver}}
# Supplementary files version:
%define spec_suppl_ver %{?suppl_ver}%{!?suppl_ver:0.0.3}
%define spec_go_ver %{?go_ver}%{!?go_ver:1.19.1}
Name: erigon2
Vendor: Ledgerwatch
Version: %{spec_pkgver}
Release: 1%{?dist}
Summary: A very efficient next-generation Ethereum execution client
License: LGPLv3
URL: https://github.com/ledgerwatch/erigon
# File sources:
Source0: https://github.com/%{vendor}/%{original_name}/archive/refs/tags/v%{version}.tar.gz
Source1: https://github.com/kaiwetlesen/%{name}-release/archive/refs/tags/v%{spec_suppl_ver}.tar.gz
BuildRequires: libmdbx-devel, binutils, git, curl
%if "%{dist}" == ".el8"
BuildRequires: gcc-toolset-10-gcc
BuildRequires: gcc-toolset-10-gcc-c++
%else
BuildRequires: gcc >= 10
BuildRequires: gcc-c++ >= 10
%endif
%description
An implementation of Ethereum (aka "Ethereum execution client"), on the
efficiency frontier, written in Go, compatible with the proof-of-stake merge.
%prep
# Build fails with GCC Go, so die unless we can set that alternative:
%autosetup -b 1 -n %{name}-release-%{spec_suppl_ver}
%autosetup -b 0 -n %{original_name}-%{version}
# Apply git attributes to release code:
git clone --bare --depth 1 -b v%{version} https://github.com/%{vendor}/%{original_name}.git .git
git init
git checkout -f -b %{spec_branch} tags/v%{version}
# Clone these two guys into the Erigon code:
#git clone https://github.com/ledgerwatch/erigon-snapshot.git turbo/snapshotsync/snapshothashes/erigon-snapshots
#git clone https://github.com/ngosang/trackerslist.git cmd/downloader/trackers/trackerslist
#sed -e 's/-buildvcs=false//g' Makefile > Makefile.new && mv -f Makefile.new Makefile
%build
if [ -f /opt/rh/gcc-toolset-10/enable ]; then
. /opt/rh/gcc-toolset-10/enable
echo "Enabled GCC toolchain v10 for RedHat systems"
fi
export mach=$(uname -m | tr '[A-Z]' '[a-z]')
echo "Detected machine architecture ${mach}"
# Map a few choice platforms:
if [ "${mach}" == 'x86_64' ]; then
go_mach='amd64'
elif [ "${mach}" == 'i386' ] || [ "${mach}" == 'i686' ]; then
go_mach='386'
elif [ "${mach}" == 'aarch64' ]; then
go_mach='arm64'
else
go_mach='unknown'
fi
if [ "$go_mach" == 'unknown' ]; then
echo "No known Go-machine match for architecture ${mach}"
exit -1
fi
echo "Installing Go v%{spec_go_ver}.${go_mach} into ${PWD}/go for the ${mach} platform"
curl -sL https://go.dev/dl/go%{spec_go_ver}.linux-${go_mach}.tar.gz | tar -C ${PWD} -xz
export GOPATH="${PWD}/go"
export PATH="${GOPATH}/bin:${PATH}"
go install github.com/cpuguy83/go-md2man@latest
export GIT_BRANCH="%{spec_branch}"
export GIT_COMMIT="%{spec_commit}"
export GIT_TAG="v%{version}"
cd %{_builddir}/%{original_name}-%{version}
make %{original_name} rpcdaemon sentry txpool downloader hack state integration observer rpctest
echo '# "%{name}" 1 "%{summary}" %{vendor} "User Manuals"' > %{name}.1.md
cat %{name}.1.md README.md | go-md2man > %{name}.1
%{__gzip} %{name}.1
%{__rm} %{name}.1.md
# Rename binaries with common names to [name]-[binary] scheme:
cd build/bin
mv %{original_name} %{name}
for binary in *; do
%{__strip} --strip-debug --strip-unneeded ${binary}
if echo $binary | grep -qv '^%{name}'; then
%{__mv} ${binary} %{name}-${binary}
fi
done
chmod -R ug+w ${GOPATH}
rm -rf ${GOPATH}
cd -
%install
%define build_srcdir %{_builddir}/%{original_name}-%{version}
%define suppl_srcdir %{_builddir}/%{name}-release-%{spec_suppl_ver}
%{__install} -m 0755 -D -s %{build_srcdir}/build/bin/* -t %{buildroot}%{_bindir}
%{__install} -m 0644 -D %{build_srcdir}/README.md -t %{buildroot}%{_datadir}/doc/%{name}
%{__install} -m 0644 -D %{build_srcdir}/TESTING.md -t %{buildroot}%{_datadir}/doc/%{name}
%{__install} -m 0644 -D %{build_srcdir}/COPYING* -t %{buildroot}%{_datadir}/licenses/%{name}
%{__install} -m 0644 -D %{build_srcdir}/AUTHORS -t %{buildroot}%{_datadir}/licenses/%{name}
%{__install} -m 0644 -D %{build_srcdir}/%{name}.1.gz -t %{buildroot}%{_mandir}/man1
%{__install} -m 0644 -D %{suppl_srcdir}/units/*.service -t %{buildroot}%{_prefix}/lib/systemd/system
%{__install} -m 0644 -D %{suppl_srcdir}/firewallsvcs/*.xml -t %{buildroot}%{_prefix}/lib/firewalld/services
%{__install} -m 0644 -D %{suppl_srcdir}/sysconfig/%{name} -T %{buildroot}%{_sysconfdir}/sysconfig/%{name}
%files
%license COPYING COPYING.LESSER AUTHORS
%doc README.md TESTING.md
%{_bindir}/*
%{_mandir}/man1/%{name}.1.gz
%{_prefix}/lib/systemd/system/*
%{_prefix}/lib/firewalld/services/*
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%pre
if ! getent group %{name} &> /dev/null; then
groupadd -r %{name}
fi
if ! getent passwd %{name} &> /dev/null; then
useradd -r -g %{name} -m -d %{_sharedstatedir}/%{name} -k /dev/null %{name}
fi
%changelog
* Fri Nov 4 2022 Kai Wetlesen <[email protected]> - 2022.10.01-0%{?dist}
- Bumping to Erigon2 to version 2022.10.01
- Bumping GoLang version to v1.19.3
- Final release of the Erigon2 package as we transition to semver
- New Erigon packages will continue under the `erigon` namespace
* Tue Sep 20 2022 Kai Wetlesen <[email protected]> - 2022.09.03-0%{?dist}
- Building Erigon2 v2022.09.03
* Tue Sep 20 2022 Kai Wetlesen <[email protected]> - 2022.09.02-0%{?dist}
- Building Erigon2 v2022.09.02, soon to be followed by v2022.09.03
- Bumped GoLang version to v1.19.1
* Mon Sep 12 2022 Kai Wetlesen <[email protected]> - 2022.09.01-1%{?dist}
- Removed the deprecated `cons' binary
- Corrected bogus spec date
* Mon Sep 12 2022 Kai Wetlesen <[email protected]> - 2022.09.01-0%{?dist}
- Bumped Erigon2 version to v2022.09.01
* Thu Sep 1 2022 Kai Wetlesen <[email protected]> - 2022.08.03-0%{?dist}
- Bumped Erigon2 version to v2022.08.03
- Bumped Go toolchain version to v1.19
* Tue Aug 16 2022 Kai Wetlesen <[email protected]> - 2022.08.02-0%{?dist}
- Bumped Erigon2 version to v2022.08.02
* Tue Aug 9 2022 Kai Wetlesen <[email protected]> - 2022.08.01-0%{?dist}
- Bumped Erigon2 version to v2022.08.01
* Tue Aug 2 2022 Kai Wetlesen <[email protected]> - 2022.07.04-0%{?dist}
- Bumped Erigon2 version to v2022.07.04
- Bumped GoLang version to patch v1.18.5
- Updated firewall rules to better reflect true purpose
- Included additional useful utilities and daemons in bundle
* Fri Jul 29 2022 Kai Wetlesen <[email protected]> - 2022.07.03-0%{?dist}
- Bumped Erigon2 version to v2022.07.03
* Tue Jul 12 2022 Kai Wetlesen <[email protected]> - 2022.07.02-0%{?dist}
- Major revamp of build specification
- GoLang now must be pulled independently due to lack of available v1.19 in RL8
- Renamed all services from Erigon to Erigon2
- Bumped build version to v2022.07.02
* Tue May 3 2022 Kai Wetlesen <[email protected]> - 2022.04.03-0%{?dist}
- First Erigon2 RPM release