File: rules

package info (click to toggle)
mysql-workbench 6.2.3%2Bdfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 102,612 kB
  • ctags: 84,593
  • sloc: ansic: 804,682; cpp: 438,759; yacc: 59,129; python: 54,293; xml: 48,851; sql: 5,512; objc: 1,414; makefile: 505; sh: 455; java: 237; ruby: 6; perl: 5; php: 1
file content (131 lines) | stat: -rwxr-xr-x 5,032 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
#!/usr/bin/make -f
# -*- makefile -*-

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

PKD  = $(abspath $(dir $(MAKEFILE_LIST)))
PKG  = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))

# parallel build by default on linux
ifeq ($(DEB_HOST_ARCH_OS),linux)
    ifeq ($(findstring parallel=,$(DEB_BUILD_OPTIONS)),)
        export DEB_BUILD_OPTIONS+=parallel=$(shell getconf _NPROCESSORS_ONLN)
    endif
endif
$(info Info: DEB_BUILD_OPTIONS:$(origin DEB_BUILD_OPTIONS)=$(DEB_BUILD_OPTIONS))

# minimise needless linking
export DEB_LDFLAGS_MAINT_APPEND= -Wl,--as-needed

%:
	dh $@ --parallel --max-parallel=4 --with python2,autoreconf

override_dh_clean:
	$(RM) -rv CMakeFiles ext/antlr-runtime/.libs
	dh_clean

override_dh_auto_configure:
	dh_auto_configure -- \
            -DUSE_UNIXODBC=ON \
            -DCMAKE_INSTALL_PREFIX=/usr \
            -DREAL_EXECUTABLE_DIR=/usr/lib/$(PKG)

override_dh_auto_build:
	# rebuild files generated by flex/bison
	cd library/sql.parser/yy_gen-tool/yy_gen-tool/ \
        && bison -dl parser.yy \
        && flex -B -oparser.lex.cc parser.lex
	# generate icon
	convert images/icons/MySQLWorkbench-32.png debian/mysql-workbench.xpm
	# generate documentation for mysql-workbench-docs package
	#cd doc && ./DoxygenRun.sh
	# build all the rest
	dh_auto_build --max-parallel=4

override_dh_auto_install:
	dh_auto_install --max-parallel=4 --destdir=$(CURDIR)/debian/tmp
	# .desktop to unix line endings
	sed -i 's/\r//g' debian/tmp/usr/share/applications/*.desktop
	# remove *.la files
	find . -name '*.la' -delete -printf 'removing %p\n'
	# install link to launcher to /usr/bin/
	dh_link -p$(PKG) \
            usr/lib/$(PKG)/mysql-workbench usr/bin/mysql-workbench

override_dh_compress:
	dh_compress --exclude=.mwb

override_dh_makeshlibs:
	dh_makeshlibs --noscripts

# help `dh_shlibdeps` to find local libraries: 'dpkg-shlibdeps: error: couldn't find library'
override_dh_shlibdeps:
	LD_LIBRARY_PATH="debian/$(PKG)/usr/lib/$(PKG):$(LD_LIBRARY_PATH)" dh_shlibdeps

# -dbg package will be over 150 MiB
override_dh_strip:
	[ -d "$(CURDIR)/debian/$(PKG)-dbg" ] \
        && dh_strip --dbg-package=$(PKG)-dbg \
        || dh_strip

override_dh_builddeb:
	dh_builddeb -- -Zxz

## semi-automated manpage generation (to invoke manually)
MAN_NAME=mysql-workbench \\- MySQL Database Design, Administration and Development Tool
mysql-workbench.1:
	help2man --no-info --manual="mysql-workbench" --name="$(MAN_NAME)" mysql-workbench > $@
	perl \
            -E 's{^.*?\s+\\-\s+mysql-workbench.*}{$(MAN_NAME)}; # correcting NAME section'     \
            -E 's{^\.SH DESCRIPTION}{.SH SYNOPSIS};             # correcting SYNOPSIS section' \
            -E 's{^mysql\\-workbench\K\\-bin}{};                # correcting executable name'  \
            -E 's{^Options:}{.SH OPTIONS};                      # create OPTIONS section'      \
            -pi $@

## http://wiki.debian.org/onlyjob/get-orig-source
UVER  = $(shell dpkg-parsechangelog -l$(PKD)/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\-\d+.*)};')
DTYPE = +dfsg
VER  ?= $(subst $(DTYPE),,$(UVER))
.PHONY: get-orig-source
get-orig-source: $(PKG)_$(VER)$(DTYPE).orig.tar.xz $(info I: $(PKG)_$(VER)$(DTYPE))
	@

$(PKG)_$(VER)$(DTYPE).orig.tar.xz:
	@echo "# Downloading..."
	uscan --noconf --verbose --rename --destdir=$(CURDIR) --check-dirname-level=0 --force-download --download-version $(VER) $(PKD)
	$(if $(wildcard $(PKG)-$(VER)),$(error $(PKG)-$(VER) exist, aborting..))
	@echo "# Extracting..."
	mkdir $(PKG)-$(VER) \
        && tar -xf $(PKG)_$(VER).orig.tar.* --directory $(PKG)-$(VER) --strip-components 1 \
        || $(RM) -r $(PKG)-$(VER)
	@echo "# Cleaning-up..."
	find $(PKG)-$(VER) -type f -name '*.cmd' -delete -printf 'removed %p\n'
	find $(PKG)-$(VER) -type f -name '*.vc*' -delete -printf 'removed %p\n'
	find $(PKG)-$(VER) -depth -type d -name 'macosx' -exec $(RM) -r {} \; -printf 'removed %p\n'
	find $(PKG)-$(VER) -depth -type d -name 'windows' -exec $(RM) -r {} \; -printf 'removed %p\n'
	cd $(PKG)-$(VER) \
        && $(RM) -r -v \
             build/msi \
             build/res \
             build/zip \
             ext/Aga.Controls \
        0000-ext/antlr-runtime \
             ext/scintilla/.hgtags \
             ext/scintilla/cocoa \
             ext/scintilla/win32 \
             frontend/mac \
             library/base.windows \
             library/base.wr/resource.h \
             library/forms/winforms/resource.h \
             library/forms/cocoa \
             library/sql.parser/yy_purify-tool/dist/*.jar \
             library/sql.parser/update-tool/classes/*.class \
             MySQLWorkbench.xcodeproj \
             plugins/wb.doclib/res/DocLibrary/* \
             res/fonts \
	#$(RM) -v $(PKG)_$(VER).orig.tar.*
	@echo "# Packing..."
	find -L "$(PKG)-$(VER)" -xdev -type f -print | sort \
        | XZ_OPT="-7v" tar -caf "$(PKG)_$(VER)$(DTYPE).orig.tar.xz" -T- --owner=root --group=root --mode=a+rX \
        && $(RM) -r "$(PKG)-$(VER)"