def unpack(self):
        destdir = os.path.join(self.sourceDir(), "bin")
        utils.createDir(self.sourceDir())
        utils.createDir(destdir)

        postfix = ""
        if self.buildType() == "Debug":
            postfix = "d"

        srcdir = None
        files = []
        if compiler.isMinGW():
            if self.subinfo.options.features.legacyGCC:
                if compiler.isMinGW_W32():
                    srcdir = os.path.join(self.rootdir, "mingw", "bin")
                elif compiler.isMinGW_W64():
                    srcdir = os.path.join(self.rootdir, "mingw64", "bin")
                files = ['libgcc_s_sjlj-1.dll', 'libgomp-1.dll']
            else:
                files = [
                    'libgomp-1.dll', 'libstdc++-6.dll', 'libwinpthread-1.dll'
                ]
                if compiler.isMinGW_W32():
                    files.append('libgcc_s_sjlj-1.dll')
                    srcdir = os.path.join(self.rootdir, "mingw", "bin")
                elif compiler.isMinGW_W64():
                    files.append('libgcc_s_seh-1.dll')
                    srcdir = os.path.join(self.rootdir, "mingw64", "bin")

        elif compiler.isMSVC():
            if compiler.isX86(
            ) and os.environ["PROCESSOR_ARCHITECTURE"] == "AMD64":
                srcdir = os.path.join(os.environ["SystemRoot"], "SysWOW64")
            else:
                srcdir = os.path.join(os.environ["SystemRoot"], "System32")

            if compiler.isMSVC2010():
                files = [
                    "msvcr100%s.dll" % postfix,
                    "msvcp100%s.dll" % postfix
                ]
            elif compiler.isMSVC2013():
                files = [
                    "msvcr120%s.dll" % postfix,
                    "msvcp120%s.dll" % postfix
                ]
            elif compiler.isMSVC2015():
                files = [
                    "concrt140%s.dll" % postfix,
                    "msvcp140%s.dll" % postfix,
                    "vccorlib140%s.dll" % postfix,
                    "vcruntime140%s.dll" % postfix
                ]
        for file in files:
            utils.copyFile(os.path.join(srcdir, file),
                           os.path.join(destdir, file), False)

        return True
    def unpack( self ):
        destdir = os.path.join( self.sourceDir(), "bin" )
        utils.createDir( self.sourceDir() )
        utils.createDir( destdir )

        postfix = ""
        if self.buildType() == "Debug":
            postfix = "d"

        srcdir = None
        files = []
        if compiler.isMinGW():
            if self.subinfo.options.features.legacyGCC:
                if compiler.isMinGW_W32():
                    srcdir = os.path.join( self.rootdir, "mingw", "bin" )
                elif compiler.isMinGW_W64():
                    srcdir = os.path.join( self.rootdir, "mingw64", "bin" )
                files = [ 'libgcc_s_sjlj-1.dll', 'libgomp-1.dll' ]
            else:
                files = [ 'libgomp-1.dll', 'libstdc++-6.dll', 'libwinpthread-1.dll' ]
                if compiler.isMinGW_W32():
                    files.append('libgcc_s_sjlj-1.dll')
                    srcdir = os.path.join( self.rootdir, "mingw", "bin" )                    
                elif compiler.isMinGW_W64():
                    files.append('libgcc_s_seh-1.dll')
                    srcdir = os.path.join( self.rootdir, "mingw64", "bin" )

        elif compiler.isMSVC():
            if compiler.isX86() and os.environ["PROCESSOR_ARCHITECTURE"] == "AMD64":
                srcdir = os.path.join( os.environ["SystemRoot"], "SysWOW64") 
            else:
                srcdir = os.path.join( os.environ["SystemRoot"], "System32")

            if compiler.isMSVC2010():
                files = [
                    "msvcr100%s.dll" % postfix,
                    "msvcp100%s.dll" % postfix
                ]
            elif compiler.isMSVC2013():
                files = [
                    "msvcr120%s.dll" % postfix,
                    "msvcp120%s.dll" % postfix
                ]
            elif compiler.isMSVC2015():
                files = [
                    "concrt140%s.dll" % postfix,
                    "msvcp140%s.dll" % postfix,
                    "vccorlib140%s.dll" % postfix,
                    "vcruntime140%s.dll" % postfix
                ]
        for file in files:
            utils.copyFile( os.path.join( srcdir, file ), os.path.join( destdir, file ), False )

        return True
    def unpack( self ):
        destdir = os.path.join( self.installDir(), "bin" )
        utils.createDir( self.workDir() )
        utils.createDir( destdir )

        postfix = ""
        if self.buildType() == "Debug":
            postfix = "d"

        files = []
        if compiler.isMinGW():
            if compiler.isMinGW32():
                srcdir = os.path.join( self.rootdir, "mingw", "bin" )
                files = [ 'mingwm10.dll', 'libgcc_s_dw2-1.dll' ]
            elif compiler.isMinGW_W32():
                srcdir = os.path.join( self.rootdir, "mingw", "bin" )
                files = [ 'libgcc_s_sjlj-1.dll', 'libgomp-1.dll' ]
            elif compiler.isMinGW_W64():
                srcdir = os.path.join( self.rootdir, "mingw64", "bin" )
                files = [ 'libgcc_s_sjlj-1.dll', 'libgomp-1.dll' ]
