Index: debian/bitlbee-common.postinst
===================================================================
--- debian/bitlbee-common.postinst	(revision 5c163e5063e01dfe94f73b2a3729c475cdd75467)
+++ debian/bitlbee-common.postinst	(revision 17cc2fe53806232b2cb61042f238b34c87da0724)
@@ -35,5 +35,7 @@
 fi
 
-chmod 700 /var/lib/bitlbee/
+if [ -d /var/lib/bitlbee ]; then
+    chmod 700 /var/lib/bitlbee/
+fi
 
 ## Can't do this in packaging phase: Don't know the UID yet. Access to
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 5c163e5063e01dfe94f73b2a3729c475cdd75467)
+++ debian/changelog	(revision 17cc2fe53806232b2cb61042f238b34c87da0724)
@@ -1,6 +1,14 @@
 bitlbee (3.5.1-1.1) UNRELEASED; urgency=medium
 
+  [ dequis ]
   * Remove bitlbee-plugin-skype and skyped (obsolete)
   * Enable only bitlbee.service, not bitlbee.socket too
+
+  [ Sean Whitton ]
+  * Add existence check to chmod call in bitlbee-common.postinst
+    (Closes: #816200).
+
+  [ dequis ]
+  * Fix lintian pkg-config-unavailable-for-cross-compilation 
 
  -- dequis <dx@dxzone.com.ar>  Mon, 19 Mar 2018 22:18:43 -0300
Index: debian/control
===================================================================
--- debian/control	(revision 5c163e5063e01dfe94f73b2a3729c475cdd75467)
+++ debian/control	(revision 17cc2fe53806232b2cb61042f238b34c87da0724)
@@ -12,5 +12,5 @@
 Package: bitlbee
 Architecture: any
-Depends: ${misc:Depends}, ${shlibs:Depends}, debianutils (>= 1.16), bitlbee-common (= ${source:Version})
+Depends: ${misc:Depends}, ${shlibs:Depends}, debianutils (>= 1.16), bitlbee-common (= ${binary:Version})
 Conflicts: bitlbee-libpurple
 Replaces: bitlbee-libpurple
@@ -22,5 +22,5 @@
 Package: bitlbee-libpurple
 Architecture: any
-Depends: ${misc:Depends}, ${shlibs:Depends}, debianutils (>= 1.16), bitlbee-common (= ${source:Version})
+Depends: ${misc:Depends}, ${shlibs:Depends}, debianutils (>= 1.16), bitlbee-common (= ${binary:Version})
 Conflicts: bitlbee
 Replaces: bitlbee
@@ -38,5 +38,5 @@
 
 Package: bitlbee-common
-Architecture: all
+Architecture: any
 Depends: ${misc:Depends}, adduser
 Replaces: bitlbee
@@ -50,6 +50,6 @@
 
 Package: bitlbee-dev
-Architecture: all
-Depends: ${misc:Depends}, bitlbee (>= ${source:Version}) | bitlbee-libpurple (>= ${source:Version}), bitlbee (<< ${source:Version}.1~) | bitlbee-libpurple (<< ${source:Version}.1~), bitlbee-common (= ${source:Version})
+Architecture: any
+Depends: ${misc:Depends}, bitlbee (= ${binary:Version}) | bitlbee-libpurple (= ${binary:Version}), bitlbee-common (= ${binary:Version})
 Description: IRC to other chat networks gateway (dev files)
  This program can be used as an IRC server which forwards everything you
@@ -61,5 +61,5 @@
 Package: bitlbee-plugin-otr
 Architecture: any
-Depends: ${misc:Depends}, ${shlibs:Depends}, bitlbee (= ${binary:Version}) | bitlbee-libpurple (= ${binary:Version}), bitlbee-common (= ${source:Version})
+Depends: ${misc:Depends}, ${shlibs:Depends}, bitlbee (= ${binary:Version}) | bitlbee-libpurple (= ${binary:Version}), bitlbee-common (= ${binary:Version})
 Description: IRC to other chat networks gateway (OTR plugin)
  This program can be used as an IRC server which forwards everything you
Index: debian/rules
===================================================================
--- debian/rules	(revision 5c163e5063e01dfe94f73b2a3729c475cdd75467)
+++ debian/rules	(revision 17cc2fe53806232b2cb61042f238b34c87da0724)
@@ -35,8 +35,5 @@
 HAS_DH_SYSTEMD:=$(shell dpkg-query -W -f='$${Status}' dh-systemd 2>/dev/null | grep -c "ok installed")
 
-# No difference at the build stage so just call main build target.
-# (Well indep could be docs-only but we prebuild them plus it's really
-# not that much work.)
-build-arch build-indep: build
+build-arch: build
 
 build: build-stamp
@@ -45,10 +42,10 @@
 
 	mkdir -p debian/build-native
-	ROOT=$$PWD; cd debian/build-native; $(BITLBEE_CONFIGURE_VERSION) $(CONFIGURE_OVERRIDES) $$ROOT/configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --events=libevent --otr=$(BITLBEE_OTR) --systemdsystemunitdir=/lib/systemd/system $(BITLBEE_CONFIGURE_FLAGS)
+	ROOT=$$PWD; cd debian/build-native; $(BITLBEE_CONFIGURE_VERSION) $(CONFIGURE_OVERRIDES) $$ROOT/configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --events=libevent --otr=$(BITLBEE_OTR) --systemdsystemunitdir=/lib/systemd/system --pcdir=/usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig $(BITLBEE_CONFIGURE_FLAGS)
 	$(MAKE) -C debian/build-native
 
 ifeq ($(BITLBEE_LIBPURPLE),1)
 	mkdir -p debian/build-libpurple
-	ROOT=$$PWD; cd debian/build-libpurple; $(BITLBEE_CONFIGURE_VERSION) $(CONFIGURE_OVERRIDES) $$ROOT/configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --systemdsystemunitdir=/lib/systemd/system --purple=1 $(BITLBEE_CONFIGURE_FLAGS)
+	ROOT=$$PWD; cd debian/build-libpurple; $(BITLBEE_CONFIGURE_VERSION) $(CONFIGURE_OVERRIDES) $$ROOT/configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --systemdsystemunitdir=/lib/systemd/system --pcdir=/usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig --purple=1 $(BITLBEE_CONFIGURE_FLAGS)
 	$(MAKE) -C debian/build-libpurple
 endif
@@ -98,8 +95,5 @@
 	dh_installchangelogs doc/CHANGES
 	dh_installexamples
-	dh_installdocs #--link-doc=bitlbee-common
-	# TODO: Restore --link-doc up here and remove the hack below once
-	# Hardy and Lenny are deprecated.
-	for p in bitlbee bitlbee-libpurple bitlbee-dev bitlbee-plugin-otr; do rm -r debian/$$p/usr/share/doc/$$p && ln -s bitlbee-common debian/$$p/usr/share/doc/$$p || true; done
+	dh_installdocs --link-doc=bitlbee-common
 	dh_installdebconf
 ifeq ($(HAS_DH_SYSTEMD),1)
@@ -123,7 +117,4 @@
 	dh_builddeb
 
-binary-indep: build install
-	DH_OPTIONS=-i $(MAKE) -f debian/rules binary-common
-
 binary-arch: build install
 	DH_OPTIONS=-a $(MAKE) -f debian/rules binary-common
@@ -132,4 +123,4 @@
 	DH_OPTIONS=-p$* $(MAKE) -f debian/rules binary-common
 
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary-common binary install
+binary: binary-arch
+.PHONY: build clean binary-arch binary-common binary install
