$NetBSD: patch-SConstruct,v 1.11 2023/06/06 10:55:13 wiz Exp $ Hack: Use OPENSSL variable as final shared library path; fixes lib id on Darwin. Don't append -O2 compiler flag. Don't special case sunos5 in naming shlibs Fix build with scons-3.x. --- SConstruct.orig 2015-09-17 12:46:24.000000000 +0000 +++ SConstruct @@ -111,6 +111,7 @@ opts.AddVariables( RawListVariable('CC', "Command name or path of the C compiler", None), RawListVariable('CFLAGS', "Extra flags for the C compiler (space-separated)", None), + RawListVariable('LDFLAGS', "Extra linker flags from pkgsrc", None), RawListVariable('LIBS', "Extra libraries passed to the linker, " "e.g. \"-l -l\" (space separated)", None), RawListVariable('LINKFLAGS', "Extra flags for the linker (space-separated)", @@ -152,7 +153,7 @@ if sys.platform == 'win32': True), ) -env = Environment(variables=opts, +env = Environment(variables=opts, ENV=os.environ, tools=('default', 'textfile',), CPPPATH=['.', ], ) @@ -215,8 +216,7 @@ incdir = '$PREFIX/include/serf-$MAJOR' # Unfortunately we can't set the .dylib compatibility_version option separately # from current_version, so don't use the PATCH level to avoid that build and # runtime patch levels have to be identical. -if sys.platform != 'sunos5': - env['SHLIBVERSION'] = '%d.%d.%d' % (MAJOR, MINOR, 0) +env['SHLIBVERSION'] = '%d.%d.%d' % (MAJOR, MINOR, 0) LIBNAME = 'libserf-%d' % (MAJOR,) if sys.platform != 'win32': @@ -257,7 +257,6 @@ if sys.platform != 'win32': env.Append(CCFLAGS=['-g']) env.Append(CPPDEFINES=['DEBUG', '_DEBUG']) else: - env.Append(CCFLAGS=['-O2']) env.Append(CPPDEFINES=['NDEBUG']) ### works for Mac OS. probably needs to change @@ -391,6 +390,11 @@ if sys.platform == 'win32': for d in env['LIBPATH']: env.Append(RPATH=':'+d) +for l in env['LDFLAGS']: + if l.startswith('-l'): + env.Append(LINKFLAGS=l) + env.Append(GSSAPI_LIBS=l) + # Set up the construction of serf-*.pc pkgconfig = env.Textfile('serf-%d.pc' % (MAJOR,), env.File('build/serf.pc.in'), @@ -429,7 +433,7 @@ if sys.platform == 'darwin': # make applications depend on the exact major.minor.patch version of serf. install_shared_path = install_shared[0].abspath - target_install_shared_path = os.path.join(libdir, '%s.dylib' % LIBNAME) + target_install_shared_path = os.path.join('$OPENSSL', '%s.dylib' % LIBNAME) env.AddPostAction(install_shared, ('install_name_tool -id %s %s' % (target_install_shared_path, install_shared_path)))