File: rules

package info (click to toggle)
openclipart 1:0.18+dfsg-15
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 263,828 kB
  • sloc: makefile: 262; perl: 113; sh: 90
file content (154 lines) | stat: -rwxr-xr-x 5,419 bytes parent folder | download
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

# Put here files that are oversized and need to have a reduced size
OVERSIZED_FILES = ./clipart/animals/mammals/big_cats/tiger_graig_ryan_smith_-_01.svg \
		  ./clipart/signs_and_symbols/flags/national_flag_of_the_re_.svg \
		  ./clipart/signs_and_symbols/flags/the_official_flag_of_i_r.svg \
		  ./clipart/food/bread_and_wine_mark_near_.svg \
		  ./clipart/geography/africa_01.svg \
		  ./clipart/geography/europe_01.svg \
		  ./clipart/geography/oceania_01.svg \
		  ./clipart/geography/world_map_01.svg \
		  ./clipart/geography/world_map_02.svg \
		  ./clipart/shapes/tangram_erwan_01.svg \
		  ./clipart/shapes/tangram_erwan_02.svg \
		  ./clipart/recreation/games/chess/tamerlane_chess_jonadab_.svg \
		  ./clipart/recreation/tamerlane_chess_jonadab_.svg

clean:
	dh_testdir
	dh_testroot

	# Files with space in their name are causing problems. Removing spaces.
	-mv "./clipart/recreation/music/CD_Player" "./clipart/recreation/music/CD Player"
	-mv "./clipart/unsorted/profilo_della_citta.svg" "./clipart/unsorted/profilo_della citta.svg"

	-rm -rf build
	-rm -f *-stamp
	dh_clean


build: build-arch build-indep

build-arch: build-stamp

build-indep: build-stamp

build-stamp:
	dh_testdir

	# Files with space in their name are causing problems. Removing spaces.
	mv "./clipart/recreation/music/CD Player" "./clipart/recreation/music/CD_Player"
	mv "./clipart/unsorted/profilo_della citta.svg" "./clipart/unsorted/profilo_della_citta.svg"

	# Create svg and png files
	cd $(CURDIR)/clipart && for i in `find . -name "*.svg" -printf "%p " ` ; do \
		echo "Processing $$i" ; \
		dir=`dirname $$i` ; \
		file=`basename $$i` ; \
		pngfile=`basename $$file svg`png ; \
		mkdir -p $(CURDIR)/build/usr/share/openclipart/svg/$$dir ; \
		sed -e '/<i:pgf id="adobe_illustrator_pgf">/,/<\/i:pgf>/d' $(CURDIR)/clipart/$$dir/$$file > \
			$(CURDIR)/build/usr/share/openclipart/svg/$$dir/$$file ; \
		mkdir -p $(CURDIR)/build/usr/share/openclipart/png/$$dir ; \
		if echo $(OVERSIZED_FILES) | grep -q $$i ; then \
			inkscape -w 1500 --export-png=$(CURDIR)/build/usr/share/openclipart/png/$$dir/$$pngfile \
				 $$dir/$$file 2>&1 | grep -v "^$$" | uniq; \
		else \
			inkscape --export-png=$(CURDIR)/build/usr/share/openclipart/png/$$dir/$$pngfile \
				 $$dir/$$file 2>&1 | grep -v "^$$" | uniq; \
		fi ; \
		optipng -quiet $(CURDIR)/build/usr/share/openclipart/png/$$dir/$$pngfile; \
	done
 
	# Replace duplicates files by symlinks
	cd $(CURDIR)/build/ ; \
	fdupes -r -1 . | while read lines ; do \
		unset MAIN ; \
		for dupes in $$lines ; do \
			if [ -z "$$MAIN" ] ; then \
	    			MAIN=`echo $$dupes | sed s/\\.//` ; \
			else \
				ln -sf $$MAIN $$dupes ; \
			fi ; \
		done ; \
	done

	# Move some files
	mv $(CURDIR)/build/usr/share/openclipart/svg/animals/birds/macchina_fotografica_di_01.svg \
		$(CURDIR)/build/usr/share/openclipart/svg/electronics/
	mv $(CURDIR)/build/usr/share/openclipart/png/animals/birds/macchina_fotografica_di_01.png \
		$(CURDIR)/build/usr/share/openclipart/png/electronics/

	# Create OOo gallery files; we need to add the files in hunks
	# because we othererwise may get too many arguments....
	mkdir -p $(CURDIR)/build/usr/lib/libreoffice/share/gallery
	for dir in `find build/usr/share/openclipart/png -mindepth 1 -maxdepth 1 -type d | LC_CTYPE=C sort` ; do \
		gal_name=$${dir##*/}; \
		gal_oooname=`echo $$gal_name | awk '{gsub("_"," ");a=toupper(substr($$0,1,1));b=substr($$0,2);print a b}' | sed -e "s/^Education/Education2/" | sed -e "s/^People/People2/" | sed -e "s/^Transportation/Transportation2/"` ; \
		echo "Doing gallery $$gal_oooname..."; \
		find $(CURDIR)/$$dir -name "*.png" -and -not -type l >> build/$$gal_name.filelist; \
		split -d -l 250 build/$$gal_name.filelist build/$$gal_name.filelist- ; \
		for file in build/$$gal_name.filelist-*; do \
			echo "Processing filelist $$file"; \
			SAL_USE_VCLPLUGIN="svp" /usr/lib/libreoffice/program/gengal --name "$$gal_oooname" --path "$(CURDIR)/build/usr/lib/libreoffice/share/gallery" --destdir "$(CURDIR)/build" `cat $$file | xargs`; \
		done; \
	done

	touch build-stamp

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	# Install PNG files
	cp -af $(CURDIR)/build/usr/share/openclipart/png/* \
		$(CURDIR)/debian/openclipart-png/usr/share/openclipart/png/

	# Install SVG files
	cp -af $(CURDIR)/build/usr/share/openclipart/svg/* \
		$(CURDIR)/debian/openclipart-svg/usr/share/openclipart/svg/

	# Install OOo files
	mkdir -p $(CURDIR)/debian/openclipart-libreoffice/usr/lib/libreoffice/share/gallery
	cp -af $(CURDIR)/build/usr/lib/libreoffice/share/gallery/* \
		$(CURDIR)/debian/openclipart-libreoffice/usr/lib/libreoffice/share/gallery/


# Build architecture-dependent files here.
# We have nothing to do by default.
binary-arch: build install

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
#	dh_installdebconf
	dh_installdocs
	dh_installexamples
#	dh_installlogrotate
	dh_installcron
	dh_installman
	dh_installinfo
	dh_installchangelogs
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	dh_makeshlibs
	dh_installdeb
#	dh_perl
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install