public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: Remove unused txt files
@ 2019-02-15 14:32 Liming Gao
  2019-02-15 23:00 ` Laszlo Ersek
  2019-02-19 13:58 ` Feng, Bob C
  0 siblings, 2 replies; 3+ messages in thread
From: Liming Gao @ 2019-02-15 14:32 UTC (permalink / raw)
  To: edk2-devel

externals.txt is to refer to the binary Win32. It is not used any longer.
BuildNotes.txt is to freeze BaseTools python. It is not used any longer.
BinaryFiles.txt is to list the file in Bin directory. But, Bin dir is empty.
building-gcc.txt and gcc is for mingw-gcc. It is not used any longer.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Bin/externals.txt      |   1 -
 BaseTools/BuildNotes.txt         |  83 ------
 BaseTools/Source/BinaryFiles.txt |  79 ------
 BaseTools/building-gcc.txt       |  15 --
 BaseTools/gcc/README.txt         |  71 -----
 BaseTools/gcc/mingw-gcc-build.py | 565 ---------------------------------------
 6 files changed, 814 deletions(-)
 delete mode 100644 BaseTools/Bin/externals.txt
 delete mode 100644 BaseTools/BuildNotes.txt
 delete mode 100644 BaseTools/Source/BinaryFiles.txt
 delete mode 100644 BaseTools/building-gcc.txt
 delete mode 100644 BaseTools/gcc/README.txt
 delete mode 100755 BaseTools/gcc/mingw-gcc-build.py

