11
11
12
12
LND_VERSION_REGEX=" lnd version (.+) commit"
13
13
PKG=" github.com/lightningnetwork/lnd"
14
- PACKAGE=lnd
14
+ LND_PACKAGE=lnd
15
+ SIGNER_PACKAGE=lndsigner
15
16
16
17
# Needed for setting file timestamps to get reproducible archives.
17
18
BUILD_DATE=" 2020-01-01 00:00:00"
@@ -127,15 +128,50 @@ function check_tag_correct() {
127
128
fi
128
129
}
129
130
131
+ # build_package builds release binaries for the passed package and lncli, for
132
+ # the passed environment.
133
+ # arguments: <package-name> <iteration-index> <tag> <os> <arch> <arm>
134
+ # <build-tags> <ldflags>
135
+ function build_package() {
136
+ local package_name=$1
137
+ local index=$2
138
+ local tag=$3
139
+ local os=$4
140
+ local arch=$5
141
+ local arm=$6
142
+ local build_tags=$7
143
+ local ldflags=$8
144
+
145
+ dir=" ${package_name} -${index} -${tag} "
146
+ mkdir " ${dir} "
147
+ pushd " ${dir} "
148
+
149
+ green " - Building ${package_name} : ${os} ${arch} ${arm} with build tags '${build_tags} '"
150
+ env GOEXPERIMENT=loopvar CGO_ENABLED=0 GOOS=$os GOARCH=$arch GOARM=$arm go build -v -trimpath -ldflags=" ${ldflags} " -tags=" ${build_tags} " ${PKG} /cmd/${package_name}
151
+ env GOEXPERIMENT=loopvar CGO_ENABLED=0 GOOS=$os GOARCH=$arch GOARM=$arm go build -v -trimpath -ldflags=" ${ldflags} " -tags=" ${build_tags} " ${PKG} /cmd/lncli
152
+ popd
153
+
154
+ # Add the hashes for the individual binaries as well for easy verification
155
+ # of a single installed binary.
156
+ shasum -a 256 " ${dir} /" * >> " manifest-$tag .txt"
157
+
158
+ if [[ $os == " windows" ]]; then
159
+ reproducible_zip " ${dir} "
160
+ else
161
+ reproducible_tar_gzip " ${dir} "
162
+ fi
163
+ }
164
+
130
165
# build_release builds the actual release binaries.
131
- # arguments: <version-tag> <build-system(s)> <build-tags> <ldflags >
132
- # <go-version>
166
+ # arguments: <version-tag> <build-system(s)> <lnd- build-tags>
167
+ # <lndsigner-build-tags> <ldflags> < go-version>
133
168
function build_release() {
134
169
local tag=$1
135
170
local sys=$2
136
- local buildtags=$3
137
- local ldflags=$4
138
- local goversion=$5
171
+ local lndbuildtags=$3
172
+ local signerbuildtags=$4
173
+ local ldflags=$5
174
+ local goversion=$6
139
175
140
176
# Check if the active Go version matches the specified Go version.
141
177
active_go_version=$( go version | awk ' {print $3}' | sed ' s/go//' )
@@ -151,13 +187,13 @@ required Go version ($goversion)."
151
187
go mod vendor
152
188
reproducible_tar_gzip vendor
153
189
154
- maindir=$PACKAGE -$tag
190
+ maindir=$LND_PACKAGE -$tag
155
191
mkdir -p $maindir
156
192
mv vendor.tar.gz " ${maindir} /"
157
193
158
194
# Don't use tag in source directory, otherwise our file names get too long and
159
195
# tar starts to package them non-deterministically.
160
- package_source=" ${PACKAGE } -source"
196
+ package_source=" ${LND_PACKAGE } -source"
161
197
162
198
# The git archive command doesn't support setting timestamps and file
163
199
# permissions. That's why we unpack the tar again, then use our reproducible
@@ -184,28 +220,15 @@ required Go version ($goversion)."
184
220
arm=7
185
221
fi
186
222
187
- dir=" ${PACKAGE} -${i} -${tag} "
188
- mkdir " ${dir} "
189
- pushd " ${dir} "
223
+ # Build lnd package
224
+ build_package " ${LND_PACKAGE} " " ${i} " " ${tag} " " ${os} " " ${arch} " " ${arm} " " ${lndbuildtags} " " ${ldflags} "
190
225
191
- green " - Building: ${os} ${arch} ${arm} with build tags '${buildtags} '"
192
- env GOEXPERIMENT=loopvar CGO_ENABLED=0 GOOS=$os GOARCH=$arch GOARM=$arm go build -v -trimpath -ldflags=" ${ldflags} " -tags=" ${buildtags} " ${PKG} /cmd/lnd
193
- env GOEXPERIMENT=loopvar CGO_ENABLED=0 GOOS=$os GOARCH=$arch GOARM=$arm go build -v -trimpath -ldflags=" ${ldflags} " -tags=" ${buildtags} " ${PKG} /cmd/lncli
194
- popd
195
-
196
- # Add the hashes for the individual binaries as well for easy verification
197
- # of a single installed binary.
198
- shasum -a 256 " ${dir} /" * >> " manifest-$tag .txt"
199
-
200
- if [[ $os == " windows" ]]; then
201
- reproducible_zip " ${dir} "
202
- else
203
- reproducible_tar_gzip " ${dir} "
204
- fi
226
+ # Build lndsigner package
227
+ build_package " ${SIGNER_PACKAGE} " " ${i} " " ${tag} " " ${os} " " ${arch} " " ${arm} " " ${signerbuildtags} " " ${ldflags} "
205
228
done
206
229
207
230
# Add the hash of the packages too, then sort by the second column (name).
208
- shasum -a 256 lnd -* vendor* >> " manifest-$tag .txt"
231
+ shasum -a 256 " ${LND_PACKAGE} " - * " ${SIGNER_PACKAGE} " -* vendor* >> " manifest-$tag .txt"
209
232
LC_ALL=C sort -k2 -o " manifest-$tag .txt" " manifest-$tag .txt"
210
233
cat " manifest-$tag .txt"
211
234
}
0 commit comments