Compare commits

..

6 Commits

Author SHA1 Message Date
693ac6e677 Generate Debian package from template
Refs #7
2021-04-09 00:19:56 +00:00
953b1009d3 Fix PREFIX AND DESTDIR
Refs #7
2021-04-09 00:19:50 +00:00
11053571d5 Move debian files
Refs #7
2021-04-09 00:19:38 +00:00
86720c72f9 Initial Debian package
Refs #7
2021-04-08 05:38:02 +00:00
0df1524976 Use PREFIX and DESTDIR for make install
Refs #7
2021-04-08 05:37:54 +00:00
965b1b4339 Don't get LDFLAGS from the environment
Refs #7
2021-04-08 05:37:37 +00:00
6 changed files with 56 additions and 4 deletions

3
.gitignore vendored
View File

@ -21,3 +21,6 @@
.vscode/configurationCache.log
.vscode/dryrun.log
.vscode/targets.log
# packaging
/debian

View File

@ -1,7 +1,8 @@
V ?= 0
Q = $(if $(filter 1, $V),, @)
BINDIR=$(CURDIR)/bin
DESTDIR=/usr/local/bin
PREFIX=/usr
DESTDIR=bin
ifeq ($(OS), Windows_NT)
EXE=$(BINDIR)/lume.exe
@ -15,7 +16,7 @@ endif
LUME_VERSION ?= $(shell git describe --tags --always)
GIT_COMMIT := $(shell git rev-parse --short HEAD)
LDFLAGS := $(LDFLAGS) \
LDFLAGS = \
-X git.kill0.net/chill9/lume/cmd.Version=$(LUME_VERSION) \
-X git.kill0.net/chill9/lume/cmd.BuildDate=$(BUILD_DATE) \
-X git.kill0.net/chill9/lume/cmd.GitCommit=$(GIT_COMMIT)
@ -25,9 +26,26 @@ build:
$(Q) go build -o $(EXE) -ldflags="$(LDFLAGS)" ./cmd/lume
.PHONY: clean
clean:
clean: deb-clean
$(Q) $(RM) $(EXE)
.PHONY: install
install:
$(Q) install -p -D -m 0755 $(EXE) $(DESTDIR)
$(Q) install -p -D -m 0755 $(EXE) $(DESTDIR)${PREFIX}/bin/lume
$(Q) install -p -D -m 0644 .lumerc.sample $(DESTDIR)${PREFIX}/share/lume/lumerc
DEBDIR=$(CURDIR)/debian
TMPLDIR=$(CURDIR)/packaging/debian
DEBDATE=$(shell date -R)
.PHONY: deb
deb:
$(Q) mkdir -p $(DEBDIR)
$(Q) sed -e 's/__VERSION__/$(LUME_VERSION)/g' $(TMPLDIR)/rules > $(DEBDIR)/rules
$(Q) sed -e 's/__VERSION__/$(LUME_VERSION)/g' -e 's/__DATE__/$(DEBDATE)/g' $(TMPLDIR)/changelog > $(DEBDIR)/changelog
$(Q) echo 9 > $(DEBDIR)/compat
$(Q) cp $(TMPLDIR)/control $(DEBDIR)/control
$(Q) dpkg-buildpackage -us -uc -b
deb-clean:
$(Q) rm -rf $(CURDIR)/debian

View File

@ -0,0 +1,5 @@
lume (__VERSION__) UNRELEASED; urgency=medium
* Package generated with make deb
-- Ryan Cavicchioni <ryan@cavi.cc> __DATE__

1
packaging/debian/compat Normal file
View File

@ -0,0 +1 @@
9

7
packaging/debian/control Normal file
View File

@ -0,0 +1,7 @@
Source: lume
Maintainer: Ryan Cavicchioni <ryan@cavi.cc>
Package: lume
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: A CLI tool for the LIFX HTTP API

18
packaging/debian/rules Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/make -f
DISTRIBUTION = $(shell lsb_release -sr)
VERSION = __VERSION__
PACKAGEVERSION = $(VERSION)
%:
dh $@
override_dh_auto_clean:
override_dh_auto_test:
override_dh_auto_build:
override_dh_auto_install:
make
make install DESTDIR=debian/lume
override_dh_gencontrol:
dh_gencontrol -- -v$(PACKAGEVERSION)