diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/boost')
18 files changed, 616 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/boost/1.55.nix b/nixpkgs/pkgs/development/libraries/boost/1.55.nix new file mode 100644 index 000000000000..0a38f35af753 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/1.55.nix @@ -0,0 +1,12 @@ +{ callPackage, fetchurl, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "1.55.0"; + + patches = [ ./clang-math.patch ./clang-math-2.patch ./gcc-5.patch ]; + + src = fetchurl { + url = "mirror://sourceforge/boost/boost_1_55_0.tar.bz2"; + sha256 = "0lkv5dzssbl5fmh2nkaszi8x9qbj80pr4acf9i26sj3rvlih1w7z"; + }; +}) diff --git a/nixpkgs/pkgs/development/libraries/boost/1.59.nix b/nixpkgs/pkgs/development/libraries/boost/1.59.nix new file mode 100644 index 000000000000..f4931dfe5474 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/1.59.nix @@ -0,0 +1,10 @@ +{ stdenv, callPackage, fetchurl, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "1.59.0"; + + src = fetchurl { + url = "mirror://sourceforge/boost/boost_1_59_0.tar.bz2"; + sha256 = "1jj1aai5rdmd72g90a3pd8sw9vi32zad46xv5av8fhnr48ir6ykj"; + }; +}) diff --git a/nixpkgs/pkgs/development/libraries/boost/1.60.nix b/nixpkgs/pkgs/development/libraries/boost/1.60.nix new file mode 100644 index 000000000000..b6d74234f799 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/1.60.nix @@ -0,0 +1,11 @@ +{ stdenv, callPackage, fetchurl, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "1.60.0"; + + src = fetchurl { + url = "mirror://sourceforge/boost/boost_1_60_0.tar.bz2"; + sha256 = "0fzx6dwqbrkd4bcd8pjv0fpapwmrxxwr8yx9g67lihlsk3zzysk8"; + }; + +}) diff --git a/nixpkgs/pkgs/development/libraries/boost/1.62.nix b/nixpkgs/pkgs/development/libraries/boost/1.62.nix new file mode 100644 index 000000000000..871ef392c1ae --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/1.62.nix @@ -0,0 +1,12 @@ +{ stdenv, callPackage, fetchurl, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "1.62.0"; + + src = fetchurl { + url = "mirror://sourceforge/boost/boost_1_62_0.tar.bz2"; + # long-form SHA256 from www.boost.org + sha256 = "36c96b0f6155c98404091d8ceb48319a28279ca0333fba1ad8611eb90afb2ca0"; + }; + +}) diff --git a/nixpkgs/pkgs/development/libraries/boost/1.63.nix b/nixpkgs/pkgs/development/libraries/boost/1.63.nix new file mode 100644 index 000000000000..c4749bc3ee41 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/1.63.nix @@ -0,0 +1,12 @@ +{ stdenv, callPackage, fetchurl, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "1.63.0"; + + src = fetchurl { + url = "mirror://sourceforge/boost/boost_1_63_0.tar.bz2"; + # SHA256 from http://www.boost.org/users/history/version_1_63_0.html + sha256 = "beae2529f759f6b3bf3f4969a19c2e9d6f0c503edcb2de4a61d1428519fcb3b0"; + }; + +}) diff --git a/nixpkgs/pkgs/development/libraries/boost/1.64.nix b/nixpkgs/pkgs/development/libraries/boost/1.64.nix new file mode 100644 index 000000000000..1cf9bfa51f4b --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/1.64.nix @@ -0,0 +1,12 @@ +{ stdenv, callPackage, fetchurl, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "1.64.0"; + + src = fetchurl { + url = "mirror://sourceforge/boost/boost_1_64_0.tar.bz2"; + # SHA256 from http://www.boost.org/users/history/version_1_64_0.html + sha256 = "7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332"; + }; + +}) diff --git a/nixpkgs/pkgs/development/libraries/boost/1.65.nix b/nixpkgs/pkgs/development/libraries/boost/1.65.nix new file mode 100644 index 000000000000..9837e1c69193 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/1.65.nix @@ -0,0 +1,12 @@ +{ stdenv, callPackage, fetchurl, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "1.65.1"; + + src = fetchurl { + url = "mirror://sourceforge/boost/boost_1_65_1.tar.bz2"; + # SHA256 from http://www.boost.org/users/history/version_1_65_1.html + sha256 = "9807a5d16566c57fd74fb522764e0b134a8bbe6b6e8967b83afefd30dcd3be81"; + }; + +}) diff --git a/nixpkgs/pkgs/development/libraries/boost/1.66.nix b/nixpkgs/pkgs/development/libraries/boost/1.66.nix new file mode 100644 index 000000000000..b44c1a3823a9 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/1.66.nix @@ -0,0 +1,11 @@ +{ stdenv, callPackage, fetchurl, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "1.66.0"; + + src = fetchurl { + url = "mirror://sourceforge/boost/boost_1_66_0.tar.bz2"; + # SHA256 from http://www.boost.org/users/history/version_1_66_0.html + sha256 = "5721818253e6a0989583192f96782c4a98eb6204965316df9f5ad75819225ca9"; + }; +}) diff --git a/nixpkgs/pkgs/development/libraries/boost/1.67.nix b/nixpkgs/pkgs/development/libraries/boost/1.67.nix new file mode 100644 index 000000000000..406e63b9622b --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/1.67.nix @@ -0,0 +1,39 @@ +{ stdenv, callPackage, fetchurl, fetchpatch, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "1.67.0"; + + patches = [ + (fetchpatch { + url = "https://github.com/boostorg/lockfree/commit/12726cda009a855073b9bedbdce57b6ce7763da2.patch"; + sha256 = "0x65nkwzv8fdacj8sw5njl3v63jj19dirrpklbwy6qpsncw7fc7h"; + stripLen = 1; + }) + ] ++ stdenv.lib.optionals stdenv.cc.isClang [ + # Fixes https://github.com/boostorg/atomic/issues/15 + (fetchpatch { + url = https://github.com/boostorg/atomic/commit/6e14ca24dab50ad4c1fa8c27c7dd6f1cb791b534.patch; + sha256 = "102g35ygvv8cxagp9651284xk4vybk93q2fm577y4mdxf5k46b7a"; + stripLen = 1; + }) + + # Needed for the next patch + (fetchpatch { + url = https://github.com/boostorg/asio/commit/38cb19719748ad56b14d73ca1fff5828f36e5894.patch; + sha256 = "0cj9cxz9rfbsx8p8f5alxx00dq3r7g0vh23j68bbxbs9gq1arq2n"; + stripLen = 1; + }) + # Fixes https://github.com/boostorg/asio/pull/91 + (fetchpatch { + url = https://github.com/boostorg/asio/commit/43874d5497414c67655d901e48c939ef01337edb.patch; + sha256 = "1c2ds164s2ygvpb4785p4ncv8ywbpm08cphirb99xp4mqvb693is"; + stripLen = 1; + }) + ]; + + src = fetchurl { + url = "mirror://sourceforge/boost/boost_1_67_0.tar.bz2"; + # SHA256 from http://www.boost.org/users/history/version_1_66_0.html + sha256 = "2684c972994ee57fc5632e03bf044746f6eb45d4920c343937a465fd67a5adba"; + }; +}) diff --git a/nixpkgs/pkgs/development/libraries/boost/1.68.nix b/nixpkgs/pkgs/development/libraries/boost/1.68.nix new file mode 100644 index 000000000000..cd980439b710 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/1.68.nix @@ -0,0 +1,11 @@ +{ stdenv, callPackage, fetchurl, fetchpatch, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "1.68.0"; + + src = fetchurl { + url = "mirror://sourceforge/boost/boost_1_68_0.tar.bz2"; + # SHA256 from http://www.boost.org/users/history/version_1_68_0.html + sha256 = "7f6130bc3cf65f56a618888ce9d5ea704fa10b462be126ad053e80e553d6d8b7"; + }; +}) diff --git a/nixpkgs/pkgs/development/libraries/boost/1.69.nix b/nixpkgs/pkgs/development/libraries/boost/1.69.nix new file mode 100644 index 000000000000..959fa851fe22 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/1.69.nix @@ -0,0 +1,11 @@ +{ stdenv, callPackage, fetchurl, fetchpatch, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "1.69.0"; + + src = fetchurl { + url = "mirror://sourceforge/boost/boost_1_69_0.tar.bz2"; + # SHA256 from http://www.boost.org/users/history/version_1_69_0.html + sha256 = "8f32d4617390d1c2d16f26a27ab60d97807b35440d45891fa340fc2648b04406"; + }; +}) diff --git a/nixpkgs/pkgs/development/libraries/boost/1.70.nix b/nixpkgs/pkgs/development/libraries/boost/1.70.nix new file mode 100644 index 000000000000..5f7b39c1189e --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/1.70.nix @@ -0,0 +1,11 @@ +{ stdenv, callPackage, fetchurl, fetchpatch, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "1.70.0"; + + src = fetchurl { + url = "mirror://sourceforge/boost/boost_1_70_0.tar.bz2"; + # SHA256 from http://www.boost.org/users/history/version_1_70_0.html + sha256 = "430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778"; + }; +}) diff --git a/nixpkgs/pkgs/development/libraries/boost/clang-math-2.patch b/nixpkgs/pkgs/development/libraries/boost/clang-math-2.patch new file mode 100644 index 000000000000..f819e9bec623 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/clang-math-2.patch @@ -0,0 +1,45 @@ +From 6bb71fdd8f7cc346d90fb14beb38b7297fc1ffd9 Mon Sep 17 00:00:00 2001 +From: Andrey Semashev <andrey.semashev@gmail.com> +Date: Sun, 26 Jan 2014 13:58:48 +0400 +Subject: [PATCH] Fixed incorrect initialization of 128-bit values, when no + native support for 128-bit integers is available. + +--- + boost/atomic/detail/cas128strong.hpp | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/boost/atomic/detail/cas128strong.hpp b/boost/atomic/detail/cas128strong.hpp +index 906c13e..dcb4d7d 100644 +--- a/boost/atomic/detail/cas128strong.hpp ++++ b/boost/atomic/detail/cas128strong.hpp +@@ -196,15 +196,17 @@ class base_atomic<T, void, 16, Sign> + + public: + BOOST_DEFAULTED_FUNCTION(base_atomic(void), {}) +- explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0) ++ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT + { ++ memset(&v_, 0, sizeof(v_)); + memcpy(&v_, &v, sizeof(value_type)); + } + + void + store(value_type const& value, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT + { +- storage_type value_s = 0; ++ storage_type value_s; ++ memset(&value_s, 0, sizeof(value_s)); + memcpy(&value_s, &value, sizeof(value_type)); + platform_fence_before_store(order); + platform_store128(value_s, &v_); +@@ -247,7 +249,9 @@ class base_atomic<T, void, 16, Sign> + memory_order success_order, + memory_order failure_order) volatile BOOST_NOEXCEPT + { +- storage_type expected_s = 0, desired_s = 0; ++ storage_type expected_s, desired_s; ++ memset(&expected_s, 0, sizeof(expected_s)); ++ memset(&desired_s, 0, sizeof(desired_s)); + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + diff --git a/nixpkgs/pkgs/development/libraries/boost/clang-math.patch b/nixpkgs/pkgs/development/libraries/boost/clang-math.patch new file mode 100644 index 000000000000..aa3d76af28b2 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/clang-math.patch @@ -0,0 +1,65 @@ +From e4bde20f2eec0a51be14533871d2123bd2ab9cf3 Mon Sep 17 00:00:00 2001 +From: Andrey Semashev <andrey.semashev@gmail.com> +Date: Fri, 28 Feb 2014 12:43:11 +0400 +Subject: [PATCH] More compilation fixes for the case when 128-bit integers are + not supported. + +--- + boost/atomic/detail/gcc-atomic.hpp | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/boost/atomic/detail/gcc-atomic.hpp b/boost/atomic/detail/gcc-atomic.hpp +index a130590..4af99a1 100644 +--- a/boost/atomic/detail/gcc-atomic.hpp ++++ b/boost/atomic/detail/gcc-atomic.hpp +@@ -958,14 +958,16 @@ class base_atomic<T, void, 16, Sign> + + public: + BOOST_DEFAULTED_FUNCTION(base_atomic(void), {}) +- explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0) ++ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT + { ++ memset(&v_, 0, sizeof(v_)); + memcpy(&v_, &v, sizeof(value_type)); + } + + void store(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT + { +- storage_type tmp = 0; ++ storage_type tmp; ++ memset(&tmp, 0, sizeof(tmp)); + memcpy(&tmp, &v, sizeof(value_type)); + __atomic_store_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order)); + } +@@ -980,7 +982,8 @@ class base_atomic<T, void, 16, Sign> + + value_type exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT + { +- storage_type tmp = 0; ++ storage_type tmp; ++ memset(&tmp, 0, sizeof(tmp)); + memcpy(&tmp, &v, sizeof(value_type)); + tmp = __atomic_exchange_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order)); + value_type res; +@@ -994,7 +997,9 @@ class base_atomic<T, void, 16, Sign> + memory_order success_order, + memory_order failure_order) volatile BOOST_NOEXCEPT + { +- storage_type expected_s = 0, desired_s = 0; ++ storage_type expected_s, desired_s; ++ memset(&expected_s, 0, sizeof(expected_s)); ++ memset(&desired_s, 0, sizeof(desired_s)); + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, false, +@@ -1010,7 +1015,9 @@ class base_atomic<T, void, 16, Sign> + memory_order success_order, + memory_order failure_order) volatile BOOST_NOEXCEPT + { +- storage_type expected_s = 0, desired_s = 0; ++ storage_type expected_s, desired_s; ++ memset(&expected_s, 0, sizeof(expected_s)); ++ memset(&desired_s, 0, sizeof(desired_s)); + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, true, diff --git a/nixpkgs/pkgs/development/libraries/boost/darwin-1.55-no-system-python.patch b/nixpkgs/pkgs/development/libraries/boost/darwin-1.55-no-system-python.patch new file mode 100644 index 000000000000..f8163f6d2718 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/darwin-1.55-no-system-python.patch @@ -0,0 +1,45 @@ +diff --git a/tools/build/src/tools/python.jam b/tools/build/src/tools/python.jam +index 273b28a..2d2031e 100644 +--- a/tools/build/v2/tools/python.jam ++++ b/tools/build/v2/tools/python.jam +@@ -428,13 +428,7 @@ local rule windows-installed-pythons ( version ? ) + + local rule darwin-installed-pythons ( version ? ) + { +- version ?= $(.version-countdown) ; +- +- local prefix +- = [ GLOB /System/Library/Frameworks /Library/Frameworks +- : Python.framework ] ; +- +- return $(prefix)/Versions/$(version)/bin/python ; ++ return ; + } + + +@@ -890,25 +884,6 @@ local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? : + + # See if we can find a framework directory on darwin. + local framework-directory ; +- if $(target-os) = darwin +- { +- # Search upward for the framework directory. +- local framework-directory = $(libraries[-1]) ; +- while $(framework-directory:D=) && $(framework-directory:D=) != Python.framework +- { +- framework-directory = $(framework-directory:D) ; +- } +- +- if $(framework-directory:D=) = Python.framework +- { +- debug-message framework directory is \"$(framework-directory)\" ; +- } +- else +- { +- debug-message "no framework directory found; using library path" ; +- framework-directory = ; +- } +- } + + local dll-path = $(libraries) ; + diff --git a/nixpkgs/pkgs/development/libraries/boost/darwin-no-system-python.patch b/nixpkgs/pkgs/development/libraries/boost/darwin-no-system-python.patch new file mode 100644 index 000000000000..73e0910336a1 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/darwin-no-system-python.patch @@ -0,0 +1,45 @@ +diff --git a/tools/build/src/tools/python.jam b/tools/build/src/tools/python.jam +index 273b28a..2d2031e 100644 +--- a/tools/build/src/tools/python.jam ++++ b/tools/build/src/tools/python.jam +@@ -428,13 +428,7 @@ local rule windows-installed-pythons ( version ? ) + + local rule darwin-installed-pythons ( version ? ) + { +- version ?= $(.version-countdown) ; +- +- local prefix +- = [ GLOB /System/Library/Frameworks /Library/Frameworks +- : Python.framework ] ; +- +- return $(prefix)/Versions/$(version)/bin/python ; ++ return ; + } + + +@@ -890,25 +884,6 @@ local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? : + + # See if we can find a framework directory on darwin. + local framework-directory ; +- if $(target-os) = darwin +- { +- # Search upward for the framework directory. +- local framework-directory = $(libraries[-1]) ; +- while $(framework-directory:D=) && $(framework-directory:D=) != Python.framework +- { +- framework-directory = $(framework-directory:D) ; +- } +- +- if $(framework-directory:D=) = Python.framework +- { +- debug-message framework directory is \"$(framework-directory)\" ; +- } +- else +- { +- debug-message "no framework directory found; using library path" ; +- framework-directory = ; +- } +- } + + local dll-path = $(libraries) ; + diff --git a/nixpkgs/pkgs/development/libraries/boost/gcc-5.patch b/nixpkgs/pkgs/development/libraries/boost/gcc-5.patch new file mode 100644 index 000000000000..2b2713590ca7 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/gcc-5.patch @@ -0,0 +1,64 @@ +https://svn.boost.org/trac/boost/ticket/10125 + + boost/thread/pthread/once.hpp | 6 +++--- + boost/thread/pthread/once_atomic.hpp | 2 +- + boost/thread/win32/once.hpp | 2 +- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/boost/thread/pthread/once.hpp b/boost/thread/pthread/once.hpp +index ccfb051..0bef038 100644 +--- a/boost/thread/pthread/once.hpp ++++ b/boost/thread/pthread/once.hpp +@@ -42,7 +42,7 @@ namespace boost + } + + #ifdef BOOST_THREAD_PROVIDES_ONCE_CXX11 +-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES ++#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template<typename Function, class ...ArgTypes> + inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(ArgTypes)... args); + #else +@@ -65,7 +65,7 @@ namespace boost + private: + volatile thread_detail::uintmax_atomic_t epoch; + +-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES ++#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template<typename Function, class ...ArgTypes> + friend void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(ArgTypes)... args); + #else +@@ -118,7 +118,7 @@ namespace boost + // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2444.html + + +-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES ++#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + + + template<typename Function, class ...ArgTypes> +diff --git a/boost/thread/pthread/once_atomic.hpp b/boost/thread/pthread/once_atomic.hpp +index 9e2f876..923f07b 100644 +--- a/boost/thread/pthread/once_atomic.hpp ++++ b/boost/thread/pthread/once_atomic.hpp +@@ -115,7 +115,7 @@ namespace boost + #endif + + +-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES ++#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + + template<typename Function, class ...ArgTypes> + inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(ArgTypes)... args) +diff --git a/boost/thread/win32/once.hpp b/boost/thread/win32/once.hpp +index cafcfd4..9b37b31 100644 +--- a/boost/thread/win32/once.hpp ++++ b/boost/thread/win32/once.hpp +@@ -227,7 +227,7 @@ namespace boost + } + } + +-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES ++#if !defined BOOST_NO_CXX11_VARIADIC_TEMPLATES && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + //#if defined(BOOST_THREAD_RVALUE_REFERENCES_DONT_MATCH_FUNTION_PTR) + inline void call_once(once_flag& flag, void (*f)()) + { diff --git a/nixpkgs/pkgs/development/libraries/boost/generic.nix b/nixpkgs/pkgs/development/libraries/boost/generic.nix new file mode 100644 index 000000000000..90dd8ff1744f --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/boost/generic.nix @@ -0,0 +1,188 @@ +{ stdenv, fetchurl, icu, expat, zlib, bzip2, python, fixDarwinDylibNames, libiconv +, which +, buildPackages +, toolset ? /**/ if stdenv.cc.isClang then "clang" + else null +, enableRelease ? true +, enableDebug ? false +, enableSingleThreaded ? false +, enableMultiThreaded ? true +, enableShared ? !(stdenv.hostPlatform.libc == "msvcrt") # problems for now +, enableStatic ? !enableShared +, enablePython ? false +, enableNumpy ? false +, taggedLayout ? ((enableRelease && enableDebug) || (enableSingleThreaded && enableMultiThreaded) || (enableShared && enableStatic)) +, patches ? [] +, mpi ? null + +# Attributes inherit from specific versions +, version, src +, ... +}: + +# We must build at least one type of libraries +assert enableShared || enableStatic; + +# Python isn't supported when cross-compiling +assert enablePython -> stdenv.hostPlatform == stdenv.buildPlatform; +assert enableNumpy -> enablePython; + +with stdenv.lib; +let + + variant = concatStringsSep "," + (optional enableRelease "release" ++ + optional enableDebug "debug"); + + threading = concatStringsSep "," + (optional enableSingleThreaded "single" ++ + optional enableMultiThreaded "multi"); + + link = concatStringsSep "," + (optional enableShared "shared" ++ + optional enableStatic "static"); + + runtime-link = if enableShared then "shared" else "static"; + + # To avoid library name collisions + layout = if taggedLayout then "tagged" else "system"; + + # Versions of b2 before 1.65 have job limits; specifically: + # - Versions before 1.58 support up to 64 jobs[0] + # - Versions before 1.65 support up to 256 jobs[1] + # + # [0]: https://github.com/boostorg/build/commit/0ef40cb86728f1cd804830fef89a6d39153ff632 + # [1]: https://github.com/boostorg/build/commit/316e26ca718afc65d6170029284521392524e4f8 + jobs = + if versionOlder version "1.58" then + "$(($NIX_BUILD_CORES<=64 ? $NIX_BUILD_CORES : 64))" + else if versionOlder version "1.65" then + "$(($NIX_BUILD_CORES<=256 ? $NIX_BUILD_CORES : 256))" + else + "$NIX_BUILD_CORES"; + + b2Args = concatStringsSep " " ([ + "--includedir=$dev/include" + "--libdir=$out/lib" + "-j${jobs}" + "--layout=${layout}" + "variant=${variant}" + "threading=${threading}" + "link=${link}" + "-sEXPAT_INCLUDE=${expat.dev}/include" + "-sEXPAT_LIBPATH=${expat.out}/lib" + + # TODO: make this unconditional + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "address-model=${toString stdenv.hostPlatform.parsed.cpu.bits}" + "architecture=${toString stdenv.hostPlatform.parsed.cpu.family}" + "binary-format=${toString stdenv.hostPlatform.parsed.kernel.execFormat.name}" + "target-os=${toString stdenv.hostPlatform.parsed.kernel.name}" + + # adapted from table in boost manual + # https://www.boost.org/doc/libs/1_66_0/libs/context/doc/html/context/architectures.html + "abi=${if stdenv.hostPlatform.parsed.cpu.family == "arm" then "aapcs" + else if stdenv.hostPlatform.isWindows then "ms" + else if stdenv.hostPlatform.isMips then "o32" + else "sysv"}" + ] ++ optional (link != "static") "runtime-link=${runtime-link}" + ++ optional (variant == "release") "debug-symbols=off" + ++ optional (toolset != null) "toolset=${toolset}" + ++ optional (!enablePython) "--without-python" + ++ optional (mpi != null || stdenv.hostPlatform != stdenv.buildPlatform) "--user-config=user-config.jam" + ++ optionals (stdenv.hostPlatform.libc == "msvcrt") [ + "threadapi=win32" + ]); + +in + +stdenv.mkDerivation { + pname = "boost"; + + inherit src version; + + patchFlags = ""; + + patches = patches + ++ optional stdenv.isDarwin ( + if version == "1.55.0" + then ./darwin-1.55-no-system-python.patch + else ./darwin-no-system-python.patch); + + meta = { + homepage = http://boost.org/; + description = "Collection of C++ libraries"; + license = licenses.boost; + platforms = platforms.unix ++ platforms.windows; + badPlatforms = optional (versionOlder version "1.59") "aarch64-linux" + ++ optional ((versionOlder version "1.57") || version == "1.58") "x86_64-darwin"; + maintainers = with maintainers; [ peti ]; + }; + + preConfigure = '' + if test -f tools/build/src/tools/clang-darwin.jam ; then + substituteInPlace tools/build/src/tools/clang-darwin.jam \ + --replace '@rpath/$(<[1]:D=)' "$out/lib/\$(<[1]:D=)"; + fi; + '' + optionalString (mpi != null) '' + cat << EOF >> user-config.jam + using mpi : ${mpi}/bin/mpiCC ; + EOF + '' + optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' + cat << EOF >> user-config.jam + using gcc : cross : ${stdenv.cc.targetPrefix}c++ ; + EOF + ''; + + NIX_CFLAGS_LINK = stdenv.lib.optionalString stdenv.isDarwin + "-headerpad_max_install_names"; + + enableParallelBuilding = true; + + nativeBuildInputs = [ which ]; + depsBuildBuild = [ buildPackages.stdenv.cc ]; + buildInputs = [ expat zlib bzip2 libiconv ] + ++ optional (stdenv.hostPlatform == stdenv.buildPlatform) icu + ++ optional stdenv.isDarwin fixDarwinDylibNames + ++ optional enablePython python + ++ optional enableNumpy python.pkgs.numpy; + + configureScript = "./bootstrap.sh"; + configurePlatforms = []; + configureFlags = [ + "--includedir=$(dev)/include" + "--libdir=$(out)/lib" + ] ++ optional enablePython "--with-python=${python.interpreter}" + ++ [ (if stdenv.hostPlatform == stdenv.buildPlatform then "--with-icu=${icu.dev}" else "--without-icu") ] + ++ optional (toolset != null) "--with-toolset=${toolset}"; + + buildPhase = '' + runHook preBuild + ./b2 ${b2Args} + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + # boostbook is needed by some applications + mkdir -p $dev/share/boostbook + cp -a tools/boostbook/{xsl,dtd} $dev/share/boostbook/ + + # Let boost install everything else + ./b2 ${b2Args} install + + runHook postInstall + ''; + + postFixup = '' + # Make boost header paths relative so that they are not runtime dependencies + cd "$dev" && find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \ + -exec sed '1s/^\xef\xbb\xbf//;1i#line 1 "{}"' -i '{}' \; + '' + optionalString (stdenv.hostPlatform.libc == "msvcrt") '' + $RANLIB "$out/lib/"*.a + ''; + + outputs = [ "out" "dev" ]; + setOutputFlags = false; +} |