Added versioning + removed shared library build (does not work because of C++ templates).

This commit is contained in:
Vincent Richard 2004-12-26 13:26:59 +00:00
parent 6246c53201
commit 51a37c62c0
2 changed files with 33 additions and 52 deletions

View File

@ -8,6 +8,8 @@ VERSION 0.6.1-cvs
* Added support for 'pkg-config'. * Added support for 'pkg-config'.
* Added versioning in library name (eg. libvmime-0.6.a).
2004-12-24 Vincent Richard <vincent@vincent-richard.net> 2004-12-24 Vincent Richard <vincent@vincent-richard.net>
* Renamed class 'disposition' to 'contentDisposition' and the enum * Renamed class 'disposition' to 'contentDisposition' and the enum

View File

@ -301,6 +301,12 @@ packageVersion = GetPackageVersion()
packageRealName = 'VMime' packageRealName = 'VMime'
packageDescription = 'VMime C++ Mail Library (http://vmime.sourceforge.net)' packageDescription = 'VMime C++ Mail Library (http://vmime.sourceforge.net)'
packageVersionMajor = re.compile('(\d+)\.(\d+)\.(\d+)', re.DOTALL).sub(r'\1', packageVersion)
packageVersionMinor = re.compile('(\d+)\.(\d+)\.(\d+)', re.DOTALL).sub(r'\2', packageVersion)
packageVersionRev = re.compile('(\d+)\.(\d+)\.(\d+)', re.DOTALL).sub(r'\3', packageVersion)
versionedPackageName = 'vmime-%d.%d' % (int(packageVersionMajor), int(packageVersionMinor))
############# #############
# Options # # Options #
@ -326,22 +332,6 @@ opts.AddOptions(
map = { }, map = { },
ignorecase = 1 ignorecase = 1
), ),
EnumOption(
'static',
'Build a static library (.a)',
'yes',
allowed_values = ('yes', 'no'),
map = { },
ignorecase = 1
),
EnumOption(
'shared',
'Build a shared library (.so)',
'no',
allowed_values = ('yes', 'no'),
map = { },
ignorecase = 1
),
EnumOption( EnumOption(
'with_messaging', 'with_messaging',
'Messaging support (connection to mail store/transport servers)', 'Messaging support (connection to mail store/transport servers)',
@ -497,8 +487,6 @@ print "| CONFIGURATION |"
print "+=================+" print "+=================+"
print "" print ""
print "Installation prefix : " + env['prefix'] print "Installation prefix : " + env['prefix']
print "Static library (.a) : " + env['static']
print "Shared library (.so) : " + env['shared']
print "Debugging mode : " + env['debug'] print "Debugging mode : " + env['debug']
print "Messaging support : " + env['with_messaging'] print "Messaging support : " + env['with_messaging']
if env['with_messaging'] == 'yes': if env['with_messaging'] == 'yes':
@ -681,35 +669,27 @@ for file in libvmime_full_sources:
libvmime_sources_HPP.append(buildDirectory + file) libvmime_sources_HPP.append(buildDirectory + file)
libvmime_install_includes.append([dir, buildDirectory + file]) libvmime_install_includes.append([dir, buildDirectory + file])
# HACK: SCons does not allow '.' in target name, so we have to
# detect the suffix for library name and add it ourself
libFoo = env.StaticLibrary(target = 'FOO', source = [])
libNameSuffix = '';
if str(libFoo[0]).rfind('.') != -1:
libNameSuffix = str(libFoo[0])[str(libFoo[0]).rfind('.'):]
# Main program build # Main program build
if env['debug'] == 'yes': if env['debug'] == 'yes':
if env['static'] == 'yes':
libVmime = env.StaticLibrary( libVmime = env.StaticLibrary(
target = 'vmime-debug', target = versionedPackageName + '-debug' + libNameSuffix,
source = libvmime_sources_CPP
)
if env['shared'] == 'yes':
libVmimeSh = env.SharedLibrary(
target = 'vmime-debug',
source = libvmime_sources_CPP source = libvmime_sources_CPP
) )
else: else:
if env['static'] == 'yes':
libVmime = env.StaticLibrary( libVmime = env.StaticLibrary(
target = 'vmime', target = versionedPackageName + libNameSuffix,
source = libvmime_sources_CPP source = libvmime_sources_CPP
) )
if env['shared'] == 'yes': Default(libVmime)
libVmimeSh = env.SharedLibrary(
target = 'vmime',
source = libvmime_sources_CPP
)
if env['static'] == 'yes': Default(libVmime)
if env['shared'] == 'yes': Default(libVmimeSh)
# Platform header files # Platform header files
@ -739,7 +719,7 @@ for platform in platforms:
sources_CPP.append(buildDirectory + file) sources_CPP.append(buildDirectory + file)
platformLib = env.StaticLibrary( platformLib = env.StaticLibrary(
target = 'vmime-' + platform, target = versionedPackageName + '-' + platform + libNameSuffix,
source = sources_CPP source = sources_CPP
) )
@ -762,7 +742,7 @@ if env['build_tests'] == 'yes':
env.Program( env.Program(
target = test[0], target = test[0],
source = test[1], source = test[1],
LIBS=['unit++', 'vmime-posix', 'vmime-debug'], LIBS=['unit++', versionedPackageName + '-posix', versionedPackageName + '-debug'],
LIBPATH=['.', './tests/'] LIBPATH=['.', './tests/']
) )
) )
@ -773,13 +753,12 @@ if env['build_tests'] == 'yes':
######################## ########################
libDir = "%s/lib" % env['prefix'] libDir = "%s/lib" % env['prefix']
includeDir = "%s/include/vmime" % env['prefix'] includeDir = "%s/include/%s/vmime" % (env['prefix'], versionedPackageName)
installPaths = [libDir, includeDir] installPaths = [libDir, includeDir]
# Library # Library
if env['static'] == 'yes': env.Install(libDir, libVmime) env.Install(libDir, libVmime)
if env['shared'] == 'yes': env.Install(libDir, libVmimeSh)
# Platform libraries # Platform libraries
for platformLib in platformLibraries: for platformLib in platformLibraries:
@ -793,7 +772,7 @@ for i in range(len(libvmime_install_includes)):
env.Install(includeDir, 'src/config.hpp') env.Install(includeDir, 'src/config.hpp')
# Pkg-config support # Pkg-config support
vmime_pc = open('vmime.pc', 'w') vmime_pc = open(versionedPackageName + ".pc", 'w')
vmime_pc.write("prefix=" + env['prefix'] + "\n") vmime_pc.write("prefix=" + env['prefix'] + "\n")
vmime_pc.write("exec_prefix=" + env['prefix'] + "\n") vmime_pc.write("exec_prefix=" + env['prefix'] + "\n")
@ -804,10 +783,10 @@ vmime_pc.write("Name: " + packageRealName + "\n")
vmime_pc.write("Description: " + packageDescription + "\n") vmime_pc.write("Description: " + packageDescription + "\n")
vmime_pc.write("Version: " + packageVersion + "\n") vmime_pc.write("Version: " + packageVersion + "\n")
vmime_pc.write("Requires:\n") vmime_pc.write("Requires:\n")
vmime_pc.write("Libs: -L${libdir} -lvmime-posix -lvmime\n") vmime_pc.write("Libs: -L${libdir} -l" + versionedPackageName + "-posix -l" + versionedPackageName + "\n")
vmime_pc.write("Cflags: -I${includedir}/vmime\n") vmime_pc.write("Cflags: -I${includedir}/" + versionedPackageName + "\n")
env.Install(libDir + "/pkgconfig", "vmime.pc") env.Install(libDir + "/pkgconfig", versionedPackageName + ".pc")
# Provide "install" target (ie. 'scons install') # Provide "install" target (ie. 'scons install')
env.Alias('install', installPaths) env.Alias('install', installPaths)
@ -819,7 +798,7 @@ env.Alias('install', installPaths)
# 'tar' is not available under Windows... # 'tar' is not available under Windows...
if not (os.name == 'win32' or os.name == 'nt'): if not (os.name == 'win32' or os.name == 'nt'):
packageFile = 'libvmime-' + packageVersion + '.tar.bz2' packageFile = packageName + '-' + packageVersion + '.tar.bz2'
env.Tar(packageFile, libvmime_dist_files) env.Tar(packageFile, libvmime_dist_files)