python: Explicitly add sqlite to cflags/ldflags
Fixes Homebrew/homebrew#15300 because sqlite is keg_only since a few days. Closes Homebrew/homebrew#17120. Signed-off-by: Adam Vandenberg <flangy@gmail.com>master
parent
4c0a33fe0d
commit
5eb71eb481
|
@ -74,8 +74,11 @@ class Python < Formula
|
||||||
args << '--without-gcc' if ENV.compiler == :clang
|
args << '--without-gcc' if ENV.compiler == :clang
|
||||||
args << '--with-dtrace' if build.include? 'with-dtrace'
|
args << '--with-dtrace' if build.include? 'with-dtrace'
|
||||||
|
|
||||||
distutils_fix_superenv(args)
|
if superenv?
|
||||||
distutils_fix_stdenv
|
distutils_fix_superenv(args)
|
||||||
|
else
|
||||||
|
distutils_fix_stdenv
|
||||||
|
end
|
||||||
|
|
||||||
if build.universal?
|
if build.universal?
|
||||||
ENV.universal_binary
|
ENV.universal_binary
|
||||||
|
@ -175,57 +178,53 @@ class Python < Formula
|
||||||
end
|
end
|
||||||
|
|
||||||
def distutils_fix_superenv(args)
|
def distutils_fix_superenv(args)
|
||||||
if superenv?
|
# To allow certain Python bindings to find brewed software:
|
||||||
# To allow certain Python bindings to find brewed software:
|
cflags = "CFLAGS=-I#{HOMEBREW_PREFIX}/include -I#{Formula.factory('sqlite').opt_prefix}/include"
|
||||||
cflags = "CFLAGS=-I#{HOMEBREW_PREFIX}/include"
|
ldflags = "LDFLAGS=-L#{HOMEBREW_PREFIX}/lib -L#{Formula.factory('sqlite').opt_prefix}/lib"
|
||||||
ldflags = "LDFLAGS=-L#{HOMEBREW_PREFIX}/lib"
|
unless MacOS::CLT.installed?
|
||||||
unless MacOS::CLT.installed?
|
# Help Python's build system (distribute/pip) to build things on Xcode-only systems
|
||||||
# Help Python's build system (distribute/pip) to build things on Xcode-only systems
|
# The setup.py looks at "-isysroot" to get the sysroot (and not at --sysroot)
|
||||||
# The setup.py looks at "-isysroot" to get the sysroot (and not at --sysroot)
|
cflags += " -isysroot #{MacOS.sdk_path}"
|
||||||
cflags += " -isysroot #{MacOS.sdk_path}"
|
ldflags += " -isysroot #{MacOS.sdk_path}"
|
||||||
ldflags += " -isysroot #{MacOS.sdk_path}"
|
# Same zlib.h-not-found-bug as in env :std (see below)
|
||||||
# Same zlib.h-not-found-bug as in env :std (see below)
|
args << "CPPFLAGS=-I#{MacOS.sdk_path}/usr/include"
|
||||||
args << "CPPFLAGS=-I#{MacOS.sdk_path}/usr/include"
|
# For the Xlib.h, Python needs this header dir with the system Tk
|
||||||
# For the Xlib.h, Python needs this header dir with the system Tk
|
unless build.include? 'with-brewed-tk'
|
||||||
unless build.include? 'with-brewed-tk'
|
cflags += " -I#{MacOS.sdk_path}/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers"
|
||||||
cflags += " -I#{MacOS.sdk_path}/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
args << cflags
|
|
||||||
args << ldflags
|
|
||||||
# Avoid linking to libgcc http://code.activestate.com/lists/python-dev/112195/
|
|
||||||
args << "MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}"
|
|
||||||
# We want our readline! This is just to outsmart the detection code,
|
|
||||||
# superenv handles that cc finds includes/libs!
|
|
||||||
inreplace "setup.py",
|
|
||||||
"do_readline = self.compiler.find_library_file(lib_dirs, 'readline')",
|
|
||||||
"do_readline = '#{HOMEBREW_PREFIX}/opt/readline/lib/libhistory.dylib'"
|
|
||||||
end
|
end
|
||||||
|
args << cflags
|
||||||
|
args << ldflags
|
||||||
|
# Avoid linking to libgcc http://code.activestate.com/lists/python-dev/112195/
|
||||||
|
args << "MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}"
|
||||||
|
# We want our readline! This is just to outsmart the detection code,
|
||||||
|
# superenv handles that cc finds includes/libs!
|
||||||
|
inreplace "setup.py",
|
||||||
|
"do_readline = self.compiler.find_library_file(lib_dirs, 'readline')",
|
||||||
|
"do_readline = '#{HOMEBREW_PREFIX}/opt/readline/lib/libhistory.dylib'"
|
||||||
end
|
end
|
||||||
|
|
||||||
def distutils_fix_stdenv()
|
def distutils_fix_stdenv()
|
||||||
if not superenv?
|
# Python scans all "-I" dirs but not "-isysroot", so we add
|
||||||
# Python scans all "-I" dirs but not "-isysroot", so we add
|
# the needed includes with "-I" here to avoid this err:
|
||||||
# the needed includes with "-I" here to avoid this err:
|
# building dbm using ndbm
|
||||||
# building dbm using ndbm
|
# error: /usr/include/zlib.h: No such file or directory
|
||||||
# error: /usr/include/zlib.h: No such file or directory
|
ENV.append 'CPPFLAGS', "-I#{MacOS.sdk_path}/usr/include" unless MacOS::CLT.installed?
|
||||||
ENV.append 'CPPFLAGS', "-I#{MacOS.sdk_path}/usr/include" unless MacOS::CLT.installed?
|
|
||||||
|
|
||||||
# Don't use optimizations other than "-Os" here, because Python's distutils
|
# Don't use optimizations other than "-Os" here, because Python's distutils
|
||||||
# remembers (hint: `python3-config --cflags`) and reuses them for C
|
# remembers (hint: `python3-config --cflags`) and reuses them for C
|
||||||
# extensions which can break software (such as scipy 0.11 fails when
|
# extensions which can break software (such as scipy 0.11 fails when
|
||||||
# "-msse4" is present.)
|
# "-msse4" is present.)
|
||||||
ENV.minimal_optimization
|
ENV.minimal_optimization
|
||||||
|
|
||||||
# We need to enable warnings because the configure.in uses -Werror to detect
|
# We need to enable warnings because the configure.in uses -Werror to detect
|
||||||
# "whether gcc supports ParseTuple" (https://github.com/mxcl/homebrew/issues/12194)
|
# "whether gcc supports ParseTuple" (https://github.com/mxcl/homebrew/issues/12194)
|
||||||
ENV.enable_warnings
|
ENV.enable_warnings
|
||||||
if ENV.compiler == :clang
|
if ENV.compiler == :clang
|
||||||
# http://docs.python.org/devguide/setup.html#id8 suggests to disable some Warnings.
|
# http://docs.python.org/devguide/setup.html#id8 suggests to disable some Warnings.
|
||||||
ENV.append_to_cflags '-Wno-unused-value'
|
ENV.append_to_cflags '-Wno-unused-value'
|
||||||
ENV.append_to_cflags '-Wno-empty-body'
|
ENV.append_to_cflags '-Wno-empty-body'
|
||||||
ENV.append_to_cflags '-Qunused-arguments'
|
ENV.append_to_cflags '-Qunused-arguments'
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -284,4 +283,4 @@ index 6b47451..b0400f8 100644
|
||||||
+ # return
|
+ # return
|
||||||
|
|
||||||
# Assume we haven't found any of the libraries or include files
|
# Assume we haven't found any of the libraries or include files
|
||||||
# The versions with dots are used on Unix, and the versions without
|
# The versions with dots are used on Unix, and the versions without
|
||||||
|
|
Loading…
Reference in New Issue