scons: Update to 4.9.1
Remove all the mingw specific code. We no longer used cygwin scons for building mingw packages, so just remove it. Also remove the explicit msys support and just patch the cygwin platform code instead, to simplify things.
This commit is contained in:
parent
c81fe40674
commit
98adfd8703
24
scons/0001-msysize.patch
Normal file
24
scons/0001-msysize.patch
Normal file
@ -0,0 +1,24 @@
|
||||
--- scons-4.9.1/SCons/Tool/cyglink.py.orig 2025-04-25 12:07:51.870163400 +0200
|
||||
+++ scons-4.9.1/SCons/Tool/cyglink.py 2025-04-25 12:07:59.542045300 +0200
|
||||
@@ -179,7 +179,7 @@
|
||||
|
||||
env['LINKFLAGS'] = CLVar('-Wl,-no-undefined')
|
||||
|
||||
- env['SHLIBPREFIX'] = 'cyg'
|
||||
+ env['SHLIBPREFIX'] = 'msys-'
|
||||
env['SHLIBSUFFIX'] = '.dll'
|
||||
|
||||
env['IMPLIBPREFIX'] = 'lib'
|
||||
--- scons-4.9.1/SCons/Platform/cygwin.py.orig 2024-09-22 03:25:14.000000000 +0200
|
||||
+++ scons-4.9.1/SCons/Platform/cygwin.py 2025-04-25 13:23:07.594688100 +0200
|
||||
@@ -43,6 +43,10 @@
|
||||
def generate(env) -> None:
|
||||
posix.generate(env)
|
||||
|
||||
+ import os, subprocess
|
||||
+ env['ENV']['PATH'] = os.getenv('PATH')
|
||||
+ env['SPAWN'] = (lambda sh, esc, cmd, args, env_param:
|
||||
+ subprocess.call(['sh', '-c', ' '.join(args)]))
|
||||
env['PROGPREFIX'] = ''
|
||||
env['PROGSUFFIX'] = '.exe'
|
||||
env['SHLIBPREFIX'] = ''
|
||||
@ -2,8 +2,8 @@
|
||||
# Contributor: Renato Silva <br.renatosilva@gmail.com>
|
||||
|
||||
pkgname=scons
|
||||
pkgver=3.1.2
|
||||
pkgrel=11
|
||||
pkgver=4.9.1
|
||||
pkgrel=1
|
||||
pkgdesc="Extensible Python-based build utility"
|
||||
arch=('any')
|
||||
url="https://scons.org/"
|
||||
@ -11,42 +11,33 @@ msys2_references=(
|
||||
"anitya: 4770"
|
||||
"purl: pkg:pypi/scons"
|
||||
)
|
||||
license=('MIT')
|
||||
license=('spdx:MIT')
|
||||
depends=('python')
|
||||
makedepends=('python-setuptools')
|
||||
source=("https://downloads.sourceforge.net/sourceforge/${pkgname}/${pkgname}-${pkgver}.tar.gz"
|
||||
scons-2.3.4-cyglink-msys2.patch
|
||||
scons-2.3.4-msys2-plat-mingw-env.patch
|
||||
mingw_w64.py)
|
||||
sha256sums=('7801f3f62f654528e272df780be10c0e9337e897650b62ddcee9f39fde13f8fb'
|
||||
'48e9ac05b18f123c179da0a7398b6a8e777bb309d4125b729855100119644ec4'
|
||||
'c024560dc93636d92614c17d7519080dd931f6c1471088616692a443d3cfc064'
|
||||
'984c55d0ca18ac594941bb6336fe994efe2f5bba20225e8cb1f5d42c80eaf651')
|
||||
makedepends=(
|
||||
'python-build'
|
||||
'python-installer'
|
||||
'python-setuptools'
|
||||
)
|
||||
source=("https://pypi.org/packages/source/${pkgname::1}/${pkgname}/${pkgname}-${pkgver}.tar.gz"
|
||||
"0001-msysize.patch")
|
||||
sha256sums=('bacac880ba2e86d6a156c116e2f8f2bfa82b257046f3ac2666c85c53c615c338'
|
||||
'67455ddb48cdd068daa6fb8c2cb0b35feaa0a64b0fb9bd0020d99b74ef399fd3')
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}/${pkgname}-${pkgver}"
|
||||
cp ../mingw_w64.py engine/SCons/Tool/
|
||||
cd "${pkgname}-${pkgver}"
|
||||
|
||||
# avoid errors when re-running makepkg
|
||||
rm -f engine/SCons/Platform/msys.py engine/SCons/Tool/msyslink.py
|
||||
patch -p1 -i ${srcdir}/scons-2.3.4-cyglink-msys2.patch
|
||||
patch -p0 -i ${srcdir}/scons-2.3.4-msys2-plat-mingw-env.patch
|
||||
patch -p1 -i "${srcdir}/0001-msysize.patch"
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "${pkgname}-${pkgver}"
|
||||
|
||||
python -m build --wheel --skip-dependency-check --no-isolation
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${srcdir}/${pkgname}-${pkgver}"
|
||||
cd "${pkgname}-${pkgver}"
|
||||
|
||||
/usr/bin/python setup.py install \
|
||||
--standard-lib \
|
||||
--prefix=/usr \
|
||||
--install-data=/usr/share \
|
||||
--optimize=1 \
|
||||
--root="${pkgdir}"
|
||||
|
||||
# Fix shebang
|
||||
sed -i 's:^#!.*bin/env python:#!/usr/bin/python:' \
|
||||
"${pkgdir}"/usr/bin/*
|
||||
|
||||
install -Dm644 LICENSE.txt \
|
||||
"${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
|
||||
python -m installer --destdir="${pkgdir}" dist/*.whl
|
||||
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
|
||||
}
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
"""SCons.Tool.mingw_w64
|
||||
|
||||
Tool-specific initialization for MinGW-w64 (http://mingw-w64.sourceforge.net)
|
||||
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2015 Renato Silva
|
||||
# This module is based on SCons.Tool.mingw and is licensed under the same terms
|
||||
#
|
||||
|
||||
__revision__ = "unknown"
|
||||
from SCons.Tool.mingw import *
|
||||
import SCons.Tool.mingw
|
||||
import SCons.Util
|
||||
|
||||
def find(env):
|
||||
path = env.WhereIs('gcc')
|
||||
if (path):
|
||||
return path
|
||||
return SCons.Util.WhereIs('gcc')
|
||||
@ -1,411 +0,0 @@
|
||||
--- scons-3.1.2.orig/engine/SCons/Platform/__init__.py 2019-12-17 03:07:12.000000000 +0100
|
||||
+++ scons-3.1.2/engine/SCons/Platform/__init__.py 2021-05-13 11:44:15.899865900 +0200
|
||||
@@ -69,7 +69,7 @@
|
||||
osname = os._osType
|
||||
if osname == 'posix':
|
||||
if sys.platform == 'cygwin':
|
||||
- return 'cygwin'
|
||||
+ return 'msys'
|
||||
elif sys.platform.find('irix') != -1:
|
||||
return 'irix'
|
||||
elif sys.platform.find('sunos') != -1:
|
||||
diff -Naur scons-2.3.4-orig/engine/SCons/Platform/msys.py scons-2.3.4/engine/SCons/Platform/msys.py
|
||||
--- /dev/null 2020-02-13 15:28:59.000000000 +0100
|
||||
+++ scons-3.1.2/engine/SCons/Platform/msys.py 2020-02-13 15:28:52.358387400 +0100
|
||||
@@ -0,0 +1,60 @@
|
||||
+"""SCons.Platform.msys
|
||||
+
|
||||
+Platform-specific initialization for MSYS systems.
|
||||
+
|
||||
+There normally shouldn't be any need to import this module directly. It
|
||||
+will usually be imported through the generic SCons.Platform.Platform()
|
||||
+selection method.
|
||||
+"""
|
||||
+
|
||||
+#
|
||||
+# Copyright (c) 2001 - 2019 The SCons Foundation
|
||||
+#
|
||||
+# Permission is hereby granted, free of charge, to any person obtaining
|
||||
+# a copy of this software and associated documentation files (the
|
||||
+# "Software"), to deal in the Software without restriction, including
|
||||
+# without limitation the rights to use, copy, modify, merge, publish,
|
||||
+# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
+# permit persons to whom the Software is furnished to do so, subject to
|
||||
+# the following conditions:
|
||||
+#
|
||||
+# The above copyright notice and this permission notice shall be included
|
||||
+# in all copies or substantial portions of the Software.
|
||||
+#
|
||||
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
||||
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+#
|
||||
+
|
||||
+__revision__ = "src/engine/SCons/Platform/cygwin.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
|
||||
+
|
||||
+import os, subprocess
|
||||
+from . import posix
|
||||
+from SCons.Platform import TempFileMunge
|
||||
+
|
||||
+def generate(env):
|
||||
+ posix.generate(env)
|
||||
+
|
||||
+ env['ENV']['PATH'] = os.getenv('PATH')
|
||||
+ env['SPAWN'] = (lambda sh, esc, cmd, args, env_param:
|
||||
+ subprocess.call(['sh', '-c', ' '.join(args)]))
|
||||
+ env['PROGPREFIX'] = ''
|
||||
+ env['PROGSUFFIX'] = '.exe'
|
||||
+ env['SHLIBPREFIX'] = ''
|
||||
+ env['SHLIBSUFFIX'] = '.dll'
|
||||
+ env['LIBPREFIXES'] = [ '$LIBPREFIX', '$SHLIBPREFIX', '$IMPLIBPREFIX' ]
|
||||
+ env['LIBSUFFIXES'] = [ '$LIBSUFFIX', '$SHLIBSUFFIX', '$IMPLIBSUFFIX' ]
|
||||
+ env['TEMPFILE'] = TempFileMunge
|
||||
+ env['TEMPFILEPREFIX'] = '@'
|
||||
+ env['MAXLINELENGTH'] = 2048
|
||||
+
|
||||
+# Local Variables:
|
||||
+# tab-width:4
|
||||
+# indent-tabs-mode:nil
|
||||
+# End:
|
||||
+# vim: set expandtab tabstop=4 shiftwidth=4:
|
||||
+
|
||||
diff -Naur scons-2.3.4-orig/engine/SCons/Script/Main.py scons-2.3.4/engine/SCons/Script/Main.py
|
||||
--- scons-2.3.4-orig/engine/SCons/Script/Main.py 2014-09-27 19:51:48.000000000 +0300
|
||||
+++ scons-2.3.4/engine/SCons/Script/Main.py 2014-11-05 01:00:42.034000000 +0300
|
||||
@@ -770,7 +770,7 @@
|
||||
def homedir(d):
|
||||
return os.path.expanduser('~/'+d)
|
||||
|
||||
- if platform == 'win32' or platform == 'cygwin':
|
||||
+ if platform == 'win32' or platform == 'cygwin' or platform == 'msys':
|
||||
# Note we use $ here instead of %...% because older
|
||||
# pythons (prior to 2.6?) didn't expand %...% on Windows.
|
||||
# This set of dirs should work on XP, Vista, 7 and later.
|
||||
diff -Naur scons-2.3.4-orig/engine/SCons/Tool/__init__.py scons-2.3.4/engine/SCons/Tool/__init__.py
|
||||
--- scons-2.3.4-orig/engine/SCons/Tool/__init__.py 2014-09-27 19:51:48.000000000 +0300
|
||||
+++ scons-2.3.4/engine/SCons/Tool/__init__.py 2014-11-05 01:00:42.034000000 +0300
|
||||
@@ -1249,6 +1249,14 @@
|
||||
c_compilers = ['gcc', 'msvc', 'intelc', 'icc', 'cc']
|
||||
cxx_compilers = ['g++', 'msvc', 'intelc', 'icc', 'c++']
|
||||
assemblers = ['gas', 'nasm', 'masm']
|
||||
+ fortran_compilers = ['gfortran', 'g77', 'ifort', 'ifl', 'f95', 'f90', 'f77']
|
||||
+ ars = ['ar', 'mslib']
|
||||
+ elif str(platform) == 'msys':
|
||||
+ "prefer GNU tools on MSYS, except for a platform-specific linker"
|
||||
+ linkers = ['msyslink', 'mslink', 'ilink']
|
||||
+ c_compilers = ['gcc', 'msvc', 'intelc', 'icc', 'cc']
|
||||
+ cxx_compilers = ['g++', 'msvc', 'intelc', 'icc', 'cxx']
|
||||
+ assemblers = ['gas', 'nasm', 'masm']
|
||||
fortran_compilers = ['gfortran', 'g77', 'ifort', 'ifl', 'f95', 'f90', 'f77']
|
||||
ars = ['ar', 'mslib']
|
||||
else:
|
||||
diff -Naur scons-2.3.4-orig/engine/SCons/Tool/g77.py scons-2.3.4/engine/SCons/Tool/g77.py
|
||||
--- scons-2.3.4-orig/engine/SCons/Tool/g77.py 2014-09-27 19:51:48.000000000 +0300
|
||||
+++ scons-2.3.4/engine/SCons/Tool/g77.py 2014-11-05 01:00:42.049600000 +0300
|
||||
@@ -44,7 +44,7 @@
|
||||
add_f77_to_env(env)
|
||||
|
||||
fcomp = env.Detect(compilers) or 'g77'
|
||||
- if env['PLATFORM'] in ['cygwin', 'win32']:
|
||||
+ if env['PLATFORM'] in ['cygwin', 'msys', 'win32']:
|
||||
env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS')
|
||||
env['SHF77FLAGS'] = SCons.Util.CLVar('$F77FLAGS')
|
||||
else:
|
||||
diff -Naur scons-2.3.4-orig/engine/SCons/Tool/gcc.py scons-2.3.4/engine/SCons/Tool/gcc.py
|
||||
--- scons-2.3.4-orig/engine/SCons/Tool/gcc.py 2014-09-27 19:51:48.000000000 +0300
|
||||
+++ scons-2.3.4/engine/SCons/Tool/gcc.py 2014-11-05 01:00:42.049600000 +0300
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
cc.generate(env)
|
||||
|
||||
- if env['PLATFORM'] in ['cygwin', 'win32']:
|
||||
+ if env['PLATFORM'] in ['cygwin', 'msys', 'win32']:
|
||||
env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS')
|
||||
else:
|
||||
env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS -fPIC')
|
||||
diff -Naur scons-2.3.4-orig/engine/SCons/Tool/gfortran.py scons-2.3.4/engine/SCons/Tool/gfortran.py
|
||||
--- scons-2.3.4-orig/engine/SCons/Tool/gfortran.py 2014-09-27 19:51:48.000000000 +0300
|
||||
+++ scons-2.3.4/engine/SCons/Tool/gfortran.py 2014-11-05 01:00:42.049600000 +0300
|
||||
@@ -46,7 +46,7 @@
|
||||
for dialect in ['F77', 'F90', 'FORTRAN', 'F95', 'F03', 'F08']:
|
||||
env['%s' % dialect] = 'gfortran'
|
||||
env['SH%s' % dialect] = '$%s' % dialect
|
||||
- if env['PLATFORM'] in ['cygwin', 'win32']:
|
||||
+ if env['PLATFORM'] in ['cygwin', 'msys', 'win32']:
|
||||
env['SH%sFLAGS' % dialect] = SCons.Util.CLVar('$%sFLAGS' % dialect)
|
||||
else:
|
||||
env['SH%sFLAGS' % dialect] = SCons.Util.CLVar('$%sFLAGS -fPIC' % dialect)
|
||||
--- a/engine/SCons/Tool/hpcxx.py.orig 2017-11-14 22:16:57.000000000 +0100
|
||||
+++ b/engine/SCons/Tool/hpcxx.py 2018-06-17 18:57:36.738460100 +0200
|
||||
@@ -72,7 +72,7 @@
|
||||
if line.find('aCC: HP ANSI C++') == 0:
|
||||
env['CXXVERSION'] = line.split()[-1]
|
||||
|
||||
- if env['PLATFORM'] == 'cygwin':
|
||||
+ if env['PLATFORM'] == 'cygwin' or env['PLATFORM'] == 'msys':
|
||||
env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS')
|
||||
else:
|
||||
env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS +Z')
|
||||
diff -Naur /dev/null scons-3.0.4/engine/SCons/Tool/msyslink.py
|
||||
--- /dev/null 2020-02-13 15:20:14.000000000 +0100
|
||||
+++ scons-3.1.2/engine/SCons/Tool/msyslink.py 2020-02-13 14:13:48.506525300 +0100
|
||||
@@ -0,0 +1,236 @@
|
||||
+"""SCons.Tool.msyslink
|
||||
+
|
||||
+Customization of gnulink for MSYS
|
||||
+
|
||||
+There normally shouldn't be any need to import this module directly.
|
||||
+It will usually be imported through the generic SCons.Tool.Tool()
|
||||
+selection method.
|
||||
+
|
||||
+"""
|
||||
+
|
||||
+from __future__ import absolute_import, print_function
|
||||
+
|
||||
+import re
|
||||
+import os
|
||||
+
|
||||
+import SCons.Action
|
||||
+import SCons.Util
|
||||
+import SCons.Tool
|
||||
+
|
||||
+#MAYBE: from . import gnulink
|
||||
+from . import gnulink
|
||||
+from . import link
|
||||
+
|
||||
+def _lib_generator(target, source, env, for_signature, **kw):
|
||||
+ try: cmd = kw['cmd']
|
||||
+ except KeyError: cmd = SCons.Util.CLVar(['$SHLINK'])
|
||||
+
|
||||
+ try: vp = kw['varprefix']
|
||||
+ except KeyError: vp = 'SHLIB'
|
||||
+
|
||||
+ dll = env.FindIxes(target, '%sPREFIX' % vp, '%sSUFFIX' % vp)
|
||||
+ if dll: cmd.extend(['-o', dll])
|
||||
+
|
||||
+ cmd.extend(['$SHLINKFLAGS', '$__%sVERSIONFLAGS' % vp, '$__RPATH'])
|
||||
+
|
||||
+ implib = env.FindIxes(target, 'IMPLIBPREFIX', 'IMPLIBSUFFIX')
|
||||
+ if implib:
|
||||
+ cmd.extend([
|
||||
+ '-Wl,--out-implib='+implib.get_string(for_signature),
|
||||
+ '-Wl,--export-all-symbols',
|
||||
+ '-Wl,--enable-auto-import',
|
||||
+ '-Wl,--whole-archive', '$SOURCES',
|
||||
+ '-Wl,--no-whole-archive', '$_LIBDIRFLAGS', '$_LIBFLAGS'
|
||||
+ ])
|
||||
+ else:
|
||||
+ cmd.extend(['$SOURCES', '$_LIBDIRFLAGS', '$_LIBFLAGS'])
|
||||
+
|
||||
+ return [cmd]
|
||||
+
|
||||
+
|
||||
+def shlib_generator(target, source, env, for_signature):
|
||||
+ return _lib_generator(target, source, env, for_signature,
|
||||
+ varprefix='SHLIB',
|
||||
+ cmd = SCons.Util.CLVar(['$SHLINK']))
|
||||
+
|
||||
+def ldmod_generator(target, source, env, for_signature):
|
||||
+ return _lib_generator(target, source, env, for_signature,
|
||||
+ varprefix='LDMODULE',
|
||||
+ cmd = SCons.Util.CLVar(['$LDMODULE']))
|
||||
+
|
||||
+def _lib_emitter(target, source, env, **kw):
|
||||
+ Verbose = False
|
||||
+
|
||||
+ if Verbose:
|
||||
+ print("_lib_emitter: target[0]=%r" % target[0].get_path())
|
||||
+
|
||||
+ try: vp = kw['varprefix']
|
||||
+ except KeyError: vp = 'SHLIB'
|
||||
+
|
||||
+ try: libtype = kw['libtype']
|
||||
+ except KeyError: libtype = 'ShLib'
|
||||
+
|
||||
+ dll = env.FindIxes(target, '%sPREFIX' % vp, '%sSUFFIX' % vp)
|
||||
+ no_import_lib = env.get('no_import_lib', 0)
|
||||
+
|
||||
+ if Verbose:
|
||||
+ print("_lib_emitter: dll=%r" % dll.get_path())
|
||||
+
|
||||
+ if not dll or len(target) > 1:
|
||||
+ raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s" % env.subst("$%sSUFFIX" % vp))
|
||||
+
|
||||
+ # Remove any "lib" after the prefix
|
||||
+ pre = env.subst('$%sPREFIX' % vp)
|
||||
+ if dll.name[len(pre):len(pre)+3] == 'lib':
|
||||
+ dll.name = pre + dll.name[len(pre)+3:]
|
||||
+
|
||||
+ if Verbose:
|
||||
+ print("_lib_emitter: dll.name=%r" % dll.name)
|
||||
+
|
||||
+ orig_target = target
|
||||
+ target = [env.fs.File(dll)]
|
||||
+ target[0].attributes.shared = 1
|
||||
+
|
||||
+ if Verbose:
|
||||
+ print("_lib_emitter: after target=[env.fs.File(dll)]: target[0]=%r" % target[0].get_path())
|
||||
+
|
||||
+ # Append an import lib target
|
||||
+ if not no_import_lib:
|
||||
+ # Create list of target libraries as strings
|
||||
+ target_strings = env.ReplaceIxes(orig_target[0],
|
||||
+ '%sPREFIX' % vp, '%sSUFFIX' % vp,
|
||||
+ 'IMPLIBPREFIX', 'IMPLIBSUFFIX')
|
||||
+ if Verbose:
|
||||
+ print("_lib_emitter: target_strings=%r" % target_strings)
|
||||
+
|
||||
+ implib_target = env.fs.File(target_strings)
|
||||
+ if Verbose:
|
||||
+ print("_lib_emitter: implib_target=%r" % implib_target.get_path())
|
||||
+ implib_target.attributes.shared = 1
|
||||
+ target.append(implib_target)
|
||||
+
|
||||
+ symlinks = SCons.Tool.ImpLibSymlinkGenerator(env, implib_target,
|
||||
+ implib_libtype=libtype,
|
||||
+ generator_libtype=libtype+'ImpLib')
|
||||
+ if Verbose:
|
||||
+ print("_lib_emitter: implib symlinks=%r" % SCons.Tool.StringizeLibSymlinks(symlinks))
|
||||
+ if symlinks:
|
||||
+ SCons.Tool.EmitLibSymlinks(env, symlinks, implib_target, clean_targets = target[0])
|
||||
+ implib_target.attributes.shliblinks = symlinks
|
||||
+
|
||||
+ return (target, source)
|
||||
+
|
||||
+def shlib_emitter(target, source, env):
|
||||
+ return _lib_emitter(target, source, env, varprefix='SHLIB', libtype='ShLib')
|
||||
+
|
||||
+def ldmod_emitter(target, source, env):
|
||||
+ return _lib_emitter(target, source, env, varprefix='LDMODULE', libtype='LdMod')
|
||||
+
|
||||
+def _versioned_lib_suffix(env, suffix, version):
|
||||
+ """Generate versioned shared library suffix from a unversioned one.
|
||||
+ If suffix='.dll', and version='0.1.2', then it returns '-0-1-2.dll'"""
|
||||
+ Verbose = False
|
||||
+ if Verbose:
|
||||
+ print("_versioned_lib_suffix: suffix= ", suffix)
|
||||
+ print("_versioned_lib_suffix: version= ", version)
|
||||
+ msysversion = re.sub('\.', '-', version)
|
||||
+ if not suffix.startswith('-' + msysversion):
|
||||
+ suffix = '-' + msysversion + suffix
|
||||
+ if Verbose:
|
||||
+ print("_versioned_lib_suffix: return suffix= ", suffix)
|
||||
+ return suffix
|
||||
+
|
||||
+def _versioned_implib_name(env, libnode, version, prefix, suffix, **kw):
|
||||
+ return link._versioned_lib_name(env, libnode, version, prefix, suffix,
|
||||
+ SCons.Tool.ImpLibPrefixGenerator,
|
||||
+ SCons.Tool.ImpLibSuffixGenerator,
|
||||
+ implib_libtype=kw['libtype'])
|
||||
+
|
||||
+def _versioned_implib_symlinks(env, libnode, version, prefix, suffix, **kw):
|
||||
+ """Generate link names that should be created for a versioned shared library.
|
||||
+ Returns a list in the form [ (link, linktarget), ... ]
|
||||
+ """
|
||||
+ Verbose = False
|
||||
+
|
||||
+ if Verbose:
|
||||
+ print("_versioned_implib_symlinks: libnode=%r" % libnode.get_path())
|
||||
+ print("_versioned_implib_symlinks: version=%r" % version)
|
||||
+
|
||||
+ try: libtype = kw['libtype']
|
||||
+ except KeyError: libtype = 'ShLib'
|
||||
+
|
||||
+
|
||||
+ linkdir = os.path.dirname(libnode.get_path())
|
||||
+ if Verbose:
|
||||
+ print("_versioned_implib_symlinks: linkdir=%r" % linkdir)
|
||||
+
|
||||
+ name = SCons.Tool.ImpLibNameGenerator(env, libnode,
|
||||
+ implib_libtype=libtype,
|
||||
+ generator_libtype=libtype+'ImpLib')
|
||||
+ if Verbose:
|
||||
+ print("_versioned_implib_symlinks: name=%r" % name)
|
||||
+
|
||||
+ major = version.split('.')[0]
|
||||
+
|
||||
+ link0 = env.fs.File(os.path.join(linkdir, name))
|
||||
+ symlinks = [(link0, libnode)]
|
||||
+
|
||||
+ if Verbose:
|
||||
+ print("_versioned_implib_symlinks: return symlinks=%r" % SCons.Tool.StringizeLibSymlinks(symlinks))
|
||||
+
|
||||
+ return symlinks
|
||||
+
|
||||
+shlib_action = SCons.Action.Action(shlib_generator, generator=1)
|
||||
+ldmod_action = SCons.Action.Action(ldmod_generator, generator=1)
|
||||
+
|
||||
+def generate(env):
|
||||
+ """Add Builders and construction variables for msyslink to an Environment."""
|
||||
+ gnulink.generate(env)
|
||||
+
|
||||
+ env['LINKFLAGS'] = SCons.Util.CLVar('-Wl,-no-undefined')
|
||||
+
|
||||
+ env['SHLINKCOM'] = shlib_action
|
||||
+ env['LDMODULECOM'] = ldmod_action
|
||||
+ env.Append(SHLIBEMITTER = [shlib_emitter])
|
||||
+ env.Append(LDMODULEEMITTER = [ldmod_emitter])
|
||||
+
|
||||
+ env['SHLIBPREFIX'] = 'msys-'
|
||||
+ env['SHLIBSUFFIX'] = '.dll'
|
||||
+
|
||||
+ env['IMPLIBPREFIX'] = 'lib'
|
||||
+ env['IMPLIBSUFFIX'] = '.dll.a'
|
||||
+
|
||||
+ # Variables used by versioned shared libraries
|
||||
+ env['_SHLIBVERSIONFLAGS'] = '$SHLIBVERSIONFLAGS'
|
||||
+ env['_LDMODULEVERSIONFLAGS'] = '$LDMODULEVERSIONFLAGS'
|
||||
+
|
||||
+ # SHLIBVERSIONFLAGS and LDMODULEVERSIONFLAGS are same as in gnulink...
|
||||
+
|
||||
+ # LINKCALLBACKS are NOT inherited from gnulink
|
||||
+ env['LINKCALLBACKS'] = {
|
||||
+ 'VersionedShLibSuffix' : _versioned_lib_suffix,
|
||||
+ 'VersionedLdModSuffix' : _versioned_lib_suffix,
|
||||
+ 'VersionedImpLibSuffix' : _versioned_lib_suffix,
|
||||
+ 'VersionedShLibName' : link._versioned_shlib_name,
|
||||
+ 'VersionedLdModName' : link._versioned_ldmod_name,
|
||||
+ 'VersionedShLibImpLibName' : lambda *args: _versioned_implib_name(*args, libtype='ShLib'),
|
||||
+ 'VersionedLdModImpLibName' : lambda *args: _versioned_implib_name(*args, libtype='LdMod'),
|
||||
+ 'VersionedShLibImpLibSymlinks' : lambda *args: _versioned_implib_symlinks(*args, libtype='ShLib'),
|
||||
+ 'VersionedLdModImpLibSymlinks' : lambda *args: _versioned_implib_symlinks(*args, libtype='LdMod'),
|
||||
+ }
|
||||
+
|
||||
+ # these variables were set by gnulink but are not used in msyslink
|
||||
+ try: del env['_SHLIBSONAME']
|
||||
+ except KeyError: pass
|
||||
+ try: del env['_LDMODULESONAME']
|
||||
+ except KeyError: pass
|
||||
+
|
||||
+def exists(env):
|
||||
+ return gnulink.exists(env)
|
||||
+
|
||||
+
|
||||
+# Local Variables:
|
||||
+# tab-width:4
|
||||
+# indent-tabs-mode:nil
|
||||
+# End:
|
||||
+# vim: set expandtab tabstop=4 shiftwidth=4:
|
||||
diff -Naur scons-2.3.4-orig/MANIFEST scons-2.3.4/MANIFEST
|
||||
--- scons-2.3.4-orig/MANIFEST 2014-09-27 19:52:20.000000000 +0300
|
||||
+++ scons-2.3.4/MANIFEST 2014-11-05 01:00:42.065200000 +0300
|
||||
@@ -31,6 +31,7 @@
|
||||
engine/SCons/Platform/hpux.py
|
||||
engine/SCons/Platform/irix.py
|
||||
engine/SCons/Platform/mingw.py
|
||||
+engine/SCons/Platform/msys.py
|
||||
engine/SCons/Platform/os2.py
|
||||
engine/SCons/Platform/posix.py
|
||||
engine/SCons/Platform/sunos.py
|
||||
@@ -139,6 +141,7 @@
|
||||
engine/SCons/Tool/mssdk.py
|
||||
engine/SCons/Tool/msvc.py
|
||||
engine/SCons/Tool/msvs.py
|
||||
+engine/SCons/Tool/msyslink.py
|
||||
engine/SCons/Tool/mwcc.py
|
||||
engine/SCons/Tool/mwld.py
|
||||
engine/SCons/Tool/nasm.py
|
||||
@ -1,24 +0,0 @@
|
||||
--- engine/SCons/Platform/msys.py.orig 2015-05-06 15:26:45.478712800 +0200
|
||||
+++ engine/SCons/Platform/msys.py 2015-05-06 15:33:07.915575600 +0200
|
||||
@@ -38,6 +38,21 @@
|
||||
def generate(env):
|
||||
posix.generate(env)
|
||||
|
||||
+ # (copied from win32.py, for when msys2 scons is used for building mingw packages)
|
||||
+ # Import things from the external environment to the construction
|
||||
+ # environment's ENV. This is a potential slippery slope, because we
|
||||
+ # *don't* want to make builds dependent on the user's environment by
|
||||
+ # default. We're doing this for SystemRoot, though, because it's
|
||||
+ # needed for anything that uses sockets, and seldom changes, and
|
||||
+ # for SystemDrive because it's related.
|
||||
+ #
|
||||
+ # Weigh the impact carefully before adding other variables to this list.
|
||||
+ import_env = [ 'SystemDrive', 'SystemRoot', 'TEMP', 'TMP' ]
|
||||
+ for var in import_env:
|
||||
+ v = os.environ.get(var)
|
||||
+ if v:
|
||||
+ env['ENV'][var] = v
|
||||
+
|
||||
env['ENV']['PATH'] = os.getenv('PATH')
|
||||
env['SPAWN'] = (lambda sh, esc, cmd, args, env_param:
|
||||
subprocess.call(['sh', '-c', ' '.join(args)]))
|
||||
Loading…
x
Reference in New Issue
Block a user