diff --git a/BaseTools/Bin/externals.txt b/BaseTools/Bin/externals.txt
deleted file mode 100644
index c2c4ab7297..0000000000
--- a/BaseTools/Bin/externals.txt
+++ /dev/null
@@ -1 +0,0 @@
-Win32  https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32
diff --git a/BaseTools/BuildNotes.txt b/BaseTools/BuildNotes.txt
deleted file mode 100644
index e2b10fddc3..0000000000
--- a/BaseTools/BuildNotes.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-Intel(R) Platform Innovation Framework for EFI
-BuildTools Project, BaseTools Sub-Project
-Root Package 1.00
-2007-08-31
-
-Intel is a trademark or registered trademark of Intel Corporation or its
-subsidiaries in the United States and other countries.
-* Other names and brands may be claimed as the property of others.
-Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-
--------------------------------------------------------------------------------
-Quick Start
------------
-
-Windows:
-  a) Go to the <buildtools_project>/BaseTools and run "toolsetup" script
-
-Unix-like:
-  a) make -C <buildtools_project>/BaseTools
-  b) Look over https://github.com/tianocore/tianocore.github.io/wiki/Getting%20Started%20with%20EDK%20II
-     for a helpful step-by-step guide for building 'Hello World' on
-     various operating systems with edk2.
-
-Supported build targets (toolsetup)
------------------------------------
-
-build(or none)  - Incremental Build of all C based tools. This is the default target
-rebuild         - Clean all generated files and directories during build, and rebuild all tools
-
--------------------------------------------------------------------------------
-Tools in Python
----------------
-* Convert Python source to exe file
-
-  The tools written in Python can be converted into executable program which can
-  be executed without installing a Python interpreter. (Generally it is easier
-  to run the scripts from their source on operating systems other than Windows.)
-
-  For Windows and Linux, the conversion tool package is called cx_Freeze, its
-  home page is:
-
-    http://sourceforge.net/projects/cx-freeze/
-
-  If you have installed cx_Freeze at c:\cx_Freeze-3.0.3. Use following command
-  lines to convert MyBuild.py to MyBuild.exe (note this is an example, there is
-  no MyBuild Python project in the BaseTools\Python tree.
-
-    set PYTHONPATH=<BaseToolsDirPath>\Source\Python
-    c:\cx_Freeze-3.0.3\FreezePython.exe --include-modules=encodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf_16_le,encodings.utf_8 --install-dir=.\mybuild MyBuild.py
-
-  The generated .exe (and .dll) files are put in "mybuild" subdirectory.
-
-  The following is a real example with the BuildTools/trunk/BaseTools project
-  installed in: C:\Work\BaseTools
-
-
-  C:\Work\BaseTools\Source\Python> set PYTHONPATH=C:\Work\BaseTools\Source\Python
-  C:\Work\BaseTools\Source\Python> c:\cx_Freeze-3.0.3\FreezePython.exe --include-modules=encodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf_16_le,encodings.utf_8 --install-dir=C:\Work\BaseTools\Bin\Win32 build\build.py
-
----------------
-* Execute tools written in Python without conversion
-
-Unix-like systems:
-
-The edk2/edksetup.sh script will setup everything which is needed to
-run the scripts from their source.
-
-Windows:
-
-  The tools written in Python can be executed directly from its source directory
-as long as the Python interpreter (Python 2.5) has been installed. Before the execution,
-please make sure the environment variable PYTHONPATH is set to
-
-        <buildtools_project>/BaseTools/Source/Python
-
-  There're five tools written in Python. The entrance file of each tool is listed
-below.
-
-      build               <buildtools_project>/BaseTools/Source/Python/build/build.py
-      GenFds              <buildtools_project>/BaseTools/Source/Python/GenFds/GenFds.py
-      Trim                <buildtools_project>/BaseTools/Source/Python/Trim/Trim.py
-      MigrationMsa2Inf    <buildtools_project>/BaseTools/Source/Python/MigrationMsa2Inf/MigrationMsa2Inf.py
-      UPT                 <buildtools_project>/BaseTools/Source/Python/UPT/UPT.py
diff --git a/BaseTools/Source/BinaryFiles.txt b/BaseTools/Source/BinaryFiles.txt
deleted file mode 100644
index 818226a2c4..0000000000
--- a/BaseTools/Source/BinaryFiles.txt
+++ /dev/null
@@ -1,79 +0,0 @@
-## @file
-# This file lists all of the tool files that must be present in the Bin trees.
-#
-# This file is used by the EDK II Build Server that automatically builds the
-# BaseTools Win32 binaries.
-# When new tools are create, the tool executable must be listed in the [Bin.Win32]
-# section.
-# If a tool requires additional files, the developer must list those files in the
-# [ExtraFiles.Win32] section.
-# The [CxFreeze.Win32] section is maintained by the owner of the Build Server who
-# must ensure that files that are required by the cx_freeze frozen binaries are
-# present in the Bin\Win32 directory.
-#
-# Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials are licensed and made available under
-# the terms and conditions of the BSD License which accompanies this distribution.
-# The full text of the license may be found at:
-#   http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-##
-
-[Bin.Win32]
-build.exe
-BPDG.exe
-Common.PyUtility.pyd
-Ecc.exe
-EfiCompressor.pyd
-EfiRom.exe
-Eot.EfiCompressor.pyd
-Eot.LzmaCompressor.pyd
-GenCrc32.exe
-GenDepex.exe
-GenFds.exe
-GenFfs.exe
-GenFv.exe
-GenFw.exe
-GenPatchPcdTable.exe
-GenSec.exe
-ImportTool.bat
-LzmaCompress.exe
-LzmaF86Compress.bat
-PatchPcdValue.exe
-Rsa2048Sha256GenerateKeys.exe
-Rsa2048Sha256Sign.exe
-Split.exe
-TargetTool.exe
-TianoCompress.exe
-Trim.exe
-UPT.exe
-VfrCompile.exe
-VolInfo.exe
-Pkcs7Sign.exe
-DevicePath.exe
-
-[ExtraFiles.Win32]
-TestSigningPrivateKey.pem
-config.ini
-exception.xml
-TestCert.pem
-TestCert.pub.pem
-TestRoot.pem
-TestRoot.pub.pem
-TestSub.pem
-TestSub.pub.pem
-
-[CxFreeze.Win32]
-_ctypes.pyd
-_hashlib.pyd
-_socket.pyd
-_sqlite3.pyd
-_ssl.pyd
-pyexpat.pyd
-python27.dll
-select.pyd
-sqlite3.dll
diff --git a/BaseTools/building-gcc.txt b/BaseTools/building-gcc.txt
deleted file mode 100644
index 13b5395f99..0000000000
--- a/BaseTools/building-gcc.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-To use GCC with the BaseTools project for edk2 based development purposes,
-you will need to build a GCC based cross-compiler (in addition to binutils).
-
-Instructions for building GCC for this purpose can be found under the
-BaseTools source tree.  (In addition to the instructions, you will also
-find scripts to help automate the build process.)
-
-If you do not have a tianocore.org account, you can make use of the 'guest'
-account with an empty password.
-
-In a web browser, you can 'browse' the relevant source at this location:
- http://sourceforge.net/p/edk2-buildtools/code/HEAD/tree/trunk/BaseTools/gcc
-
-Or, with subversion, you can download the relevant source with this command:
- svn co https://svn.code.sf.net/p/edk2-buildtools/code/trunk/BaseTools/gcc
diff --git a/BaseTools/gcc/README.txt b/BaseTools/gcc/README.txt
deleted file mode 100644
index ea7dd64576..0000000000
--- a/BaseTools/gcc/README.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-You may run these scripts to build a UEFI/PI gcc cross compiler.
-
-Cross compilers built with these scripts are tested on
-Linux, OS X and Cygwin.
-
-Please note that you may need to modify your edk2 tree's Conf/tools_def.txt
-file to point to the location where you installed the cross compiler.
-
-=== tianoCross-gcc-4.1 ===
-
-This script will build an x86 (ia32) cross compiler.
-
-The results of this script are very similar to the 'mingw' cross compiler
-which is commonly available on linux and OS X.  But, since the cross
-compiler produced by this script is tested, it is the only 'supported' way
-to build UEFI/PI images.
-
-To use this script, you will need:
-
- * A recent version (3.0 or later should be fine) of gcc that is able to produce
-   executables for the machine that you want to run this compiler on (the host
-   machine).
- * wget or curl
- * tar
- * bzip
- * gzip
- * bash
- * As well as (possibly) others tools and development packages
-
-=== x86_64-mingw-gcc-build.py ==
-
-This script will build an x86_64 (x64/Intel 64/amd64) cross compiler.
-
-To use this script, you will need:
-
- * A recent version (3.0 or later should be fine) of gcc that is able to
-   produce executables for the machine that you want to run this compiler
-   on (the host machine).
- * Python 2.5
- * texinfo
- * bison
- * flex
- * libmpfr
- * libgmp
- * As well as (possibly) others tools and development packages
-
-=== Ubuntu Notes ===
-
-On Ubuntu, the following command should install all the necessary build
-packages to utilize the x86_64-mingw-gcc-build.py script:
-
-  sudo apt-get install build-essential texinfo bison flex libgmp3-dev libmpfr-dev
-
-=== CYGWIN Notes ===
-
-You should setup cygwin to use binmode on all mounts. When you initially
-install cygwin it gives you the choice of Unix file mode (recommended) or DOS
-file mode. Unix mode will cause all the cygwin directories to be mounted in
-binmode, while DOS will mount the dirs in textmode. Here is an example of a
-cygwin install where the dirs are (properly) mounted in binmode.
-
-C:\cygwin\bin on /usr/bin type user (binmode)
-C:\cygwin\lib on /usr/lib type user (binmode)
-c:\workspace on /workspace type system (binmode)
-C:\cygwin on / type user (binmode)
-
-If you use textmode, it is likely that the build will fail in a way that is
-hard to debug.
-
-Cygwin is pretty slow, so it is not recommended for large builds.
-
diff --git a/BaseTools/gcc/mingw-gcc-build.py b/BaseTools/gcc/mingw-gcc-build.py
deleted file mode 100755
index 92778d1fcb..0000000000
--- a/BaseTools/gcc/mingw-gcc-build.py
+++ /dev/null
@@ -1,565 +0,0 @@
-#!/usr/bin/env python
-
-## @file
-#
-# Automation of instructions from:
-#   http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/trunk/mingw-w64-doc/
-#     howto-build/mingw-w64-howto-build.txt?revision=216&view=markup
-#
-# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution.    The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-
-from __future__ import print_function
-from optparse import OptionParser
-import os
-import shutil
-import subprocess
-import sys
-import tarfile
-import urllib
-import urlparse
-try:
-    from hashlib import md5
-except Exception:
-    from md5 import md5
-
-if sys.version_info < (2, 5):
-    #
-    # This script (and edk2 BaseTools) require Python 2.5 or newer
-    #
-    print('Python version 2.5 or later is required.')
-    sys.exit(-1)
-
-#
-# Version and Copyright
-#
-VersionNumber = "0.01"
-__version__ = "%prog Version " + VersionNumber
-__copyright__ = "Copyright (c) 2008 - 2018, Intel Corporation.  All rights reserved."
-
-class Config:
-    """class Config
-
-    Stores the configuration options for the rest of the script.
-
-    Handles the command line options, and allows the code within
-    the script to easily interact with the 'config' requested by
-    the user.
-    """
-
-    def __init__(self):
-        self.base_dir = os.getcwd()
-        (self.options, self.args) = self.CheckOptions()
-        self.__init_dirs__()
-
-    def CheckOptions(self):
-        Parser = \
-            OptionParser(
-                description=__copyright__,
-                version=__version__,
-                prog="mingw-gcc-build",
-                usage="%prog [options] [target]"
-                )
-        Parser.add_option(
-            "--arch",
-            action = "store", type = "string",
-            default = '',
-            dest = "arch",
-            help = "Processor architecture to build gcc for."
-            )
-        Parser.add_option(
-            "--src-dir",
-            action = "store", type = "string", dest = "src_dir",
-            default = os.path.join(self.base_dir, 'src'),
-            help = "Directory to download/extract binutils/gcc sources"
-            )
-        Parser.add_option(
-            "--build-dir",
-            action = "store", type = "string", dest = "build_dir",
-            default = os.path.join(self.base_dir, 'build'),
-            help = "Directory to download/extract binutils/gcc sources"
-            )
-        Parser.add_option(
-            "--prefix",
-            action = "store", type = "string", dest = "prefix",
-            default = os.path.join(self.base_dir, 'install'),
-            help = "Prefix to install binutils/gcc into"
-            )
-        Parser.add_option(
-            "--skip-binutils",
-            action = "store_true", dest = "skip_binutils",
-            default = False,
-            help = "Will skip building binutils"
-            )
-        Parser.add_option(
-            "--skip-gcc",
-            action = "store_true", dest = "skip_gcc",
-            default = False,
-            help = "Will skip building GCC"
-            )
-        Parser.add_option(
-            "--symlinks",
-            action = "store", type = "string", dest = "symlinks",
-            default = os.path.join(self.base_dir, 'symlinks'),
-            help = "Directory to create binutils/gcc symbolic links into."
-            )
-        Parser.add_option(
-            "-v", "--verbose",
-            action="store_true",
-            type=None, help="Print verbose messages"
-            )
-
-        (Opt, Args) = Parser.parse_args()
-
-        self.arch = Opt.arch.lower()
-        allowedArchs = ('ia32', 'x64', 'ipf')
-        if self.arch not in allowedArchs:
-            Parser.error(
-                'Please use --arch to specify one of: %s' %
-                    ', '.join(allowedArchs)
-                )
-        self.target_arch = {'ia32': 'i686', 'x64': 'x86_64', 'ipf': 'ia64'}[self.arch]
-        self.target_sys = {'ia32': 'pc', 'x64': 'pc', 'ipf': 'pc'}[self.arch]
-        self.target_bin = {'ia32': 'mingw32', 'x64': 'mingw32', 'ipf': 'elf'}[self.arch]
-        self.target_combo = '-'.join((self.target_arch, self.target_sys, self.target_bin))
-
-        return (Opt, Args)
-
-    def __init_dirs__(self):
-        self.src_dir = os.path.realpath(os.path.expanduser(self.options.src_dir))
-        self.build_dir = os.path.realpath(os.path.expanduser(self.options.build_dir))
-        self.prefix = os.path.realpath(os.path.expanduser(self.options.prefix))
-        self.symlinks = os.path.realpath(os.path.expanduser(self.options.symlinks))
-
-    def IsConfigOk(self):
-
-        building = []
-        if not self.options.skip_binutils:
-            building.append('binutils')
-        if not self.options.skip_gcc:
-            building.append('gcc')
-        if len(building) == 0:
-            print("Nothing will be built!")
-            print()
-            print("Please try using --help and then change the configuration.")
-            return False
-
-        print("Current directory:")
-        print("   ", self.base_dir)
-        print("Sources download/extraction:", self.Relative(self.src_dir))
-        print("Build directory            :", self.Relative(self.build_dir))
-        print("Prefix (install) directory :", self.Relative(self.prefix))
-        print("Create symlinks directory  :", self.Relative(self.symlinks))
-        print("Building                   :", ', '.join(building))
-        print()
-        answer = raw_input("Is this configuration ok? (default = no): ")
-        if (answer.lower() not in ('y', 'yes')):
-            print()
-            print("Please try using --help and then change the configuration.")
-            return False
-
-        if self.arch.lower() == 'ipf':
-            print()
-            print('Please note that the IPF compiler built by this script has')
-            print('not yet been validated!')
-            print()
-            answer = raw_input("Are you sure you want to build it? (default = no): ")
-            if (answer.lower() not in ('y', 'yes')):
-                print()
-                print("Please try using --help and then change the configuration.")
-                return False
-
-        print()
-        return True
-
-    def Relative(self, path):
-        if path.startswith(self.base_dir):
-            return '.' + path[len(self.base_dir):]
-        return path
-
-    def MakeDirs(self):
-        for path in (self.src_dir, self.build_dir, self.prefix, self.symlinks):
-            if not os.path.exists(path):
-                os.makedirs(path)
-
-class SourceFiles:
-    """class SourceFiles
-
-    Handles the downloading of source files used by the script.
-    """
-
-    def __init__(self, config):
-        self.config = config
-        self.source_files = self.source_files[config.arch]
-
-        if config.options.skip_binutils:
-            del self.source_files['binutils']
-
-        if config.options.skip_gcc:
-            del self.source_files['gcc']
-            del self.source_files['mingw_hdr']
-
-    source_files_common = {
-        'binutils': {
-            'url': 'http://www.kernel.org/pub/linux/devel/binutils/' + \
-                   'binutils-$version.tar.bz2',
-            'version': '2.20.51.0.5',
-            'md5': '6d2de7cdf7a8389e70b124e3d73b4d37',
-            },
-        }
-
-    source_files_x64 = {
-        'gcc': {
-            'url': 'http://ftpmirror.gnu.org/gcc/' + \
-                   'gcc-$version/gcc-$version.tar.bz2',
-            'version': '4.3.0',
-            'md5': '197ed8468b38db1d3481c3111691d85b',
-            },
-        }
-
-    source_files_ia32 = {
-        'gcc': source_files_x64['gcc'],
-        }
-
-    source_files_ipf = source_files_x64.copy()
-    source_files_ipf['gcc']['configure-params'] = (
-        '--with-gnu-as', '--with-gnu-ld', '--with-newlib',
-        '--verbose', '--disable-libssp', '--disable-nls',
-        '--enable-languages=c,c++'
-        )
-
-    source_files = {
-        'ia32': [source_files_common, source_files_ia32],
-        'x64': [source_files_common, source_files_x64],
-        'ipf': [source_files_common, source_files_ipf],
-        }
-
-    for arch in source_files:
-        mergedSourceFiles = {}
-        for source_files_dict in source_files[arch]:
-            mergedSourceFiles.update(source_files_dict)
-        for downloadItem in mergedSourceFiles:
-            fdata = mergedSourceFiles[downloadItem]
-            fdata['filename'] = fdata['url'].split('/')[-1]
-            if 'extract-dir' not in fdata:
-                for ext in ('.tar.gz', '.tar.bz2', '.zip'):
-                    if fdata['filename'].endswith(ext):
-                        fdata['extract-dir'] = fdata['filename'][:-len(ext)]
-                        break
-            replaceables = ('extract-dir', 'filename', 'url')
-            for replaceItem in fdata:
-                if replaceItem in replaceables: continue
-                if not isinstance(fdata[replaceItem], str): continue
-                for replaceable in replaceables:
-                    if not isinstance(fdata[replaceable], str): continue
-                    if replaceable in fdata:
-                        fdata[replaceable] = \
-                            fdata[replaceable].replace(
-                                '$' + replaceItem,
-                                fdata[replaceItem]
-                                )
-        source_files[arch] = mergedSourceFiles
-    #print 'source_files:', source_files
-
-    def GetAll(self):
-
-        def progress(received, blockSize, fileSize):
-            if fileSize < 0: return
-            wDots = (100 * received * blockSize) / fileSize / 10
-            if wDots > self.dots:
-                for i in range(wDots - self.dots):
-                    print('.', end=' ')
-                    sys.stdout.flush()
-                    self.dots += 1
-
-        maxRetries = 1
-        for (fname, fdata) in self.source_files.items():
-            for retries in range(maxRetries):
-                try:
-                    self.dots = 0
-                    local_file = os.path.join(self.config.src_dir, fdata['filename'])
-                    url = fdata['url']
-                    print('Downloading %s:' % fname, url)
-                    if retries > 0:
-                        print('(retry)', end=' ')
-                    sys.stdout.flush()
-
-                    completed = False
-                    if os.path.exists(local_file):
-                        md5_pass = self.checkHash(fdata)
-                        if md5_pass:
-                            print('[md5 match]', end=' ')
-                        else:
-                            print('[md5 mismatch]', end=' ')
-                        sys.stdout.flush()
-                        completed = md5_pass
-
-                    if not completed:
-                        urllib.urlretrieve(url, local_file, progress)
-
-                    #
-                    # BUGBUG: Suggest proxy to user if download fails.
-                    #
-                    # export http_proxy=http://proxyservername.mycompany.com:911
-                    # export ftp_proxy=http://proxyservername.mycompany.com:911
-
-                    if not completed and os.path.exists(local_file):
-                        md5_pass = self.checkHash(fdata)
-                        if md5_pass:
-                            print('[md5 match]', end=' ')
-                        else:
-                            print('[md5 mismatch]', end=' ')
-                        sys.stdout.flush()
-                        completed = md5_pass
-
-                    if completed:
-                        print('[done]')
-                        break
-                    else:
-                        print('[failed]')
-                        print('  Tried to retrieve', url)
-                        print('  to', local_file)
-                        print('Possible fixes:')
-                        print('* If you are behind a web-proxy, try setting the', end=' ')
-                        print('http_proxy environment variable')
-                        print('* You can try to download this file separately', end=' ')
-                        print('and rerun this script')
-                        raise Exception()
-
-                except KeyboardInterrupt:
-                    print('[KeyboardInterrupt]')
-                    return False
-
-                except Exception as e:
-                    print(e)
-
-            if not completed: return False
-
-        return True
-
-    def checkHash(self, fdata):
-        local_file = os.path.join(self.config.src_dir, fdata['filename'])
-        expect_md5 = fdata['md5']
-        data = open(local_file).read()
-        md5sum = md5()
-        md5sum.update(data)
-        return md5sum.hexdigest().lower() == expect_md5.lower()
-
-    def GetModules(self):
-        return self.source_files.keys()
-
-    def GetFilenameOf(self, module):
-        return self.source_files[module]['filename']
-
-    def GetMd5Of(self, module):
-        return self.source_files[module]['md5']
-
-    def GetExtractDirOf(self, module):
-        return self.source_files[module]['extract-dir']
-
-    def GetAdditionalParameters(self, module, step):
-        key = step + '-params'
-        if key in self.source_files[module]:
-            return self.source_files[module][key]
-        else:
-            return tuple()
-
-class Extracter:
-    """class Extracter
-
-    Handles the extraction of the source files from their downloaded
-    archive files.
-    """
-
-    def __init__(self, source_files, config):
-        self.source_files = source_files
-        self.config = config
-
-    def Extract(self, module):
-        src = self.config.src_dir
-        extractDst = os.path.join(src, self.config.arch)
-        local_file = os.path.join(src, self.source_files.GetFilenameOf(module))
-        moduleMd5 = self.source_files.GetMd5Of(module)
-        extracted = os.path.join(extractDst, os.path.split(local_file)[1] + '.extracted')
-        if not os.path.exists(extractDst):
-            os.mkdir(extractDst)
-
-        extractedMd5 = None
-        if os.path.exists(extracted):
-            extractedMd5 = open(extracted).read()
-
-        if extractedMd5 != moduleMd5:
-            print('Extracting %s:' % self.config.Relative(local_file))
-            tar = tarfile.open(local_file)
-            tar.extractall(extractDst)
-            open(extracted, 'w').write(moduleMd5)
-        else:
-            pass
-            #print 'Previously extracted', self.config.Relative(local_file)
-
-    def ExtractAll(self):
-        for module in self.source_files.GetModules():
-            self.Extract(module)
-
-class Builder:
-    """class Builder
-
-    Builds and installs the GCC tool suite.
-    """
-
-    def __init__(self, source_files, config):
-        self.source_files = source_files
-        self.config = config
-
-    def Build(self):
-        if not self.config.options.skip_binutils:
-            self.BuildModule('binutils')
-        if not self.config.options.skip_gcc:
-            self.BuildModule('gcc')
-            self.MakeSymLinks()
-
-    def IsBuildStepComplete(self, step):
-        return \
-            os.path.exists(
-                os.path.join(
-                    self.config.build_dir, self.config.arch, step + '.completed'
-                    )
-                )
-
-    def MarkBuildStepComplete(self, step):
-        open(
-            os.path.join(
-                self.config.build_dir, self.config.arch, step + '.completed'
-                ),
-            "w"
-            ).close()
-
-
-    def BuildModule(self, module):
-        base_dir = os.getcwd()
-        build_dir = os.path.join(self.config.build_dir, self.config.arch, module)
-        module_dir = self.source_files.GetExtractDirOf(module)
-        module_dir = os.path.realpath(os.path.join('src', self.config.arch, module_dir))
-        configure = os.path.join(module_dir, 'configure')
-        prefix = self.config.prefix
-        if not os.path.exists(build_dir):
-            os.makedirs(build_dir)
-        os.chdir(build_dir)
-
-        cmd = (
-            configure,
-            '--target=%s' % self.config.target_combo,
-            '--prefix=' + prefix,
-            '--with-sysroot=' + prefix,
-            '--disable-werror',
-            )
-        if os.path.exists('/opt/local/include/gmp.h'):
-            cmd += ('--with-gmp=/opt/local',)
-        if module == 'gcc': cmd += ('--oldincludedir=/opt/local/include',)
-        cmd += self.source_files.GetAdditionalParameters(module, 'configure')
-        self.RunCommand(cmd, module, 'config', skipable=True)
-
-        cmd = ('make',)
-        if module == 'gcc':
-            cmd += ('all-gcc',)
-        self.RunCommand(cmd, module, 'build')
-
-        cmd = ('make',)
-        if module == 'gcc':
-            cmd += ('install-gcc',)
-        else:
-            cmd += ('install',)
-        self.RunCommand(cmd, module, 'install')
-
-        os.chdir(base_dir)
-
-        print('%s module is now built and installed' % module)
-
-    def RunCommand(self, cmd, module, stage, skipable=False):
-        if skipable:
-            if self.IsBuildStepComplete('%s.%s' % (module, stage)):
-                return
-
-        popen = lambda cmd: \
-            subprocess.Popen(
-                cmd,
-                stdin=subprocess.PIPE,
-                stdout=subprocess.PIPE,
-                stderr=subprocess.STDOUT
-                )
-
-        print('%s [%s] ...' % (module, stage), end=' ')
-        sys.stdout.flush()
-        p = popen(cmd)
-        output = p.stdout.read()
-        p.wait()
-        if p.returncode != 0:
-            print('[failed!]')
-            logFile = os.path.join(self.config.build_dir, 'log.txt')
-            f = open(logFile, "w")
-            f.write(output)
-            f.close()
-            raise Exception('Failed to %s %s\n' % (stage, module) + \
-                'See output log at %s' % self.config.Relative(logFile))
-        else:
-            print('[done]')
-
-        if skipable:
-            self.MarkBuildStepComplete('%s.%s' % (module, stage))
-
-    def MakeSymLinks(self):
-        links_dir = os.path.join(self.config.symlinks, self.config.arch)
-        if not os.path.exists(links_dir):
-            os.makedirs(links_dir)
-        startPrinted = False
-        for link in ('ar', 'ld', 'gcc'):
-            src = os.path.join(
-                self.config.prefix, 'bin', self.config.target_combo + '-' + link
-                )
-            linkdst = os.path.join(links_dir, link)
-            if not os.path.lexists(linkdst):
-                if not startPrinted:
-                    print('Making symlinks in %s:' % self.config.Relative(links_dir), end=' ')
-                    startPrinted = True
-                print(link, end=' ')
-                os.symlink(src, linkdst)
-
-        if startPrinted:
-            print('[done]')
-
-class App:
-    """class App
-
-    The main body of the application.
-    """
-
-    def __init__(self):
-        config = Config()
-
-        if not config.IsConfigOk():
-            return
-
-        config.MakeDirs()
-
-        sources = SourceFiles(config)
-        result = sources.GetAll()
-        if result:
-            print('All files have been downloaded & verified')
-        else:
-            print('An error occurred while downloading a file')
-            return
-
-        Extracter(sources, config).ExtractAll()
-
-        Builder(sources, config).Build()
-
-App()
-
-- 
2.13.0.windows.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Patch] BaseTools: Remove unused txt files
  2019-02-15 14:32 [Patch] BaseTools: Remove unused txt files Liming Gao
