libcxx: add package
This commit is contained in:
parent
2849bcc6d6
commit
70d9ab2cdc
65
package/libs/libcxx/Makefile
Normal file
65
package/libs/libcxx/Makefile
Normal file
@ -0,0 +1,65 @@
|
||||
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libcxx
|
||||
PKG_VERSION:=9.0.1
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://git.llvm.org/git/libcxx
|
||||
PKG_SOURCE_VERSION:=2076f539f410805ef88692b9c0ce0a0b882a7680
|
||||
PKG_MIRROR_HASH:=d527880a18dec9109575c76717cf5288fb91c11381b9d261cae2e5bebcbdab2e
|
||||
|
||||
PKG_MAINTAINER:=Rosen Penev <rosenp@gmail.com>
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE.txt
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
CMAKE_BINARY_SUBDIR:=build
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/libcxx
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=LLVM libstdc++
|
||||
URL:=https://libcxx.llvm.org/
|
||||
DEPENDS:=+libatomic +libpthread
|
||||
endef
|
||||
|
||||
define Package/libcxx/description
|
||||
LLVM C++ library targeting C++11 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_ENABLE_ASSERTIONS=OFF \
|
||||
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF \
|
||||
-DLIBCXX_INCLUDE_BENCHMARKS=OFF \
|
||||
-DLIBCXX_INCLUDE_DOCS=OFF \
|
||||
-DLIBCXX_INCLUDE_TESTS=OFF \
|
||||
-DLIBCXX_STANDALONE_BUILD=ON \
|
||||
-DLIBCXX_HAS_MUSL_LIBC=$(if $(CONFIG_USE_MUSL),ON,OFF)
|
||||
|
||||
TARGET_CXXFLAGS += -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -Wno-attributes -flto
|
||||
TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
|
||||
|
||||
define Build/InstallDev
|
||||
$(call Build/InstallDev/cmake,$(1))
|
||||
$(CP) files/g++-libcxx $(TOOLCHAIN_DIR)/bin/
|
||||
$(SED) 's,CXX,$(TARGET_CXX),g' $(TOOLCHAIN_DIR)/bin/g++-libcxx
|
||||
endef
|
||||
|
||||
define Package/libcxx/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libc++.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libcxx))
|
||||
19
package/libs/libcxx/files/g++-libcxx
Executable file
19
package/libs/libcxx/files/g++-libcxx
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
WRAPPER_INCLUDEDIR="-I$STAGING_DIR/usr/include/c++/v1"
|
||||
WRAPPER_LIBDIR="-L$STAGING_DIR/usr/lib"
|
||||
WRAPPER_LIBS="-lc -lgcc_s -lssp_nonshared"
|
||||
|
||||
WRAPPER_OPTIONS=""
|
||||
WRAPPER_INCLIB="Y"
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-c|-E|-S) WRAPPER_INCLIB="N" ;;
|
||||
-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"
|
||||
|
||||
exec CXX -fno-builtin -nostdinc++ -DGCC_HASCLASSVISIBILITY "$WRAPPER_INCLUDEDIR" "$@" $WRAPPER_OPTIONS
|
||||
|
||||
14
package/libs/libcxx/patches/010-cxx17.patch
Normal file
14
package/libs/libcxx/patches/010-cxx17.patch
Normal file
@ -0,0 +1,14 @@
|
||||
--- 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}")
|
||||
35
package/libs/libcxx/patches/020-fixes.patch
Normal file
35
package/libs/libcxx/patches/020-fixes.patch
Normal file
@ -0,0 +1,35 @@
|
||||
--- 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>
|
||||
Loading…
Reference in New Issue
Block a user