#        elif compiler.isMSVC2008():
#            if self.buildType() == "Debug":
#                srcdir = os.path.join( self.packageDir(), "redist", "Debug_NonRedist", "x86", "Microsoft.VC90.DebugCRT" )
#                files = [ "Microsoft.VC90.DebugCRT.manifest", "msvcr90d.dll", "msvcp90d.dll", "msvcm90d.dll"]
#            else:
#                srcdir = os.path.join( self.packageDir(), "redist", "x86", "Microsoft.VC90.CRT" )
#                files = [ "Microsoft.VC90.CRT.manifest", "msvcr90.dll", "msvcp90.dll", "msvcm90.dll" ]
        elif compiler.isMSVC2010():
            srcdir = os.path.join( os.environ["windir"], "system32" ) 
            files = [ "msvcr100%s.dll" % postfix, "msvcp100%s.dll" % postfix ]

        for file in files:
            utils.copyFile( os.path.join( srcdir, file ), os.path.join( destdir, file ) )

        # extract pthread package.
        if compiler.isMinGW_WXX():
            tmpdir = os.getenv( "TEMP" )

            if compiler.isMinGW_W32(): _ext = 32
            elif compiler.isMinGW_W64(): _ext = 64
            else: utils.die( "unknown flavor of mingw-wXX" )

            pthreadPackageName = os.path.join( self.rootdir, "mingw", "pthreads-w%s.zip" ) % _ext
            pthreadDll = "pthreadGC2-w%s.dll" % _ext

            utils.unZip( pthreadPackageName, tmpdir )

            srcdir = os.path.join( tmpdir, "bin" )
            files = [ pthreadDll ]
            for file in files:
                utils.copyFile( os.path.join( srcdir, file ), os.path.join( destdir, file ) )
        return True
Exemple #4
0
 def getArchitecture(self):
     arch = ""
     if( os.getenv('EMERGE_ARCHITECTURE')=="x64"):
         arch = "-x64"
     if compiler.isMinGW_W32():
         arch = "-x86"
     return arch
Exemple #5
0
 def __init__( self ):
     CMakePackageBase.__init__( self )
     # required for package generating because we build from svnHEAD by default
     self.subinfo.options.package.version = '0.5.7'
     self.subinfo.options.configure.defines = '-DBUILD_BASE_LIB=ON -DBUILD_TOOLS=OFF -DBUILD_QT_LIB=OFF -DBUILD_BASE_LIB_WITH_QT=OFF '
     if compiler.isMinGW_W32():
       self.subinfo.options.configure.defines += ' -DMINGW_W32=ON '
 def setDependencies( self ):
     self.dependencies[ 'kdesupport/poppler' ] = 'default'
     if compiler.isMinGW32():
         self.dependencies[ 'dev-util/mingw4' ] = 'default'
     elif compiler.isMinGW_W32():
         self.dependencies[ 'dev-util/mingw-w32' ] = 'default'
     elif compiler.isMinGW_W64():
         self.dependencies[ 'dev-util/mingw-w64' ] = 'default'
Exemple #7
0
 def install(self):
     if not BinaryPackageBase.install(self):
         return False
     if compiler.isMinGW_W32():
         shutil.move(os.path.join(self.imageDir(),"yasm-1.2.0-win32.exe"),os.path.join(self.imageDir(),"yasm.exe"))
     if compiler.isMinGW_W64():
         shutil.move(os.path.join(self.imageDir(),"yasm-1.2.0-win64.exe"),os.path.join(self.imageDir(),"yasm.exe"))
     return True
