File: rules

package info (click to toggle)
nocache 0.9-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 164 kB
  • ctags: 70
  • sloc: ansic: 512; makefile: 74; sh: 26
file content (45 lines) | stat: -rwxr-xr-x 1,997 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
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@

override_dh_auto_install:
	dh_auto_install -v -- PREFIX=/usr LIBDIR=/lib/$(PKG)
	# check if wrapper built for correct PREFIX and LIBDIR
	[ -n "$$(grep '/usr/lib/$(PKG)/$(PKG)' $(CURDIR)/debian/$(PKG)/usr/bin/$(PKG))" ]

override_dh_auto_test:
#	-NOCACHE_NR_FADVISE=2 dh_auto_test -v

override_dh_builddeb:
	dh_builddeb -- -Zxz

PKD  = $(abspath $(dir $(MAKEFILE_LIST)))
PKG  = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))
VER ?= $(shell dpkg-parsechangelog -l$(PKD)/changelog | perl -ne 'print $$1 if m{Version:\s*([\d\.+git]+)}')
GDATE = $(shell date --rfc-3339=seconds --date='TZ="UTC" $(shell echo $(VER) | perl -ne 'print "$$1-$$2-$$3" if m/\+git(\d{4})(\d{2})(\d{2})/')')
.PHONY: get-orig-source
get-orig-source: $(PKG)_$(VER).orig.tar.xz
	@

$(PKG)_$(VER).orig.tar.xz:
	@echo "# Downloading..."
	#uscan --noconf --verbose --rename --destdir=$(CURDIR) --check-dirname-level=0 --force-download --download-version $(VER) $(PKD)
	git clone git://github.com/Feh/nocache.git $(PKG)-$(VER) \
        || $(RM) -r $(PKG)-$(VER)
	cd $(PKG)-$(VER) \
        && git checkout v$(VER) || git reset --hard $$(git rev-list --all -n 1 --before="$(GDATE)") \
        && [ -s ChangeLog ] || ( echo "# Generating ChangeLog..." \
           ; git log --pretty="format:%ad  %aN  <%aE>%n%n%x09* %s%n" --date=short > ChangeLog \
           ; touch -d "$$(git log -1 --format='%ci')" ChangeLog) \
        && echo "# Setting times..." \
        && for F in $$(git ls-tree -r --name-only HEAD); do touch --no-dereference -d "$$(git log -1 --format="%ai" -- $$F)" "$$F"; done \
        && echo "# Cleaning-up..." \
        && $(RM) -rv .git .git* \
        && cd .. && echo "# Packing..." \
        && find -L "$(PKG)-$(VER)" -xdev -type f -print \
        | sort | XZ_OPT="-7v" tar -caf "$(PKG)_$(VER).orig.tar.xz" -T- --owner=root --group=root --mode=a+rX \
        && $(RM) -r "$(PKG)-$(VER)"