|
From db0014657a52a44d5eef8ac983694483e7d3b990 Mon Sep 17 00:00:00 2001 |
|
From: Pietras <[email protected]> |
|
Date: Tue, 11 Aug 2015 15:06:29 +0200 |
|
Subject: [PATCH 1/2] oldbp |
|
|
|
--- |
|
Library/Formula/boost-python.rb | 59 ++++++++++++++++++++++++----------------- |
|
1 file changed, 34 insertions(+), 25 deletions(-) |
|
|
|
diff --git a/Library/Formula/boost-python.rb b/Library/Formula/boost-python.rb |
|
index d3610e6..b95ddc0 100644 |
|
--- a/Library/Formula/boost-python.rb |
|
+++ b/Library/Formula/boost-python.rb |
|
@@ -1,31 +1,40 @@ |
|
+class UniversalPython < Requirement |
|
+ satisfy(:build_env => false) { archs_for_command("python").universal? } |
|
+ |
|
+ def message; <<-EOS.undent |
|
+ A universal build was requested, but Python is not a universal build |
|
+ |
|
+ Boost compiles against the Python it finds in the path; if this Python |
|
+ is not a universal build then linking will likely fail. |
|
+ EOS |
|
+ end |
|
+end |
|
+ |
|
+class UniversalPython3 < Requirement |
|
+ satisfy(:build_env => false) { archs_for_command("python3").universal? } |
|
+ |
|
+ def message; <<-EOS.undent |
|
+ A universal build was requested, but Python 3 is not a universal build |
|
+ |
|
+ Boost compiles against the Python 3 it finds in the path; if this Python |
|
+ is not a universal build then linking will likely fail. |
|
+ EOS |
|
+ end |
|
+end |
|
+ |
|
class BoostPython < Formula |
|
- desc "C++ library for C++/Python interoperability" |
|
homepage "http://www.boost.org" |
|
- url "https://downloads.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.tar.bz2" |
|
- sha256 "fdfc204fc33ec79c99b9a74944c3e54bd78be4f7f15e260c0e2700a36dc7d3e5" |
|
+ url "https://downloads.sourceforge.net/project/boost/boost/1.57.0/boost_1_57_0.tar.bz2" |
|
+ sha1 "e151557ae47afd1b43dc3fac46f8b04a8fe51c12" |
|
head "https://github.com/boostorg/boost.git" |
|
|
|
- stable do |
|
- # don't explicitly link a Python framework |
|
- # https://github.com/boostorg/build/pull/78 |
|
- patch do |
|
- url "https://gist.githubusercontent.com/tdsmith/9026da299ac1bfd3f419/raw/b73a919c38af08941487ca37d46e711864104c4d/boost-python.diff" |
|
- sha256 "9f374761ada11eecd082e7f9d5b80efeb387039d3a290f45b61f0730bce3801a" |
|
- end |
|
- end |
|
- |
|
- bottle do |
|
- cellar :any |
|
- sha256 "7f627fb1887ecaaea4b6b363d300a21c5274a1607c7dc64f2114d3794b5fec11" => :yosemite |
|
- sha256 "6239719b00615abb9ce2bd40c680b14182325c2e1844c1bea410c002b42ce1db" => :mavericks |
|
- sha256 "24acf2ddde1edfabe04239856dec6ce85e8652f3c0d5d8cf357b219c2bf3272a" => :mountain_lion |
|
- end |
|
- |
|
option :universal |
|
option :cxx11 |
|
|
|
- option "without-python", "Build without python 2 support" |
|
+ depends_on :python => :recommended |
|
depends_on :python3 => :optional |
|
+ depends_on UniversalPython if build.universal? and build.with? "python" |
|
+ depends_on UniversalPython3 if build.universal? and build.with? "python3" |
|
|
|
if build.cxx11? |
|
depends_on "boost" => "c++11" |
|
@@ -105,12 +114,12 @@ class BoostPython < Formula |
|
boost::python::def("greet", greet); |
|
} |
|
EOS |
|
- Language::Python.each_python(build) do |python, _| |
|
- pyflags = (`#{python}-config --includes`.strip + |
|
- `#{python}-config --ldflags`.strip).split(" ") |
|
- system ENV.cxx, "-shared", "hello.cpp", "-lboost_#{python}", "-o", "hello.so", *pyflags |
|
+ Language::Python.each_python(build) do |python, version| |
|
+ pycflags = `#{python}-config --includes`.strip |
|
+ pyldflags = `#{python}-config --ldflags`.strip |
|
+ system "#{ENV.cxx} -shared hello.cpp #{pycflags} #{pyldflags} -lboost_#{python} -o hello.so" |
|
output = `#{python} -c "from __future__ import print_function; import hello; print(hello.greet())"` |
|
- assert_match "Hello, world!", output |
|
+ assert output.include?("Hello, world!") |
|
end |
|
end |
|
end |
|
-- |
|
2.1.0 |
|
|
|
|
|
From e91af7212a3330b34ae33b4367385d8c10cd42b3 Mon Sep 17 00:00:00 2001 |
|
From: Pietras <[email protected]> |
|
Date: Tue, 11 Aug 2015 18:00:44 +0200 |
|
Subject: [PATCH 2/2] asdf |
|
|
|
--- |
|
Library/Formula/boost-python.rb | 5 +- |
|
Library/Formula/boost.rb | 197 +++++++++++++++++++++++++++------------- |
|
2 files changed, 137 insertions(+), 65 deletions(-) |
|
|
|
diff --git a/Library/Formula/boost-python.rb b/Library/Formula/boost-python.rb |
|
index b95ddc0..76941c4 100644 |
|
--- a/Library/Formula/boost-python.rb |
|
+++ b/Library/Formula/boost-python.rb |
|
@@ -24,8 +24,9 @@ end |
|
|
|
class BoostPython < Formula |
|
homepage "http://www.boost.org" |
|
- url "https://downloads.sourceforge.net/project/boost/boost/1.57.0/boost_1_57_0.tar.bz2" |
|
- sha1 "e151557ae47afd1b43dc3fac46f8b04a8fe51c12" |
|
+ url "https://downloads.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2" |
|
+ sha1 "cef9a0cc7084b1d639e06cd3bc34e4251524c840" |
|
+ revision 2 |
|
head "https://github.com/boostorg/boost.git" |
|
|
|
option :universal |
|
diff --git a/Library/Formula/boost.rb b/Library/Formula/boost.rb |
|
index 83ff291..8f48924 100644 |
|
--- a/Library/Formula/boost.rb |
|
+++ b/Library/Formula/boost.rb |
|
@@ -1,35 +1,108 @@ |
|
+require 'formula' |
|
+ |
|
+class UniversalPython < Requirement |
|
+ satisfy(:build_env => false) { archs_for_command("python").universal? } |
|
+ |
|
+ def message; <<-EOS.undent |
|
+ A universal build was requested, but Python is not a universal build |
|
+ |
|
+ Boost compiles against the Python it finds in the path; if this Python |
|
+ is not a universal build then linking will likely fail. |
|
+ EOS |
|
+ end |
|
+end |
|
+ |
|
+class UniversalPython3 < Requirement |
|
+ satisfy(:build_env => false) { archs_for_command("python3").universal? } |
|
+ |
|
+ def message; <<-EOS.undent |
|
+ A universal build was requested, but Python 3 is not a universal build |
|
+ |
|
+ Boost compiles against the Python 3 it finds in the path; if this Python |
|
+ is not a universal build then linking will likely fail. |
|
+ EOS |
|
+ end |
|
+end |
|
+ |
|
class Boost < Formula |
|
- desc "Collection of portable C++ source libraries" |
|
- homepage "http://www.boost.org" |
|
- url "https://downloads.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.tar.bz2" |
|
- sha256 "fdfc204fc33ec79c99b9a74944c3e54bd78be4f7f15e260c0e2700a36dc7d3e5" |
|
+ homepage 'http://www.boost.org' |
|
+ url 'https://downloads.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2' |
|
+ sha1 'cef9a0cc7084b1d639e06cd3bc34e4251524c840' |
|
+ revision 2 |
|
|
|
- head "https://github.com/boostorg/boost.git" |
|
+ head 'https://github.com/boostorg/boost.git' |
|
|
|
bottle do |
|
cellar :any |
|
- sha256 "9a3929bec0e9e9db36e005f57193433ac6b5ff9ff86b2ed3262b975d58488c19" => :yosemite |
|
- sha256 "c5ad1f8591ed91c551658fd198ce31cf9f6a8026fcbfd5970a39cb479e64faa2" => :mavericks |
|
- sha256 "7b154bf42d72bbb90c3017bb94b24fdd2e0605ceab8717283f5c9f456ac5c03d" => :mountain_lion |
|
+ revision 4 |
|
+ sha1 "81b8843487a6f0017fac77b4bf58bdc20f3298fa" => :mavericks |
|
+ sha1 "40089f76eddb25ac418032fa0055b6f0b6d76847" => :mountain_lion |
|
+ sha1 "da4fb2a221fd83f50741f757eefe4bc38b5e910c" => :lion |
|
end |
|
|
|
env :userpaths |
|
|
|
option :universal |
|
- option "with-icu4c", "Build regexp engine with icu support" |
|
- option "without-single", "Disable building single-threading variant" |
|
- option "without-static", "Disable building static library variant" |
|
- option "with-mpi", "Build with MPI support" |
|
+ option 'with-icu', 'Build regexp engine with icu support' |
|
+ option 'without-single', 'Disable building single-threading variant' |
|
+ option 'without-static', 'Disable building static library variant' |
|
+ option 'with-mpi', 'Build with MPI support' |
|
option :cxx11 |
|
|
|
- deprecated_option "with-icu" => "with-icu4c" |
|
- |
|
- if build.cxx11? |
|
- depends_on "icu4c" => [:optional, "c++11"] |
|
- depends_on "open-mpi" => "c++11" if build.with? "mpi" |
|
- else |
|
- depends_on "icu4c" => :optional |
|
- depends_on :mpi => [:cc, :cxx, :optional] |
|
+ depends_on :python => :optional |
|
+ depends_on :python3 => :optional |
|
+ depends_on UniversalPython if build.universal? and build.with? "python" |
|
+ depends_on UniversalPython3 if build.universal? and build.with? "python3" |
|
+ |
|
+ if build.with?("python3") && build.with?("python") |
|
+ odie "boost: --with-python3 cannot be specified when using --with-python" |
|
+ end |
|
+ |
|
+ if build.with? 'icu' |
|
+ if build.cxx11? |
|
+ depends_on 'icu4c' => 'c++11' |
|
+ else |
|
+ depends_on 'icu4c' |
|
+ end |
|
+ end |
|
+ |
|
+ if build.with? 'mpi' |
|
+ if build.cxx11? |
|
+ depends_on 'open-mpi' => 'c++11' |
|
+ else |
|
+ depends_on :mpi => [:cc, :cxx, :optional] |
|
+ end |
|
+ end |
|
+ |
|
+ stable do |
|
+ # Patches boost::atomic for LLVM 3.4 as it is used on OS X 10.9 with Xcode 5.1 |
|
+ # https://github.com/Homebrew/homebrew/issues/27396 |
|
+ # https://github.com/Homebrew/homebrew/pull/27436 |
|
+ patch :p2 do |
|
+ url "https://github.com/boostorg/atomic/commit/6bb71fdd.diff" |
|
+ sha1 "ca8679011d5293a7fd02cb3b97dde3515b8b2b03" |
|
+ end |
|
+ |
|
+ patch :p2 do |
|
+ url "https://github.com/boostorg/atomic/commit/e4bde20f.diff" |
|
+ sha1 "b68f5536474c9f543879698299bd4975538a89eb" |
|
+ end |
|
+ |
|
+ # Patch fixes upstream issue reported here (https://svn.boost.org/trac/boost/ticket/9698). |
|
+ # Will be fixed in Boost 1.56 and can be removed once that release is available. |
|
+ # See this issue (https://github.com/Homebrew/homebrew/issues/30592) for more details. |
|
+ |
|
+ patch :p2 do |
|
+ url "https://github.com/boostorg/chrono/commit/143260d.diff" |
|
+ sha1 "2600214608e7706116831d6ffc302d099ba09950" |
|
+ end |
|
+ |
|
+ # Patch boost::serialization for Clang |
|
+ # https://svn.boost.org/trac/boost/ticket/8757 |
|
+ patch :p1 do |
|
+ url "https://gist.githubusercontent.com/philacs/375303205d5f8918e700/raw/d6ded52c3a927b6558984d22efe0a5cf9e59cd8c/0005-Boost.S11n-include-missing-algorithm.patch" |
|
+ sha1 "a37552d48e5c1c0507ee9d48fb82a3fa5e3bc9fa" |
|
+ end |
|
end |
|
|
|
fails_with :llvm do |
|
@@ -37,38 +110,59 @@ class Boost < Formula |
|
cause "Dropped arguments to functions when linking with boost" |
|
end |
|
|
|
- needs :cxx11 if build.cxx11? |
|
- |
|
def install |
|
# https://svn.boost.org/trac/boost/ticket/8841 |
|
- if build.with?("mpi") && build.with?("single") |
|
+ if build.with? 'mpi' and build.with? 'single' |
|
raise <<-EOS.undent |
|
Building MPI support for both single and multi-threaded flavors |
|
- is not supported. Please use "--with-mpi" together with |
|
- "--without-single". |
|
+ is not supported. Please use '--with-mpi' together with |
|
+ '--without-single'. |
|
+ EOS |
|
+ end |
|
+ |
|
+ if build.cxx11? and build.with? 'mpi' and (build.with? 'python' \ |
|
+ or build.with? 'python3') |
|
+ raise <<-EOS.undent |
|
+ Building MPI support for Python using C++11 mode results in |
|
+ failure and hence disabled. Please don't use this combination |
|
+ of options. |
|
EOS |
|
end |
|
|
|
ENV.universal_binary if build.universal? |
|
|
|
- # Force boost to compile with the desired compiler |
|
+ # Force boost to compile using the appropriate GCC version. |
|
open("user-config.jam", "a") do |file| |
|
file.write "using darwin : : #{ENV.cxx} ;\n" |
|
- file.write "using mpi ;\n" if build.with? "mpi" |
|
+ file.write "using mpi ;\n" if build.with? 'mpi' |
|
+ |
|
+ # Link against correct version of Python if python3 build was requested |
|
+ if build.with? 'python3' |
|
+ py3executable = `which python3`.strip |
|
+ py3version = `python3 -c "import sys; print(sys.version[:3])"`.strip |
|
+ py3prefix = `python3 -c "import sys; print(sys.prefix)"`.strip |
|
+ |
|
+ file.write <<-EOS.undent |
|
+ using python : #{py3version} |
|
+ : #{py3executable} |
|
+ : #{py3prefix}/include/python#{py3version}m |
|
+ : #{py3prefix}/lib ; |
|
+ EOS |
|
+ end |
|
end |
|
|
|
- # libdir should be set by --prefix but isn't |
|
- bootstrap_args = ["--prefix=#{prefix}", "--libdir=#{lib}"] |
|
+ # we specify libdir too because the script is apparently broken |
|
+ bargs = ["--prefix=#{prefix}", "--libdir=#{lib}"] |
|
|
|
- if build.with? "icu4c" |
|
- icu4c_prefix = Formula["icu4c"].opt_prefix |
|
- bootstrap_args << "--with-icu=#{icu4c_prefix}" |
|
+ if build.with? 'icu' |
|
+ icu4c_prefix = Formula['icu4c'].opt_prefix |
|
+ bargs << "--with-icu=#{icu4c_prefix}" |
|
else |
|
- bootstrap_args << "--without-icu" |
|
+ bargs << '--without-icu' |
|
end |
|
|
|
# Handle libraries that will not be built. |
|
- without_libraries = ["python"] |
|
+ without_libraries = [] |
|
|
|
# The context library is implemented as x86_64 ASM, so it |
|
# won't build on PPC or 32-bit builds |
|
@@ -82,11 +176,12 @@ class Boost < Formula |
|
# Boost.Log cannot be built using Apple GCC at the moment. Disabled |
|
# on such systems. |
|
without_libraries << "log" if ENV.compiler == :gcc || ENV.compiler == :llvm |
|
- without_libraries << "mpi" if build.without? "mpi" |
|
+ without_libraries << "python" if (build.without? 'python' \ |
|
+ and build.without? 'python3') |
|
+ without_libraries << "mpi" if build.without? 'mpi' |
|
|
|
- bootstrap_args << "--without-libraries=#{without_libraries.join(",")}" |
|
+ bargs << "--without-libraries=#{without_libraries.join(',')}" |
|
|
|
- # layout should be synchronized with boost-python |
|
args = ["--prefix=#{prefix}", |
|
"--libdir=#{lib}", |
|
"-d2", |
|
@@ -118,12 +213,12 @@ class Boost < Formula |
|
end |
|
end |
|
|
|
- system "./bootstrap.sh", *bootstrap_args |
|
+ system "./bootstrap.sh", *bargs |
|
system "./b2", *args |
|
end |
|
|
|
def caveats |
|
- s = "" |
|
+ s = '' |
|
# ENV.compiler doesn't exist in caveats. Check library availability |
|
# instead. |
|
if Dir["#{lib}/libboost_log*"].empty? |
|
@@ -143,28 +238,4 @@ class Boost < Formula |
|
|
|
s |
|
end |
|
- |
|
- test do |
|
- (testpath/"test.cpp").write <<-EOS.undent |
|
- #include <boost/algorithm/string.hpp> |
|
- #include <string> |
|
- #include <vector> |
|
- #include <assert.h> |
|
- using namespace boost::algorithm; |
|
- using namespace std; |
|
- |
|
- int main() |
|
- { |
|
- string str("a,b"); |
|
- vector<string> strVec; |
|
- split(strVec, str, is_any_of(",")); |
|
- assert(strVec.size()==2); |
|
- assert(strVec[0]=="a"); |
|
- assert(strVec[1]=="b"); |
|
- return 0; |
|
- } |
|
- EOS |
|
- system ENV.cxx, "test.cpp", "-std=c++1y", "-lboost_system", "-o", "test" |
|
- system "./test" |
|
- end |
|
end |
|
-- |
|
2.1.0 |
|
|