Exemple #8
0
 def install(self):
     if not BinaryPackageBase.install(self):
         return False
     if compiler.isMinGW_W32():
         shutil.move(os.path.join(self.imageDir(), "yasm-1.2.0-win32.exe"),
                     os.path.join(self.imageDir(), "yasm.exe"))
     if compiler.isMinGW_W64():
         shutil.move(os.path.join(self.imageDir(), "yasm-1.2.0-win64.exe"),
                     os.path.join(self.imageDir(), "yasm.exe"))
     return True
Exemple #9
0
 def __init__(self):
     CMakePackageBase.__init__(self)
     # required for package generating because we build from svnHEAD by default
     #        self.subinfo.options.package.version = '0.5.4'
     self.subinfo.options.configure.defines = '-DBUILD_BASE_LIB_WITH_QT=ON -DBUILD_QT_LIB=ON -DBUILD_PNG2ICO=OFF '
     self.subinfo.options.configure.defines += ' -DBUILD_TOOLS=ON '
     if compiler.isMinGW_W32():
         self.subinfo.options.configure.defines += ' -DMINGW_W32=ON '
     if compiler.isMinGW():
         self.subinfo.options.configure.defines += ' -DKDEWIN_DEFINITIONS="-DKDEWIN_NO_LOCALTIME_R -DKDEWIN_NO_GMTIME_R" '
Exemple #10
0
    def __init__( self ):
        CMakePackageBase.__init__( self )
          # required for package generating because we build from svnHEAD by default
#        self.subinfo.options.package.version = '0.5.4'
        self.subinfo.options.configure.defines = '-DBUILD_BASE_LIB_WITH_QT=ON -DBUILD_QT_LIB=ON '
        self.subinfo.options.configure.defines += ' -DBUILD_TOOLS=ON '
        if compiler.isMinGW_W32():
          self.subinfo.options.configure.defines += ' -DMINGW_W32=ON '
        if compiler.isMinGW():
            self.subinfo.options.configure.defines += ' -DKDEWIN_DEFINITIONS="-DKDEWIN_NO_LOCALTIME_R -DKDEWIN_NO_GMTIME_R" '
Exemple #11
0
    def __init__( self ):
        self.subinfo = subinfo()
        # required for package generating because we build from svnHEAD by default
        self.subinfo.options.package.version = '0.5.4'
        self.subinfo.options.configure.defines = '-DBUILD_BASE_LIB_WITH_QT=ON -DBUILD_QT_LIB=ON '
        if not emergePlatform.isCrossCompilingEnabled() or self.isHostBuild():
            self.subinfo.options.configure.defines += ' -DBUILD_TOOLS=ON '
        if compiler.isMinGW_W32():
          self.subinfo.options.configure.defines += ' -DMINGW_W32=ON '
        CMakePackageBase.__init__( self )

        qmake = os.path.join(self.mergeDestinationDir(), "bin", "qmake.exe")
        if not os.path.exists(qmake):
            utils.warning("could not find qmake in <%s>" % qmake)
        ## \todo a standardized way to check if a package is installed in the image dir would be good.
        self.subinfo.options.configure.defines += " -DQT_QMAKE_EXECUTABLE:FILEPATH=%s " \
            % qmake.replace('\\', '/')