@ 2019-02-15 23:00 ` Laszlo Ersek
  2019-02-19 13:58 ` Feng, Bob C
  1 sibling, 0 replies; 3+ messages in thread
From: Laszlo Ersek @ 2019-02-15 23:00 UTC (permalink / raw)
  To: Liming Gao, edk2-devel

On 02/15/19 15:32, Liming Gao wrote:
> externals.txt is to refer to the binary Win32. It is not used any longer.
> BuildNotes.txt is to freeze BaseTools python. It is not used any longer.
> BinaryFiles.txt is to list the file in Bin directory. But, Bin dir is empty.
> building-gcc.txt and gcc is for mingw-gcc. It is not used any longer.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> ---
>  BaseTools/Bin/externals.txt      |   1 -
>  BaseTools/BuildNotes.txt         |  83 ------
>  BaseTools/Source/BinaryFiles.txt |  79 ------
>  BaseTools/building-gcc.txt       |  15 --
>  BaseTools/gcc/README.txt         |  71 -----
>  BaseTools/gcc/mingw-gcc-build.py | 565 ---------------------------------------
>  6 files changed, 814 deletions(-)
>  delete mode 100644 BaseTools/Bin/externals.txt
>  delete mode 100644 BaseTools/BuildNotes.txt
>  delete mode 100644 BaseTools/Source/BinaryFiles.txt
>  delete mode 100644 BaseTools/building-gcc.txt
>  delete mode 100644 BaseTools/gcc/README.txt
>  delete mode 100755 BaseTools/gcc/mingw-gcc-build.py

Sounds reasonable. I don't remember looking at these files, ever.

Acked-by: Laszlo Ersek <lersek@redhat.com>

Thanks,
Laszlo


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch] BaseTools: Remove unused txt files
  2019-02-15 14:32 [Patch] BaseTools: Remove unused txt files Liming Gao
  2019-02-15 23:00 ` Laszlo Ersek
@ 2019-02-19 13:58 ` Feng, Bob C
  1 sibling, 0 replies; 3+ messages in thread
From: Feng, Bob C @ 2019-02-19 13:58 UTC (permalink / raw)
  To: Gao, Liming, edk2-devel@lists.01.org

Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Liming Gao
Sent: Friday, February 15, 2019 10:32 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch] BaseTools: Remove unused txt files

externals.txt is to refer to the binary Win32. It is not used any longer.
BuildNotes.txt is to freeze BaseTools python. It is not used any longer.
BinaryFiles.txt is to list the file in Bin directory. But, Bin dir is empty.
building-gcc.txt and gcc is for mingw-gcc. It is not used any longer.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Bin/externals.txt      |   1 -
 BaseTools/BuildNotes.txt         |  83 ------
 BaseTools/Source/BinaryFiles.txt |  79 ------
 BaseTools/building-gcc.txt       |  15 --
 BaseTools/gcc/README.txt         |  71 -----
 BaseTools/gcc/mingw-gcc-build.py | 565 ---------------------------------------
 6 files changed, 814 deletions(-)
 delete mode 100644 BaseTools/Bin/externals.txt  delete mode 100644 BaseTools/BuildNotes.txt  delete mode 100644 BaseTools/Source/BinaryFiles.txt  delete mode 100644 BaseTools/building-gcc.txt  delete mode 100644 BaseTools/gcc/README.txt  delete mode 100755 BaseTools/gcc/mingw-gcc-build.py

