void-packages/srcpkgs/gpick/patches/scons-python3.patch
Đoàn Trần Công Danh e4a3a0afb2 gpick: build with new scons
Also build with -O2 -g --Wl,--as-needed
2020-10-25 11:47:50 +07:00

145 lines
4.8 KiB
Diff

diff --git SConscript SConscript
index 43f9857..6065023 100644
--- SConscript
+++ SConscript
@@ -48,7 +48,7 @@ env.AddCustomBuilders()
env.GetVersionInfo()
try:
- umask = os.umask(022)
+ umask = os.umask(0o22)
except OSError: # ignore on systems that don't support umask
pass
@@ -81,56 +81,20 @@ if not env.GetOption('clean'):
env = conf.Finish()
-if os.environ.has_key('CC'):
+if 'CC' in os.environ:
env['CC'] = os.environ['CC']
-if os.environ.has_key('CFLAGS'):
+
+if 'CFLAGS' in os.environ:
env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
-if os.environ.has_key('CXX'):
+if 'CXX' in os.environ:
env['CXX'] = os.environ['CXX']
-if os.environ.has_key('CXXFLAGS'):
+if 'CXXFLAGS' in os.environ:
env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
-if os.environ.has_key('LDFLAGS'):
+if 'LDFLAGS' in os.environ:
env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
Decider('MD5-timestamp')
-if not env['TOOLCHAIN'] == 'msvc':
- if not (os.environ.has_key('CFLAGS') or os.environ.has_key('CXXFLAGS') or os.environ.has_key('LDFLAGS')):
- if env['DEBUG']:
- env.Append(
- CPPFLAGS = ['-Wall', '-g3', '-O0'],
- CFLAGS = ['-Wall', '-g3', '-O0'],
- LINKFLAGS = ['-Wl,-as-needed'],
- )
- else:
- env.Append(
- CPPDEFINES = ['NDEBUG'],
- CDEFINES = ['NDEBUG'],
- CPPFLAGS = ['-Wall', '-O3'],
- CFLAGS = ['-Wall', '-O3'],
- LINKFLAGS = ['-Wl,-as-needed', '-s'],
- )
-
- if env['BUILD_TARGET'] == 'win32':
- env.Append(
- LINKFLAGS = ['-Wl,--enable-auto-import', '-static-libgcc', '-static-libstdc++'],
- CPPDEFINES = ['_WIN32_WINNT=0x0501'],
- )
-else:
- env['LINKCOM'] = [env['LINKCOM'], 'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;1']
- if env['DEBUG']:
- env.Append(
- CPPFLAGS = ['/Od', '/EHsc', '/MD', '/Gy', '/Zi', '/TP', '/wd4819'],
- CPPDEFINES = ['WIN32', '_DEBUG'],
- LINKFLAGS = ['/MANIFEST', '/DEBUG'],
- )
- else:
- env.Append(
- CPPFLAGS = ['/O2', '/Oi', '/GL', '/EHsc', '/MD', '/Gy', '/Zi', '/TP', '/wd4819'],
- CPPDEFINES = ['WIN32', 'NDEBUG'],
- LINKFLAGS = ['/MANIFEST', '/LTCG'],
- )
-
extern_libs = SConscript(['extern/SConscript'], exports='env')
executable, parser_files = SConscript(['source/SConscript'], exports='env')
diff --git source/SConscript source/SConscript
index b78bfb5..ca42710 100644
--- source/SConscript
+++ source/SConscript
@@ -50,6 +50,8 @@ if local_env['BUILD_TARGET'] == 'win32':
elif local_env['BUILD_TARGET'] == 'linux2':
local_env.Append(LIBS=['rt', 'expat'])
+local_env.Append(LIBS=['expat'])
+
executable = local_env.Program(
'gpick',
source = [sources, objects])
diff --git tools/gpick.py tools/gpick.py
index 29000a6..5aecfe8 100644
--- tools/gpick.py
+++ tools/gpick.py
@@ -9,10 +9,10 @@ import sys
import glob
import subprocess
-from lemon import *
-from flex import *
-from gettext import *
-from resource_template import *
+from .lemon import *
+from .flex import *
+from .gettext import *
+from .resource_template import *
from SCons.Script import *
from SCons.Util import *
@@ -79,9 +79,9 @@ class GpickEnvironment(SConsEnvironment):
def ConfirmPrograms(self, conf, programs):
conf.AddTests({'CheckProgram': CheckProgram})
- for evar, args in programs.iteritems():
+ for evar, args in programs.items():
found = False
- for name, member_name in args['checks'].iteritems():
+ for name, member_name in args['checks'].items():
if conf.CheckProgram(self, name, member_name):
found = True;
break
@@ -95,9 +95,9 @@ class GpickEnvironment(SConsEnvironment):
def ConfirmLibs(self, conf, libs):
conf.AddTests({'CheckPKG': CheckPKG})
- for evar, args in libs.iteritems():
+ for evar, args in libs.items():
found = False
- for name, version in args['checks'].iteritems():
+ for name, version in args['checks'].items():
if conf.CheckPKG(name + ' ' + version):
self[evar]=name
found = True;
@@ -127,9 +127,9 @@ class GpickEnvironment(SConsEnvironment):
self.AddPostAction(i, Chmod(i, perm))
return dir
- InstallProgram = lambda self, dir, source: GpickEnvironment.InstallPerm(self, dir, source, 0755)
- InstallData = lambda self, dir, source: GpickEnvironment.InstallPerm(self, dir, source, 0644)
- InstallDataAutoDir = lambda self, dir, relative_dir, source: GpickEnvironment.InstallPermAutoDir(self, dir, relative_dir, source, 0644)
+ InstallProgram = lambda self, dir, source: GpickEnvironment.InstallPerm(self, dir, source, 0o755)
+ InstallData = lambda self, dir, source: GpickEnvironment.InstallPerm(self, dir, source, 0o644)
+ InstallDataAutoDir = lambda self, dir, relative_dir, source: GpickEnvironment.InstallPermAutoDir(self, dir, relative_dir, source, 0o644)
def GetSourceFiles(self, dir_exclude_pattern, file_exclude_pattern):
dir_exclude_prog = re.compile(dir_exclude_pattern)