ncdns-repro/projects/q/build
2021-03-29 12:00:57 +00:00

43 lines
1.2 KiB
Bash

#!/bin/bash
[% c("var/set_default_env") -%]
[% pc('go', 'var/setup', { go_tarfile => c('input_files_by_name/go') }) %]
export CGO_ENABLED=[% c("var/cgo") %]
distdir=/var/tmp/dist/[% project %]
mkdir -p $distdir
[% FOREACH dep = c("var/go_lib_deps") -%]
tar -C /var/tmp/dist -xf [% c('input_files_by_name/' _ dep) %]
[% END -%]
mkdir -p $GOPATH/src/github.com/namecoin
tar -C $GOPATH/src/github.com/namecoin -xf [% project %]-[% c('version') %].tar.gz
mv $GOPATH/src/github.com/namecoin/q-[% c('version') %] $GOPATH/src/github.com/namecoin/qlib
# TODO: Remove static build ID after migrating to Go 1.13.3+
go install $TAGS -ldflags '-s -buildid=' github.com/namecoin/qlib/cmd/q
[% IF c("var/linux-x86_64") -%]
GOPATHBIN="${GOPATH}/bin"
[% ELSE -%]
GOPATHBIN="${GOPATH}/bin/${GOOS}_${GOARCH}"
[% END -%]
cd /var/tmp/dist
[% IF !c("var/go_lib_no_output") -%]
# Build as library
[% c('tar', {
tar_src => [ 'gopath' ],
tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
}) %]
[% ELSE %]
# Build as executable
cp -a $GOPATHBIN/q[% IF c("var/windows") %].exe[% END %] $distdir/
cd $distdir
[% c('tar', {
tar_src => [ '.' ],
tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
}) %]
[% END %]