diff options
-rw-r--r-- | cpp/Makefile | 2 | ||||
-rw-r--r-- | cpp/config/Make.rules | 15 | ||||
-rwxr-xr-x | distribution/bin/makebindist.py | 1417 | ||||
-rw-r--r-- | distribution/lib/DistUtils.py | 291 | ||||
-rw-r--r-- | java/build.xml | 17 | ||||
-rw-r--r-- | java/config/common.xml | 11 | ||||
-rw-r--r-- | java/config/icegridgui.pro | 3 | ||||
-rwxr-xr-x | makedist.py | 61 |
8 files changed, 598 insertions, 1219 deletions
diff --git a/cpp/Makefile b/cpp/Makefile index 060fadb7e7f..1839141d02f 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -16,7 +16,7 @@ SUBDIRS = config src include test demo doc INSTALL_SUBDIRS = $(install_bindir) $(install_libdir) $(install_includedir) $(install_docdir) install:: install-common -ifneq ($(embedded_runpath_prefix),) +ifeq ("$(create_runpath_symlink)",yes) @if test -h $(embedded_runpath_prefix) ; \ then \ if `\rm -f $(embedded_runpath_prefix) 2>/dev/null`; \ diff --git a/cpp/config/Make.rules b/cpp/config/Make.rules index 35947f4f3f6..ed6f03c25ac 100644 --- a/cpp/config/Make.rules +++ b/cpp/config/Make.rules @@ -95,12 +95,6 @@ USE_READLINE ?= no #MCPP_HOME ?= /opt/mcpp # -# Define if your OpenSSL requires Kerberos, and if Kerberos is not -# installed in a standard location -# -KERBEROS_HOME ?= /usr/kerberos - -# # If readline is not installed in a standard location where the # compiler can find it, AND you want to use readline, set # READLINE_HOME to the readline installation directory. @@ -160,7 +154,8 @@ else endif ifneq ($(embedded_runpath_prefix),) - runpath_libdir := $(embedded_runpath_prefix)/$(libsubdir) + runpath_libdir := $(embedded_runpath_prefix)/$(libsubdir) + create_runpath_symlink ?= yes endif ifneq ($(STLPORT_HOME),) @@ -188,9 +183,9 @@ ifneq ($(DB_HOME),) DB_LIBS = -L$(DB_HOME)/$(libsubdir) -ldb_cxx DB_RPATH_LINK = $(call rpathlink,$(DB_HOME)/$(libsubdir)) else - ifeq ($(shell if [ -d /usr/include/db45 -a -d /usr/$(libsubdir)/db45 ] ; then echo yes; fi), yes) - DB_FLAGS = -I/usr/include/db45 - DB_LIBS = -L/usr/$(libsubdir)/db45 -ldb_cxx + ifeq ($(shell if [ -d /usr/include/db46 -a -d /usr/$(libsubdir)/db46 ] ; then echo yes; fi), yes) + DB_FLAGS = -I/usr/include/db46 + DB_LIBS = -L/usr/$(libsubdir)/db46 -ldb_cxx else DB_LIBS = -ldb_cxx endif diff --git a/distribution/bin/makebindist.py b/distribution/bin/makebindist.py index 2978174c668..5a4419a3fd2 100755 --- a/distribution/bin/makebindist.py +++ b/distribution/bin/makebindist.py @@ -7,1189 +7,318 @@ # ICE_LICENSE file included in this distribution. # # ********************************************************************** -import os, sys, shutil, re, string, getopt, glob, fileinput -repoDir = os.getcwd() - -def initDirectory(d): - """Check for the existance of the directory. If it isn't there make - it.""" - if os.path.exists(d): - # - # Make sure its a directory and has correct permissions. - # - if not os.path.isdir(d): - print 'Path ' + d + ' exists but is not a directory.' - sys.exit(1) - - if os.access(d, os.X_OK | os.R_OK | os.W_OK): - logging.info('Path ' + d + ' exists and is ok, continuing') - else: - logging.warning('Directory ' + d + ' exists, but has incorrect permissions') - sys.exit(1) - else: - # - # This could fail due to lack of permissions. - # - os.makedirs(d, 0770) - -class ExtProgramError: - def __init__(self, error = None): - self.msg = error - - def __str__(self): - return repr(self.msg) - -def runprog(commandstring, haltOnError = True): - #commandtuple = commandstring.split() - #result = os.spawnvpe(os.P_WAIT, commandtuple[0], commandtuple, os.environ) - result = os.system(commandstring) - if result != 0: - msg = 'Command %s returned error code %d' % (commandstring, result) - if haltOnError: - raise ExtProgramError(msg) - -def copyfiles(srcDir, destDir): - '''Copy the contents of one directory to another (non-recursive)''' - for f in os.listdir(srcDir): - src = os.path.join(srcDir, f) - dest = os.path.join(destDir, f) - if not os.path.isdir(src) and not os.path.islink(src): - shutil.copy(src, dest) - -def getIceVersion(file): - """Extract the ICE version string from a file.""" - config = open(file, 'r') - return re.search('ICE_STRING_VERSION \"([0-9\.b]*)\"', config.read()).group(1) - -def getIceMMVersion(file): - """Extract the ICE major.minor version string from a file.""" - config = open(file, 'r') - return re.search('ICE_STRING_VERSION \"([0-9]+\.[0-9]+)[\.b0-9]*\"', config.read()).group(1) - -def getIceSoVersion(file): - """Extract the ICE version ordinal from a file.""" - config = open(file, 'r') - mm = re.search('ICE_STRING_VERSION \"([0-9]*\.[0-9b]*)[\.0-9]*\"', config.read()).group(1) - verComponents = mm.split(".") - return verComponents[0] + verComponents[1] - -def getPlatform(): - """Determine the platform we are building and targetting for""" - if sys.platform.startswith('win') or sys.platform.startswith('cygwin'): - return 'win32' - elif sys.platform.startswith('linux'): - return 'linux' - elif sys.platform.startswith('sunos'): - return 'solaris' - elif sys.platform.startswith('hp'): - return 'hpux' - elif sys.platform.startswith('darwin'): - return 'macosx' - elif sys.platform.startswith('aix'): - return 'aix' - else: - return None - -def getPlatformString(): - """Determine the platform string used in the .tar.gz names""" - if getPlatform() == 'linux': - redhat = os.system('test -f /etc/redhat-release') - if readcommand('uname -p') == 'x86_64': - if redhat == 0: - return 'rhel-x86_64' - else: - return 'sles-x86_64' - else: - if redhat == 0: - return 'rhel-i386' - else: - return 'sles-i586' - elif getPlatform() == "solaris": - if readcommand("uname -p") == "i386": - return "solaris-x86" - else: - return "solaris-sparc" - else: - return getPlatform() - -def getMakeRulesSuffix(): - '''Ice for C++ contains system specific rules for make. This - function maps the system name to the appropriate file suffix.''' - if sys.platform.startswith('linux'): - return 'Linux' - elif sys.platform.startswith('sunos'): - return 'SunOS' - elif sys.platform.startswith('hp'): - return 'HP-UX' - elif sys.platform.startswith('darwin'): - return 'Darwin' - elif sys.platform.startswith('aix'): - return 'AIX' - else: - return None - -def getVersion(buildDir): - """Extracts a source file from the repository and gets the version number from it""" - cwd = os.getcwd() - if getPlatform() == 'aix': - os.environ['LIBPATH'] = '' - configFile = os.path.join(buildDir, "install", "Config.h") - result = [ getIceVersion(configFile), getIceSoVersion(configFile), getIceMMVersion(configFile) ] - - os.chdir(cwd) - return result - -def fixVersion(filename, version, mmVersion): - f = fileinput.input(filename, True) - for line in f: - l = line.rstrip('\n') - l = l.replace('@ver@', version) - l = l.replace('@mmver@', mmVersion) - print l - f.close() - -def fixInstallFiles(buildDir, version, mmVersion): - """Gets the install sources for this revision""" - cwd = os.getcwd() - try: - os.chdir(buildDir) - fixVersion('install/common/README.DEMOS', version, mmVersion) - snapshot = os.walk('./install/unix') - for dirInfo in snapshot: - for f in dirInfo[2]: - fixVersion(os.path.join(dirInfo[0], f), version, mmVersion) - finally: - os.chdir(cwd) - return os.path.join(buildDir, "install") - -# XXX- I don't think this is needed any longer. -def getInstallFilesFromLocalDirectory(buildDir, version, mmVersion): - '''Gets the install files from an existing repository, has the - advantage of working even if repository is down allowing the install-O to - continue working!''' - cwd = os.getcwd() - try: - os.chdir(buildDir) - target = os.path.join(buildDir, 'cpp', 'install') - if os.path.exists(target): - shutil.rmtree(target) - iceloc = os.path.abspath(os.path.join(os.environ['ICE_HOME'],'install')) - os.makedirs(target) - for f in ['unix', 'common', 'rpm', 'thirdparty']: - shutil.copytree(os.path.join(iceloc, f), os.path.join(target, f)) - fixVersion('cpp/install/common/README.DEMOS', version, mmVersion) - snapshot = os.walk('./cpp/install/unix') - for dirInfo in snapshot: - for f in dirInfo[2]: - fixVersion(os.path.join(dirInfo[0], f), version, mmVersion) - finally: - os.chdir(cwd) - return os.path.join(buildDir, "cpp", "install") - -def readcommand(cmd): - pipe_stdin, pipe_stdout = os.popen2(cmd) - lines = pipe_stdout.readlines() - pipe_stdin.close() - pipe_stdout.close() - return lines[0].strip() - -def editMakeRulesCS(filename, version): - ''' - The make rules in the C# distribution need some simple tweaking to - make them suitable for inclusion in the demo distribution. - ''' - reIceLocation = re.compile('^[a-z]*dir.*=\s*\$\(top_srcdir\)') - makefile = fileinput.input(filename, True) - for line in makefile: - if reIceLocation.search(line) <> None: - print line.rstrip('\n').replace('top_srcdir', 'ICE_DIR', 10) - elif line.startswith('prefix'): - print 'prefix = $(ICE_DIR)' - else: - print line.rstrip('\n') - makefile.close() - -def editMakeRules(filename, version): - ''' - Ice distributions contain files with useful build rules. However, - these rules are source distribution specific. This script edits - these files to make them appropriate to accompany binary - distributions. - ''' - reIceLocation = re.compile('^[a-z]*dir.*=\s*\$\(top_srcdir\)') +import os, sys, shutil, glob, fnmatch, string, re +from stat import * - makefile = fileinput.input(filename, True) - skipLine = 0 - for line in makefile: - if (skipLine > 0): - skipLine = skipLine - 1 - elif line.startswith('slicedir'): - print """ -ifeq ($(ICE_DIR),/usr) - slicedir = $(ICE_DIR)/share/Ice-$(VERSION)/slice -else - slicedir = $(ICE_DIR)/slice -endif -""" - elif line.startswith('embedded_runpath_prefix'): - # - # embedded_runpath_prefix is moved down to after the version - # information is set. - # - pass - elif line.startswith('# Select an installation base directory'): - # - # Delete this comment - # - skipLine = 2 - elif line.startswith('# The "root directory" for runpath'): - # - # Delete this comment - # - skipLine = 2 - elif reIceLocation.search(line) <> None: - output = line.rstrip('\n').replace('top_srcdir', 'ICE_DIR', 10) - if line.startswith('libdir'): - print 'ifeq ($(LP64),yes)' - print ' ' + output + '$(lp64suffix)' - print 'else' - print ' ' + output - print 'endif' - elif line.startswith('bindir'): - print output - # - # NOTE!!! Magic occurs... - # It simplifies building the demos for the user if - # we try to detect whether the executables are 64 - # bit and, if so, set LP64=yes automagically. - # - print '' - print '#' - print '# If LP64 is unset, sample an Ice executable to see if it is 64 bit' - print '# and set automatically. This avoids having to set LP64 if there is' - print '# Ice installation in a well-known location.' - print '#' - print 'ifeq ($(LP64),)' - print ' ifneq ($(shell file $(bindir)/slice2cpp | grep 64-bit),)' - print ' LP64=yes' - print ' endif' - print 'endif' - print '' - else: - print output +version = "3.3.0" +#version = "@ver@" +distDir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) +sys.path.append(os.path.join(distDir, "lib")) +from DistUtils import * - elif line.startswith('install_'): - # - # Delete - # - pass - elif line.startswith('SOVERSION'): - print line.rstrip('\n') - print """ +# +# Defines which languges are supported on a given platform +# +languages = { \ + 'SunOS' : ['cpp', 'java'], \ + 'HP-UX' : ['cpp', 'java'], \ + 'Darwin' : ['cpp', 'java', 'py'], \ + 'Linux' : ['cpp', 'java', 'cs', 'py', 'rb', 'php'], \ +} # -# Checks for ICE_HOME environment variable. If it isn't present, -# attempt to find an Ice installation in /usr or the default install +# Defines third party dependencies for each supported platform and their default # location. # -ifeq ($(ICE_HOME),) - ICE_DIR = /usr - ifneq ($(shell test -f $(ICE_DIR)/bin/icestormadmin && echo 0),0) - NEXTDIR = /opt/Ice-$(VERSION) - ifneq ($(shell test -f $(NEXTDIR)/bin/icestormadmin && echo 0),0) - $(error Unable to locate Ice distribution, please set ICE_HOME!) - else - ICE_DIR = $(NEXTDIR) - endif - else - NEXTDIR = /opt/Ice-$(VERSION) - ifeq ($(shell test -f $(NEXTDIR)/bin/icestormadmin && echo 0),0) - $(warning Ice distribution found in /usr and $(NEXTDIR)! Installation in "/usr" will be used by default. Use ICE_HOME to specify alternate Ice installation.) - endif - endif -else - ICE_DIR = $(ICE_HOME) - ifneq ($(shell test -f $(ICE_DIR)/bin/icestormadmin && echo 0),0) - $(error Ice distribution not found in $(ICE_DIR), please verify ICE_HOME location!) - endif -endif - -ifneq ($(ICE_DIR),/usr) - embedded_runpath_prefix ?= /opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR) -endif - -prefix = $(ICE_DIR) +bzip2 = { 'HP-UX' : '/usr/local' } + +berkeleydb = { \ + 'SunOS' : '/opt/db', \ + 'Darwin' : '/opt/db', \ + 'HP-UX' : '/opt/db', \ +} + +berkeleydbjar = { \ + 'Linux' : '/usr/share/java/db46/db.jar', \ +} + +expat = { \ + 'SunOS' : '/usr/sfw', \ + 'HP-UX' : '/usr/local', \ + 'Darwin' : '/opt/expat', \ +} + +openssl = { \ + 'SunOS' : '/usr/sfw', \ + 'HP-UX' : '/opt/openssl', \ +} + +mcpp = { + 'SunOS' : '/opt/mcpp', \ + 'HP-UX' : '/opt/mcpp', \ + 'Darwin' : '/opt/mcpp' +} + +jgoodies_looks = { \ + 'SunOS' : '/share/opt/looks-2.1.4/looks-2.1.4.jar', \ + 'HP-UX' : '/share/opt/looks-2.1.4/looks-2.1.4.jar', \ + 'Darwin' : '/opt/looks-2.1.4/looks-2.1.4.jar', \ + 'Linux' : '/opt/looks-2.1.4/looks-2.1.4.jar', \ +} + +jgoodies_forms = { \ + 'SunOS' : '/share/opt/forms-1.1.0/forms-1.1.0.jar', \ + 'HP-UX' : '/share/opt/forms-1.1.0/forms-1.1.0.jar', \ + 'Darwin' : '/opt/forms-1.1.0/forms-1.1.0.jar', \ + 'Linux' : '/opt/forms-1.1.0/forms-1.1.0.jar', \ +} + +proguard = { \ + 'SunOS' : '/share/opt/proguard4.1/lib/proguard.jar', \ + 'HP-UX' : '/share/opt/proguard4.1/lib/proguard.jar', \ + 'Darwin' : '/opt/proguard/lib/proguard.jar', \ + 'Linux' : '/opt/proguard/lib/proguard.jar', \ +} + +class BerkeleyDB(ThirdParty): + def __init__(self, platform, locations, jarlocations): + ThirdParty.__init__(self, platform, "BerkeleyDB", locations, ["cpp", "java"], None, "DB_HOME") + if not self.location: + self.languages = ["java"] + self.location = jarlocations.get(str(platform), None) + + def getFiles(self, platform): + files = [ os.path.join("lib", "db.jar"), os.path.join("bin", "db_*") ] + files += platform.getSharedLibraryFiles(self.location, os.path.join("lib", "*")) + files += platform.getSharedLibraryFiles(self.location, os.path.join("lib", "*"), "jnilib") + return files + +class Bzip2(ThirdParty): + def __init__(self, platform, locations): + ThirdParty.__init__(self, platform, "Bzip2", locations, ["cpp"]) + + def getFiles(self, platform): + return platform.getSharedLibraryFiles(self.location, os.path.join("lib", "*")) + +class Expat(ThirdParty): + def __init__(self, platform, locations): + ThirdParty.__init__(self, platform, "Expat", locations, ["cpp"]) + + def getFiles(self, platform): + return platform.getSharedLibraryFiles(self.location, os.path.join("lib", "*")) + +class OpenSSL(ThirdParty): + def __init__(self, platform, locations): + ThirdParty.__init__(self, platform, "OpenSSL", locations, ["cpp"]) + + def getFiles(self, platform): + files = [ os.path.join("bin", "openssl") ] + files += platform.getSharedLibraryFiles(self.location, os.path.join("lib", "*")) + return files -""" - elif line.startswith('prefix'): - # - # Delete prefix line - # - pass - else: - print line.rstrip('\n') - - # - # Dependency files are all going to be bogus since they contain relative - # paths to Ice headers. We need to adjust this. - # - os.chdir("..") - runprog("for f in `find . -name .depend` ; do sed -i -e 's/\.\.\/\.\.\/\.\.\/\.\.\/slice/$(slicedir)/g' $f ; done") - runprog("for f in `find . -name .depend` ; do sed -i -e 's/\.\.\/\.\.\/\.\.\/\.\./$(ICE_DIR)/g' $f ; done") - runprog("for f in `find . -name .depend` ; do sed -i -e 's/\.\.\/\.\.\/\.\.\/slice/$(slicedir)/g' $f ; done") - runprog("for f in `find . -name .depend` ; do sed -i -e 's/\.\.\/\.\.\/\.\./$(ICE_DIR)/g' $f ; done") - makefile.close() - -def editMakeRulesMak(filename, version): - ''' - Ice distributions contain files with useful build rules. However, - these rules are source distribution specific. This script edits - these files to make them appropriate to accompany binary - distributions. - ''' - state = 'header' - reIceLocation = re.compile('^[a-z]*dir.*=\s*\$\(top_srcdir\)') - - makefile = fileinput.input(filename, True) - for line in makefile: - if state == 'done': - if reIceLocation.search(line) <> None: - output = line.rstrip('\n').replace('top_srcdir', 'ICE_DIR', 10) - print output - elif line.startswith('install_'): - # - # Do nothing. - # - pass - elif line.startswith('# If third party'): - state = 'thirdparty' - else: - print line.rstrip('\n') - elif state == 'header': - # - # Reading header. - # - print line.rstrip('\n') - if line.strip() == "": - state = 'untilprefix' - print """ # -# Checks for ICE_HOME environment variable. +# Program usage. # +def usage(): + print "Usage: " + sys.argv[0] + " [options] tag" + print + print "Options:" + print "-c Clean previous build" + print "-n Don't build any language mapping" + print "-h Show this message." + print "-v Be verbose." -!if "$(ICE_HOME)" == "" -!error Ice distribution not found, please set ICE_HOME! -!endif - -ICE_DIR = $(ICE_HOME) -prefix = $(ICE_DIR) -THIRDPARTY_HOME = - -""" - elif state == 'untilprefix': - if line.startswith('prefix'): - state = 'done' - elif state == 'thirdparty': - if line.startswith('# For VC80 and VC80'): - print line.rstrip('\n') - state = 'done' - # - # Dependency files are all going to be bogus since they contain relative - # paths to Ice headers. We need to adjust this - # - os.chdir("..") - runprog("for f in `find . -name .depend` ; do sed -i -e 's/\.\.\/\.\.\/\.\.\/\.\.\/slice/$(slicedir)/g' $f ; done") - runprog("for f in `find . -name .depend` ; do sed -i -e 's/\.\.\/\.\.\/\.\.\/\.\./$(ICE_DIR)/g' $f ; done") - runprog("for f in `find . -name .depend` ; do sed -i -e 's/\.\.\/\.\.\/\.\.\/slice/$(slicedir)/g' $f ; done") - runprog("for f in `find . -name .depend` ; do sed -i -e 's/\.\.\/\.\.\/\.\./$(ICE_DIR)/g' $f ; done") - makefile.close() - -def editMakeRulesMakCS(filename, version): - ''' - Ice distributions contain files with useful build rules. However, - these rules are source distribution specific. This script edits - these files to make them appropriate to accompany binary - distributions. - ''' - state = 'header' - reIceLocation = re.compile('^[a-z]*dir.*=\s*\$\(top_srcdir\)') - - makefile = fileinput.input(filename, True) - for line in makefile: - if state == 'done': - if reIceLocation.search(line) <> None: - output = line.rstrip('\n').replace('top_srcdir', 'ICE_DIR', 10) - print output - elif line.startswith('install_'): - # - # Do nothing. - # - pass - else: - print line.rstrip('\n') - elif state == 'header': - # - # Reading header. - # - print line.rstrip('\n') - if line.strip() == "": - state = 'untilprefix' - print """ # -# Checks for ICE_HOME environment variable. +# Instantiate the gobal platform object # +(sysname, nodename, release, ver, machine) = os.uname(); +if not languages.has_key(sysname): + print sys.argv[0] + ": error: `" + sysname + "' is not a supported system" +platform = eval(sysname.replace("-", ""))(sysname, languages[sysname]) -!if "$(ICE_HOME)" == "" -!error Ice distribution not found, please set ICE_HOME! -!endif - -ICE_DIR = $(ICE_HOME) -prefix = $(ICE_DIR) - -""" - elif state == 'untilprefix': - if line.startswith('prefix'): - state = 'done' - - makefile.close() - -def updateIceVersion(filename, version): - print 'Updating ice version in ' + filename + ' to ' + version - f = fileinput.input(filename, True) - for line in f: - print line.rstrip('\n').replace('ICE_VERSION', version) - f.close() - -def obliterate(files): - for f in files: - if os.path.exists(f): - if os.path.isdir(f): - shutil.rmtree(f) - else: - os.remove(f) - -def extractDemos(sources, buildDir, version, distro, demoDir): - """Pulls the demo directory out of a distribution and massages its - build system so it can be built against an installed version of - Ice""" - cwd = os.getcwd() - os.chdir(os.path.join(buildDir, "demotree")) - - # - # TODO: Some archives don't contain all of these elements. It might - # be nicer to make the toExtract list more tailored for each - # distribution. - # - toExtract = "%s/demo " % distro - if demoDir == '': - toExtract = toExtract + " %s/ICE_LICENSE" % distro - if not demoDir == 'php': - toExtract = toExtract + " %s/certs %s/config" % (distro, distro) - - runprog("gzip -dc " + os.path.join(sources, distro) + ".tar.gz | tar xf - " + toExtract, False) - - shutil.move(os.path.join(distro, "demo"), os.path.join(buildDir, "Ice-" + version + "-demos", "demo" + demoDir)) - if os.path.exists(os.path.join(buildDir, "demotree", distro, "ICE_LICENSE")): - shutil.move(os.path.join(buildDir, "demotree", distro, "ICE_LICENSE"), \ - os.path.join(buildDir, "Ice-%s-demos" % version, "ICE_LICENSE")) - - # - # 'System' copying of files here because its just easier! We don't - # need any configuration out of the Python tree. - # - if not os.path.exists(buildDir + "/Ice-" + version + "-demos/certs"): - os.mkdir(buildDir + "/Ice-" + version + "-demos/certs") - - if not os.path.exists(buildDir + "/Ice-" + version + "-demos/config"): - os.mkdir(buildDir + "/Ice-" + version + "-demos/config") - - if os.path.exists('%s/certs' % distro): - runprog("cp -pR " + distro + "/certs " + buildDir + "/Ice-" + version + "-demos") - - srcConfigDir = '%s/%s/config' % (os.getcwd(), distro) - destConfigDir = '%s/Ice-%s-demos/config' % (buildDir, version) - - if not demoDir in ['py', 'rb', 'vb'] and os.path.exists(srcConfigDir): - for f in os.listdir(srcConfigDir): - src = os.path.join(srcConfigDir, f) - dest = os.path.join(destConfigDir, f) - if not os.path.isdir(src) and not os.path.islink(src): - shutil.copy(src, dest) +# +# Instantiate the third party libraries +# +thirdParties = [ \ + Bzip2(platform, bzip2), \ + BerkeleyDB(platform, berkeleydb, berkeleydbjar), \ + Expat(platform, expat), \ + OpenSSL(platform, openssl), \ + ThirdParty(platform, "Mcpp", mcpp, ["cpp"]), \ + ThirdParty(platform, "JGoodiesLooks", jgoodies_looks, ["java"], "jgoodies.looks"), \ + ThirdParty(platform, "JGoodiesForms", jgoodies_forms, ["java"], "jgoodies.forms"), \ + ThirdParty(platform, "Proguard", proguard, ["java"]), \ +] - if demoDir == 'j': - updateIceVersion(os.path.join(destConfigDir, 'common.xml'), version) +# +# Check arguments +# +verbose = 0 +forceclean = 0 +nobuild = 0 +languages = [ ] +for x in sys.argv[1:]: + if x == "-h": + usage() + sys.exit(0) + elif x == "-v": + verbose = 1 + elif x == "-c": + forceclean = 1 + elif x == "-n": + nobuild = 1 + elif x.startswith("-"): + print sys.argv[0] + ": unknown option `" + x + "'" + print + usage() + sys.exit(1) + else: + if not x in platform.languages: + print sys.argv[0] + ": language `" + x + "' not supported on this platform" + print + usage() + sys.exit(1) + languages.append(x) - # - # Collect files to remove from the demo distribution. - # - remove = [] - basepath = os.path.join(buildDir, 'Ice-' + version + '-demos', 'certs') +if len(languages) == 0: + languages = platform.languages - for f in ['openssl', 'makecerts']: - fullpath = os.path.join(basepath, f) - if os.path.exists(fullpath): - remove.append(fullpath) +if nobuild: + languages = [] - basepath = os.path.join(buildDir, 'Ice-' + version + '-demos', 'config') +if verbose: + quiet = "v" +else: + quiet = "" - if distro.startswith('Ice-'): - editMakeRules(os.path.join(basepath, 'Make.rules'), version) - editMakeRulesMak(os.path.join(basepath, 'Make.rules.mak'), version) - elif distro.startswith('IceNET-'): - editMakeRulesCS(os.path.join(basepath, 'Make.rules.cs'), version) - editMakeRulesMakCS(os.path.join(basepath, 'Make.rules.mak.cs'), version) +# +# Ensure the script is being run from the dist-@ver@ directory. +# +cwd = os.getcwd() - # - # Remove collected files. - # - obliterate(remove) - - shutil.rmtree(os.path.join(buildDir, 'demotree', distro), True) - os.chdir(cwd) +if not os.path.exists(os.path.join(distDir, "src", "windows", "LICENSE.rtf")): + print sys.argv[0] + ": you must run makebindist.py from the dist-" + version + " directory created by makedist.py" + sys.exit(1) -def archiveDemoTree(buildDir, version, installFiles): - cwd = os.getcwd() - os.chdir(os.path.join(buildDir, "Ice-%s-demos" % version)) - filesToRemove = [ - "certs/makecerts.py", - "certs/ImportKey.java", - "certs/ImportKey.class", - "certs/seed.dat", - "config/convertssl.py", - "config/upgradeicegrid.py", - "config/upgradeicestorm.py", - "config/icegrid-slice.3.1.ice.gz", - "config/PropertyNames.def", - "config/makeprops.py", - "config/Makefile", - "config/Makefile.mak", - "config/TestUtil.py", - "config/IceGridAdmin.py", - "config/ice_ca.cnf", - "config/findSliceFiles.py", - "config/IcecsKey.snk", - "config/icegridnode.cfg", - "config/icegridregistry.cfg", - "config/makeconfig.py", - "config/makedepend.py", - "config/makegitignore.py", - "config/icegridgui.pro"] - obliterate(filesToRemove) - os.chdir(buildDir) +print "Building Ice " + version + " binary distribution (" + platform.getPackageName(version) + ".tar.gz)" +print "Using the following third party libraries:" +if not platform.checkAndPrintThirdParties(): + print "error: some required third party dependencies were not found" + sys.exit(1) - # - # Remove compiled Java. - # - runprog("sh -c 'for f in `find Ice-" + version + "-demos/demoj -name classes -type d` ; do rm -rf $f/* ; done'") - - # - # Remove generated source files. - # - runprog("sh -c 'for f in `find Ice-" + version + "-demos/demoj -name generated -type d` ; do rm -rf $f/* ; done'") - - # - # Remove config files. - # - runprog("sh -c 'for f in `find Ice-" + version + "-demos/democs -name \"*\.config\" ` ; do rm -f $f ; done'") - runprog("sh -c 'for f in `find Ice-" + version + "-demos/demovb -name \"*\.config\" ` ; do rm -f $f ; done'") - - # - # Remove Windows project files. - # - runprog("sh -c 'for f in `find Ice-" + version + "-demos -name \"*\.dsp\" ` ; do rm -rf $f ; done'") - runprog("sh -c 'for f in `find Ice-" + version + "-demos -name \"*\.dsw\" ` ; do rm -rf $f ; done'") - runprog("sh -c 'for f in `find Ice-" + version + "-demos -name \"*.sln\" ` ; do rm -rf $f ; done'") - runprog("sh -c 'for f in `find Ice-" + version + "-demos -name \"*.csproj\" ` ; do rm -rf $f ; done'") - runprog("sh -c 'for f in `find Ice-" + version + "-demos -name \"*.vbproj\" ` ; do rm -rf $f ; done'") - runprog("sh -c 'for f in `find Ice-" + version + "-demos -name \"*.vcproj\" ` ; do rm -rf $f ; done'") - - runprog("tar cf Ice-" + version + "-demos.tar Ice-" + version + "-demos") - runprog("gzip -9 Ice-" + version + "-demos.tar") - runprog("zip -9r Ice-" + version + "-demos.zip Ice-" + version + "-demos") - os.chdir(cwd) - -def makeInstall(sources, buildDir, installDir, distro, clean, version, mmVersion): - """Make the distro in buildDir sources and install it to installDir.""" - cwd = os.getcwd() - os.chdir(buildDir) - if clean: - shutil.rmtree(distro, True) - - if not os.path.exists(distro): - filename = os.path.join(sources, distro + '.tar') - runprog('gzip -dc %s.gz | tar xf -' % filename) - - os.chdir(distro) +# +# Ensure that the source archive or directory exists and create the build directory. +# +buildRootDir = os.path.join(cwd, os.path.join("build-" + platform.pkgname + "-" + version)) +srcDir = os.path.join(buildRootDir, "Ice-" + version + "-src") +buildDir = os.path.join(buildRootDir, "Ice-" + version) +if forceclean or not os.path.exists(srcDir) or not os.path.exists(buildDir): + if os.path.exists(buildRootDir): + print "Removing previous build from " + os.path.join("build-" + platform.pkgname + "-" + version) + "...", + sys.stdout.flush() + shutil.rmtree(buildRootDir) + print "ok" + os.mkdir(buildRootDir) # - # Java does not have a 'make install' process, but comes complete - # with the Jar already built. - # - if distro.startswith('IceJ'): - initDirectory(installDir) - initDirectory(os.path.join(installDir, 'lib')) - shutil.copy(os.path.join(buildDir, distro, "lib", "Ice.jar"), os.path.join(installDir, "lib")) - shutil.copy(os.path.join(buildDir, distro, "lib", "IceGridGUI.jar"), os.path.join(installDir, "lib")) - # - # We really just want to copy the files, not move them. - # Shelling out to a copy is easier (and more likely to always - # work) than shutil.copytree(). - # - runprog('cp -pR ' + os.path.join(buildDir, distro, "ant") + " " + installDir) - runprog('find ' + installDir + '/ant -name "*.java" | xargs rm') - initDirectory(os.path.join(installDir, 'help')) - runprog('cp -pR ' + buildDir + '/' + distro + '/resources/IceGridAdmin ' + installDir + '/help') - destDir = os.path.join(installDir, 'config') - if not os.path.exists(destDir): - os.mkdir(destDir) - shutil.copy(os.path.join('config', 'build.properties'), destDir) - os.chdir(cwd) - return - - if distro.startswith('IcePy'): - try: - pyHome = os.environ['PYTHON_HOME'] - except KeyError: - pyHome = None - - if pyHome == None or pyHome == '': - logging.info('PYTHON_HOME is not set, figuring it out and trying that') - pyHome = sys.exec_prefix - os.environ['PYTHON_HOME'] = pyHome - - # - # XXX- Optimizations need to be turned on for the release. + # If we can't find the source archive in the current directory, ask its location # - - try: - - buildCommand = "gmake NOGAC=yes OPTIMIZE=yes prefix=%s embedded_runpath_prefix=/opt/Ice-%s install" % \ - (installDir, mmVersion) - if getPlatform() == "solaris": - os.chdir(buildDir) - srcdir = os.path.join(buildDir, distro + "-64") - - if clean: - shutil.rmtree(srcdir, True) - if not os.path.exists(srcdir): - filename = os.path.join(sources, distro + '.tar') - runprog('gzip -dc %s.gz | tar xf -' % filename) - runprog("mv %s %s" % (distro, srcdir)) - - os.chdir(srcdir) - runprog("LP64=yes && export LP64 && " + buildCommand) - os.chdir(os.path.join(buildDir, distro)) - - runprog("LP64=no && export LP64 && " + buildCommand) - - except ExtProgramError: - print "gmake failed for makeInstall(%s, %s, %s, %s, %s, %s, %s)" % (sources, buildDir, installDir, distro, str(clean), version, mmVersion) - raise - - runprog('rm -rf /opt/Ice-%s' % (mmVersion), False) - - if distro.startswith('IceNET'): - assemblies = ["glacier2cs", "iceboxcs", "icecs", "icegridcs", "icepatch2cs", "icestormcs"] - - # - # We are relying on pkgconfig to deal with some mono library - # configuration, so we need to copy these files into place. - # - if not os.path.exists("%s/lib/pkgconfig" % installDir): - os.makedirs("%s/lib/pkgconfig" % installDir) - - for a in assemblies: - shutil.copy("bin/%s.dll" % a, "%s/bin/%s.dll" % (installDir, a)) - if os.path.exists("bin/policy.%s.%s" % (mmVersion, a)): - shutil.copy("bin/policy.%s.%s" % (mmVersion, a), "%s/bin/policy.%s.%s" % (installDir, mmVersion, a)) - shutil.copy("bin/policy.%s.%s.dll" % (mmVersion, a), - "%s/bin/policy.%s.%s.dll" % (installDir, mmVersion, a)) - shutil.copy("lib/pkgconfig/%s.pc" % a, "%s/lib/pkgconfig" % installDir) - - - os.chdir(cwd) - -def shlibExtensions(versionString, versionInt): - """Returns a tuple containing the extensions for the shared library, and - the 2 symbolic links (respectively)""" - platform = getPlatform() - if platform == 'hpux': - return ['.sl.' + versionString, '.sl.' + versionInt, '.sl'] - elif platform == 'macosx': - return ['.' + versionString + '.dylib', '.' + versionInt + '.dylib', '.dylib'] - else: - return ['.so.' + versionString, '.so.' + versionInt, '.so'] - -def getPlatformLibExtension(): - platform = getPlatform() - if platform == 'hpux': - return '.sl' - elif platform == 'macosx': - return '.dylib' - else: - return '.so' - -def getDBfiles(dbLocation): - cwd = os.getcwd() - os.chdir(dbLocation) - pipe_stdin, pipe_stdout = os.popen2('find bin -name "*" -type f') - lines = pipe_stdout.readlines() - pipe_stdin.close() - pipe_stdout.close() - - fileList = ['lib/db.jar'] - fileList.extend(lines) - - findCmd = '' - if getPlatform() == 'solaris': - # - # Removed the maxdepth limiter to pick up the 64 bit versions of the libraries. - # - findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f' + if not os.path.exists(os.path.join(cwd, "Ice-" + version + ".tar.gz")): + print + src = raw_input("Couldn't find Ice-" + version + ".tar.gz in current directory, please specify\n" + \ + "where to download or copy the source distribution or hit enter to \n" + \ + "download it from sun:/share/srcdists/" + version + ": ") + if src == "": + src = "sun:/share/srcdists/" + version + "/Ice-" + version + ".tar.gz" + elif not src.endswith("Ice-" + version + ".tar.gz"): + src = os.path.join(src, "Ice-" + version + ".tar.gz") + + if os.system("scp " + src + " ."): + print sys.argv[0] + ": couldn't copy " + src + sys.exit(1) - elif getPlatform() == 'macosx': - findCmd = 'find lib \( -name "*' + getPlatformLibExtension() + '" -or -name "*jnilib" \) -type f ' - else: - findCmd = 'find lib* -name "*' + getPlatformLibExtension() + '" -type f' - pipe_stdin, pipe_stdout = os.popen2(findCmd) - lines = pipe_stdout.readlines() - pipe_stdin.close() - pipe_stdout.close() - fileList.extend(lines) - if getPlatform() == 'aix': - fileList.append('lib/libdb_cxx.so') - - os.chdir(cwd) - - return fileList - -def copyExpatFiles(expatLocation, version): - cwd = os.getcwd() - os.chdir(expatLocation) - - fileList = [] - findCmd = '' - if getPlatform() == 'solaris': - findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f -maxdepth 1' - else: - findCmd = 'find lib* -name "*' + getPlatformLibExtension() + '" -type f' - pipe_stdin, pipe_stdout = os.popen2(findCmd) - lines = pipe_stdout.readlines() - pipe_stdin.close() - pipe_stdout.close() - fileList.extend(lines) - - linkList = [] - findCmd = '' - if getPlatform() == 'solaris': - findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type l -maxdepth 1' - else: - findCmd = 'find lib* -name "*' + getPlatformLibExtension() + '" -type l' - pipe_stdin, pipe_stdout = os.popen2(findCmd) - lines = pipe_stdout.readlines() - pipe_stdin.close() - pipe_stdout.close() - fileList.extend(lines) - - for i in lines: - if i != 'libexpat.' + getPlatformLibExtension(): - linkList.append(i) - + print "Unpacking ./Ice-" + version + ".tar.gz ...", + sys.stdout.flush() + os.chdir(buildRootDir) + if os.system("gunzip -c " + os.path.join(cwd, "Ice-" + version + ".tar.gz") + " | tar x" + quiet + "f -"): + print sys.argv[0] + ": failed to unpack ./Ice-" + version + ".tar.gz" + sys.exit(1) + os.rename("Ice-" + version, srcDir) os.chdir(cwd) - - if not os.path.exists('Ice-' + version + '/' + fileList[0].strip()): - shutil.copy(expatLocation + '/' + fileList[0].strip(), 'Ice-' + version + '/' + fileList[0].strip()) - os.symlink(os.path.basename(fileList[0].strip()), 'Ice-' + version + '/' + linkList[0].strip()) - -def fixInstallNames(version, mmVersion): - - # - # Fix the install names of the 3rd party libraries. - # - libs = ['libdb-*.dylib', 'libdb_cxx-*.dylib', 'libdb_java-*.jnilib', 'libexpat*.dylib'] - oldInstallNames = [] - for l in libs: - p = os.popen('otool -D ' + 'Ice-' + version + '/lib/' + l + ' | tail -1') - oldInstallNames.append(p.readline().strip()) - p.close() - - allFiles = [] - p = os.popen('find Ice-' + version + '/bin -name "*" -type f') - allFiles.extend(p.readlines()) - p.close() - p = os.popen('find Ice-' + version + '/lib -name "*.dylib" -type f') - allFiles.extend(p.readlines()) - p.close() + print "ok" - binFiles = [] - for f in allFiles: - f = f.strip() - if not os.system('file -b ' + f + ' | grep -q "Mach-O"'): - os.system('chmod u+w ' + f) - binFiles.append(f) + os.mkdir(buildDir) - for oldName in oldInstallNames: - libName = re.sub("\/opt\/.*\/(.*)", "\\1", oldName) - newName = '/opt/Ice-' + mmVersion + '/' + libName - - os.system('install_name_tool -id ' + newName + ' Ice-' + version + '/lib/' + libName) - for f in binFiles: - os.system('install_name_tool -change ' + oldName + ' ' + newName + ' ' + f) - - -def usage(): - """Print usage/help information""" - print 'Usage: ' + sys.argv[0] + ' [options] [tag]' - print - print 'Options:' - print '-h Show this message.' - print '--build-dir=[path] Specify the directory where the distributions' - print ' will be unpacked and built.' - print '--install-dir=[path] Specify the directory where the distribution' - print ' contents will be installed to.' - print '--install-root=[path] Specify the root directory that will appear' - print ' in the tarball.' - print '--sources=[path] Specify the location of the sources directory.' - print ' If this is omitted makebindist will traverse' - print ' ../icej ../icepy ../icecs, etc and make the' - print ' distributions for you.' - print ' (Note: makedist.py seems to only work on Linux.' - print ' To use makebindist.py on other UNIX platforms,' - print ' you must copy pre-made source distributions onto' - print ' the host and use this option to reference their' - print ' location.' - print '-v, --verbose Print verbose processing messages.' - print '--noclean Do not clean up current sources where' - print ' applicable (some bits will still be cleaned.' - print '--nobuild Run through the process but don\'t build' - print ' anything new.' - print - print 'The following options set the locations for third party libraries' - print 'that may be required on your platform. Alternatively, you can' - print 'set these locations using environment variables of the form. If' - print 'you do not set locations through the enviroment or through the ' - print 'command line, default locations will be used (system defaults +' - print 'the default locations indicated).' - print - print 'LIBRARY_HOME=[path to library]' +# +# Build and install each language mappings supported by this platform in the build directory. +# +for l in languages: print - print 'e.g. for bzip2' - print - print 'export BZIP2_HOME=/opt/bzip2-1.0.3' - print - print '--stlporthome=[path] Specify location of the STLPort libraries, ' - print ' if required.' - print '--bzip2home=[path] Specify location of the bzip2 libraries ' - print ' (default=/opt/bzip2).' - print '--dbhome=[path] Specify location of Berkeley DB' - print ' (default=/opt/db).' - print '--sslhome=[path] Specify location of OpenSSL' - print ' (default=/opt/openssl).' - print '--expathome=[path] Specify location of expat libraries ' - print ' (default=/opt/expat).' - print '--readlinehome=[path] Specify readline library and location ' - print ' (defaults to /opt/readline if set).' + print "============= Building " + l + " sources =============" print - print 'If no tag is specified, HEAD is used.' - -def main(): - - buildEnvironment = dict() - buildDir = None - installDir = None - sources = os.getcwd() - installRoot = None - clean = True - build = True - version = None - mmVersion = None - soVersion = 0 - verbose = False - offline = False - - # - # Process args. - # - try: - optionList, args = getopt.getopt(sys.argv[1:], 'hvt:', - [ 'build-dir=', 'install-dir=', 'install-root=', 'sources=', - 'verbose', 'noclean', 'nobuild', - 'stlporthome=', 'bzip2home=', 'dbhome=', 'sslhome=', - 'expathome=', 'readlinehome=', 'offline', 'debug']) - - except getopt.GetoptError: - usage() - sys.exit(2) + os.chdir(os.path.join(srcDir, l)) - for o, a in optionList: - if o == '--build-dir': - buildDir = a - elif o == '--install-dir': - installDir = a - elif o == '--install-root': - installRoot = a - elif o == '--sources': - sources = a - elif o in ('-h', '--help'): - usage() - sys.exit() - elif o in ('-v', '--verbose'): - verbose = True - elif o == '--noclean': - clean = False - elif o == '--nobuild': - build = False - clean = False # Cleaning doesn't make much sense if we aren't building either. - elif o == '--stlporthome': - buildEnvironment['STLPORT_HOME'] = a - elif o == '--bzip2home': - buildEnvironment['BZIP2_HOME'] = a - elif o == '--dbhome': - buildEnvironment['DB_HOME'] = a - elif o == '--sslhome': - buildEnvironment['OPENSSL_HOME'] = a - elif o == '--expathome': - buildEnvironment['EXPAT_HOME'] = a - elif o == '--readlinehome': - buildEnvironment['READLINE_HOME'] = a - elif o == '--offline': - offline = True - - if sources == None or not os.path.exists(sources): - print "You must specify a valid location for the source distributions" - sys.exit(1) - - # - # Determine location of binary distribution-only files. - # - distfiles = None - trypaths = [ sources, os.getcwd() ] - for f in trypaths: - if os.path.exists(os.path.join(f, "distfiles.tar.gz")): - distfiles = os.path.join(f, "distfiles.tar.gz") - break - - if distfiles == None: - print "Unable to find distfiles.tar.gz." - sys.exit(1) - - if verbose: - logging.getLogger().setLevel(logging.DEBUG) - - if offline and sources == None: - logging.error("You must specify a location for the sources if running in offline mode") - sys.exit(1) - - # - # Configure environment. - # - if getPlatform() == 'aix': - dylibEnvironmentVar = 'LIBPATH' - elif getPlatform() == 'hpux': - dylibEnvironmentVar = 'SHLIB_PATH' - elif getPlatform() == 'macosx': - dylibEnvironmentVar = 'DYLD_LIBRARY_PATH' + if l != "java": + if os.system("gmake " + platform.getMakeEnvs(version, l) + " prefix=" + buildDir + " install") != 0: + print sys.argv[0] + ": `" + l + "' build failed" + os.chdir(cwd) + sys.exit(1) else: - dylibEnvironmentVar = 'LD_LIBRARY_PATH' - - for k, v in buildEnvironment.iteritems(): - os.environ[k] = v - if os.environ.has_key(dylibEnvironmentVar): - os.environ[dylibEnvironmentVar] = v + '/lib:' + os.environ[dylibEnvironmentVar] - - if buildDir == None: - print 'No build directory specified, defaulting to $HOME/tmp/icebuild' - buildDir = os.path.join(os.environ.get('HOME'), "tmp", "icebuild") - - if installDir == None: - print 'No install directory specified, default to $HOME/tmp/iceinstall' - installDir = os.path.join(os.environ.get('HOME'), "tmp", "iceinstall") - - # - # We need to clean the directory out to keep obsolete files from - # being installed. This needs to happen whether we are running with - # noclean or not. - # - if build: - if os.path.exists(installDir): - shutil.rmtree(installDir, True) - - directories = [buildDir, os.path.join(buildDir, "sources"), os.path.join(buildDir, "demotree"), - os.path.join(buildDir, "install"), installDir] - - for d in directories: - initDirectory(d) - - # - # Unpack and update distribution files. - # - # TODO: The updates performed here should be performed by the makedist script. - # - installFiles = None - os.system("gzip -dc " + distfiles + " | tar xf - -C " + os.path.join(buildDir, "install")) - configFile = os.path.join(buildDir, "install", "Config.h") - version = getIceVersion(configFile) - soVersion = getIceSoVersion(configFile) - mmVersion = getIceMMVersion(configFile) - version, soVersion, mmVersion = getVersion(buildDir) - installFiles = fixInstallFiles(buildDir, version, mmVersion) - - if verbose: - print 'Building binary distributions for Ice-' + version + ' on ' + getPlatformString() - print 'Using build directory: ' + buildDir - print 'Using install directory: ' + installDir - print - - # - # These last build directories will have to wait until we've got - # the version number for the distribution. - # - shutil.rmtree(buildDir + '/Ice-' + version + '-demos', True) - initDirectory(buildDir + '/Ice-' + version + '-demos/config') + antCmd = platform.getAntEnv() + " ant " + platform.getAntOptions() + " -Dprefix=" + buildDir - if build: - # - # Ice must be first or building the other source distributions will fail. - # - sourceTarBalls = [ ('cpp', 'Ice-%s' % version, ''), - ('java','IceJ-%s-java2' % version, 'j')] + if os.system(antCmd + " -Dbuild.suffix=-java2 -Dice.mapping=java2 install") != 0 or \ + os.system(antCmd + " -Dbuild.suffix=-java5 -Dice.mapping=java5 install") != 0: + print sys.argv[0] + ": `" + l + "' build failed" + os.chdir(cwd) + sys.exit(1) - if not getPlatform() in ['aix', 'solaris', 'hpux', 'macosx']: - sourceTarBalls.append(('php','IcePHP-' + version, 'php')) - - if not getPlatform() in ['aix', 'solaris', 'hpux']: - sourceTarBalls.append(('py','IcePy-' + version, 'py')) - - if getPlatform() == 'linux': - sourceTarBalls.append(('cs','IceNET-' + version, 'cs')) - if os.system('which ruby > /dev/null 2>&1') == 0: - sourceTarBalls.append(('rb', 'IceRuby-%s' % version, 'rb')) - - os.environ['ICE_HOME'] = os.path.join(buildDir, "Ice-" + version) - currentLibraryPath = None - try: - currentLibraryPath = os.environ[dylibEnvironmentVar] - except KeyError: - currentLibraryPath = '' - - os.environ[dylibEnvironmentVar] = os.path.join(buildDir, "Ice-" + version, "lib") + os.pathsep + currentLibraryPath - os.environ['PATH'] = os.path.join(buildDir, "Ice-" + version, "bin") + os.pathsep + os.environ['PATH'] - - # - # Package up demo distribution. - # - if getPlatform() != 'hpux' and getPlatform() != 'solaris' and getPlatform() != 'macosx': - toCollect = list(sourceTarBalls) - toCollect.append(('vb', 'IceVB-' + version, 'vb')) - for cvs, tarball, demoDir in toCollect: - extractDemos(sources, buildDir, version, tarball, demoDir) - shutil.copy("%s/common/README.DEMOS" % installFiles, "%s/Ice-%s-demos/README.DEMOS" % (buildDir, version)) - archiveDemoTree(buildDir, version, installFiles) - shutil.move("%s/Ice-%s-demos.tar.gz" % (buildDir, version), "%s/Ice-%s-demos.tar.gz" % (installDir, version)) - shutil.move("%s/Ice-%s-demos.zip" % (buildDir, version), "%s/Ice-%s-demos.zip" % (installDir, version)) - - # - # Everything should be set for building stuff up now. - # - for cvs, tarball, demoDir in sourceTarBalls: - makeInstall(sources, buildDir, "%s/Ice-%s" % (installDir, version), tarball, clean, version, mmVersion) - - # - # Put the Java2 jar in its directory - # - prevDir = os.getcwd() - os.chdir("%s/Ice-%s/lib" % (installDir, version)) - os.mkdir("java2") - shutil.move("Ice.jar", "java2/Ice.jar") - os.system("gzip -dc %s/IceJ-%s-java5.tar.gz | tar xf - IceJ-%s-java5/lib/Ice.jar" % (sources, version, version)) - shutil.move("IceJ-%s-java5/lib/Ice.jar" % version, "Ice.jar") - shutil.rmtree("IceJ-%s-java5" % version) - os.chdir(prevDir) - - # - # Sources should have already been built and installed. We - # can pick the binaries up from the iceinstall directory. - # - # TODO: What is this used for? - # - binaries = glob.glob(installDir + '/Ice-' + version + '/bin/*') - binaries.extend(glob.glob(installDir + '/Ice-' + version + '/lib/*' + shlibExtensions(version, soVersion)[0])) - - cwd = os.getcwd() - os.chdir(installDir) - - # - # Get third party libraries. - # - dbLocation = os.environ['DB_HOME'] - - dbFiles = getDBfiles(dbLocation) - for f in dbFiles: - if not os.path.exists('Ice-' + version + '/' + f.strip()): - shutil.copy(dbLocation + '/' + f.strip(), 'Ice-' + version + '/' + f.strip()) - - if getPlatform() == 'macosx': - copyExpatFiles(os.environ['EXPAT_HOME'], version) - - if getPlatform() == 'hpux': - ssl = os.environ['OPENSSL_HOME'] - shutil.copy('%s/bin/openssl' % ssl, 'Ice-%s/bin' % version) -# runprog('cp -R ' + ssl + '/include Ice-' + version) - runprog('cp ' + ssl + '/lib/lib*.sl.* Ice-' + version + '/lib') - runprog('rm -rf Ice-' + version + '/lib/libfips*') - runprog('rm -rf Ice-' + version + '/lib/engines') - runprog('rm -rf Ice-' + version + '/lib/pkgconfig') - runprog('rm -f Ice-' + version + '/lib/*.a') - - uname = readcommand('uname') - platformSpecificFiles = [ 'README', 'SOURCES', 'THIRD_PARTY_LICENSE' ] - for psf in platformSpecificFiles: - platform = uname - if psf == 'README': - if platform == 'Linux': - if os.system('test -f /etc/redhat-release') == 0: - platform = 'RHEL' - else: - platform = 'SLES' - elif platform == "SunOS": - cpu = readcommand("uname -p") - if cpu == "i386": - platform = platform + ".x86" - else: - platform = platform + ".SPARC" - cf = os.path.join(installFiles, 'unix', psf + '.' + platform) - if os.path.exists(cf): - shutil.copy(cf, os.path.join('Ice-' + version, psf)) + os.chdir(os.path.join(cwd)) + print + print "============= Finished buiding " + l + " sources =============" + print - # - # Remove build files from binary distribution. - # - runprog("rm -f Ice-%s/config/build.properties" % (version)) - runprog("rm -f Ice-%s/config/Make.rules*" % (version)) +# +# Copy platform third party dependencies. +# +print "Copying third party dependencies..." +sys.stdout.flush() +platform.copyThirdPartyDependencies(buildDir) +platform.completeDistribution(buildDir, version) - # - # Remove doc from binary distribution. - # - runprog("rm -rf Ice-%s/doc" % (version)) +# +# Copy platform specific files (README, SOURCES, etc) +# +print "Copying distribution files (README, SOURCES, etc)...", +sys.stdout.flush() +platform.copyDistributionFiles(distDir, buildDir) - # - # Fix install names on Mac OS X - # - if getPlatform() == 'macosx': - fixInstallNames(version, mmVersion) +if os.path.exists(os.path.join(buildDir, "doc")): + shutil.rmtree(os.path.join(buildDir, "doc")) +print "ok" - shutil.copyfile(os.path.join(buildDir, "install", "RELEASE_NOTES.txt"), - os.path.join(installDir, "Ice-%s" % version, "RELEASE_NOTES.txt")) +if not os.path.exists("RELEASE_NOTES.txt"): + print "warning: couldn't find ./RELEASE_NOTES.txt file" +else: + copy("RELEASE_NOTES.txt", os.path.join(buildDir, "RELEASE_NOTES.txt")) - runprog('tar cf Ice-' + version + '-bin-' + getPlatformString() + '.tar Ice-' + version) - runprog('gzip -9 Ice-' + version + '-bin-' + getPlatformString() + '.tar') - os.chdir(cwd) +# +# Everything should be clean now, we can create the binary distribution archive +# +print "Archiving " + platform.getPackageName(version) + ".tar.gz ...", +sys.stdout.flush() +os.chdir(buildRootDir) +tarfile = os.path.join(cwd, platform.getPackageName(version)) + ".tar.gz" +os.system("tar c" + quiet + "f - Ice-" + version + " | gzip -9 - > " + tarfile) +os.chdir(cwd) +print "ok" - # - # TODO: Cleanups? I've left everything in place so that the process - # can be easily debugged. - # +# +# Done. +# +print "Cleaning up...", +sys.stdout.flush() +shutil.rmtree(buildRootDir) +print "ok" -if __name__ == "__main__": - main() +os.chdir(cwd) diff --git a/distribution/lib/DistUtils.py b/distribution/lib/DistUtils.py index a22a2f9e40d..5fdf7bcbc8f 100644 --- a/distribution/lib/DistUtils.py +++ b/distribution/lib/DistUtils.py @@ -1,20 +1,273 @@ -import fileinput - -def commentOutLexYacc(target, makefile): - f = fileinput.input("$makefile", True) - inComment = False - inClean = False - for x in f: - if not x.startswith("\t") and x.find("$base") != -1 and x.find("$base" + ".o") == -1: - inComment = True - elif x.startswith("clean::"): - inClean = True - elif len(x.strip()) == 0: - inClean = False - inComment = False - x = x.rstrip('\n') - if (inComment or (inClean and x.find("$base") != -1)) and not x.startswith('#'): - print '#',x +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2008 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 os, sys, shutil, glob, fnmatch, string, re +from stat import * + +def fixPermission(dest): + + if os.path.isdir(dest): + os.chmod(dest, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) # rwxr-xr-x + for f in os.listdir(dest): + fixPermission(os.path.join(f, dest)) + else: + if os.stat(dest).st_mode & (S_IXUSR | S_IXGRP | S_IXOTH): + os.chmod(dest, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) # rwxr-xr-x + else: + os.chmod(dest, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) # rw-r--r-- + +def copy(src, dest): + + # Create the directories if necessary. + if not os.path.exists(os.path.dirname(dest)): + os.makedirs(os.path.dirname(dest)) + + # Copy the directory, link or file. + if os.path.isdir(src): + shutil.copytree(src, dest) + elif os.path.islink(src): + if os.path.exists(dest): + os.remove(dest) + os.symlink(os.readlink(src), dest) + else: + if os.path.exists(dest): + os.remove(dest) + shutil.copy(src, dest) + + fixPermission(dest) + +# +# Thidparty helper classes +# +class ThirdParty : + def __init__(self, platform, name, locations, languages, buildOption = None, buildEnv = None): + self.name = name + self.languages = languages + self.buildOption = buildOption + if buildEnv: + self.buildEnv = buildEnv + else: + self.buildEnv = self.name.upper() + "_HOME" + + # + # Get the location of the third party dependency. We first check if the environment + # variable (e.g.: DB_HOME) is set, if not we use the platform specific location. + # + self.location = os.environ.get(self.buildEnv, platform.getLocation(locations)) + + if self.location and os.path.islink(self.location): + self.location = os.path.normpath(os.path.join(os.path.dirname(self.location), os.readlink(self.location))) + + # + # Add the third party dependency to the platform object. + # + platform.addThirdParty(self) + + def __str__(self): + return self.name + + def checkAndPrint(self): + + if self.location == None: + print self.name + ": <system>" + return True else: - print x - f.close() + if not os.path.exists(self.location): + if os.environ.has_key(self.buildEnv): + print self.name + ": not found at " + self.buildEnv + " location (" + self.location + ")" + else: + print self.name + ": not found at default location (" + self.location + ")" + return False + else: + if os.environ.has_key(self.buildEnv): + print self.name + ": " + self.location + " (from " + self.buildEnv + ")" + else: + print self.name + ": " + self.location + " (default location)" + return True + + def getMakeEnv(self, language): + if language in self.languages and not os.environ.has_key(self.buildEnv) and self.location: + return self.buildEnv + "=" + self.location + + def getAntOption(self): + if "java" in self.languages and self.buildOption and self.location: + return "-D" + self.buildOption + "=" + self.location + + def getJar(self): + if "java" in self.languages and self.location and self.location.endswith(".jar"): + return self.location + + def getFiles(self, platform): + return [] + + def includeInDistribution(self): + # Only copy third party files installed in /opt + return self.location and self.location.startswith("/opt") + + def copyToDistribution(self, platform, buildDir): + if not self.location: + return + + # + # Get files/directories to copy. The path returned by getFiles() are relative + # to the third party library location and might contain wildcards characters. + # + files = [f for path in self.getFiles(platform) for f in glob.glob(os.path.join(self.location, path))] + if len(files) > 0: + print " Copying " + self.name + "...", + sys.stdout.flush() + for src in files: + copy(src, os.path.join(buildDir, src[len(self.location) + 1::])) + print "ok" + +# +# Platform helper classes +# +class Platform: + def __init__(self, uname, pkgname, languages, shlibExtension): + self.uname = uname + self.pkgname = pkgname + self.languages = languages + self.shlibExtension = shlibExtension + self.thirdParties = [] + + def __str__(self): + return self.__class__.__name__ + + def getLocation(self, locations): + return locations.get(self.uname, None) + + def addThirdParty(self, thirdParty): + self.thirdParties.append(thirdParty) + + def checkAndPrintThirdParties(self): + found = True + for t in self.thirdParties: + print " ", + found &= t.checkAndPrint() + return found + + def getPackageName(self, version): + return "Ice-" + version + "-bin-" + self.pkgname + + def getMakeEnvs(self, version, language): + + # Get third party environement variables. + envs = [t.getMakeEnv(language) for t in self.thirdParties if t.getMakeEnv(language)] + + # Build with optimization by default. + if not os.environ.has_key("OPTIMIZE"): + envs.append("OPTIMIZE=yes") + + # Language specific environment variables to pass to make. + if language == "cpp": + envs.append("create_runpath_symlink=no") + elif language == "cs": + envs.append("NOGAC=1") + + return string.join(envs, " ") + + def getAntEnv(self): + return "CLASSPATH=" + string.join([t.getJar() for t in self.thirdParties if t.getJar()], os.pathsep) + + def getAntOptions(self): + return string.join([t.getAntOption() for t in self.thirdParties if t.getAntOption()], " ") + + def getSharedLibraryFiles(self, root, path, extension = None): + if not extension: + extension = self.shlibExtension + libs = [] + for f in glob.glob(os.path.join(root, path)): + (dirname, basename) = os.path.split(f) + if fnmatch.fnmatch(basename, "*" + extension + "*") and not os.path.islink(f): + libs.append(os.path.join(dirname[len(root) + 1::], basename)) + return libs + + def copyDistributionFiles(self, distDir, buildDir): + for f in [ 'README', 'SOURCES', 'THIRD_PARTY_LICENSE' ]: + filepath = os.path.join(os.path.join(distDir, "src", "unix"), f + "." + self.uname) + if not os.path.exists(filepath): + print "warning: " + filepath + " doesn't exist" + else: + copy(filepath, os.path.join(buildDir, f)) + + def copyThirdPartyDependencies(self, buildDir): + for t in filter(ThirdParty.includeInDistribution, self.thirdParties): t.copyToDistribution(self, buildDir) + + def completeDistribution(self, buildDir, version): + pass + +class Darwin(Platform): + def __init__(self, uname, languages): + Platform.__init__(self, uname, "macosx", languages, "dylib") + + def getSharedLibraryFiles(self, root, path, extension = None) : + libraries = Platform.getSharedLibraryFiles(self, root, path, extension) + links = [] + for l in libraries: + out = os.popen("otool -D " + os.path.join(root, l)) + lines = out.readlines() + out.close() + if(len(lines) <= 1): + continue + link = lines[1].strip() + if link != os.path.join(root, l) and link.startswith(root): + links.append(link[len(root) + 1::]) + return libraries + links + + def completeDistribution(self, buildDir, version): + + print "Fixing install names...", + sys.stdout.flush() + + isLib = lambda f: (fnmatch.fnmatch(f, "*dylib") or fnmatch.fnmatch(f, "*jnilib")) and not os.path.islink(f) + isExe = lambda f : os.system('file -b ' + f + ' | grep -q "Mach-O"') == 0 + + # + # Find the install names of the third party libraries included with the distribution. + # + oldInstallNames = [] + for t in self.thirdParties: + if t.includeInDistribution(): + for l in filter(isLib, [os.path.join(buildDir, l) for l in t.getFiles(self)]): + p = os.popen('otool -D ' + l + ' | tail -1') + oldInstallNames.append(p.readline().strip()) + p.close() + + # + # Find the binary files included with this distribution. + # + binFiles = [ f for f in glob.glob(os.path.join(buildDir, "bin", "*")) if isExe(f)] + binFiles += [ f for f in glob.glob(os.path.join(buildDir, "lib", "*")) if isLib(f)] + + # + # Fix the install names in each binary. + # + mmversion = re.search("([0-9]+\.[0-9b]+)[\.0-9]*", version).group(1) + for oldName in oldInstallNames: + libName = re.sub("\/opt\/.*\/(.*)", "\\1", oldName) + newName = '/opt/Ice-' + mmversion + '/' + libName + os.system('install_name_tool -id ' + newName + ' ' + buildDir + '/lib/' + libName) + for f in binFiles: + os.system('install_name_tool -change ' + oldName + ' ' + newName + ' ' + f) + + print "ok" + +class HPUX(Platform): + def __init__(self, uname, languages): + Platform.__init__(self, uname, "hpux", languages, "sl") + +class Linux(Platform): + def __init__(self, uname, languages): + Platform.__init__(self, uname, "linux", languages, "sl") + +class SunOS(Platform): + def __init__(self, uname, languages): + Platform.__init__(self, uname, "solaris", languages, "so") diff --git a/java/build.xml b/java/build.xml index f822d04a08e..7ea7cfcda3f 100644 --- a/java/build.xml +++ b/java/build.xml @@ -13,14 +13,14 @@ <!-- set global properties for this build --> <property name="top.dir" value="."/> - <property name="src.dir" value="src"/> - <property name="lib.dir" value="lib"/> - <property name="generated.dir" value="generated"/> - <property name="cache.dir" value="depcache"/> <!-- import common definitions --> <import file="config/common.xml"/> + <property name="src.dir" value="src"/> + <property name="lib.dir" value="lib${build.suffix}"/> + <property name="cache.dir" value="depcache${build.suffix}"/> + <target name="generate" depends="init"> <!-- Create the output directory for generated code --> <mkdir dir="${generated.dir}"/> @@ -203,6 +203,13 @@ </target> <target name="icegridadmin-pro-jar" depends="icegridadmin-compile" if="build-icegridadmin-pro-jar"> + <condition property="runtime.jar" value="${java.home}/../Classes/classes.jar" else="${java.home}/lib/rt.jar"> + <os family="mac"/> + </condition> + <condition property="jsse.jar" value="${java.home}/../Classes/jsse.jar" else="${java.home}/lib/jsse.jar"> + <os family="mac"/> + </condition> + <manifest file="${lib.dir}/icegridgui.mf"> <attribute name="Main-Class" value="IceGridGUI.Main"/> <attribute name="Class-Path" value="../help/ ../resources/ ../../share/doc/Ice-${ice.version}/ ../../share/doc/packages/Ice-${ice.version}/"/> @@ -223,6 +230,8 @@ -injars ${jgoodies.looks}(!META-INF/**) -injars ${jgoodies.forms}(!META-INF/**) -outjars ${lib.dir}/IceGridGUI.jar + -libraryjars ${runtime.jar} + -libraryjars ${jsse.jar} -include config/icegridgui.pro </proguard> <delete file="${lib.dir}/IceGridGUItemp.jar" /> diff --git a/java/config/common.xml b/java/config/common.xml index 5156b028bec..8afef02e586 100644 --- a/java/config/common.xml +++ b/java/config/common.xml @@ -47,9 +47,16 @@ <isset property="lint"/> </condition> + <!-- Default build suffix is empty. This can be defined by build + scripts to build the jars and classes file in other + directories than the default one. This is useful to build + both the Java2 and Java5 mapping with the same source tree. + --> + <property name="build.suffix" value=""/> + <!-- Commonly needed properties --> - <property name="class.dir" value="classes"/> - <property name="generated.dir" value="generated"/> + <property name="class.dir" value="classes${build.suffix}"/> + <property name="generated.dir" value="generated${build.suffix}"/> <!-- We use pathconvert to ensure that ice.top.dir is relative to the path of the build.xml file insead of the current working directory. --> diff --git a/java/config/icegridgui.pro b/java/config/icegridgui.pro index 849b0116d3d..6a00d0d3572 100644 --- a/java/config/icegridgui.pro +++ b/java/config/icegridgui.pro @@ -8,9 +8,6 @@ # Preserve all public applications. --libraryjars <java.home>/lib/rt.jar --libraryjars <java.home>/lib/jsse.jar - -keepclasseswithmembers public class * { public static void main(java.lang.String[]); } diff --git a/makedist.py b/makedist.py index 05c5d00021b..a21682e6cd9 100755 --- a/makedist.py +++ b/makedist.py @@ -13,13 +13,6 @@ from stat import * from shutil import copytree, rmtree # -# TODO: The test distribution is currently disabled. There's still some work to do -# to get it to work. For instance, the test/Ice/background test can't be compiled -# without the sources. The allTests.py scripts also don't support being run from -# the test directory. -# - -# # Sub-directories to keep to create the source distributions. # includeSubDirs = [ \ @@ -43,6 +36,7 @@ includeSubDirs = [ \ filesToRemove = [ \ "fixCopyright.py", \ "fixVersion.py", \ + "makedist.py", \ "cpp/iceemakedist.py", \ "cpp/iceslmakedist.py", \ "cpp/config/makegitignore.py", \ @@ -50,12 +44,15 @@ filesToRemove = [ \ "cpp/config/Make.rules.mak.icee", \ # "cpp/config/Make.rules.icesl", \ "cpp/config/Make.rules.mak.icesl", \ + "cpp/src/slice2cppe", \ + "cpp/src/slice2javae", \ + "cpp/src/slice2sl", \ "rb/config/Make.rules.Darwin", \ ] # # Files from the top-level, cpp, java and cs config directories to include in the demo -# and test source distribution config directory. +# source distribution config directory. # configFiles = [ \ "Make.*", \ @@ -77,7 +74,7 @@ certsFiles = [ \ # Program usage. # def usage(): - print "Usage: " + sys.argv[0] + " [options]" + print "Usage: " + sys.argv[0] + " [options] tag" print print "Options:" print "-h Show this message." @@ -115,7 +112,6 @@ def copy(srcpath, destpath): # Copy files from srcpath and matching the given patterns to destpath # def copyMatchingFiles(srcpath, destpath, patterns): - for p in patterns: for f in glob.glob(os.path.join(srcpath, p)): copy(f, os.path.join(destpath, os.path.basename(f))) @@ -269,6 +265,11 @@ def fixVersion(file): newFile.write(line) newFile.close() oldFile.close() + + # Preserve the executable permission + st = os.stat(origfile) + if st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH): + os.chmod(file, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) # rwxr-xr-x os.remove(origfile) def fixFilePermission(file): @@ -397,6 +398,9 @@ if verbose: else: quiet = "" +cwd = os.getcwd() +os.chdir(os.path.dirname(__file__)) + # # Get Ice version. # @@ -419,14 +423,11 @@ print "Creating " + version + " source distributions in " + distDir demoscriptDistDir = os.path.join(distDir, "Ice-" + version + "-demo-scripts") demoDistDir = os.path.join(distDir, "Ice-" + version + "-demos") -#testDistDir = os.path.join(distDir, "Ice-" + version + "-tests") srcDistDir = os.path.join(distDir, "Ice-" + version) os.mkdir(demoscriptDistDir) os.mkdir(demoDistDir) os.mkdir(os.path.join(demoDistDir, "config")) os.mkdir(os.path.join(demoDistDir, "certs")) -#os.mkdir(testDistDir) -#os.mkdir(os.path.join(testDistDir, "config")) # # Extract the sources with git archive using the given tag. @@ -436,8 +437,6 @@ sys.stdout.flush() os.system("git archive --prefix=Ice-" + version + "/ " + tag + " | ( cd " + distDir + " && tar xf - )") print "ok" -cwd = os.getcwd() - os.chdir(os.path.join(srcDistDir)) # @@ -456,6 +455,7 @@ print "ok" print "Walking through distribution to fix permissions, versions, etc...", sys.stdout.flush() +fixVersion(os.path.join("distribution", "bin", "makebindist.py")) fixVersion(os.path.join("cpp", "config", "glacier2router.cfg")) fixVersion(os.path.join("cpp", "config", "icegridregistry.cfg")) fixVersion(os.path.join("distribution", "src", "rpm", "glacier2router.conf")) @@ -475,7 +475,6 @@ for root, dirnames, filesnames in os.walk('.'): copy(filepath, os.path.join(distDir, demoscriptDistDir, filepath)) os.remove(filepath) else: - fixFilePermission(filepath) # Fix version of README/INSTALL files and keep track of bison/flex files for later processing if fnmatch.fnmatch(f, "README*") or fnmatch.fnmatch(f, "INSTALL*"): @@ -484,6 +483,8 @@ for root, dirnames, filesnames in os.walk('.'): bisonFiles.append(filepath) elif fnmatch.fnmatch(f, "*.l"): flexFiles.append(filepath) + + fixFilePermission(filepath) for d in dirnames: os.chmod(os.path.join(root, d), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) # rwxr-xr-x @@ -506,9 +507,9 @@ fixMakeRules(os.path.join("cpp", "config", "Make.rules")) print "ok" # -# Consolidate demo, demo scripts and test distributions. +# Consolidate demo, demo scripts distributions. # -print "Consolidating demo, test and demo scripts distributions...", +print "Consolidating demo and demo scripts distributions...", sys.stdout.flush() # Demo distribution @@ -521,24 +522,13 @@ copyMatchingFiles(os.path.join("cpp", "config"), os.path.join(demoDistDir, "conf copyMatchingFiles(os.path.join("java", "config"), os.path.join(demoDistDir, "config"), configFiles) copyMatchingFiles(os.path.join("cs", "config"), os.path.join(demoDistDir, "config"), configFiles) -# Test distribution -# copy("ICE_LICENSE", testDistDir) -# copyMatchingFiles(os.path.join("config"), os.path.join(testDistDir, "config"), configFiles) -# copyMatchingFiles(os.path.join("cpp", "config"), os.path.join(testDistDir, "config"), configFiles) -# copyMatchingFiles(os.path.join("java", "config"), os.path.join(testDistDir, "config"), configFiles) -# copyMatchingFiles(os.path.join("cs", "config"), os.path.join(testDistDir, "config"), configFiles) - -# Consolidate demoscript, test and demo distribution with files from each language mapping +# Consolidate demoscript and demo distribution with files from each language mapping for d in os.listdir('.'): if os.path.isdir(d) and os.path.exists(os.path.join(d, "allDemos.py")): os.rename(os.path.join(d, "allDemos.py"), os.path.join(demoscriptDistDir, d, "allDemos.py")) os.rename(os.path.join(demoscriptDistDir, d), os.path.join(demoscriptDistDir, getMappingDir("demo", d))) -# if os.path.isdir(d) and os.path.exists(os.path.join(d, "test")): -# copytree(os.path.join(d, "test"), os.path.join(testDistDir, getMappingDir("test", d))) -# copy(os.path.join(d, "allTests.py"), os.path.join(testDistDir, getMappingDir("test", d))) - if os.path.isdir(d) and os.path.exists(os.path.join(d, "demo")): copytree(os.path.join(d, "demo"), os.path.join(demoDistDir, getMappingDir("demo", d))) @@ -557,9 +547,8 @@ print "ok" print "Archiving..." sys.stdout.flush() os.chdir(distDir) - -#for d in [srcDistDir, testDistDir, demoDistDir, demoscriptDistDir]: -for d in [srcDistDir, demoDistDir, demoscriptDistDir]: +os.rename("distribution", "distfiles-" + version) +for d in [srcDistDir, demoDistDir, demoscriptDistDir, "distfiles-" + version]: dist = os.path.basename(d) print " creating " + dist + ".tar.gz ...", sys.stdout.flush() @@ -588,7 +577,7 @@ else: readme = open("README.txt", "w") print >>readme, "This directory contains the source distributions of Ice " + version + ".\n" print >>readme, "Creation time: " + time.strftime("%a %b %d %Y, %I:%M:%S %p (%Z)") -(sysname, nodename, release, version, machine) = os.uname(); +(sysname, nodename, release, ver, machine) = os.uname(); print >>readme, "Host: " + nodename print >>readme, "Platform: " + sysname + " " + release if os.path.exists("/etc/redhat-release"): @@ -600,7 +589,7 @@ else: print >>readme, "User: " + os.environ["USER"] print >>readme, "" print >>readme, "" + \ -"The `distribution' directory contains the sources for building the\n" + \ +"The archive distfiles-" + version + ".tar.gz contains the sources for building the\n" + \ "binary distributions.\n" readme.close() @@ -609,9 +598,9 @@ readme.close() # print "Cleaning up...", sys.stdout.flush() +rmtree(os.path.join(distDir, "distfiles-" + version)) rmtree(srcDistDir) rmtree(demoDistDir) -#rmtree(testDistDir) rmtree(demoscriptDistDir) print "ok" |