python-pygobject: Backport 2.28.3

The skeleton code does not run with pygobject-3 today, so
backport pygobject-2 recipe from yocto 2.0.1.

TODO: Create issue to track upgrade to pygobject-3.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/common/recipes-devtools/python/python-pygobject/obsolete_automake_macros.patch b/common/recipes-devtools/python/python-pygobject/obsolete_automake_macros.patch
new file mode 100644
index 0000000..c259112
--- /dev/null
+++ b/common/recipes-devtools/python/python-pygobject/obsolete_automake_macros.patch
@@ -0,0 +1,23 @@
+Upstream-Status: Accepted [https://bugzilla.gnome.org/show_bug.cgi?id=691101]
+
+Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
+diff -Nurd pygobject-2.27.91/configure.ac pygobject-2.27.91/configure.ac
+--- pygobject-2.27.91/configure.ac	2011-02-23 22:14:37.000000000 +0200
++++ pygobject-2.27.91/configure.ac	2013-01-03 05:13:44.034949954 +0200
+@@ -35,7 +35,7 @@
+ AC_DEFINE(PYGOBJECT_MICRO_VERSION, pygobject_micro_version, [pygobject micro version])
+ AC_SUBST(PYGOBJECT_MICRO_VERSION, pygobject_micro_version)
+
+-AM_CONFIG_HEADER(config.h)
++AC_CONFIG_HEADERS(config.h)
+ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
+ AM_INIT_AUTOMAKE(foreign)
+ AM_MAINTAINER_MODE
+@@ -82,7 +82,6 @@
+ m4_ifdef([LT_OUTPUT], [LT_OUTPUT])
+ AC_ISC_POSIX
+ AC_PROG_CC
+-AM_PROG_CC_STDC
+ AM_PROG_CC_C_O
+
+ # check that we have the minimum version of python necisary to build
diff --git a/common/recipes-devtools/python/python-pygobject_2.28.3.bb b/common/recipes-devtools/python/python-pygobject_2.28.3.bb
new file mode 100644
index 0000000..81d37b4
--- /dev/null
+++ b/common/recipes-devtools/python/python-pygobject_2.28.3.bb
@@ -0,0 +1,53 @@
+SUMMARY = "Python GObject bindings"
+SECTION = "devel/python"
+LICENSE = "LGPLv2.1"
+
+RECIPE_NO_UPDATE_REASON = "Newer versions of python-pygobject depend on gobject-introspection which doesn't cross-compile"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=a916467b91076e631dd8edb7424769c7"
+DEPENDS = "python python-pygobject-native libffi glib-2.0"
+DEPENDS_class-native = "python-native libffi-native glib-2.0-native"
+RDEPENDS_class-native = ""
+
+MAJ_VER = "${@d.getVar('PV',1).split('.')[0]}.${@d.getVar('PV',1).split('.')[1]}"
+
+SRC_URI = "${GNOME_MIRROR}/pygobject/${MAJ_VER}/pygobject-${PV}.tar.bz2 \
+           file://obsolete_automake_macros.patch \
+"
+
+# libtool-native doesn't have fixinstall.patch applied which means
+# that libs get relinked at installation time. This triggers a 
+# relinking along the lines of:
+# gcc -L/tmp/foo/media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/lib -lpyglib-2.0-python -o .libs/_glib.so
+# where /tmp/foo is DESTDIR and pyglib-2.0-python may be installed/reinstalled
+# at the same time as the gcc command runs.
+# If this happens between the handoff between gcc and ld, you can see:
+# /bin/ld: cannot find -lpyglib-2.0-python
+# Adding a dependency rule like  install-pyglibLTLIBRARIES: install-libLTLIBRARIES
+# would be ideal but automake can't cope with that without manually 
+# defining the whole function. Give up and disable parallel make in native builds.
+PARALLEL_MAKEINST_class-native = ""
+
+SRC_URI[md5sum] = "aa64900b274c4661a5c32e52922977f9"
+SRC_URI[sha256sum] = "7da88c169a56efccc516cebd9237da3fe518a343095a664607b368fe21df95b6"
+S = "${WORKDIR}/pygobject-${PV}"
+
+EXTRA_OECONF += "--disable-introspection"
+
+inherit autotools distutils-base pkgconfig
+
+# necessary to let the call for python-config succeed
+export BUILD_SYS
+export HOST_SYS
+export STAGING_INCDIR
+export STAGING_LIBDIR
+
+PACKAGES += "${PN}-lib"
+
+RDEPENDS_${PN} += "python-textutils"
+
+FILES_${PN} = "${libdir}/python*"
+FILES_${PN}-lib = "${libdir}/lib*.so.*"
+FILES_${PN}-dev += "${bindir} ${datadir}"
+
+BBCLASSEXTEND = "native"
diff --git a/conf/distro/openbmc-phosphor.conf b/conf/distro/openbmc-phosphor.conf
index 4af4a4b..f37e88c 100644
--- a/conf/distro/openbmc-phosphor.conf
+++ b/conf/distro/openbmc-phosphor.conf
@@ -36,3 +36,6 @@
         "
 
 DISTRO_EXTRA_RDEPENDS_remove_qemuarm = "packagegroup-core-device-devel"
+
+# TODO: openbmc/openbmc#12345 - Upgrade to pygobject-3.
+PREFERRED_VERSION_python-pygobject = "2.%"