cadoles-profile/debian/rules

59 lines
1.6 KiB
Makefile

#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
GO_VERSION := 1.12.7
OS := linux
ARCH := amd64
GOPATH=$(HOME)/go
ifeq (, $(shell which go 2>/dev/null))
override_dh_auto_build: install-go
endif
ifeq (, $(shell which mage 2>/dev/null))
override_dh_auto_build: install-mage
endif
# ifeq (, $(shell which node 2>/dev/null))
# override_dh_auto_build: install-nodejs
# endif
%:
dh $@ --with systemd
override_dh_auto_build: $(GOPATH)
GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" mage -v installDeps
GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" ARCH_TARGETS=$(ARCH) mage -v release
$(GOPATH):
mkdir -p $(GOPATH)
install-go:
wget https://dl.google.com/go/go$(GO_VERSION).$(OS)-$(ARCH).tar.gz
tar -C /usr/local -xzf go$(GO_VERSION).$(OS)-$(ARCH).tar.gz
install-mage: $(GOPATH)
GOPATH=$(GOPATH) misc/mage/install
# install-nodejs:
# curl -sL https://deb.nodesource.com/setup_8.x | bash -
# apt-get install -y nodejs
# npm install -g yarn
override_dh_auto_install:
mkdir -p debian/cadoles-profile/usr/share/cadoles-profile
mkdir -p debian/cadoles-profile/etc/cadoles-profile
mkdir -p debian/cadoles-profile/usr/bin
cp -r release/cadoles-profile-$(OS)-$(ARCH)/* debian/cadoles-profile/usr/share/cadoles-profile/
mv debian/cadoles-profile/usr/share/cadoles-profile/bin/server debian/cadoles-profile/usr/bin/cadoles-profile
mv debian/cadoles-profile/usr/share/cadoles-profile/server.conf debian/cadoles-profile/etc/cadoles-profile/server.conf
install -d debian/cadoles-profile
override_dh_strip: