diff options
author | Cory Winter <cory@zeroc.com> | 2005-03-31 04:30:08 +0000 |
---|---|---|
committer | Cory Winter <cory@zeroc.com> | 2005-03-31 04:30:08 +0000 |
commit | d28716c0bfb6a80f6b368d6a6d79b5a0083468a0 (patch) | |
tree | ad70af140dc3df13592dd5b547f44adeaedb3f60 /cpp/install/common/makewindist.py | |
parent | file makewindist.bat was initially added on branch R2_1_branch. (diff) | |
download | ice-d28716c0bfb6a80f6b368d6a6d79b5a0083468a0.tar.bz2 ice-d28716c0bfb6a80f6b368d6a6d79b5a0083468a0.tar.xz ice-d28716c0bfb6a80f6b368d6a6d79b5a0083468a0.zip |
merge from R2_1_branch to get windows installers automation changes
Diffstat (limited to 'cpp/install/common/makewindist.py')
-rwxr-xr-x | cpp/install/common/makewindist.py | 389 |
1 files changed, 389 insertions, 0 deletions
diff --git a/cpp/install/common/makewindist.py b/cpp/install/common/makewindist.py new file mode 100755 index 00000000000..adfaa046c47 --- /dev/null +++ b/cpp/install/common/makewindist.py @@ -0,0 +1,389 @@ +# **********************************************************************
+#
+# Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import getopt, os, re, shutil, string, sys, zipfile
+
+def prependEnvPath(name, path):
+ """Prepend a path to an existing environment variable."""
+ os.environ[name] = path + os.pathsep + os.environ[name]
+
+def prependEnvPathList(name, list):
+ """Prepend a list of paths to an existing environment variable."""
+ for path in list:
+ prependEnvPath(name, path)
+
+def usage():
+ """Print usage/help information"""
+ print "Usage: " + sys.argv[0] + " [options]"
+ print
+ print "Options:"
+ print "-h, --help Show this message."
+ print " --skip-build Do not build any sources."
+ print " --skip-clean Do not clean any sources or staged files."
+ print " --skip-installer Do not build any installers or merge modules."
+
+def cleanIceDists(sourcesDir, sourcesVersion, installVersion):
+ """Clean all Ice distributions."""
+ iceHome = os.environ['ICE_HOME']
+ if installVersion == "vc71":
+ #
+ # Ice for C++
+ #
+ os.chdir(iceHome)
+ print "Cleaning in " + os.getcwd() + "..."
+ os.system("devenv all.sln /useenv /clean Debug")
+ os.system("devenv all.sln /useenv /clean Release")
+
+ #
+ # Ice for Java
+ #
+ os.chdir(os.path.join(sourcesDir, "IceJ-" + sourcesVersion))
+ print "Cleaning in " + os.getcwd() + "..."
+ os.system("ant clean")
+
+ #
+ # Ice for C#
+ #
+ os.chdir(os.path.join(sourcesDir, "IceCS-" + sourcesVersion))
+ print "Cleaning in " + os.getcwd() + "..."
+ os.system("devenv all.sln /useenv /clean Debug")
+
+ #
+ # Ice for PHP
+ #
+ os.chdir(os.path.join(sourcesDir, "IcePHP-" + sourcesVersion))
+ print "Cleaning in " + os.getcwd() + "..."
+ os.system("devenv icephp.sln /useenv /clean Release")
+
+ #
+ # Ice for Python
+ #
+ os.chdir(os.path.join(sourcesDir, "IcePy-" + sourcesVersion))
+ print "Cleaning in " + os.getcwd() + "..."
+ os.system("devenv all.sln /useenv /clean Release")
+
+ #
+ # Ice for Visual Basic
+ #
+ os.rename(os.path.join(sourcesDir, "IceCS-" + sourcesVersion), os.path.join(sourcesDir, "IceCS")) # XXX temp
+ os.chdir(os.path.join(sourcesDir, "IceVB-" + sourcesVersion))
+ print "Cleaning in " + os.getcwd() + "..."
+ os.system("devenv all.sln /useenv /clean Debug")
+ os.rename(os.path.join(sourcesDir, "IceCS"), os.path.join(sourcesDir, "IceCS-" + sourcesVersion)) # XXX temp
+ elif installVersion == "vc60":
+ os.chdir(iceHome)
+ print "Cleaning in " + os.getcwd() + "..."
+ os.system("msdev all.dsw /useenv /make ALL /clean")
+
+def buildIceDists(stageDir, sourcesDir, sourcesVersion, installVersion):
+ """Build all Ice distributions."""
+ #
+ # Update PATH, LIB and INCLUDE environment variables required for
+ # building Ice for C++.
+ #
+ path = [
+ os.path.join(stageDir, "berkeley/dev/bin"),
+ os.path.join(stageDir, "berkeley/runtime/bin"),
+ os.path.join(stageDir, "berkeley/java/bin"),
+ os.path.join(stageDir, "expat/runtime/bin"),
+ os.path.join(stageDir, "openssl/runtime/bin")
+ ]
+ if installVersion == "vc60":
+ path.append(os.path.join(stageDir, "stlport/dev/bin"))
+ path.append(os.path.join(stageDir, "stlport/runtime/bin"))
+ prependEnvPathList('PATH', path)
+
+ lib = [
+ os.path.join(stageDir, "berkeley/dev/lib"),
+ os.path.join(stageDir, "bzip2/dev/lib"),
+ os.path.join(stageDir, "expat/dev/lib"),
+ os.path.join(stageDir, "openssl/dev/lib")
+ ]
+ if installVersion == "vc60":
+ lib.append(os.path.join(stageDir, "stlport/dev/lib"))
+ prependEnvPathList('LIB', lib)
+
+ include = [
+ os.path.join(stageDir, "berkeley/dev/include"),
+ os.path.join(stageDir, "bzip2/dev/include"),
+ os.path.join(stageDir, "expat/dev/include"),
+ os.path.join(stageDir, "openssl/dev/include")
+ ]
+ if installVersion == "vc60":
+ include.append(os.path.join(stageDir, "stlport/dev/include/stlport"))
+ prependEnvPathList('INCLUDE', include)
+
+ iceHome = os.environ['ICE_HOME']
+ prependEnvPath('PATH', os.path.join(iceHome, "bin"))
+ prependEnvPath('LIB', os.path.join(iceHome, "lib"))
+ prependEnvPath('INCLUDE', os.path.join(iceHome, "include"))
+
+ if installVersion == "vc71":
+ #
+ # Ice for C++
+ #
+ os.chdir(iceHome)
+ print "Building in " + os.getcwd() + "..."
+ os.system("devenv all.sln /useenv /build Debug")
+ os.system("devenv all.sln /useenv /build Release")
+
+ #
+ # Ice for Java
+ #
+ os.chdir(os.path.join(sourcesDir, "IceJ-" + sourcesVersion))
+ print "Building in " + os.getcwd() + "..."
+ os.system("ant")
+
+ #
+ # Ice for C#
+ #
+ os.chdir(os.path.join(sourcesDir, "IceCS-" + sourcesVersion))
+ print "Building in " + os.getcwd() + "..."
+ os.system("devenv all.sln /useenv /build Debug")
+
+ #
+ # Ice for PHP
+ #
+ phpBinHome = os.environ['PHP_BIN_HOME']
+ phpLib = [
+ os.path.join(phpBinHome, "lib"),
+ os.path.join(phpBinHome, "dev")
+ ]
+ prependEnvPathList('LIB', phpLib)
+
+ phpSrcHome = os.environ['PHP_SRC_HOME']
+ phpInc = [
+ phpSrcHome,
+ os.path.join(phpSrcHome, "main"),
+ os.path.join(phpSrcHome, "Zend"),
+ os.path.join(phpSrcHome, "TSRM")
+ ]
+ prependEnvPathList('INCLUDE', phpInc)
+
+ os.chdir(os.path.join(sourcesDir, "IcePHP-" + sourcesVersion))
+ print "Building in " + os.getcwd() + "..."
+ os.system("devenv icephp.sln /useenv /build Release")
+
+ #
+ # Ice for Python
+ #
+ pythonHome = os.environ['PYTHON_HOME']
+ prependEnvPath('LIB', os.path.join(pythonHome, "libs"))
+ prependEnvPath('INCLUDE', os.path.join(pythonHome, "include"))
+
+ os.chdir(os.path.join(sourcesDir, "IcePy-" + sourcesVersion))
+ print "Building in " + os.getcwd() + "..."
+ os.system("devenv all.sln /useenv /build Release")
+
+ #
+ # Ice for Visual Basic
+ #
+ os.chdir(os.path.join(sourcesDir, "IceVB-" + sourcesVersion))
+ print "Building in " + os.getcwd() + "..."
+ os.system("devenv all.sln /useenv /build Debug")
+ elif installVersion == "vc60":
+ #
+ # Ice for C++
+ #
+ os.chdir(iceHome)
+ print "Building in " + os.getcwd() + "..."
+ os.system("msdev all.dsw /useenv /make ALL")
+
+def buildMergeModules(startDir, stageDir, sourcesVersion, installVersion):
+ """Build third party merge modules."""
+ modules = [
+ ("BerkeleyDBDevKit", "BERKELEYDB_DEV_KIT"),
+ ("BerkeleyDBRuntime", "BERKELEYDB_RUNTIME"),
+ ("BerkeleyDBJava", "BERKELEYDB_JAVA"),
+ ("BZip2DevKit", "BZIP2_DEV_KIT"),
+ ("ExpatDevKit", "EXPAT_DEV_KIT"),
+ ("ExpatRuntime", "EXPAT_RUNTIME"),
+ ("OpenSSLDevKit", "OPENSSL_DEV_KIT"),
+ ("OpenSSLRuntime", "OPENSSL_RUNTIME")
+ ]
+ if installVersion == "vc60":
+ extras = [ ("STLPortDevKit", "STLPORT_DEV_KIT"), ("STLPortRuntime", "STLPORT_RUNTIME") ]
+ modules.extend(extras)
+
+ #
+ # Build modules.
+ #
+ os.chdir(startDir)
+ for project, release in modules:
+ os.system("ISCmdBld -c COMP -a ZEROC -p " + project + ".ism -r " + release)
+
+ #
+ # Archive modules in the stage directory root.
+ #
+ zipPath = "ThirdPartyMergeModules-" + sourcesVersion + "-" + installVersion.upper() + ".zip"
+ zip = zipfile.ZipFile(os.path.join(stageDir, zipPath), 'w')
+ for project, release in modules:
+ msm = project + "." + installVersion.upper() + ".msm"
+ msmPath = os.path.join(os.getcwd(), project, "ZEROC", release, "DiskImages/DISK1", msm)
+ zip.write(msmPath, os.path.basename(msmPath))
+ zip.close()
+
+def buildInstallers(startDir, stageDir, sourcesVersion, installVersion):
+ """Build MSI installers."""
+ installers = [("ThirdParty", "THIRD_PARTY_MSI"), ("Ice", "ICE_MSI")]
+
+ #
+ # Build and copy to the stage directory root.
+ #
+ os.chdir(startDir)
+ for project, release in installers:
+ os.system("ISCmdBld -c COMP -a ZEROC -p " + project + ".ism -r " + release)
+ msi = project + "-" + sourcesVersion + "-" + installVersion.upper() + ".msi"
+ msiPath = os.path.join(os.getcwd(), project, "ZEROC", release, "DiskImages/DISK1", msi)
+ shutil.copy(msiPath, stageDir)
+
+def main():
+ #
+ # Save our start dir. This script expects that this will be
+ # <ice-cvs-root>/install/[vc60|vc71]
+ #
+ startDir = os.getcwd()
+ print "Start Directory: " + startDir
+
+ installDir = startDir[:startDir.rfind("\\")]
+ print "Install Directory: " + installDir
+
+ #
+ # Check the installer version string.
+ #
+ installVersion = startDir[startDir.rfind("\\")+1:].lower()
+ if installVersion != "vc60" and installVersion != "vc71":
+ print "Invalid install version."
+ sys.exit(2)
+ else:
+ print "Install Version: " + installVersion
+
+ #
+ # Where all the files will be staged so that the install projects
+ # can find them.
+ #
+ stageDir = os.path.join(startDir, "install")
+ print "Stage Directory: " + stageDir
+
+ #
+ # Process args.
+ #
+ try:
+ optionList, args = getopt.getopt(
+ sys.argv[1:], "h:", [ "help", "skip-clean", "skip-build", "skip-installer" ])
+ except getopt.GetoptError:
+ usage()
+ sys.exit(2)
+
+ #
+ # Set a few defaults.
+ #
+ clean = True
+ build = True
+ installer = True
+
+ for o, a in optionList:
+ if o in ("-h", "--help"):
+ usage()
+ sys.exit()
+ elif o == "--skip-clean":
+ clean = False
+ elif o == "--skip-build":
+ build = False
+ elif o == "--skip-installer":
+ installer = False
+
+ #
+ # Check the environment for the required vars.
+ #
+ ok = True
+ required = ['ICE_HOME', 'BERKELEY_HOME', 'BZIP2_HOME', 'EXPAT_HOME', 'OPENSSL_HOME']
+ if installVersion == "vc71":
+ required.extend(['PHP_BIN_HOME', 'PHP_SRC_HOME', 'PYTHON_HOME'])
+ elif installVersion == "vc60":
+ required.append('STLPORT_HOME')
+ for var in required:
+ path = os.environ[var]
+ if path == "":
+ print var + " is not set!"
+ ok = False
+ elif not os.path.isdir(path):
+ print var + " is invalid!"
+ ok = False
+ else:
+ print var + ": " + path
+ if not ok:
+ sys.exit(2)
+
+ iceHome = os.environ['ICE_HOME']
+ berkeleyHome = os.environ['BERKELEY_HOME']
+ bzip2Home = os.environ['BZIP2_HOME']
+ expatHome = os.environ['EXPAT_HOME']
+ opensslHome = os.environ['OPENSSL_HOME']
+
+ if installVersion == "vc71":
+ phpBinHome = os.environ['PHP_BIN_HOME']
+ phpSrcHome = os.environ['PHP_SRC_HOME']
+ pythonHome = os.environ['PYTHON_HOME']
+ stlportHome = ""
+ elif installVersion == "vc60":
+ phpBinHome = ""
+ phpSrcHome = ""
+ pythonHome = ""
+ stlportHome = os.environ['STLPORT_HOME']
+
+ #
+ # Extract the Ice source distributions directory.
+ #
+ sourcesDir = iceHome[:iceHome.rfind("\\Ice-")]
+ print "Ice Sources Directory: " + sourcesDir
+
+ #
+ # Extract the Ice distribution version.
+ #
+ sourcesVersion = iceHome[iceHome.rfind("-")+1:]
+ if not re.match("^\d\.\d\.\d$", sourcesVersion):
+ print "Invalid Version: " + sourcesVersion
+ sys.exit(2)
+ else:
+ print "Ice Sources Version: " + sourcesVersion
+
+ antOptions = " -buildfile " + os.path.join(installDir, "common/stage.xml") + \
+ " -Dinstall.dir=" + installDir + \
+ " -Dinstall.version=" + installVersion + \
+ " -Dsources.dir=" + sourcesDir + \
+ " -Dsources.version=" + sourcesVersion + \
+ " -Dstage.dir=" + stageDir
+
+ if clean:
+ os.system("ant" + antOptions + " clean")
+ cleanIceDists(sourcesDir, sourcesVersion, installVersion)
+
+ #
+ # Stage the third party packages.
+ #
+ if installer:
+ os.system("ant" + antOptions + " packages-stage-" + installVersion)
+
+ #
+ # Build the Ice distributions.
+ #
+ if build:
+ buildIceDists(stageDir, sourcesDir, sourcesVersion, installVersion)
+
+ #
+ # Build the merge module and installer projects.
+ #
+ if installer:
+ os.system("ant" + antOptions + " ice-stage-" + installVersion)
+ buildMergeModules(startDir, stageDir, sourcesVersion, installVersion)
+ buildInstallers(startDir, stageDir, sourcesVersion, installVersion)
+
+if __name__ == "__main__":
+ main()
|