lcalc: use libc++-compatible way of extending namespace std (#370545)

authored by Mauricio Collares and committed by GitHub cf071d96 a914df74

+32 -6
+30
pkgs/by-name/lc/lcalc/libcxx-compat.patch
··· 1 + diff --git a/src/libLfunction/Lcomplex.h b/src/libLfunction/Lcomplex.h 2 + index 363bbf4..ffecd70 100644 3 + --- a/src/libLfunction/Lcomplex.h 4 + +++ b/src/libLfunction/Lcomplex.h 5 + @@ -56,8 +56,11 @@ 6 + #include <cmath> 7 + #include <sstream> 8 + 9 + -namespace std 10 + -{ 11 + +#ifdef _LIBCPP_VERSION 12 + +_LIBCPP_BEGIN_NAMESPACE_STD 13 + +#else 14 + +namespace std { 15 + +#endif 16 + // Forward declarations 17 + template<typename _Tp> class complex; 18 + template<> class complex<float>; 19 + @@ -1193,6 +1196,10 @@ namespace std 20 + inline 21 + complex<long double>::complex(const complex<double>& __z) 22 + : _M_value(_ComplexT(__z._M_value)) { } 23 + -} // namespace std 24 + +#ifdef _LIBCPP_VERSION 25 + +_LIBCPP_END_NAMESPACE_STD 26 + +#else 27 + +} 28 + +#endif 29 + 30 + #endif /* _CPP_COMPLEX */
+2 -6
pkgs/by-name/lc/lcalc/package.nix
··· 19 19 hash = "sha256-RxWZ7T0I9zV7jUVnL6jV/PxEoU32KY7Q1UsOL5Lonuc="; 20 20 }; 21 21 22 - # workaround for vendored GCC 3.5 <complex> 22 + # workaround for vendored GCC <complex> on libc++ 23 23 # https://gitlab.com/sagemath/lcalc/-/issues/16 24 - env.NIX_CFLAGS_COMPILE = toString [ 25 - "-D_GLIBCXX_COMPLEX" 26 - "-D_LIBCPP_COMPLEX" 27 - "-D_LIBCPP___FWD_COMPLEX_H" 28 - ]; 24 + patches = [ ./libcxx-compat.patch ]; 29 25 30 26 nativeBuildInputs = [ 31 27 autoreconfHook