Files
macports-ports/math/gmtl/files/SConstruct-clang.patch
Ryan Schmidt d10d2fa463 gmtl: Fix build issues
Add patches to fix build failures when using clang, when using the
latest version of scons, when scons is using python 3, and to prevent
the creation of the unwanted file gmtl-0.6.1.tar.gz and to install the
file gmtl.pc.

Add runtime dependencies on flagpoll and python which are used by
gmtl-config. flagpoll is currently incompatible with python 3 and uses
python27 so use the same python here to reduce the number of pythons
a user needs to install.

Specify absolute path to scons.

Specify prefix at build time so that build output does not give the
erroneous impression that files will be installed in /usr/local.

Specify empty directories for Boost and CppUnit at build time so that
any Boost or CppUnit that might be installed in /usr/local is not
inadvertently used.

No need to specify destroot.cmd or destroot.target; the defaults work.

Add modeline.

Modernize checksums.

Set platforms to any and set supported_archs to noarch because this port
doesn't install anything architecture- or OS-specific.

Add GitHub handle to maintainers line.

Install documentation files.

Indicate license. The software claims to be licensed LGPL-2.1+ but there
is also a license addendum that imposes additional restrictions and the
LGPL does not permit the imposition of additional restrictions.

Rewrite master_sites to avoid redirects.

Closes: https://trac.macports.org/ticket/57421
2023-03-28 02:21:07 -05:00

53 lines
1.8 KiB
Diff

Fixes for determining "GCC" version when compiler is clang.
https://sourceforge.net/p/ggt/bugs/28/
--- SConstruct.orig 2009-11-21 15:31:52.000000000 -0600
+++ SConstruct 2023-03-08 18:28:02.000000000 -0600
@@ -3,6 +3,7 @@
EnsureSConsVersion(0,96)
SConsignFile()
+from subprocess import Popen, PIPE
import os, string, sys
import re
import distutils.sysconfig
@@ -129,26 +126,28 @@
framework_opt = '-F' + m.group(1)
CXX = os.environ.get("CXX", WhereIs('g++'))
-
- ver_re = re.compile(r'gcc version ((\d+)\.(\d+)\.(\d+))')
- (gv_stdout, gv_stdin, gv_stderr) = os.popen3(CXX + ' -v')
- ver_str = gv_stderr.read()
-
- match_obj = ver_re.search(ver_str)
-
LINK = CXX
CXXFLAGS = ['-ftemplate-depth-256', '-DBOOST_PYTHON_DYNAMIC_LIB',
'-Wall', framework_opt, '-pipe']
- compiler_ver = match_obj.group(1)
- compiler_major_ver = int(match_obj.group(2))
- compiler_minor_ver = int(match_obj.group(3))
+ p = Popen([CXX, '-dM', '-E', '-x', 'c++', '-'], stdout=PIPE)
+ preprocessor_macros = p.stdout.read().decode('utf-8')
+
+ ver_re = re.compile(r'#define __GNUC__ (\d+)')
+ match_obj = ver_re.search(preprocessor_macros)
+ compiler_major_ver = int(match_obj.group(1))
+
+ ver_re = re.compile(r'#define __GNUC_MINOR__ (\d+)')
+ match_obj = ver_re.search(preprocessor_macros)
+ compiler_minor_ver = int(match_obj.group(1))
+
+ compiler_ver = f'{compiler_major_ver}.{compiler_minor_ver}'
# GCC 4.0 in Mac OS X 10.4 and newer does not have -fcoalesce-templates.
if compiler_major_ver < 4:
CXXFLAGS.append('-fcoalesce-templates')
else:
- if compiler_minor_ver < 2:
+ if compiler_major_ver == 4 and compiler_minor_ver < 2:
CXXFLAGS += ['-Wno-long-double', '-no-cpp-precomp']
SHLIBSUFFIX = distutils.sysconfig.get_config_var('SO')