File debian.rules of Package Trezarcoin

#!/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

CFLAGS = -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif

NAME=trezarcoin
#DESTDIR=/usr/src/packages/BUILD/debian/$(NAME)
DESTDIR=debian/$(NAME)
PREFIX=/usr
BINDIR=$(PREFIX)/bin

CONFIG_PARMS=  --with-incompatible-bdb --enable-tests=no --enable-hardening --disable-shared

#check if we have a qt5 capable OS
# check for debian 7
ifeq "$(shell cat /etc/issue |grep -c -e '^Debian.*7')" "1"
QT_VERS=qt4
CONFIG_PARMS +=--with-qrcode=no
else
QT_VERS=qt5
endif


# Ubuntu 14.04 doesn't have qrcode and zxing libraries
ifeq "$(shell cat /etc/issue |grep -c -e '^Ubuntu.*'14)" "1"
CONFIG_PARMS +=--with-qrcode=no

endif

ifeq "$(shell cat /etc/issue |grep -c -e '^Ubuntu.*)" "1"
ifeq "$(shell uname -m)" "x86_64"
LIBDIR="$(PREFIX)/lib64
else
LIBDIR=$(PREFIX)/lib
CONFIG_PARMS=  --with-incompatible-bdb $(GUI_PARMS) --with-boost=yes --with-boost-libdir=/usr/lib/i386-linux-gnu --enable-tests=no -enable-hardening" --with-pic --disable-shared
endif
endif


INCLUDEDIR=../../../include
SBINDIR=$(PREFIX)/sbin
MANDIR=$(PREFIX)/share/man
DATADIR=$(PREFIX)/share/$(NAME)
DOCDIR=$(PREFIX)/share/doc/$(NAME)
SYSCONFDIR=/etc
RCDIR=$(SYSCONFDIR)/init.d
CGIDIR=/src/www/cgi-bin

build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp:
	#dh_testdir
	#dh_autoreconf
	# Add here commands to compile the package.
	#**************************************
	echo " $(CONFIG_PARMS)                      "
	#**************************************
	

	./autogen.sh
	#Debian has older boost libraries, so reduce
	# requirements

	#sed -i 's/1.54/1.48/g' ./configure
	
	export CFLAGS="-fPIC";./configure $(CONFIG_PARMS)
	 
	#compile the forms into ui_ headerfiles
	#cd contrib;touch ../src/qt/forms/*.ui
	#cd contrib; QT_SELECT=$(QT_VERS) qmake $(QT_PARAM) trezarcoin-qt.pro ; make; mv ui_* ../src/qt/forms/

	pwd
	#sed -i 's/llibzxing/lzxing/g' src/qt/Makefile
	#sed -i 's/llibzxing/lzxing/g' src/Makefile
	make
	
	# replace 'bitcoin' with 'trezarcoin' in man pages
	#sed -i 's/bitcoin/trezarcoin/g' contrib/debian/manpages/*
	# --- end custom part for compiling

	touch build-stamp

clean:
	#dh_testdir
	#dh_testroot
	rm -f build-stamp

	# Add here commands to clean up after the build process.
	
	# --- end custom part for cleaning up

	#dh_clean

install: build
	#dh_testdir
	#dh_testroot
	dh_prep
	dh_installdirs

	# Add here commands to install the package
	# The DESTDIR Has To Be Exactly  /usr/src/packages/BUILD/debian/<nameOfPackage>
	mkdir -p "$(DESTDIR)$(BINDIR)"
	echo " " 
	echo "$(DESTDIR)$(BINDIR)"
	echo " "
	install -m 0755 src/qt/$(NAME)-qt "$(DESTDIR)$(BINDIR)"
	install -m 0755 src/$(NAME)d "$(DESTDIR)$(BINDIR)"
	install -m 0755 src/$(NAME)-cli "$(DESTDIR)$(BINDIR)"
	
	#mkdir -p "$(DESTDIR)$(DATADIR)/applications"
	install -p -D  -m 644 "../SOURCES/$(NAME).desktop" "$(DESTDIR)$(PREFIX)/share/applications/$(NAME).desktop"
	mkdir -p "$(DESTDIR)$(DATADIR)/pixmaps"
	install -p -D -m 644 share/pixmaps/bitcoin64.png "$(DESTDIR)$(PREFIX)/share/pixmaps/$(NAME).png"
	# --- end custom part for installing

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

# Build architecture-dependent files here.
binary-arch: build install
#	dh_testdir
#	dh_testroot
#	dh_installdebconf
#	dh_installdocs COPYING  doc/*
	dh_installexamples
	dh_installmenu
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
	dh_installcron
	dh_installman contrib/debian/manpages/trezarcoin*
	dh_installinfo
#	dh_undocumented
	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