diff --git a/BaseTools/Bin/externals.txt b/BaseTools/Bin/externals.txt deleted file mode 100644 index c2c4ab7297..0000000000
--- a/BaseTools/Bin/externals.txt
+++ /dev/null
@@ -1 +0,0 @@
-Win32  https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32
diff --git a/BaseTools/BuildNotes.txt b/BaseTools/BuildNotes.txt deleted file mode 100644 index e2b10fddc3..0000000000
--- a/BaseTools/BuildNotes.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-Intel(R) Platform Innovation Framework for EFI -BuildTools Project, BaseTools Sub-Project -Root Package 1.00
-2007-08-31
-
-Intel is a trademark or registered trademark of Intel Corporation or its -subsidiaries in the United States and other countries.
-* Other names and brands may be claimed as the property of others.
-Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-
--------------------------------------------------------------------------------
-Quick Start
------------
-
-Windows:
-  a) Go to the <buildtools_project>/BaseTools and run "toolsetup" script
-
-Unix-like:
-  a) make -C <buildtools_project>/BaseTools
-  b) Look over https://github.com/tianocore/tianocore.github.io/wiki/Getting%20Started%20with%20EDK%20II
-     for a helpful step-by-step guide for building 'Hello World' on
-     various operating systems with edk2.
-
-Supported build targets (toolsetup)
------------------------------------
-
-build(or none)  - Incremental Build of all C based tools. This is the default target
-rebuild         - Clean all generated files and directories during build, and rebuild all tools
-
--------------------------------------------------------------------------------
-Tools in Python
----------------
-* Convert Python source to exe file
-
-  The tools written in Python can be converted into executable program which can
-  be executed without installing a Python interpreter. (Generally it is easier
-  to run the scripts from their source on operating systems other than Windows.)
-
-  For Windows and Linux, the conversion tool package is called cx_Freeze, its
-  home page is:
-
-    http://sourceforge.net/projects/cx-freeze/
-
-  If you have installed cx_Freeze at c:\cx_Freeze-3.0.3. Use following command
-  lines to convert MyBuild.py to MyBuild.exe (note this is an example, there is
-  no MyBuild Python project in the BaseTools\Python tree.
-
-    set PYTHONPATH=<BaseToolsDirPath>\Source\Python
-    c:\cx_Freeze-3.0.3\FreezePython.exe --include-modules=encodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf_16_le,encodings.utf_8 --install-dir=.\mybuild MyBuild.py
-
-  The generated .exe (and .dll) files are put in "mybuild" subdirectory.
-
-  The following is a real example with the BuildTools/trunk/BaseTools project
-  installed in: C:\Work\BaseTools
-
-
-  C:\Work\BaseTools\Source\Python> set PYTHONPATH=C:\Work\BaseTools\Source\Python
-  C:\Work\BaseTools\Source\Python> c:\cx_Freeze-3.0.3\FreezePython.exe --include-modules=encodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf_16_le,encodings.utf_8 --install-dir=C:\Work\BaseTools\Bin\Win32 build\build.py
-
----------------
-* Execute tools written in Python without conversion
-
-Unix-like systems:
-
-The edk2/edksetup.sh script will setup everything which is needed to -run the scripts from their source.
-
-Windows:
-
-  The tools written in Python can be executed directly from its source directory -as long as the Python interpreter (Python 2.5) has been installed. Before the execution, -please make sure the environment variable PYTHONPATH is set to
-
-        <buildtools_project>/BaseTools/Source/Python
-
-  There're five tools written in Python. The entrance file of each tool is listed -below.
-
-      build               <buildtools_project>/BaseTools/Source/Python/build/build.py
-      GenFds              <buildtools_project>/BaseTools/Source/Python/GenFds/GenFds.py
-      Trim                <buildtools_project>/BaseTools/Source/Python/Trim/Trim.py
-      MigrationMsa2Inf    <buildtools_project>/BaseTools/Source/Python/MigrationMsa2Inf/MigrationMsa2Inf.py
-      UPT                 <buildtools_project>/BaseTools/Source/Python/UPT/UPT.py
diff --git a/BaseTools/Source/BinaryFiles.txt b/BaseTools/Source/BinaryFiles.txt
deleted file mode 100644
index 818226a2c4..0000000000
--- a/BaseTools/Source/BinaryFiles.txt
+++ /dev/null
@@ -1,79 +0,0 @@
-## @file
-# This file lists all of the tool files that must be present in the Bin trees.
-#
-# This file is used by the EDK II Build Server that automatically builds the -# BaseTools Win32 binaries.
-# When new tools are create, the tool executable must be listed in the [Bin.Win32] -# section.
-# If a tool requires additional files, the developer must list those files in the -# [ExtraFiles.Win32] section.
-# The [CxFreeze.Win32] section is maintained by the owner of the Build Server who -# must ensure that files that are required by the cx_freeze frozen binaries are -# present in the Bin\Win32 directory.
-#
-# Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR> -# -# This program and the accompanying materials are licensed and made available under -# the terms and conditions of the BSD License which accompanies this distribution.
-# The full text of the license may be found at:
-#   http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-##
-
-[Bin.Win32]
-build.exe
-BPDG.exe
-Common.PyUtility.pyd
-Ecc.exe
-EfiCompressor.pyd
-EfiRom.exe
-Eot.EfiCompressor.pyd
-Eot.LzmaCompressor.pyd
-GenCrc32.exe
-GenDepex.exe
-GenFds.exe
-GenFfs.exe
-GenFv.exe
-GenFw.exe
-GenPatchPcdTable.exe
-GenSec.exe
-ImportTool.bat
-LzmaCompress.exe
-LzmaF86Compress.bat
-PatchPcdValue.exe
-Rsa2048Sha256GenerateKeys.exe
-Rsa2048Sha256Sign.exe
-Split.exe
-TargetTool.exe
-TianoCompress.exe
-Trim.exe
-UPT.exe
-VfrCompile.exe
-VolInfo.exe
-Pkcs7Sign.exe
-DevicePath.exe
-
-[ExtraFiles.Win32]
-TestSigningPrivateKey.pem
-config.ini
-exception.xml
-TestCert.pem
-TestCert.pub.pem
-TestRoot.pem
-TestRoot.pub.pem
-TestSub.pem
-TestSub.pub.pem
-
-[CxFreeze.Win32]
-_ctypes.pyd
-_hashlib.pyd
-_socket.pyd
-_sqlite3.pyd
-_ssl.pyd
-pyexpat.pyd
-python27.dll
-select.pyd
-sqlite3.dll
diff --git a/BaseTools/building-gcc.txt b/BaseTools/building-gcc.txt deleted file mode 100644 index 13b5395f99..0000000000
--- a/BaseTools/building-gcc.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-To use GCC with the BaseTools project for edk2 based development purposes, -you will need to build a GCC based cross-compiler (in addition to binutils).
-
-Instructions for building GCC for this purpose can be found under the -BaseTools source tree.  (In addition to the instructions, you will also -find scripts to help automate the build process.)
-
-If you do not have a tianocore.org account, you can make use of the 'guest'
-account with an empty password.
-
-In a web browser, you can 'browse' the relevant source at this location:
- http://sourceforge.net/p/edk2-buildtools/code/HEAD/tree/trunk/BaseTools/gcc
-
-Or, with subversion, you can download the relevant source with this command:
- svn co https://svn.code.sf.net/p/edk2-buildtools/code/trunk/BaseTools/gcc
diff --git a/BaseTools/gcc/README.txt b/BaseTools/gcc/README.txt deleted file mode 100644 index ea7dd64576..0000000000
--- a/BaseTools/gcc/README.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-You may run these scripts to build a UEFI/PI gcc cross compiler.
-
-Cross compilers built with these scripts are tested on -Linux, OS X and Cygwin.
-
-Please note that you may need to modify your edk2 tree's Conf/tools_def.txt -file to point to the location where you installed the cross compiler.
-
-=== tianoCross-gcc-4.1 ===
-
-This script will build an x86 (ia32) cross compiler.
-
-The results of this script are very similar to the 'mingw' cross compiler -which is commonly available on linux and OS X.  But, since the cross -compiler produced by this script is tested, it is the only 'supported' way -to build UEFI/PI images.
-
-To use this script, you will need:
-
- * A recent version (3.0 or later should be fine) of gcc that is able to produce
-   executables for the machine that you want to run this compiler on (the host
-   machine).
- * wget or curl
- * tar
- * bzip
- * gzip
- * bash
- * As well as (possibly) others tools and development packages
-
-=== x86_64-mingw-gcc-build.py ==
-
-This script will build an x86_64 (x64/Intel 64/amd64) cross compiler.
-
-To use this script, you will need:
-
- * A recent version (3.0 or later should be fine) of gcc that is able to
-   produce executables for the machine that you want to run this compiler
-   on (the host machine).
- * Python 2.5
- * texinfo
- * bison
- * flex
- * libmpfr
- * libgmp
- * As well as (possibly) others tools and development packages
-
-=== Ubuntu Notes ===
-
-On Ubuntu, the following command should install all the necessary build -packages to utilize the x86_64-mingw-gcc-build.py script:
-
-  sudo apt-get install build-essential texinfo bison flex libgmp3-dev libmpfr-dev
-
-=== CYGWIN Notes ===
-
-You should setup cygwin to use binmode on all mounts. When you initially -install cygwin it gives you the choice of Unix file mode (recommended) or DOS -file mode. Unix mode will cause all the cygwin directories to be mounted in -binmode, while DOS will mount the dirs in textmode. Here is an example of a -cygwin install where the dirs are (properly) mounted in binmode.
-
-C:\cygwin\bin on /usr/bin type user (binmode) -C:\cygwin\lib on /usr/lib type user (binmode) -c:\workspace on /workspace type system (binmode) -C:\cygwin on / type user (binmode)
-
-If you use textmode, it is likely that the build will fail in a way that is -hard to debug.
-
-Cygwin is pretty slow, so it is not recommended for large builds.
-
diff --git a/BaseTools/gcc/mingw-gcc-build.py b/BaseTools/gcc/mingw-gcc-build.py
deleted file mode 100755
index 92778d1fcb..0000000000
--- a/BaseTools/gcc/mingw-gcc-build.py
+++ /dev/null
@@ -1,565 +0,0 @@
-#!/usr/bin/env python
-
-## @file
-#
-# Automation of instructions from:
-#   http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/trunk/mingw-w64-doc/
-#     howto-build/mingw-w64-howto-build.txt?revision=216&view=markup
-#
-# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR> -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution.    The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-
-from __future__ import print_function
-from optparse import OptionParser
-import os
-import shutil
-import subprocess
-import sys
-import tarfile
-import urllib
-import urlparse
-try:
-    from hashlib import md5
-except Exception:
-    from md5 import md5
-
-if sys.version_info < (2, 5):
-    #
-    # This script (and edk2 BaseTools) require Python 2.5 or newer
-    #
-    print('Python version 2.5 or later is required.')
-    sys.exit(-1)
-
-#
-# Version and Copyright
-#
-VersionNumber = "0.01"
-__version__ = "%prog Version " + VersionNumber -__copyright__ = "Copyright (c) 2008 - 2018, Intel Corporation.  All rights reserved."
-
-class Config:
-    """class Config
-
-    Stores the configuration options for the rest of the script.
-
-    Handles the command line options, and allows the code within
-    the script to easily interact with the 'config' requested by
-    the user.
-    """
-
-    def __init__(self):
-        self.base_dir = os.getcwd()
-        (self.options, self.args) = self.CheckOptions()
-        self.__init_dirs__()
-
-    def CheckOptions(self):
-        Parser = \
-            OptionParser(
-                description=__copyright__,
-                version=__version__,
-                prog="mingw-gcc-build",
-                usage="%prog [options] [target]"
-                )
-        Parser.add_option(
-            "--arch",
-            action = "store", type = "string",
-            default = '',
-            dest = "arch",
-            help = "Processor architecture to build gcc for."
-            )
-        Parser.add_option(
-            "--src-dir",
-            action = "store", type = "string", dest = "src_dir",
-            default = os.path.join(self.base_dir, 'src'),
-            help = "Directory to download/extract binutils/gcc sources"
-            )
-        Parser.add_option(
-            "--build-dir",
-            action = "store", type = "string", dest = "build_dir",
-            default = os.path.join(self.base_dir, 'build'),
-            help = "Directory to download/extract binutils/gcc sources"
-            )
-        Parser.add_option(
-            "--prefix",
-            action = "store", type = "string", dest = "prefix",
-            default = os.path.join(self.base_dir, 'install'),
-            help = "Prefix to install binutils/gcc into"
-            )
-        Parser.add_option(
-            "--skip-binutils",
-            action = "store_true", dest = "skip_binutils",
-            default = False,
-            help = "Will skip building binutils"
-            )
-        Parser.add_option(
-            "--skip-gcc",
-            action = "store_true", dest = "skip_gcc",
-            default = False,
-            help = "Will skip building GCC"
-            )
-        Parser.add_option(
-            "--symlinks",
-            action = "store", type = "string", dest = "symlinks",
-            default = os.path.join(self.base_dir, 'symlinks'),
-            help = "Directory to create binutils/gcc symbolic links into."
-            )
-        Parser.add_option(
-            "-v", "--verbose",
-            action="store_true",
-            type=None, help="Print verbose messages"
-            )
-
-        (Opt, Args) = Parser.parse_args()
-
-        self.arch = Opt.arch.lower()
-        allowedArchs = ('ia32', 'x64', 'ipf')
-        if self.arch not in allowedArchs:
-            Parser.error(
-                'Please use --arch to specify one of: %s' %
-                    ', '.join(allowedArchs)
-                )
-        self.target_arch = {'ia32': 'i686', 'x64': 'x86_64', 'ipf': 'ia64'}[self.arch]
-        self.target_sys = {'ia32': 'pc', 'x64': 'pc', 'ipf': 'pc'}[self.arch]
-        self.target_bin = {'ia32': 'mingw32', 'x64': 'mingw32', 'ipf': 'elf'}[self.arch]
-        self.target_combo = '-'.join((self.target_arch, self.target_sys, self.target_bin))
-
-        return (Opt, Args)
-
-    def __init_dirs__(self):
-        self.src_dir = os.path.realpath(os.path.expanduser(self.options.src_dir))
-        self.build_dir = os.path.realpath(os.path.expanduser(self.options.build_dir))
-        self.prefix = os.path.realpath(os.path.expanduser(self.options.prefix))
-        self.symlinks = os.path.realpath(os.path.expanduser(self.options.symlinks))
-
-    def IsConfigOk(self):
-
-        building = []
-        if not self.options.skip_binutils:
-            building.append('binutils')
-        if not self.options.skip_gcc:
-            building.append('gcc')
-        if len(building) == 0:
-            print("Nothing will be built!")
-            print()
-            print("Please try using --help and then change the configuration.")
-            return False
-
-        print("Current directory:")
-        print("   ", self.base_dir)
-        print("Sources download/extraction:", self.Relative(self.src_dir))
-        print("Build directory            :", self.Relative(self.build_dir))
-        print("Prefix (install) directory :", self.Relative(self.prefix))
-        print("Create symlinks directory  :", self.Relative(self.symlinks))
-        print("Building                   :", ', '.join(building))
-        print()
-        answer = raw_input("Is this configuration ok? (default = no): ")
-        if (answer.lower() not in ('y', 'yes')):
-            print()
-            print("Please try using --help and then change the configuration.")
-            return False
-
-        if self.arch.lower() == 'ipf':
-            print()
-            print('Please note that the IPF compiler built by this script has')
-            print('not yet been validated!')
-            print()
-            answer = raw_input("Are you sure you want to build it? (default = no): ")
-            if (answer.lower() not in ('y', 'yes')):
-                print()
-                print("Please try using --help and then change the configuration.")
-                return False
-
-        print()
-        return True
-
-    def Relative(self, path):
-        if path.startswith(self.base_dir):
-            return '.' + path[len(self.base_dir):]
-        return path
-
-    def MakeDirs(self):
-        for path in (self.src_dir, self.build_dir, self.prefix, self.symlinks):
-            if not os.path.exists(path):
-                os.makedirs(path)
-
-class SourceFiles:
-    """class SourceFiles
-
-    Handles the downloading of source files used by the script.
-    """
-
-    def __init__(self, config):
-        self.config = config
-        self.source_files = self.source_files[config.arch]
-
-        if config.options.skip_binutils:
-            del self.source_files['binutils']
-
-        if config.options.skip_gcc:
-            del self.source_files['gcc']
-            del self.source_files['mingw_hdr']
-
-    source_files_common = {
-        'binutils': {
-            'url': 'http://www.kernel.org/pub/linux/devel/binutils/' + \
-                   'binutils-$version.tar.bz2',
-            'version': '2.20.51.0.5',
-            'md5': '6d2de7cdf7a8389e70b124e3d73b4d37',
-            },
-        }
-
-    source_files_x64 = {
-        'gcc': {
-            'url': 'http://ftpmirror.gnu.org/gcc/' + \
-                   'gcc-$version/gcc-$version.tar.bz2',
-            'version': '4.3.0',
-            'md5': '197ed8468b38db1d3481c3111691d85b',
-            },
-        }
-
-    source_files_ia32 = {
-        'gcc': source_files_x64['gcc'],
-        }
-
-    source_files_ipf = source_files_x64.copy()
-    source_files_ipf['gcc']['configure-params'] = (
-        '--with-gnu-as', '--with-gnu-ld', '--with-newlib',
-        '--verbose', '--disable-libssp', '--disable-nls',
-        '--enable-languages=c,c++'
-        )
-
-    source_files = {
-        'ia32': [source_files_common, source_files_ia32],
-        'x64': [source_files_common, source_files_x64],
-        'ipf': [source_files_common, source_files_ipf],
-        }
-
-    for arch in source_files:
-        mergedSourceFiles = {}
-        for source_files_dict in source_files[arch]:
-            mergedSourceFiles.update(source_files_dict)
-        for downloadItem in mergedSourceFiles:
-            fdata = mergedSourceFiles[downloadItem]
-            fdata['filename'] = fdata['url'].split('/')[-1]
-            if 'extract-dir' not in fdata:
-                for ext in ('.tar.gz', '.tar.bz2', '.zip'):
-                    if fdata['filename'].endswith(ext):
-                        fdata['extract-dir'] = fdata['filename'][:-len(ext)]
-                        break
-            replaceables = ('extract-dir', 'filename', 'url')
-            for replaceItem in fdata:
-                if replaceItem in replaceables: continue
-                if not isinstance(fdata[replaceItem], str): continue
-                for replaceable in replaceables:
-                    if not isinstance(fdata[replaceable], str): continue
-                    if replaceable in fdata:
-                        fdata[replaceable] = \
-                            fdata[replaceable].replace(
-                                '$' + replaceItem,
-                                fdata[replaceItem]
-                                )
-        source_files[arch] = mergedSourceFiles
-    #print 'source_files:', source_files
-
-    def GetAll(self):
-
-        def progress(received, blockSize, fileSize):
-            if fileSize < 0: return
-            wDots = (100 * received * blockSize) / fileSize / 10
-            if wDots > self.dots:
-                for i in range(wDots - self.dots):
-                    print('.', end=' ')
-                    sys.stdout.flush()
-                    self.dots += 1
-
-        maxRetries = 1
-        for (fname, fdata) in self.source_files.items():
-            for retries in range(maxRetries):
-                try:
-                    self.dots = 0
-                    local_file = os.path.join(self.config.src_dir, fdata['filename'])
-                    url = fdata['url']
-                    print('Downloading %s:' % fname, url)
-                    if retries > 0:
-                        print('(retry)', end=' ')
-                    sys.stdout.flush()
-
-                    completed = False
-                    if os.path.exists(local_file):
-                        md5_pass = self.checkHash(fdata)
-                        if md5_pass:
-                            print('[md5 match]', end=' ')
-                        else:
-                            print('[md5 mismatch]', end=' ')
-                        sys.stdout.flush()
-                        completed = md5_pass
-
-                    if not completed:
-                        urllib.urlretrieve(url, local_file, progress)
-
-                    #
-                    # BUGBUG: Suggest proxy to user if download fails.
-                    #
-                    # export http_proxy=http://proxyservername.mycompany.com:911
-                    # export ftp_proxy=http://proxyservername.mycompany.com:911
-
-                    if not completed and os.path.exists(local_file):
-                        md5_pass = self.checkHash(fdata)
-                        if md5_pass:
-                            print('[md5 match]', end=' ')
-                        else:
-                            print('[md5 mismatch]', end=' ')
-                        sys.stdout.flush()
-                        completed = md5_pass
-
-                    if completed:
-                        print('[done]')
-                        break
-                    else:
-                        print('[failed]')
-                        print('  Tried to retrieve', url)
-                        print('  to', local_file)
-                        print('Possible fixes:')
-                        print('* If you are behind a web-proxy, try setting the', end=' ')
-                        print('http_proxy environment variable')
-                        print('* You can try to download this file separately', end=' ')
-                        print('and rerun this script')
-                        raise Exception()
-
-                except KeyboardInterrupt:
-                    print('[KeyboardInterrupt]')
-                    return False
-
-                except Exception as e:
-                    print(e)
-
-            if not completed: return False
-
-        return True
-
-    def checkHash(self, fdata):
-        local_file = os.path.join(self.config.src_dir, fdata['filename'])
-        expect_md5 = fdata['md5']
-        data = open(local_file).read()
-        md5sum = md5()
-        md5sum.update(data)
-        return md5sum.hexdigest().lower() == expect_md5.lower()
-
-    def GetModules(self):
-        return self.source_files.keys()
-
-    def GetFilenameOf(self, module):
-        return self.source_files[module]['filename']
-
-    def GetMd5Of(self, module):
-        return self.source_files[module]['md5']
-
-    def GetExtractDirOf(self, module):
-        return self.source_files[module]['extract-dir']
-
-    def GetAdditionalParameters(self, module, step):
-        key = step + '-params'
-        if key in self.source_files[module]:
-            return self.source_files[module][key]
-        else:
-            return tuple()
-
-class Extracter:
-    """class Extracter
-
-    Handles the extraction of the source files from their downloaded
-    archive files.
-    """
-
-    def __init__(self, source_files, config):
-        self.source_files = source_files
-        self.config = config
-
-    def Extract(self, module):
-        src = self.config.src_dir
-        extractDst = os.path.join(src, self.config.arch)
-        local_file = os.path.join(src, self.source_files.GetFilenameOf(module))
-        moduleMd5 = self.source_files.GetMd5Of(module)
-        extracted = os.path.join(extractDst, os.path.split(local_file)[1] + '.extracted')
-        if not os.path.exists(extractDst):
-            os.mkdir(extractDst)
-
-        extractedMd5 = None
-        if os.path.exists(extracted):
-            extractedMd5 = open(extracted).read()
-
-        if extractedMd5 != moduleMd5:
-            print('Extracting %s:' % self.config.Relative(local_file))
-            tar = tarfile.open(local_file)
-            tar.extractall(extractDst)
-            open(extracted, 'w').write(moduleMd5)
-        else:
-            pass
-            #print 'Previously extracted', self.config.Relative(local_file)
-
-    def ExtractAll(self):
-        for module in self.source_files.GetModules():
-            self.Extract(module)
-
-class Builder:
-    """class Builder
-
-    Builds and installs the GCC tool suite.
-    """
-
-    def __init__(self, source_files, config):
-        self.source_files = source_files
-        self.config = config
-
-    def Build(self):
-        if not self.config.options.skip_binutils:
-            self.BuildModule('binutils')
-        if not self.config.options.skip_gcc:
-            self.BuildModule('gcc')
-            self.MakeSymLinks()
-
-    def IsBuildStepComplete(self, step):
-        return \
-            os.path.exists(
-                os.path.join(
-                    self.config.build_dir, self.config.arch, step + '.completed'
-                    )
-                )
-
-    def MarkBuildStepComplete(self, step):
-        open(
-            os.path.join(
-                self.config.build_dir, self.config.arch, step + '.completed'
-                ),
-            "w"
-            ).close()
-
-
-    def BuildModule(self, module):
-        base_dir = os.getcwd()
-        build_dir = os.path.join(self.config.build_dir, self.config.arch, module)
-        module_dir = self.source_files.GetExtractDirOf(module)
-        module_dir = os.path.realpath(os.path.join('src', self.config.arch, module_dir))
-        configure = os.path.join(module_dir, 'configure')
-        prefix = self.config.prefix
-        if not os.path.exists(build_dir):
-            os.makedirs(build_dir)
-        os.chdir(build_dir)
-
-        cmd = (
-            configure,
-            '--target=%s' % self.config.target_combo,
-            '--prefix=' + prefix,
-            '--with-sysroot=' + prefix,
-            '--disable-werror',
-            )
-        if os.path.exists('/opt/local/include/gmp.h'):
-            cmd += ('--with-gmp=/opt/local',)
-        if module == 'gcc': cmd += ('--oldincludedir=/opt/local/include',)
-        cmd += self.source_files.GetAdditionalParameters(module, 'configure')
-        self.RunCommand(cmd, module, 'config', skipable=True)
-
-        cmd = ('make',)
-        if module == 'gcc':
-            cmd += ('all-gcc',)
-        self.RunCommand(cmd, module, 'build')
-
-        cmd = ('make',)
-        if module == 'gcc':
-            cmd += ('install-gcc',)
-        else:
-            cmd += ('install',)
-        self.RunCommand(cmd, module, 'install')
-
-        os.chdir(base_dir)
-
-        print('%s module is now built and installed' % module)
-
-    def RunCommand(self, cmd, module, stage, skipable=False):
-        if skipable:
-            if self.IsBuildStepComplete('%s.%s' % (module, stage)):
-                return
-
-        popen = lambda cmd: \
-            subprocess.Popen(
-                cmd,
-                stdin=subprocess.PIPE,
-                stdout=subprocess.PIPE,
-                stderr=subprocess.STDOUT
-                )
-
-        print('%s [%s] ...' % (module, stage), end=' ')
-        sys.stdout.flush()
-        p = popen(cmd)
-        output = p.stdout.read()
-        p.wait()
-        if p.returncode != 0:
-            print('[failed!]')
-            logFile = os.path.join(self.config.build_dir, 'log.txt')
-            f = open(logFile, "w")
-            f.write(output)
-            f.close()
-            raise Exception('Failed to %s %s\n' % (stage, module) + \
-                'See output log at %s' % self.config.Relative(logFile))
-        else:
-            print('[done]')
-
-        if skipable:
-            self.MarkBuildStepComplete('%s.%s' % (module, stage))
-
-    def MakeSymLinks(self):
-        links_dir = os.path.join(self.config.symlinks, self.config.arch)
-        if not os.path.exists(links_dir):
-            os.makedirs(links_dir)
-        startPrinted = False
-        for link in ('ar', 'ld', 'gcc'):
-            src = os.path.join(
-                self.config.prefix, 'bin', self.config.target_combo + '-' + link
-                )
-            linkdst = os.path.join(links_dir, link)
-            if not os.path.lexists(linkdst):
-                if not startPrinted:
-                    print('Making symlinks in %s:' % self.config.Relative(links_dir), end=' ')
-                    startPrinted = True
-                print(link, end=' ')
-                os.symlink(src, linkdst)
-
-        if startPrinted:
-            print('[done]')
-
-class App:
-    """class App
-
-    The main body of the application.
-    """
-
-    def __init__(self):
-        config = Config()
-
-        if not config.IsConfigOk():
-            return
-
-        config.MakeDirs()
-
-        sources = SourceFiles(config)
-        result = sources.GetAll()
-        if result:
-            print('All files have been downloaded & verified')
-        else:
-            print('An error occurred while downloading a file')
-            return
-
-        Extracter(sources, config).ExtractAll()
-
-        Builder(sources, config).Build()
-
-App()
-
--
2.13.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-19 13:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-15 14:32 [Patch] BaseTools: Remove unused txt files Liming Gao
2019-02-15 23:00 ` Laszlo Ersek
2019-02-19 13:58 ` Feng, Bob C

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox