[PATCH 2/2] libcxx: update to 10.0.0

Rosen Penev rosenp at gmail.com
Sat Jul 11 14:35:30 EDT 2020


Switched to upstream tarballs.

Switched to libcxxabi as using libsupc++ is quite wonky.

Fixed description.

Removed patches. The fixes are cosmetic.

Added ssp patch. This one is needed for i386 and powerpc under musl.

Compile tested every C++ package in the tree with the exception of
several boost packages. There's something broken with boost.

Ran tested with gerbera.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/libs/libcxx/Makefile                | 18 +++++------
 package/libs/libcxx/files/g++-libcxx        |  4 +--
 package/libs/libcxx/patches/010-cxx17.patch | 14 ---------
 package/libs/libcxx/patches/010-ssp.patch   | 13 ++++++++
 package/libs/libcxx/patches/020-fixes.patch | 35 ---------------------
 5 files changed, 24 insertions(+), 60 deletions(-)
 delete mode 100644 package/libs/libcxx/patches/010-cxx17.patch
 create mode 100644 package/libs/libcxx/patches/010-ssp.patch
 delete mode 100644 package/libs/libcxx/patches/020-fixes.patch

diff --git a/package/libs/libcxx/Makefile b/package/libs/libcxx/Makefile
index 8343cbb427..3809bea651 100644
--- a/package/libs/libcxx/Makefile
+++ b/package/libs/libcxx/Makefile
@@ -7,19 +7,20 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libcxx
-PKG_VERSION:=9.0.1
-PKG_RELEASE:=4
+PKG_VERSION:=10.0.0
+PKG_RELEASE:=1
 
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=https://git.llvm.org/git/libcxx
-PKG_SOURCE_VERSION:=2076f539f410805ef88692b9c0ce0a0b882a7680
-PKG_MIRROR_HASH:=d527880a18dec9109575c76717cf5288fb91c11381b9d261cae2e5bebcbdab2e
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.xz
+PKG_SOURCE_URL:=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERSION)
+PKG_HASH:=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION).src
 
 PKG_MAINTAINER:=Rosen Penev <rosenp at gmail.com>
 PKG_LICENSE:=MIT
 PKG_LICENSE_FILES:=LICENSE.txt
 
 PKG_BUILD_PARALLEL:=1
+PKG_BUILD_DEPENDS:=libcxxabi
 CMAKE_BINARY_SUBDIR:=build
 
 include $(INCLUDE_DIR)/package.mk
@@ -34,12 +35,11 @@ define Package/libcxx
 endef
 
 define Package/libcxx/description
-  LLVM C++ library targeting C++11 and above
+  libc++ is an implementation of the C++ standard library, targeting C++11, C++14 and above.
 endef
 
 CMAKE_OPTIONS += \
-	-DLIBCXX_CXX_ABI="libsupc++" \
-	-DLIBCXX_CXX_ABI_INCLUDE_PATHS="$(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/include/c++/$(CONFIG_GCC_VERSION);$(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/include/c++/$(CONFIG_GCC_VERSION)/$(REAL_GNU_TARGET_NAME)" \
+	-DLIBCXX_CXX_ABI="libcxxabi" \
 	-DLIBCXX_ENABLE_ASSERTIONS=OFF \
 	-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF \
 	-DLIBCXX_INCLUDE_BENCHMARKS=OFF \
diff --git a/package/libs/libcxx/files/g++-libcxx b/package/libs/libcxx/files/g++-libcxx
index 81ca46eb0e..88b3e7da01 100755
--- a/package/libs/libcxx/files/g++-libcxx
+++ b/package/libs/libcxx/files/g++-libcxx
@@ -13,7 +13,7 @@ do
 	-static) [ "$WRAPPER_LIBS" != "-lc -lgcc_s -lssp_nonshared -lgcc_eh" ] && WRAPPER_LIBS="-lc -lgcc_s -lssp_nonshared -lgcc_eh" ;;
 	esac
 done
-[ "$WRAPPER_INCLIB" = "Y" ] && WRAPPER_OPTIONS="-nodefaultlibs $WRAPPER_LIBDIR -lc++ -lsupc++ $WRAPPER_LIBS"
+[ "$WRAPPER_INCLIB" = "Y" ] && WRAPPER_OPTIONS="-nodefaultlibs $WRAPPER_LIBDIR -lc++ -lc++abi $WRAPPER_LIBS"
 
-exec CXX -fno-builtin -nostdinc++ -DGCC_HASCLASSVISIBILITY "$WRAPPER_INCLUDEDIR" "$@" $WRAPPER_OPTIONS
+exec CXX -nostdinc++ -DGCC_HASCLASSVISIBILITY "$WRAPPER_INCLUDEDIR" "$@" $WRAPPER_OPTIONS
 
diff --git a/package/libs/libcxx/patches/010-cxx17.patch b/package/libs/libcxx/patches/010-cxx17.patch
deleted file mode 100644
index dceec9d4f3..0000000000
--- a/package/libs/libcxx/patches/010-cxx17.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -524,9 +524,9 @@ remove_flags(-Wno-pedantic -pedantic-err
- if (LIBCXX_HAS_MUSL_LIBC OR LIBCXX_TARGETING_CLANG_CL)
-   # musl's pthread implementations uses volatile types in their structs which is
-   # not a constexpr in C++11 but is in C++14, so we use C++14 with musl.
--  set(LIBCXX_STANDARD_VER c++14 CACHE STRING "internal option to change build dialect")
-+  set(LIBCXX_STANDARD_VER c++2a CACHE STRING "internal option to change build dialect")
- else()
--  set(LIBCXX_STANDARD_VER c++11 CACHE STRING "internal option to change build dialect")
-+  set(LIBCXX_STANDARD_VER c++2a CACHE STRING "internal option to change build dialect")
- endif()
- add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})
- add_compile_flags_if_supported("/std:${LIBCXX_STANDARD_VER}")
diff --git a/package/libs/libcxx/patches/010-ssp.patch b/package/libs/libcxx/patches/010-ssp.patch
new file mode 100644
index 0000000000..c9dc90c7f2
--- /dev/null
+++ b/package/libs/libcxx/patches/010-ssp.patch
@@ -0,0 +1,13 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -760,6 +760,10 @@ function(cxx_link_system_libraries target)
+     target_link_libraries(${target} PRIVATE atomic)
+   endif()
+ 
++  if (LIBCXX_HAS_MUSL_LIBC)
++    target_link_libraries(${target} PRIVATE ssp_nonshared)
++  endif()
++
+   if (MINGW)
+     target_link_libraries(${target} PRIVATE "${MINGW_LIBRARIES}")
+   endif()
diff --git a/package/libs/libcxx/patches/020-fixes.patch b/package/libs/libcxx/patches/020-fixes.patch
deleted file mode 100644
index 22ac494c04..0000000000
--- a/package/libs/libcxx/patches/020-fixes.patch
+++ /dev/null
@@ -1,35 +0,0 @@
---- a/include/cmath
-+++ b/include/cmath
-@@ -615,7 +615,7 @@ _Fp __lerp(_Fp __a, _Fp __b, _Fp __t) no
- 
-     if (__t == 1) return __b;
-     const _Fp __x = __a + __t * (__b - __a);
--    if (__t > 1 == __b > __a)
-+    if ((__t > 1) == (__b > __a))
-     	return __b < __x ? __x : __b;
-     else
-     	return __x < __b ? __x : __b;
---- a/include/memory
-+++ b/include/memory
-@@ -1696,7 +1696,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_tr
-             ptrdiff_t _Np = __end1 - __begin1;
-             __end2 -= _Np;
-             if (_Np > 0)
--                _VSTD::memcpy(__end2, __begin1, _Np * sizeof(_Tp));
-+                __end2 = __begin1;
-         }
- 
- private:
---- a/src/filesystem/filesystem_common.h
-+++ b/src/filesystem/filesystem_common.h
-@@ -197,8 +197,8 @@ private:
- using chrono::duration;
- using chrono::duration_cast;
- 
--using TimeSpec = struct ::timespec;
--using StatT = struct ::stat;
-+using TimeSpec = struct timespec;
-+using StatT = struct stat;
- 
- template <class FileTimeT, class TimeT,
-           bool IsFloat = is_floating_point<typename FileTimeT::rep>::value>
-- 
2.26.2




More information about the openwrt-devel mailing list