@@ -47,6 +47,12 @@ function extension {
47
47
fi
48
48
}
49
49
50
+ function do_build {
51
+ if [ -f " /hooksdir/build.sh" ]; then echo " source build.sh hook" ; source " /hooksdir/build.sh" ; fi
52
+ # call dedicated build script
53
+ $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
54
+ }
55
+
50
56
GO_VERSION_MAJOR=$( go version | sed -e ' s/.*go\([0-9]\+\)\..*/\1/' )
51
57
GO_VERSION_MINOR=$( go version | sed -e ' s/.*go[0-9]\+\.\([0-9]\+\)\..*/\1/' )
52
58
GO111MODULE=$( go env GO111MODULE)
200
206
201
207
if [ " ${# LD[@]} " -gt 0 ]; then LDF=(--ldflags=" $( printf " %s " " ${LD[@]} " ) " ); fi
202
208
209
+ # source setup.sh if existing
210
+ if [ -f " /hooksdir/setup.sh" ]; then echo " source setup.sh hook" ; source " /hooksdir/setup.sh" ; fi
211
+
203
212
# Build for each requested platform individually
204
213
for TARGET in $TARGETS ; do
205
214
# Split the target into platform and architecture
@@ -210,7 +219,7 @@ for TARGET in $TARGETS; do
210
219
if { [ " $XGOOS " == " ." ] || [ " $XGOOS " == " linux" ]; } && { [ " $XGOARCH " == " ." ] || [ " $XGOARCH " == " amd64" ]; }; then
211
220
echo " Compiling for linux/amd64..."
212
221
mkdir -p /gocache/linux/amd64
213
- GOCACHE=/gocache/linux/amd64 HOST=x86_64-linux PREFIX=/usr/local $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
222
+ XGOOS= " linux " XGOARCH= " amd64 " GOCACHE=/gocache/linux/amd64 HOST=x86_64-linux PREFIX=/usr/local do_build
214
223
if [[ " $USEMODULES " == false ]]; then
215
224
GOCACHE=/gocache/linux/amd64 GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go get $V $X " ${T[@]} " -d " $PACK_RELPATH "
216
225
fi
@@ -219,7 +228,7 @@ for TARGET in $TARGETS; do
219
228
if { [ " $XGOOS " == " ." ] || [ " $XGOOS " == " linux" ]; } && { [ " $XGOARCH " == " ." ] || [ " $XGOARCH " == " 386" ]; }; then
220
229
echo " Compiling for linux/386..."
221
230
mkdir -p /gocache/linux/386
222
- GOCACHE=/gocache/linux/386 CC=" gcc -m32" CXX=" g++ -m32" HOST=i686-linux PREFIX=/usr/local $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
231
+ XGOOS= " linux " XGOARCH= " 386 " GOCACHE=/gocache/linux/386 CC=" gcc -m32" CXX=" g++ -m32" HOST=i686-linux PREFIX=/usr/local do_build
223
232
if [[ " $USEMODULES " == false ]]; then
224
233
GOCACHE=/gocache/linux/386 GOOS=linux GOARCH=386 CGO_ENABLED=1 go get $V $X " ${T[@]} " -d " $PACK_RELPATH "
225
234
fi
@@ -231,7 +240,7 @@ for TARGET in $TARGETS; do
231
240
ln -s /usr/local/go/pkg/linux_arm-5 /usr/local/go/pkg/linux_arm
232
241
fi
233
242
echo " Compiling for linux/arm-5..."
234
- GOCACHE=/gocache/linux/arm-5 CC=arm-linux-gnueabi-gcc-6 CXX=arm-linux-gnueabi-g++-6 HOST=arm-linux-gnueabi PREFIX=/usr/arm-linux-gnueabi CFLAGS=" -march=armv5" CXXFLAGS=" -march=armv5" $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
243
+ XGOOS= " linux " XGOARCH= " arm-5 " GOCACHE=/gocache/linux/arm-5 CC=arm-linux-gnueabi-gcc-6 CXX=arm-linux-gnueabi-g++-6 HOST=arm-linux-gnueabi PREFIX=/usr/arm-linux-gnueabi CFLAGS=" -march=armv5" CXXFLAGS=" -march=armv5" do_build
235
244
export PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig
236
245
237
246
if [[ " $USEMODULES " == false ]]; then
@@ -250,7 +259,7 @@ for TARGET in $TARGETS; do
250
259
ln -s /usr/local/go/pkg/linux_arm-6 /usr/local/go/pkg/linux_arm
251
260
252
261
echo " Compiling for linux/arm-6..."
253
- GOCACHE=/gocache/linux/arm-6 CC=arm-linux-gnueabi-gcc-6 CXX=arm-linux-gnueabi-g++-6 HOST=arm-linux-gnueabi PREFIX=/usr/arm-linux-gnueabi CFLAGS=" -march=armv6" CXXFLAGS=" -march=armv6" $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
262
+ XGOOS= " linux " XGOARCH= " arm-6 " GOCACHE=/gocache/linux/arm-6 CC=arm-linux-gnueabi-gcc-6 CXX=arm-linux-gnueabi-g++-6 HOST=arm-linux-gnueabi PREFIX=/usr/arm-linux-gnueabi CFLAGS=" -march=armv6" CXXFLAGS=" -march=armv6" do_build
254
263
export PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig
255
264
256
265
if [[ " $USEMODULES " == false ]]; then
@@ -269,7 +278,7 @@ for TARGET in $TARGETS; do
269
278
ln -s /usr/local/go/pkg/linux_arm-7 /usr/local/go/pkg/linux_arm
270
279
271
280
echo " Compiling for linux/arm-7..."
272
- GOCACHE=/gocache/linux/arm-7 CC=arm-linux-gnueabihf-gcc-6 CXX=arm-linux-gnueabihf-g++-6 HOST=arm-linux-gnueabihf PREFIX=/usr/arm-linux-gnueabihf CFLAGS=" -march=armv7-a -fPIC" CXXFLAGS=" -march=armv7-a -fPIC" $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
281
+ XGOOS= " linux " XGOARCH= " arm-7 " GOCACHE=/gocache/linux/arm-7 CC=arm-linux-gnueabihf-gcc-6 CXX=arm-linux-gnueabihf-g++-6 HOST=arm-linux-gnueabihf PREFIX=/usr/arm-linux-gnueabihf CFLAGS=" -march=armv7-a -fPIC" CXXFLAGS=" -march=armv7-a -fPIC" do_build
273
282
export PKG_CONFIG_PATH=/usr/arm-linux-gnueabihf/lib/pkgconfig
274
283
275
284
if [[ " $USEMODULES " == false ]]; then
@@ -286,7 +295,7 @@ for TARGET in $TARGETS; do
286
295
else
287
296
echo " Compiling for linux/arm64..."
288
297
mkdir -p /gocache/linux/arm64
289
- GOCACHE=/gocache/linux/arm64 CC=aarch64-linux-gnu-gcc-6 CXX=aarch64-linux-gnu-g++-6 HOST=aarch64-linux-gnu PREFIX=/usr/aarch64-linux-gnu $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
298
+ XGOOS= " linux " XGOARCH= " arm64 " GOCACHE=/gocache/linux/arm64 CC=aarch64-linux-gnu-gcc-6 CXX=aarch64-linux-gnu-g++-6 HOST=aarch64-linux-gnu PREFIX=/usr/aarch64-linux-gnu do_build
290
299
export PKG_CONFIG_PATH=/usr/aarch64-linux-gnu/lib/pkgconfig
291
300
292
301
if [[ " $USEMODULES " == false ]]; then
@@ -301,7 +310,7 @@ for TARGET in $TARGETS; do
301
310
else
302
311
echo " Compiling for linux/mips64..."
303
312
mkdir -p /gocache/linux/mips64
304
- GOCACHE=/gocache/linux/mips64 CC=mips64-linux-gnuabi64-gcc-6 CXX=mips64-linux-gnuabi64-g++-6 HOST=mips64-linux-gnuabi64 PREFIX=/usr/mips64-linux-gnuabi64 $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
313
+ XGOOS= " linux " XGOARCH= " mips64 " GOCACHE=/gocache/linux/mips64 CC=mips64-linux-gnuabi64-gcc-6 CXX=mips64-linux-gnuabi64-g++-6 HOST=mips64-linux-gnuabi64 PREFIX=/usr/mips64-linux-gnuabi64 do_build
305
314
export PKG_CONFIG_PATH=/usr/mips64-linux-gnuabi64/lib/pkgconfig
306
315
307
316
if [[ " $USEMODULES " == false ]]; then
@@ -316,7 +325,7 @@ for TARGET in $TARGETS; do
316
325
else
317
326
echo " Compiling for linux/mips64le..."
318
327
mkdir -p /gocache/linux/mips64le
319
- GOCACHE=/gocache/linux/mips64le CC=mips64el-linux-gnuabi64-gcc-6 CXX=mips64el-linux-gnuabi64-g++-6 HOST=mips64el-linux-gnuabi64 PREFIX=/usr/mips64el-linux-gnuabi64 $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
328
+ XGOOS= " linux " XGOARCH= " mips64le " GOCACHE=/gocache/linux/mips64le CC=mips64el-linux-gnuabi64-gcc-6 CXX=mips64el-linux-gnuabi64-g++-6 HOST=mips64el-linux-gnuabi64 PREFIX=/usr/mips64el-linux-gnuabi64 do_build
320
329
export PKG_CONFIG_PATH=/usr/mips64le-linux-gnuabi64/lib/pkgconfig
321
330
322
331
if [[ " $USEMODULES " == false ]]; then
@@ -331,7 +340,7 @@ for TARGET in $TARGETS; do
331
340
else
332
341
echo " Compiling for linux/mips..."
333
342
mkdir -p /gocache/linux/mips
334
- GOCACHE=/gocache/linux/mips CC=mips-linux-gnu-gcc-6 CXX=mips-linux-gnu-g++-6 HOST=mips-linux-gnu PREFIX=/usr/mips-linux-gnu $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
343
+ XGOOS= " linux " XGOARCH= " mips " GOCACHE=/gocache/linux/mips CC=mips-linux-gnu-gcc-6 CXX=mips-linux-gnu-g++-6 HOST=mips-linux-gnu PREFIX=/usr/mips-linux-gnu do_build
335
344
export PKG_CONFIG_PATH=/usr/mips-linux-gnu/lib/pkgconfig
336
345
337
346
if [[ " $USEMODULES " == false ]]; then
@@ -346,7 +355,7 @@ for TARGET in $TARGETS; do
346
355
else
347
356
echo " Compiling for linux/s390x..."
348
357
mkdir -p /gocache/linux/s390x
349
- GOCACHE=/gocache/linux/s390x CC=s390x-linux-gnu-gcc-6 CXX=s390x-linux-gnu-g++-6 HOST=s390x-linux-gnu PREFIX=/usr/s390x-linux-gnu $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
358
+ XGOOS= " linux " XGOARCH= " s390x " GOCACHE=/gocache/linux/s390x CC=s390x-linux-gnu-gcc-6 CXX=s390x-linux-gnu-g++-6 HOST=s390x-linux-gnu PREFIX=/usr/s390x-linux-gnu do_build
350
359
export PKG_CONFIG_PATH=/usr/s390x-linux-gnu/lib/pkgconfig
351
360
352
361
if [[ " $USEMODULES " == false ]]; then
@@ -361,7 +370,7 @@ for TARGET in $TARGETS; do
361
370
else
362
371
echo " Compiling for linux/riscv64..."
363
372
mkdir -p /gocache/linux/riscv64
364
- GOCACHE=/gocache/linux/riscv64 CC=riscv64-linux-gnu-gcc-8 CXX=riscv64-linux-gnu-g++-8 HOST=riscv64-linux-gnu PREFIX=/usr/riscv64-linux-gnu $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
373
+ XGOOS= " linux " XGOARCH= " riscv64 " GOCACHE=/gocache/linux/riscv64 CC=riscv64-linux-gnu-gcc-8 CXX=riscv64-linux-gnu-g++-8 HOST=riscv64-linux-gnu PREFIX=/usr/riscv64-linux-gnu do_build
365
374
export PKG_CONFIG_PATH=/usr/riscv64-linux-gnu/lib/pkgconfig
366
375
367
376
if [[ " $USEMODULES " == false ]]; then
@@ -376,7 +385,7 @@ for TARGET in $TARGETS; do
376
385
else
377
386
echo " Compiling for linux/ppc64le..."
378
387
mkdir -p /gocache/linux/ppc64le
379
- GOCACHE=/gocache/linux/ppc64le CC=powerpc64le-linux-gnu-gcc-6 CXX=powerpc64le-linux-gnu-g++-6 HOST=ppc64le-linux-gnu PREFIX=/usr/ppc64le-linux-gnu $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
388
+ XGOOS= " linux " XGOARCH= " ppc64le " GOCACHE=/gocache/linux/ppc64le CC=powerpc64le-linux-gnu-gcc-6 CXX=powerpc64le-linux-gnu-g++-6 HOST=ppc64le-linux-gnu PREFIX=/usr/ppc64le-linux-gnu do_build
380
389
export PKG_CONFIG_PATH=/usr/ppc64le-linux-gnu/lib/pkgconfig
381
390
382
391
if [[ " $USEMODULES " == false ]]; then
@@ -391,7 +400,7 @@ for TARGET in $TARGETS; do
391
400
else
392
401
echo " Compiling for linux/mipsle..."
393
402
mkdir -p /gocache/linux/mipsle
394
- GOCACHE=/gocache/linux/mipsle CC=mipsel-linux-gnu-gcc-6 CXX=mipsel-linux-gnu-g++-6 HOST=mipsel-linux-gnu PREFIX=/usr/mipsel-linux-gnu $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
403
+ XGOOS= " linux " XGOARCH= " mipsle " GOCACHE=/gocache/linux/mipsle CC=mipsel-linux-gnu-gcc-6 CXX=mipsel-linux-gnu-g++-6 HOST=mipsel-linux-gnu PREFIX=/usr/mipsel-linux-gnu do_build
395
404
export PKG_CONFIG_PATH=/usr/mipsle-linux-gnu/lib/pkgconfig
396
405
397
406
if [[ " $USEMODULES " == false ]]; then
@@ -418,7 +427,7 @@ for TARGET in $TARGETS; do
418
427
if [ " $XGOARCH " == " ." ] || [ " $XGOARCH " == " amd64" ]; then
419
428
echo " Compiling for windows-$PLATFORM /amd64..."
420
429
mkdir -p /gocache/windows-$PLATFORM /amd64
421
- GOCACHE=/gocache/windows-$PLATFORM /amd64 CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix HOST=x86_64-w64-mingw32 PREFIX=/usr/x86_64-w64-mingw32 $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
430
+ XGOOS= " windows- $PLATFORM " XGOARCH= " amd64 " GOCACHE=/gocache/windows-$PLATFORM /amd64 CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix HOST=x86_64-w64-mingw32 PREFIX=/usr/x86_64-w64-mingw32 do_build
422
431
export PKG_CONFIG_PATH=/usr/x86_64-w64-mingw32/lib/pkgconfig
423
432
424
433
if [[ " $USEMODULES " == false ]]; then
@@ -429,7 +438,7 @@ for TARGET in $TARGETS; do
429
438
if [ " $XGOARCH " == " ." ] || [ " $XGOARCH " == " 386" ]; then
430
439
echo " Compiling for windows-$PLATFORM /386..."
431
440
mkdir -p /gocache/windows-$PLATFORM /386
432
- GOCACHE=/gocache/windows-$PLATFORM /386 CC=i686-w64-mingw32-gcc-posix CXX=i686-w64-mingw32-g++-posix HOST=i686-w64-mingw32 PREFIX=/usr/i686-w64-mingw32 $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
441
+ XGOOS= " windows- $PLATFORM " XGOARCH= " 386 " GOCACHE=/gocache/windows-$PLATFORM /386 CC=i686-w64-mingw32-gcc-posix CXX=i686-w64-mingw32-g++-posix HOST=i686-w64-mingw32 PREFIX=/usr/i686-w64-mingw32 do_build
433
442
export PKG_CONFIG_PATH=/usr/i686-w64-mingw32/lib/pkgconfig
434
443
435
444
if [[ " $USEMODULES " == false ]]; then
@@ -459,7 +468,7 @@ for TARGET in $TARGETS; do
459
468
if [ " $XGOARCH " == " ." ] || [ " $XGOARCH " == " amd64" ]; then
460
469
echo " Compiling for darwin-$PLATFORM /amd64..."
461
470
mkdir -p /gocache/darwin-$PLATFORM /amd64
462
- GOCACHE=/gocache/darwin-$PLATFORM /amd64 CC=o64-clang CXX=o64-clang++ HOST=x86_64-apple-darwin15 PREFIX=/usr/local $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
471
+ XGOOS= " darwin- $PLATFORM " XGOARCH= " amd64 " GOCACHE=/gocache/darwin-$PLATFORM /amd64 CC=o64-clang CXX=o64-clang++ HOST=x86_64-apple-darwin15 PREFIX=/usr/local do_build
463
472
if [[ " $USEMODULES " == false ]]; then
464
473
GOCACHE=/gocache/darwin-$PLATFORM /amd64 CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go get $V $X " ${T[@]} " " ${LDFS[@]} " " ${GC[@]} " -d " $PACK_RELPATH "
465
474
fi
@@ -471,7 +480,7 @@ for TARGET in $TARGETS; do
471
480
else
472
481
echo " Compiling for darwin-$PLATFORM /arm64..."
473
482
mkdir -p /gocache/darwin-$PLATFORM /arm64
474
- GOCACHE=/gocache/darwin-$PLATFORM /arm64 CC=o64-clang CXX=o64-clang++ HOST=arm64-apple-darwin15 PREFIX=/usr/local $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
483
+ XGOOS= " darwin- $PLATFORM " XGOARCH= " arm64 " GOCACHE=/gocache/darwin-$PLATFORM /arm64 CC=o64-clang CXX=o64-clang++ HOST=arm64-apple-darwin15 PREFIX=/usr/local do_build
475
484
if [[ " $USEMODULES " == false ]]; then
476
485
GOCACHE=/gocache/darwin-$PLATFORM /arm64 CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go get $V $X " ${T[@]} " " ${LDFS[@]} " " ${GC[@]} " -d " $PACK_RELPATH "
477
486
fi
@@ -486,7 +495,7 @@ for TARGET in $TARGETS; do
486
495
# Build the requested freebsd binaries
487
496
if [ " $XGOARCH " == " ." ] || [ " $XGOARCH " == " amd64" ]; then
488
497
echo " Compiling for freebsd/amd64..."
489
- CC=x86_64-pc-freebsd12-gcc HOST=x86_64-pc-freebsd12 PREFIX=/freebsdcross/x86_64-pc-freebsd12 $BUILD_DEPS /deps " ${DEPS_ARGS[@]} "
498
+ XGOOS= " freebsd " XGOARCH= " amd64 " CC=x86_64-pc-freebsd12-gcc HOST=x86_64-pc-freebsd12 PREFIX=/freebsdcross/x86_64-pc-freebsd12 do_build
490
499
export PKG_CONFIG_PATH=/freebsdcross/x86_64-pc-freebsd12/lib/pkgconfig
491
500
492
501
if [[ " $USEMODULES " == false ]]; then
0 commit comments