fix usgae of host and build architecture; rename binaryInstall -> binaryInstallFiles
[auto-debuild.git] / auto_debuild.py
index cb2d840039af595a7a6f79ae545cb78e08b3294a..ab04dc0e9d752e24d5aa2f8e918e457e3f1fb515 100755 (executable)
@@ -53,11 +53,14 @@ def cmakeRules(config):
        return r
 
 def automakeRules(config):
+       # "build" is what we are building *on*, and "host" is what we are building *for* (and GNU is weird...)
+       # also, we don't really support cross-building... ;-) (to do, we'd have to write shell code that checks whether BUILD_GNU_TYPE
+       #  and HOST_GNU_TYPE are equal, and if they are not, add a --host parameter)
        r = RulesFile()
        r.dh += ["--buildsystem=autoconf"]
        r.rules['auto_configure'] = [
                'BUILD_TYPE=$$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) && ' + # doing the expansion beforehand ensures that we cancel if it fails
-               'MULTIARCH=$$(dpkg-architecture -qDEB_BUILD_MULTIARCH) && '+
+               'MULTIARCH=$$(dpkg-architecture -qDEB_HOST_MULTIARCH) && '+
                        './configure --build=$$BUILD_TYPE '+ # do the escape manually here so we can use the variables (there's no user-controlled string in here anyway)
                        '--prefix=/usr --includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info '+
                        '--libdir=/usr/lib/$$MULTIARCH --libexecdir=/usr/lib/$$MULTIARCH '+
@@ -74,7 +77,7 @@ def commandInBuildEnv(config, command):
        return command
 
 def getArchitecture(config):
-       cmd = commandInBuildEnv(config, ['dpkg-architecture', '-qDEB_BUILD_ARCH'])
+       cmd = commandInBuildEnv(config, ['dpkg-architecture', '-qDEB_HOST_ARCH'])
        p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
        res = p.communicate()[0] # get only stdout
        if p.returncode != 0: raise Exception("Querying dpkg for the architecture failed")
@@ -148,7 +151,7 @@ def createDebianFiles(config):
                        files.append(os.path.join(debDir, "%s-dbg_%s_%s.deb" % (binaryName, version, arch)))
        # install file
        with open('debian/'+binaryName+'.install', 'w') as f:
-               for line in config.get('binaryInstall', []):
+               for line in config.get('binaryInstallFiles', []):
                        if line.startswith('/'): # a file from within the package, not from the source tree
                                line = 'debian/'+binaryName+line
                        print >>f, line