Exemple #12
0
    def packageDigests( self, name, version, ext='.tar.bz2', packagetypes=None ): # pylint: disable=W0613
        """ return archive file based package digests relating to info.infoclass.packageUrls()

The expected digest keys are build in the form <version>[<architecture>]-<compiler>-<packagetype> where
version=<value from version parameter>
compiler='vc90'|'mingw4'
packagetype=<keys from packagestypes parameter>
architecture=<empty for x86>|'-x64'
exception: the mingw-w32 compiler uses x86-mingw4 to not collide with the mingw.org compiler

example:
    # for x86
    self.targetDigests['2.4.2-3-vc90-bin'] = '1b7c2171fb60669924c9d7174fc2e39161f7ef7b'
    self.targetDigests['2.4.2-3-vc90-lib'] = 'e48d8c535cd245bfcc617590d3142035c77b8aa2'
    # for x64
    self.targetDigests['2.4.2-3-x64-vc90-lib'] = 'e48d8c535cd245bfcc617590d3142035c77b8aa2'

    self.targets['2.4.2-3'] = self.packageUrls(repoUrl, "fontconfig", "2.4.2-3")
    self.targetDigests['2.4.2-3'] = self.packageDigests("fontconfig", "2.4.2-3")

        """
        if packagetypes is None:
            packagetypes = ['bin', 'lib']
        arch = ""
        if( os.getenv('EMERGE_ARCHITECTURE')=="x64"):
            arch = "-x64"
        if compiler.isMinGW_W32():
            arch = "-x86"
        compilerName = "msvc"
        if os.getenv("KDECOMPILER") == "mingw":
            compilerName = "mingw"
        elif os.getenv("KDECOMPILER") == "mingw4":
            compilerName = "mingw4"
        elif os.getenv("KDECOMPILER") == "msvc2008":
            compilerName = "vc90"
        elif os.getenv("KDECOMPILER") == "msvc2010":
            compilerName = "vc100"
        # TODO: use list comprehension
        ret = []
        for packageType in packagetypes:
            key = version + '-' + compilerName + '-' + packageType + arch
            ret.append(self.targetDigests[key])
        return ret
