mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-14 15:18:06 +00:00
60 lines
1.7 KiB
Makefile
Executable File
60 lines
1.7 KiB
Makefile
Executable File
#!/usr/bin/make -f
|
|
#
|
|
# Copyright (C) 2018 Roberto Mier Escandón <rmescandon@gmail.com>
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License version 3 as
|
|
# published by the Free Software Foundation.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
PROJECT := yq
|
|
OWNER := mikefarah
|
|
REPO := github.com
|
|
GOVERSION := 1.15
|
|
|
|
export DH_OPTIONS
|
|
export DH_GOPKG := ${REPO}/${OWNER}/${PROJECT}
|
|
export GOROOT := /usr/lib/go-${GOVERSION}
|
|
export GOPATH := ${CURDIR}/_build
|
|
export GOBIN := ${GOPATH}/bin
|
|
export PATH := ${GOROOT}/bin:${GOBIN}:${PATH}
|
|
export GOCACHE := /tmp/gocache
|
|
export GOFLAGS := -mod=vendor
|
|
|
|
SRCDIR := ${GOPATH}/src/${DH_GOPKG}
|
|
DESTDIR := ${CURDIR}/debian/${PROJECT}
|
|
BINDIR := /usr/bin
|
|
ASSETSDIR := /usr/share/${PROJECT}
|
|
|
|
%:
|
|
dh $@
|
|
|
|
override_dh_auto_build:
|
|
mkdir -p ${SRCDIR}
|
|
mkdir -p ${GOBIN}
|
|
# copy project to local srcdir to build from there
|
|
rsync -avz --progress --exclude=_build --exclude=debian --exclude=tmp. --exclude=go.mod --exclude=docs . $(SRCDIR)
|
|
# build go code
|
|
(cd ${SRCDIR} && go install -buildmode=pie ./...)
|
|
|
|
override_dh_auto_test:
|
|
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
|
|
(cd ${SRCDIR} && go test -v ./...)
|
|
endif
|
|
|
|
override_dh_auto_install:
|
|
cp ${GOBIN}/yq ${DESTDIR}/${BINDIR}
|
|
cp -f ${SRCDIR}/LICENSE ${DESTDIR}/${ASSETSDIR}
|
|
chmod a+x ${DESTDIR}/${BINDIR}/yq
|
|
|
|
override_dh_auto_clean:
|
|
dh_clean
|
|
rm -rf ${CURDIR}/_build
|