Skip to content

Commit

Permalink
change debian package creation
Browse files Browse the repository at this point in the history
  • Loading branch information
adelolmo committed Jun 6, 2020
1 parent ba7bc0e commit 596bb5e
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 41 deletions.
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
.idea
build
*.iml
build
obj*
debian/notify-mail
debian/debhelper-build-stamp
debian/.debhelper
debian/files
debian/notify-mail.debhelper.log
debian/notify-mail.substvars
release
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

8 changes: 0 additions & 8 deletions deb/DEBIAN/control

This file was deleted.

7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
notify-mail (1.2.2) unstable; urgency=medium

* implement message template.
* validate variables parameter.
* fix message delivery

-- Andoni del Olmo <[email protected]> Sat, 06 Jun 2020 18:22:45 +0200
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
11 changes: 11 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Source: notify-mail
Section: extras
Priority: standard
Maintainer: Andoni del Olmo <[email protected]>
Build-Depends: debhelper (>=9), golang-go:native (>= 1.3.3), dh-golang
Standards-Version: 3.9.4
Homepage: https://github.com/adelolmo/notify-mail

Package: notify-mail
Architecture: any
Description: Send mail notifications
77 changes: 77 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/usr/bin/make -f

export DH_OPTIONS

##
# From git-lfs/git-lfs repo:
# Looks like dh_golang doesn't set diffrent archs, so you have to do them semi-manually.
##

## This if-structure is decided on what is passed by the -a flag by dpkg-buildpackage command.
ifeq ($(DEB_HOST_ARCH), i386)
export GOARCH := 386
else ifeq ($(DEB_HOST_ARCH), amd64)
export GOARCH := amd64
else ifeq ($(DEB_HOST_ARCH), armhf)
export GOARCH := arm
# May need to set GOARM as well if your going to target ARM. But for now this works.
else ifeq ($(DEB_HOST_ARCH), arm64)
export GOARCH := arm64
endif

# Or add your arch that your targeting, these are just examples.

# Directory where compiled binary is placed + debian setup files.
# Note: If your doing building thru git, you may want to add obj-* to .gitignore
BUILD_DIR := obj-$(DEB_HOST_GNU_TYPE)

# Required: Put the url (without http://) of your git repo.
export DH_GOPKG := github.com/adelolmo/notify-mail

# Required: Put the name of your git repo below.
GIT_REPO_NAME := notify-mail

export PATH := $(CURDIR)/$(BUILD_DIR)/bin:$(PATH)

##
# From git-lfs/git-lfs repo:
# by-default, dh_golang only copies *.go and other source - this upsets a bunch of vendor test routines
##
export DH_GOLANG_INSTALL_ALL := 1

%:
mkdir -p /tmp/gocache
GO111MODULE=on GOFLAGS=-mod=vendor GOCACHE=/tmp/gocache dh $@ --buildsystem=golang --with=golang

override_dh_clean:
rm -f debian/debhelper.log
dh_clean

override_dh_auto_build:
dh_auto_build
##
# From git-lfs/git-lfs repo:
# dh_golang doesn't do anything here in deb 8, and it's needed in both
##
if [ "$(DEB_HOST_GNU_TYPE)" != "$(DEB_BUILD_GNU_TYPE)" ]; then\
cp -rf $(BUILD_DIR)/bin/*/* $(BUILD_DIR)/bin/; \
fi

override_dh_strip:
##
# From git-lfs/git-lfs repo:
# strip disabled as golang upstream doesn't support it and it makes go crash.
# See https://launchpad.net/bugs/1200255.
##

override_dh_golang:
##
# From git-lfs/git-lfs repo:
# The dh_golang is used to add the Built-using field to the deb. This is only for reference.
# As of https://anonscm.debian.org/cgit/collab-maint/dh-golang.git/commit/script/dh_golang?id=7c3fbec6ea92294477fa8910264fe9bd823f21c3
# dh_golang errors out because the go compiler used was not installed via a package. Therefore the step is skipped
##

override_dh_auto_install:
install -g 0 -o 0 -d debian/$(GIT_REPO_NAME)/usr/bin
cp $(BUILD_DIR)/bin/notify-mail debian/$(GIT_REPO_NAME)/usr/bin
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/adelolmo/notify-mail

go 1.14
31 changes: 0 additions & 31 deletions package

This file was deleted.

0 comments on commit 596bb5e

Please sign in to comment.