File: rules

package info (click to toggle)
gimp-plugin-registry 7.20140602
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 55,856 kB
  • ctags: 4,984
  • sloc: ansic: 46,100; lisp: 20,560; python: 14,721; sh: 3,306; cpp: 2,528; makefile: 1,023; xml: 546
file content (110 lines) | stat: -rwxr-xr-x 3,843 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
104
105
106
107
108
109
110
#!/usr/bin/make -f
# -*- makefile -*-

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

GIMPVER := $(shell dpkg -s libgimp2.0-dev | grep Version | awk '{print $$2}')
export GIMPVER
PLUGINS := $(shell find $(CURDIR) -mindepth 1 -maxdepth 1 -name .git -prune -o -name .pc -prune -o -name debian -prune -o -name old_plugins -prune -o -type d -printf '%f\n' | sort)
export PLUGINS
PLUGINBINDIR := "/usr/lib/gimp/2.0/plug-ins"
export PLUGINBINDIR
PLUGINSCRIPTDIR := "/usr/share/gimp/2.0/scripts"
export PLUGINSCRIPTDIR

%:
	dh $@ --with quilt,python2,autotools_dev --parallel

# Here follows a small shell snipped to call dh_auto_* for all plugins
# Currently
# - if a Makefile exists in the plugin directory
#   we run dh_auto_$(1) with -O--sourcedirectory="$$plugin"
# - if $${plugin}/src exists, we run dh_auto_$(1) on that directory
# - else: fail :)
DH_AUTO_CALL = 	if [ "$$auto_command" = "dh_auto_configure" ]; then \
		    export options="$$options -- --enable-stack-protector" ;\
		fi ;\
		if [ -f $(CURDIR)/$$plugin/Makefile ]; then \
			$$auto_command -O--sourcedirectory="$${plugin}" $$options; \
		elif [ -d $(CURDIR)/$$plugin/src ]; then \
			$$auto_command -O--sourcedirectory="$${plugin}/src" $$options; \
		else \
			echo failed to build $$plugin; exit 255 ; \
		fi

PACKAGING_HELPER = /usr/bin/python $(CURDIR)/debian/packaging-helper.py


clean: $(PLUGINS:%=clean-%) debian/copyright debian/control
	dh $@ --with quilt,python2,autotools_dev --parallel
	rm -f debian/gimp-plugin-registry.install

clean-%:
	rm -rf debian/$*

dh_auto_install-%:
	# run dh_auto_install to debian/$plugin
	set -e ;\
	    export auto_command="dh_auto_install" ;\
	    export plugin="$*" ;\
	    export options="--destdir=debian/$*" ;\
	    $(DH_AUTO_CALL)
	if [ -d debian/$*/usr/lib/gimp-plugin-registry ]; then \
	    mkdir -p debian/$*/usr/lib/gimp/2.0 ;\
	    mv debian/$*/usr/lib/gimp-plugin-registry debian/$*/usr/lib/gimp/2.0/plug-ins ;\
	fi
	# add files to debian/gimp-plugin-registry.install
	set -e; find debian/$* -type f -printf '%h\n' | sort -u  |\
	    while read dir; do \
	        echo "$$dir/* `echo $$dir | sed 's,debian/$*/,,'`" ;\
	    done >> debian/gimp-plugin-registry.install
	# create shlibdeps for the plugin into a temp file
	set -e; \
	   opts=`find debian/$* -type f -exec file {} \; |\
	   grep -E ' ELF ' |\
	   sed 's,:.*,,;s,^,-e,' |\
	   tr '\n' ' '` ;\
	   if [ -n "$$opts" ]; then \
	   	dpkg-shlibdeps -O $$opts | grep shlibs:Depends > debian/$*/substvars ;\
	   fi
       
dh_auto_%:
	set -e; \
	    export auto_command=`echo $* | sed 's,-.*,,;s,^,dh_auto_,'` ;\
	    export plugin=`echo $* | sed 's,[^-]*-,,'` ;\
	    $(DH_AUTO_CALL)


override_dh_auto_build: $(PLUGINS:%=dh_auto_build-%)

override_dh_auto_clean: $(PLUGINS:%=dh_auto_clean-%)

override_dh_auto_configure: $(PLUGINS:%=dh_auto_configure-%)

override_dh_auto_install: $(PLUGINS:%=dh_auto_install-%)
	#$(PACKAGING_HELPER) --generate-readme

#override_dh_auto_test: $(PLUGINS:%=dh_auto_test-%)
override_dh_auto_test: 
	# nothign to do right now.

override_dh_python2:
	dh_python2
	dh_python2 usr/lib/gimp/2.0/python

CONTROL_FILES := $(shell for p in $(PLUGINS); do echo $$p/control; done)
COPYRIGHT_FILES := $(shell for p in $(PLUGINS); do echo $$p/copyright; done)
debian/copyright: debian/copyright.in debian/packaging-helper.py $(CONTROL_FILES) $(COPYRIGHT_FILES)
	$(PACKAGING_HELPER) --copyright
	-if [ -d .git ]; then git add $@; git commit -m 'Auto update of $@' $@; fi

debian/control: debian/control.in debian/packaging-helper.py $(CONTROL_FILES)
	$(PACKAGING_HELPER) --control
	-if [ -d .git ]; then git add $@; git commit -m 'Auto update of $@' $@; fi


watch:
	@$(PACKAGING_HELPER) --watch

.PHONY: watch override_dh_auto_build override_dh_auto_clean override_dh_auto_configure override_dh_auto_install override_dh_auto_test