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))
## "bindnow" causes run-time errors:
#export DEB_BUILD_MAINT_OPTIONS=hardening=+bindnow
# minimise needless linking
export DEB_LDFLAGS_MAINT_APPEND= -Wl,--as-needed
export DEB_CPPFLAGS_MAINT_APPEND= -std=c++11
%:
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 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_python2:
dh_python2 --no-ext-rename
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
## 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/cppconn \
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 \
build/ms \
ext/Aga.Controls \
#$(RM) -v $(PKG)_$(VER).orig.tar.*
@echo "# Packing..."
find -L "$(PKG)-$(VER)" -xdev -type f -print | LC_ALL=C sort \
| XZ_OPT="-7v" tar -caf "$(PKG)_$(VER)$(DTYPE).orig.tar.xz" -T- --owner=root --group=root --mode=a+rX \
&& $(RM) -r "$(PKG)-$(VER)"
|