File: rules

package info (click to toggle)
apptainer 1.4.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,780 kB
  • sloc: sh: 3,329; ansic: 1,706; awk: 414; python: 103; makefile: 54
file content (103 lines) | stat: -rwxr-xr-x 4,010 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk

include /usr/share/dpkg/default.mk

#DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# Causes static variable to become having multiple instances, so we need to strip it away
# See https://github.com/singularityware/singularity/issues/1947
export DEB_LDFLAGS_MAINT_STRIP=-Wl,-Bsymbolic-functions

PKGDIR=debian/apptainer
export SINGULARITY_CACHEDIR=$(PKGDIR)/var/lib/apptainer/cache

export GOPATH=$(CURDIR)/_build
SRCDIR = _build/src/github.com/apptainer/apptainer

export DESTDIR:=$(CURDIR)/$(PKGDIR)/
export HOME:=$(CURDIR)/debian/tmp

export DH_GOLANG_GO_GENERATE := 1
export DH_GOLANG_INSTALL_ALL := 1

%:
	dh $@ --with golang --builddirectory=_build --buildsystem=golang

override_dh_auto_configure:
	if [ ! -e VERSION ] ; then echo "$(DEB_VERSION_UPSTREAM)" > VERSION ; fi
# prepare source directory the way the build system wants it
# https://www.sylabs.io/guides/3.0/user-guide/quick_start.html#compile-the-singularity-binary
	dh_auto_configure --builddirectory=_build
	dh_auto_configure --builddirectory=$(CURDIR)/$(SRCDIR)
	$(RM) -rf $(CURDIR)/$(SRCDIR)/src/github.com/apptainer/apptainer

# perform the configuration
	cd $(SRCDIR) && \
	./mconfig -v \
	  -b builddir \
	  -V $(DEB_VERSION_UPSTREAM) \
	  --prefix=/usr \
	  --sysconfdir=/etc \
	  --libexecdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
	  --localstatedir=/var/lib \
	  --without-network \
	  --without-suid \
	;

override_dh_auto_build:
#	ln -s opencontainers $(SRCDIR)/vendor/github.com/openSUSE
	cd $(SRCDIR) && \
	$(MAKE) -C builddir GOFLAGS="-v -mod=readonly" GO111MODULE=off

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	DH_GOLANG_EXCLUDES="cmd/apptainer e2e etc/conf internal pkg/image pkg/network pkg/client/shub pkg/ocibundle/sif pkg/util/fs/proc /pkg/util/loop pkg/util/namespaces pkg/util/sysctl" \
        PATH="$(CURDIR)/$(SRCDIR)/builddir:$$PATH" \
        dh_auto_test -v
	## Downloads golangci-lint:
	#-$(MAKE) -C $(SRCDIR)/builddir check
endif

override_dh_auto_install:
	$(MAKE) -C $(SRCDIR)/builddir install
	-mv -v $(PKGDIR)/usr/bin/singularity $(PKGDIR)/usr/bin/singularity.$$(awk '/^Package:/ { print $$2 }' debian/control | head -1)
	-mv -v $(PKGDIR)/usr/bin/run-singularity $(PKGDIR)/usr/bin/run-singularity.$$(awk '/^Package:/ { print $$2 }' debian/control | head -1)
	: # move bash completions into now new standard location
	-mv -v $(PKGDIR)/etc/bash_completion.d $(PKGDIR)/usr/share/bash-completion/completions
	-for i in $(PKGDIR)/usr/share/bash-completion/completions/*singularity* ; do mv $$i $$i.$$(awk '/^Package:/ { print $$2 }' debian/control | head -1) ; done

override_dh_install:
	dh_install -XLICENSE.md

execute_before_dh_installman:
	: # Very sloppy man pages for now
	debian/generate_manpages $(PKGDIR) $(DEB_VERSION)

execute_after_dh_installman:
	rm $(PKGDIR)/usr/share/man/man1/singularity.1

#execute_after_dh_clean:
#	dh_clean
#	## Remove Files-Excluded (when built from checkout or non-DFSG tarball):
#	$(RM) -rv `perl -0nE 'say $$1 if m{^Files\-Excluded\:\s*(.*?)(?:\n\n|Files:|Comment:)}sm;' debian/copyright`
#	-find vendor -mindepth 1 -type d -empty -delete -printf 'removed %p\n'

# dh_golang uses `go list` to find the dependencies, then maps them
# to Debian packages. However, it wipes out the GOPATH and forces it
# to look only in <build-directory>/src. It's supposed to have symlinked
# the central libraries from /usr/share/gocode into here, but this doesn't
# appear to be happening (maybe since we aren't using `--buildsystem=golang`).
# I worked around this by using GNU stow to do the symlinking. I also stow
# the vendored libraries in to prevent dh_golang from failing.
#override_dh_golang:
#	stow vendor -t go/src
#	ln -sv /usr/share/gocode/src gocode
#	stow gocode --defer '.*crypto' --defer '.*containernetworking' -t go/src/
#	dh_golang --builddirectory=go
# clean up
#	stow -D vendor -t go/src
#	stow -D gocode -t go/src
#	$(RM) gocode