Exemple #13
0
 def getPackage( self, repoUrl, name, version, ext='.tar.bz2', packagetypes=None ):
     """return archive file based package url"""
     if packagetypes is None:
         packagetypes = ['bin', 'lib']
     arch = ""
     if( os.getenv('EMERGE_ARCHITECTURE')=="x64"):
         arch = "-x64"
     if compiler.isMinGW_W32():
         arch = "-x86"
     compilerName = "msvc"
     if os.getenv("KDECOMPILER") == "mingw":
         compilerName = "mingw"
     elif os.getenv("KDECOMPILER") == "mingw4":
         compilerName = "mingw4"
     elif os.getenv("KDECOMPILER") == "msvc2008":
         compilerName = "vc90"
     elif os.getenv("KDECOMPILER") == "msvc2010":
         compilerName = "vc100"
     ret = ''
     # TODO: return '\n'.join(repoUrl + '/' + name + arch + '-' + compilerName + '-' + version + '-' + p + ext for p in packagetypes)
     for packageType in packagetypes:
         ret += repoUrl + '/' + name + arch + '-' + compilerName + '-' + version + '-' + packageType + ext + '\n'
     return ret
    def createPackage(self):
        """packaging according to the gnuwin32 packaging rules.
        This requires the kdewin-packager"""

        if not self.packagerExe:
            utils.die("could not find kdewin-packager in your path!")

        if self.subinfo.options.package.packageName != None:
            pkgName = self.subinfo.options.package.packageName
        else:
            pkgName = self.package

        if pkgName.endswith('-src') or pkgName.endswith('-pkg'):
            pkgName = pkgName[:-4]

        pkgVersion, pkgNotesVersion = self.getPackageVersion()

        # kdewin packager creates his own manifest files, so there is no need to add
        # if self.subinfo.options.package.withDigests:
        #    utils.createManifestFiles(filesDir, filesDir, "", self.package, pkgVersion)

        # FIXME: add a test for the installer later
        dstpath = self.packageDestinationDir()

        for pkgtype in ['bin', 'lib', 'doc', 'src', 'dbg']:
            script = os.path.join( self.packageDir(), "post-install-%s.cmd" ) % pkgtype
            scriptName = "post-install-%s-%s-%s.cmd" % ( self.package, pkgVersion, pkgtype )
            destscript = os.path.join( self.imageDir(), "manifest", scriptName )
            if os.path.exists( script ):
                if not os.path.exists( os.path.join( self.imageDir(), "manifest" ) ):
                    os.mkdir( os.path.join( self.imageDir(), "manifest" ) )
                utils.copyFile( script, destscript )

        if ( self.subinfo.options.package.packSources ) and os.path.exists( self.sourceDir() ):
            srcCmd = " -srcroot " + self.sourceDir()
        else:
            if not os.path.exists( self.sourceDir() ):
                utils.warning( "The source directory %s doesn't exist and can't be used for packaging." % self.sourceDir() )
            srcCmd = ""

        # copy pdb/sym files to a temporary directory, because they can be scattered all over the build directory
        # plus, different build types copy files to different directories (could be buildDir(), buildDir()/bin, buildDir()/bin/Debug...),
        # so let's copy them to one precise location, package them, then delete that directory

        symCmd = ""
        if self.useDebugPackages:
            # directories to ignore: cmake temporary files, and dbg so it won't try to copy a file to itself
            dirsToIgnore = [ 'cmake', 'CMakeFiles', 'CMakeTmp', 'CMakeTmp2', 'CMakeTmp3', 'dbg' ]
            path = self.buildDir()
            # where to copy the debugging information files
            symRoot = os.path.join( self.buildDir(), "dbg" )
            symPath = os.path.join( symRoot, "bin" )
            if not os.path.exists( symPath ):
                utils.createDir( symPath )
            # shouldn't be needed, usually; but if files are present, that could lead to errors
            utils.cleanDirectory ( symRoot )

            utils.debug( "Copying debugging files to 'dbg'..." )
            for path, _, files in os.walk( path ):
                found = 0
                for directory in range( 0, len( dirsToIgnore ) ):
                    if path.find( dirsToIgnore[directory] ) > 0:
                        found = 1
                        break
                if found == 1:
                    continue
                utils.debug( "Checking: %s" % path, 3 )
                for fileName in files:
                    if not self.subinfo.options.package.disableStriping:
                        if ( fileName.endswith( ".exe" ) or fileName.endswith( ".dll" ) ):
                            if compiler.isMinGW():
                                symFilename = fileName[:-4] + ".sym"
                                utils.system( "strip --only-keep-debug " + " -o " + os.path.join( path, symFilename ) \
                                        + " " + os.path.join( path, fileName ) )
                                # utils.system( "strip --strip-all " + os.path.join( path, fileName ) )
                                utils.copyFile( os.path.join(path, symFilename), os.path.join( symPath, symFilename ) )
                    elif ( fileName.endswith( ".pdb" ) ):
                        utils.copyFile( os.path.join( path, fileName ), os.path.join( symPath, fileName ) )

            if not self.subinfo.options.package.disableStriping and compiler.isMinGW() :
                symCmd += "-strip "
            symCmd += "-debug-package "
            symCmd += "-symroot " + symRoot
            utils.debug ( symCmd, 2 )

        cmd = "-name %s -root %s -version %s -destdir %s %s %s -checksum sha1 " % \
                  ( pkgName, self.imageDir(), pkgVersion, dstpath, srcCmd, symCmd )
        xmltemplate = self.xmlTemplate()
        if os.path.exists(xmltemplate):
            cmd = self.packagerExe + " " + cmd + " -template " + xmltemplate + " -notes " + \
                    "%s/%s:%s:unknown " % ( self.category, self.package, pkgNotesVersion ) + "-compression 2 "
            utils.debug("using xml template for package generating", 1)
        elif self.package == "qt":
            cmd = self.packagerExe + " " + cmd + " -template :/template-qt.xml -notes " + \
                    "%s/%s:%s:unknown " % ( self.category, self.package, pkgNotesVersion ) + "-compression 2 "
            utils.debug("using xml template for package generating", 1)
        else:
            cmd = self.packagerExe + " " + cmd + " -verbose -notes " + \
                    "%s/%s:%s:unknown " % ( self.category, self.package, pkgNotesVersion ) + "-compression 2 "
            utils.debug(" xml template %s for package generating not found" % xmltemplate, 1)

        if( self.subinfo.options.package.withCompiler ):
            if( self.compiler() == "mingw"):
                cmd += " -type mingw "
            elif self.compiler() == "mingw4" and self.buildArchitecture() == "x64":
                cmd += " -type x64-mingw4 "
            elif self.compiler() == "mingw4" and compiler.isMinGW_W32():
                cmd += " -type x86-mingw4 "
            elif self.compiler() == "mingw4":
                cmd += " -type mingw4 "
            elif self.compiler() == "msvc2005":
                cmd += " -type msvc "
            elif self.compiler() == "msvc2008":
                cmd += " -type vc90 "
            elif self.compiler() == "msvc2010":
                cmd += " -type vc100 "
            else:
                cmd += " -type unknown "


#        not needed anymore
#        if self.subinfo.options.package.specialMode:
#            cmd += " -special"

        if not utils.system(cmd):
            utils.die( "while packaging. cmd: %s" % cmd )

        if self.useDebugPackages:
            utils.rmtree( symPath )
        return True