From 70adbba7599e3e1a0cf2cd57350ddc811c9550d4 Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Fri, 8 May 2015 20:54:02 +0000 Subject: [PATCH] msvc2005/configure.py - ready! Updated msvc2005/ReadMe.txt. Added tools/python --- msvc2005/ReadMe.txt | 71 +++++++++++++++--- msvc2005/configure.py | 69 +++++++++++------ msvc2005/tools/python/depend.py | 84 +++++++++++++++++++++ msvc2005/tools/python/tee.py | 127 ++++++++++++++++++++++++++++++++ 4 files changed, 316 insertions(+), 35 deletions(-) create mode 100755 msvc2005/tools/python/depend.py create mode 100755 msvc2005/tools/python/tee.py diff --git a/msvc2005/ReadMe.txt b/msvc2005/ReadMe.txt index 67a053c4..990680d5 100644 --- a/msvc2005/ReadMe.txt +++ b/msvc2005/ReadMe.txt @@ -8,7 +8,7 @@ exiv2\msvc2005\ReadMe.txt | with Visual Studio 2003/5/8 | +-----------------------------------------------------------+ -Updated: 2015-02-11 +Updated: 2015-05-08 Robin Mills http://clanmills.com @@ -21,9 +21,10 @@ T A B L E o f C O N T E N T S 1.1 Tools 1.2 Install zlib and expat sources. 1.3 Open exiv2\msvc2005\exiv2.sln -1.4 Building with and without webready -1.5 What is build -1.6 Express editions of DevStudio (or 32 bit only builds, or 64 bit only builds) +1.4 Configuring build options (such as video and webready) +1.5 Building with exiv2-webready.sln +1.6 What is build +1.7 Express editions of DevStudio (or 32 bit only builds, or 64 bit only builds) 2 Design 2.1 Architecture @@ -57,6 +58,11 @@ T A B L E o f C O N T E N T S You need a DOS version of perl to build openssl. Not the cygwin version. I use ActiveState Perl. + configure.bat is used to configure "non-standard" version of exiv2 + configure.bat requires a python3 interpreter. I use ActivePython. + ActivePython 3.4.1.0 (ActiveState Software Inc.) based on + Python 3.4.1 (default, Aug 7 2014, 13:09:27) [MSC v.1600 64 bit (AMD64)] on win32 + You need Cygwin to run the test suite because it is written in bash. 1.2 Install zlib and expat sources. @@ -99,9 +105,9 @@ T A B L E o f C O N T E N T S - 36 projects (zlib, expat, xmpsdk, exiv2lib, exiv2, addmoddel etc) x 2 Platforms (x64|Win32) x 4 Configurations (Debug|Release|DebugDLL|ReleaseDLL) - = 36x2x4 = 288 builds. + = 38x2x4 = 304 builds. - When building with webready, you add 5 libraries for a total of 328 builds. + When building with webready, you add 5 libraries for a total of 344 builds. If you haven't installed the x64 compiler, don't select the 64 bit configurations! You may have to hand-edit the vcproj and sln files to hide the 64 bit information. @@ -109,9 +115,52 @@ T A B L E o f C O N T E N T S Build time is 20 minutes on a 2.2GHz Duo Core and consumes 3.0 gBytes of disk space. Build time with webready is of the order of one hour as we add 5 libraries. - (libcurl, libeay32, ssleay32,libssh,openssl) + (libcurl, libeay32, ssleay32, libssh, openssl) + +1.4 Configuring build options (such as video and webready) + + The batch file configure.bat is used to reconfigure for various options. + You will need a python3 interpreter. I personally use ActivePython 3.4.1 + + C:\cygwin64\home\rmills\gnu\exiv2\trunk\msvc2005>configure -h + Usage: configure.py [options] + + Options: + -h, --help show this help message and exit + -A, --with-app build sample apps (false) + -a, --without-app do not build apps + -C, --with-curl enable curl + -c, --without-curl disable curl + -E, --with-expat enable expat (true) + -e, --without-expat disable expat + -O, --with-openssl enable openssl + -o, --without-openssl + disable openssl + -S, --with-ssh enable ssh + -s, --without-ssh disable ssh + -T, --with-test build test programs (true) + -t, --without-test do not build test progs + -W, --enable-webready + enable webready (false) + -w, --disable-webready + enable webready + -V, --enable-video enable video (false) + -v, --disable-video disable video + -X, --enable-xmp enable xmp (true) + -x, --disable-xmp disable xmp + -Z, --with-zlib enable zlib/png (true) + -z, --without-zlib disable zlib/png + -d, --default default + + When you run configure.bat it creates a new solution exiv2_configure.sln + configure.bat does not modify the solution or project files used by exiv2.sln + Instead it creates a parallel set of projects files. For example exivprint\exifprint_configure.vcproj + +1.5 Building with exiv2-webready.sln + The solution exiv2-webready.sln was used during development before + we created the configure.bat script to generate solution/project files + We have decided to ship this build mechanism for v0.25 only. -1.4 Building with and without webready Building the complete library with webready support requires building 5 additional libraries. This is time consuming. The build time increases from 5 to 20 minutes. @@ -122,12 +171,12 @@ T A B L E o f C O N T E N T S 1 copy include\exiv2\exv_msvc-webready.h include\exiv2\exv_msvc.h 2 open msvc2005\exiv2-webready.vcproj -1.5 What is built +1.6 What is built The DLL builds use the DLL version of the C runtime libraries The Debug|Release builds use static C runtime libraries This is discussed in exiv2\msvc2003\ReadMe.txt -1.6 Express editions of DevStudio (or 32 bit only builds, or 64 bit only builds) +1.7 Express editions of DevStudio (or 32 bit only builds, or 64 bit only builds) Some Express Editions do not provide a 64 bit compiler. You can build 32 bit libraries with DevStudio Express (with a little effort) @@ -208,7 +257,7 @@ T A B L E o f C O N T E N T S 5) msvc2005 does not require you to build 'vanilla' expat and zlib projects in advance 6) msvc2005 does not support the organize application 7) msvc2005 supports building with zlib1.2.7 or 1.2.8 - 7) msvc2005 supports building with expat2.1.0 + 8) msvc2005 supports building with expat2.1.0 or expat2.0.1 msvc2003 will continue to be supported for 32 bit builds using DevStudio 2003/05/08, however there is no plan to enhance or develop msvc2003 going forward. diff --git a/msvc2005/configure.py b/msvc2005/configure.py index 512f6a29..138ff5ae 100755 --- a/msvc2005/configure.py +++ b/msvc2005/configure.py @@ -51,30 +51,51 @@ for d in os.listdir('.'): ## # define project dependances -# TODO: read exiv-webready.sln to build project/dependency set +# This table is generated with the command 'tools/python/depends.py exiv2-webready.sln format' project = {} -# no dependancy -for p in externlib: - project[p]=empty() - -## -# dependancies -project['xmpparser-test' ] = set(['libexiv2','xmpsdk' ]) -project['xmpparse' ] = set(['libexiv2','xmpsdk' ]) -project['xmpsample' ] = set(['libexiv2','xmpsdk' ]) -project['xmpsdk' ] = set([ 'libexpat' ]) -project['geotag' ] = set([ 'libexpat','libexiv2']) -project['libexiv2' ] = set([ 'libexpat','xmpsdk' ,'zlib','libcurl','libeay32','ssleay32','libssh','openssl']) -project['libcurl' ] = set(['libeay32','ssleay32','libssh' ]) -project['libssh' ] = set(['libeay32','ssleay32','openssl' ]) -project['libeay32' ] = set(['openssl' ]) -project['ssleay32' ] = set(['openssl' ]) - -# all others depend on libexiv2 -for p in uid: - if not p in project: - project[p]=set(['libexiv2']) - +project['addmoddel' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['conntest' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['convert-test' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['easyaccess-test' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['exifcomment' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['exifdata' ] = set(['libexiv2']) +project['exifdata-test' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['exifprint' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['exifvalue' ] = set(['libexiv2']) +project['exiv2' ] = set(['libeay32', 'ssleay32', 'libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['exiv2json' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['geotag' ] = set(['zlib', 'libexpat', 'libexiv2', 'libcurl', 'xmpsdk']) +project['httptest' ] = set(['zlib', 'libexpat', 'libexiv2', 'libcurl', 'xmpsdk']) +project['iotest' ] = set(['zlib', 'libexpat', 'libexiv2', 'libcurl', 'xmpsdk']) +project['iptceasy' ] = set(['zlib', 'libexpat', 'libexiv2', 'libcurl', 'xmpsdk']) +project['iptcprint' ] = set(['zlib', 'libexpat', 'libexiv2', 'libcurl', 'xmpsdk']) +project['iptctest' ] = set(['zlib', 'libexpat', 'libexiv2', 'libcurl', 'xmpsdk']) +project['key-test' ] = set(['zlib', 'libexpat', 'libexiv2', 'libcurl', 'xmpsdk']) +project['largeiptc-test' ] = set(['zlib', 'libexpat', 'libexiv2', 'libcurl', 'xmpsdk']) +project['libcurl' ] = set(['libssh', 'libeay32', 'ssleay32']) +project['libeay32' ] = set(['openssl']) +project['libexiv2' ] = set(['libeay32', 'ssleay32', 'libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libssh']) +project['libexpat' ] = set([ ]) +project['libssh' ] = set(['zlib', 'libeay32', 'ssleay32']) +project['metacopy' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['mmap-test' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['openssl' ] = set([ ]) +project['path-test' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['prevtest' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['remotetest' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['ssleay32' ] = set(['openssl']) +project['stringto-test' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['taglist' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['tiff-test' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['utiltest' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['werror-test' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['write-test' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['write2-test' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['xmpparse' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['xmpparser-test' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['xmpsample' ] = set(['libcurl', 'zlib', 'libexpat', 'xmpsdk', 'libexiv2', 'libssh']) +project['xmpsdk' ] = set([ ]) +project['zlib' ] = set([ ]) ## # filter filters={} @@ -350,7 +371,7 @@ def main(): ## # write solution file - sln='exiv2-configure.sln' + sln='exiv2_configure.sln' s = open(sln,'w') s.write(strings['Begin']) diff --git a/msvc2005/tools/python/depend.py b/msvc2005/tools/python/depend.py new file mode 100755 index 00000000..55b6845c --- /dev/null +++ b/msvc2005/tools/python/depend.py @@ -0,0 +1,84 @@ +#!/usr/bin/python3 + +## +# read an MSVC solution file and generate the project dependency table +# syntax: tools/python/depend solution-file [format] +# - the argument 'format' can be anything! +## + +import os +import sys + +def main(): + ## + # no arguments, report and quit + if len(sys.argv)==1: + print('%s solutionfile' % sys.argv[0]) + return + bFormat = len(sys.argv)>2 + + sln=sys.argv[1] + print(sln) + + lines=open(sln).readlines() + + project={} + depends={} + bDepends = False + for line in lines: + if line.find('Project(')>=0: + start = line.find(' = "') + end = line.find('"',start+4) + name = line[start+4:end] + start = line.find('{',end) + end = line.find('}',start) + uid = line[start+1:end] + project[uid] = name + if line.find('Global')>0: + break + + # print(project) + + for line in lines: + if line.find('Project(')>=0: + start = line.find(' = "') + end = line.find('"',start+4) + name = line[start+4:end] + depends[name]=set([]) + + if bDepends & (line.find('ProjectSectionEnd')>0): + bDepends=False + if (not bDepends) & (line.find('ProjectSection(ProjectDependencies)')>=0): + bDepends=True + if bDepends: + start = line.find('{') + end = line.find('}',start+1) + if (start>0) & (end>0): + uid = line[start+1:end] + # print('found uid = ',uid) + if not name in depends: + depends[name]=set([]) + if uid in project: + depends[name].add(project[uid]) + if line.find('Global')>0: + break + + for p in sorted(depends.keys()): + if bFormat: + s=str(depends[p]) + s=s.replace('{','[').replace('}',']') + s=s.replace('set()','[ ]') + P="project['" + p + "']" + print('%-30s = set(%s)' % (P,s) ) + else: + print('%-20s %s' % (p,depends[p]) ) + + +# project['xmpparser-test' ] = set(['libexiv2','xmpsdk' ]) + + +if __name__ == "__main__": + main() + +# That's all Folks +## \ No newline at end of file diff --git a/msvc2005/tools/python/tee.py b/msvc2005/tools/python/tee.py new file mode 100755 index 00000000..4bb28780 --- /dev/null +++ b/msvc2005/tools/python/tee.py @@ -0,0 +1,127 @@ +#!/usr/bin/python3 + +## +# tee.py +# This little script was an effort tsort the dependancies +# I don't actually need it because I've used depend.py to extract +# the dependency table from exiv2-webready.sln and pasted it into configure.py +## + +import os +import sys +import uuid +import optparse +import datetime +import platform +import xml.dom.minidom + +class GraphError(Exception): + pass + +def tsort(partials): + """ + Copyright Nathan Hurst 2001 + Licenced under the LGNU GPL. see COPYING for details. + """ + preds = {} + succs = {} + output = [] + distinct_value = (0,) # Julian Satchell suggested I use a unique + # identifier, rather than None as my sentinel + for i in partials: + prev = distinct_value; + for j in i: + if(not j in preds): + preds[j] = 0; + + if(not j in succs): + succs[j] = {}; + if(not prev is distinct_value): + if(not prev in succs): + succs[prev] = {}; + if(not j in succs[prev]): + succs[prev][j] = 1; + preds[j] = preds[j] + 1; + prev = j + + starts = list(map(lambda a: a[0], filter(lambda a: (a[1] == 0), preds.items()))) + while(len(starts) > 0): + start = starts[0] + starts = starts[1:] # prune off start + output = output + [start]; + for i in succs[start].keys(): + preds[i] = preds[i] - 1; + if(preds[i] == 0): + starts.append(i) + del succs[start]; + result=[] + for i in reversed(output): + result.append(i) + return result + +def empty(): + return set([]) + +ignore = set(['expat' , 'expat201' , 'expat210' , 'tests' , 'testv' + ,'zlib123' , 'zlib125' , 'zlib127' , 'tools' , 'exiv2lib' + ]) + +## +# build dict:uid - hunt the tree for .vcproj files +uid = {} +for d in os.listdir('.'): + if os.path.isdir(d) & (not d in ignore): + for root, dirs, files in os.walk(d): + for file in files: + ext = ".vcproj" + if file.endswith(ext) & (file.find('configure') < 0): + uid[d]=str(uuid.uuid1()) + + +externlib= set(['libcurl' , 'libexpat' , 'zlib' , 'libcurl' + ,'libeay32' , 'ssleay32' , 'libssh' , 'openssl' + ]) + + +## +# define project dependances +# TODO: read exiv-webready.sln to build project/dependency set +project = {} +# no dependancy +for p in externlib: + project[p]=empty() + +## +# dependancies +project['xmpparser-test' ] = set(['libexiv2','xmpsdk' ]) +project['xmpparse' ] = set(['libexiv2','xmpsdk' ]) +project['xmpsample' ] = set(['libexiv2','xmpsdk' ]) +project['xmpsdk' ] = set([ 'libexpat' ]) +project['geotag' ] = set([ 'libexpat','libexiv2']) +project['libexiv2' ] = set([ 'libexpat','xmpsdk' ,'zlib','libcurl','libeay32','ssleay32','libssh','openssl']) +project['libcurl' ] = set(['libeay32','ssleay32','libssh' ]) +project['libssh' ] = set(['libeay32','ssleay32','openssl' ]) +project['libeay32' ] = set(['openssl' ]) +project['ssleay32' ] = set(['openssl' ]) +project['openssl' ] = set(['libcurl' , 'libssh' ]) +project['libexiv2' ] = set(['openssl' ,'zlib','xmpsdk']) + +## +# all others depend on libexiv2 +for p in uid: + if not p in project: + project[p]=set(['libexiv2']) + +## +# tsort the dependencies +edges=[] +for p in project: + for d in project[p]: + edges.append([p,d]) + +print(edges) +print('-------------') +print(tsort(edges)) + +# That's all folks +##