From fbf2c05545d0f54db8e02b7685de5123ce14b5b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Safa=20Ar=C4=B1man?= Date: Mon, 5 Aug 2019 21:50:00 +0300 Subject: [PATCH] improve_emul32 patch applied --- pisi/actionsapi/autotools.py | 31 ++++++++++++++++++++++++++++++- pisi/actionsapi/get.py | 3 +++ pisi/actionsapi/variables.py | 1 + pisi/operations/build.py | 4 ++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/pisi/actionsapi/autotools.py b/pisi/actionsapi/autotools.py index 1bb94fc6..575800a7 100644 --- a/pisi/actionsapi/autotools.py +++ b/pisi/actionsapi/autotools.py @@ -26,6 +26,11 @@ from pisi.actionsapi.shelltools import system from pisi.actionsapi.shelltools import can_access_file from pisi.actionsapi.shelltools import unlink from pisi.actionsapi.libtools import gnuconfig_update +from pisi.actionsapi.shelltools import isDirectory +from pisi.actionsapi.shelltools import ls +from pisi.actionsapi.pisitools import dosed +from pisi.actionsapi.pisitools import removeDir + class ConfigureError(pisi.actionsapi.Error): def __init__(self, value=''): @@ -59,6 +64,8 @@ def configure(parameters = ''): if can_access_file('configure'): gnuconfig_update() + prefix = get.emul32prefixDIR() if get.buildTYPE() == "emul32" else get.defaultprefixDIR() + args = './configure \ --prefix=/%s \ --build=%s \ @@ -68,11 +75,14 @@ def configure(parameters = ''): --sysconfdir=/%s \ --localstatedir=/%s \ --libexecdir=/%s \ - %s' % (get.defaultprefixDIR(), \ + %s' % (prefix, \ get.HOST(), get.manDIR(), \ get.infoDIR(), get.dataDIR(), \ get.confDIR(), get.localstateDIR(), get.libexecDIR(), parameters) + if get.buildTYPE() == "emul32": + args += " --libdir=/usr/lib32" + if system(args): raise ConfigureError(_('Configure failed.')) else: @@ -101,6 +111,15 @@ def fixInfoDir(): if can_access_file(infoDir): unlink(infoDir) + +def fixpc(): + ''' fix .pc files in installDIR()/usr/lib32/pkgconfig''' + path = "%s/usr/lib32/pkgconfig" % get.installDIR() + if isDirectory(path): + for f in ls("%s/*.pc" % path): + dosed(f, get.emul32prefixDIR(), get.defaultprefixDIR()) + + def install(parameters = '', argument = 'install'): '''install source into install directory with given parameters''' args = 'make prefix=%(prefix)s/%(defaultprefix)s \ @@ -127,6 +146,11 @@ def install(parameters = '', argument = 'install'): else: fixInfoDir() + if get.buildTYPE() == "emul32": + fixpc() + if isDirectory("%s/emul32" % get.installDIR()): + removeDir("/emul32") + def rawInstall(parameters = '', argument = 'install'): '''install source into install directory with given parameters = PREFIX=%s % get.installDIR()''' @@ -135,6 +159,11 @@ def rawInstall(parameters = '', argument = 'install'): else: fixInfoDir() + if get.buildTYPE() == "emul32": + fixpc() + if isDirectory("%s/emul32" % get.installDIR()): + removeDir("/emul32") + def aclocal(parameters = ''): '''generates an aclocal.m4 based on the contents of configure.in.''' if system('aclocal %s' % parameters): diff --git a/pisi/actionsapi/get.py b/pisi/actionsapi/get.py index e39762e5..36ad5b69 100644 --- a/pisi/actionsapi/get.py +++ b/pisi/actionsapi/get.py @@ -157,6 +157,9 @@ def libexecDIR(): def defaultprefixDIR(): return dirs.defaultprefix +def emul32prefixDIR(): + return dirs.emul32prefix + def kdeDIR(): return dirs.kde diff --git a/pisi/actionsapi/variables.py b/pisi/actionsapi/variables.py index 7c4f9dca..196e6749 100644 --- a/pisi/actionsapi/variables.py +++ b/pisi/actionsapi/variables.py @@ -84,6 +84,7 @@ class Dirs: localstate = 'var' libexec = 'usr/libexec' defaultprefix = 'usr' + emul32prefix = 'emul32' # These should be owned by object not the class. Or else Python # will bug us with NoneType errors because of uninitialized diff --git a/pisi/operations/build.py b/pisi/operations/build.py index b7491f27..b11a33ab 100644 --- a/pisi/operations/build.py +++ b/pisi/operations/build.py @@ -403,6 +403,10 @@ class Builder: "SRC_NAME": self.spec.source.name, "SRC_VERSION": self.spec.getSourceVersion(), "SRC_RELEASE": self.spec.getSourceRelease()} + + if self.build_type == "emul32": + env["CC"] = "%s -m32" % os.getenv("CC") + env["CXX"] = "%s -m32" % os.getenv("CXX") os.environ.update(env) # First check icecream, if not found use ccache