+def automakeRules(config):
+ r = RulesFile()
+ r.dh += ["--buildsystem=autoconf"]
+ r.rules['auto_configure'] = [
+ './configure --build=$$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) --prefix=/usr --sysconfdir=/etc --localstatedir=/var ' +
+ ' '.join(config.get('automakeParameters', []))
+ ]
+ r.rules['auto_clean'] = ['rm -f config.status'] # do not re-use old configuration
+ return r
+
+# utility functions
+def getArchitecture():
+ p = subprocess.Popen(['dpkg-architecture', '-qDEB_BUILD_ARCH'], stdout=subprocess.PIPE)
+ res = p.communicate()[0] # get only stdout
+ if p.returncode != 0: raise Exception("Querying dpkg for the architecture failed")
+ return res[0:len(res)-1] # chop of the \n at the end
+