diff --git a/contrib/libcxx-mingw-w64-aarch64 b/contrib/libcxx-mingw-w64-aarch64 new file mode 120000 index 00000000000..3217560f7be --- /dev/null +++ b/contrib/libcxx-mingw-w64-aarch64 @@ -0,0 +1 @@ +libcxx-mingw-w64 \ No newline at end of file diff --git a/contrib/libcxx-mingw-w64-armv7 b/contrib/libcxx-mingw-w64-armv7 new file mode 120000 index 00000000000..3217560f7be --- /dev/null +++ b/contrib/libcxx-mingw-w64-armv7 @@ -0,0 +1 @@ +libcxx-mingw-w64 \ No newline at end of file diff --git a/contrib/libcxx-mingw-w64-i686 b/contrib/libcxx-mingw-w64-i686 new file mode 120000 index 00000000000..3217560f7be --- /dev/null +++ b/contrib/libcxx-mingw-w64-i686 @@ -0,0 +1 @@ +libcxx-mingw-w64 \ No newline at end of file diff --git a/contrib/libcxx-mingw-w64-x86_64 b/contrib/libcxx-mingw-w64-x86_64 new file mode 120000 index 00000000000..3217560f7be --- /dev/null +++ b/contrib/libcxx-mingw-w64-x86_64 @@ -0,0 +1 @@ +libcxx-mingw-w64 \ No newline at end of file diff --git a/contrib/libcxx-mingw-w64/template.py b/contrib/libcxx-mingw-w64/template.py new file mode 100644 index 00000000000..2b49cf1ca42 --- /dev/null +++ b/contrib/libcxx-mingw-w64/template.py @@ -0,0 +1,170 @@ +pkgname = "libcxx-mingw-w64" +pkgver = "18.1.8" +pkgrel = 0 +build_style = "cmake" +configure_args = [ + "-DCMAKE_SYSTEM_NAME=Windows", + "-DCMAKE_BUILD_TYPE=Release", + "-Wno-dev", + "-DCMAKE_C_COMPILER=/usr/bin/clang", + "-DCMAKE_CXX_COMPILER=/usr/bin/clang++", + "-DCMAKE_AR=/usr/bin/llvm-ar", + "-DCMAKE_NM=/usr/bin/llvm-nm", + "-DCMAKE_RANLIB=/usr/bin/llvm-ranlib", + # prevent failing checks + "-DCMAKE_C_COMPILER_WORKS=ON", + "-DCMAKE_CXX_COMPILER_WORKS=ON", + "-DCMAKE_ASM_COMPILER_WORKS=ON", + # build these runtimes + "-DLLVM_ENABLE_RUNTIMES=libcxx;libcxxabi;libunwind", + # don't use libgcc + "-DLIBUNWIND_USE_COMPILER_RT=ON", + "-DLIBCXX_USE_COMPILER_RT=ON", + "-DLIBCXXABI_USE_COMPILER_RT=ON", + # building libunwind DSO with runtime dependency on c++ abi library is not supported + "-DLIBUNWIND_ENABLE_SHARED=OFF", + # FIXME: lld can't find -lc++ or -lunwind for some reason?? + "-DLIBCXX_ENABLE_SHARED=OFF", + "-DLIBCXXABI_ENABLE_SHARED=OFF", +] +cmake_dir = "runtimes" +hostmakedepends = ["cmake", "python"] +depends = [f"libcxxabi-mingw-w64={pkgver}-r{pkgrel}"] +pkgdesc = "LLVM libc++ for Windows development" +maintainer = "Erica Z " +license = "Apache-2.0" +url = "https://llvm.org" +source = f"https://github.com/llvm/llvm-project/releases/download/llvmorg-{pkgver}/llvm-project-{pkgver}.src.tar.xz" +sha256 = "0b58557a6d32ceee97c8d533a59b9212d87e0fc4d2833924eb6c611247db2f2a" +# crosstoolchain +options = ["!cross", "!check", "!lto", "empty"] + +_targets = ["x86_64", "i686", "aarch64", "armv7"] + +for _an in _targets: + # hostmakedepends += [f"mingw-w64-headers-{_an}", f"mingw-w64-crt-{_an}"] + hostmakedepends += [f"mingw-w64-headers-{_an}"] + pass + + +def do_configure(self): + from cbuild.util import cmake + + for an in _targets: + at = an + "-w64-mingw32" + # configure libcxx + with self.stamp(f"{an}_configure") as s: + s.check() + cmake.configure( + self, + f"build-{an}", + self.cmake_dir, + [ + *self.configure_args, + f"-DCMAKE_SYSROOT=/usr/{at}", + f"-DCMAKE_INSTALL_PREFIX=/usr/{at}", + f"-DCMAKE_ASM_COMPILER_TARGET={at}", + f"-DCMAKE_CXX_COMPILER_TARGET={at}", + f"-DCMAKE_C_COMPILER_TARGET={at}", + ], + cross_build=False, + generator="Unix Makefiles", + env={ + "CFLAGS": "", + "CXXFLAGS": "", + "LDFLAGS": "", + }, + ) + + +def do_build(self): + from cbuild.util import cmake + + for an in _targets: + with self.stamp(f"{an}_build") as s: + s.check() + cmake.build(self, f"build-{an}", ["--verbose"]) + + +def do_install(self): + from cbuild.util import cmake + + for an in _targets: + cmake.install( + self, + f"build-{an}", + ) + + +def _gen(an, at): + @subpackage(f"libunwind-mingw-w64-{an}") + def _unw(self): + self.pkgdesc = "LLVM libunwind for Windows development" + self.subdesc = an + self.depends = [] # TODO: determine this + # not supported for COFF + self.nostrip_files = [ + f"usr/{at}/lib/libunwind.a", + ] + + return [ + f"usr/{at}/lib/libunwind.*", + f"usr/{at}/include/*unwind*", + f"usr/{at}/include/mach-o", + ] + + @subpackage(f"libcxxabi-mingw-w64-{an}") + def _abi(self): + self.pkgdesc = "LLVM libc++abi for Windows development" + self.subdesc = an + self.depends = [f"libunwind-mingw-w64-{an}={pkgver}-r{pkgrel}"] + # not supported for COFF + self.nostrip_files = [ + f"usr/{at}/lib/libc++abi.a", + ] + + return [ + f"usr/{at}/lib/libc++abi*", + f"usr/{at}/include/c++/v1/*cxxabi*.h", + ] + + @subpackage(f"libcxx-mingw-w64-{an}") + def _subp(self): + self.subdesc = an + self.depends = [f"libcxxabi-mingw-w64-{an}={pkgver}-r{pkgrel}"] + # not supported for COFF + self.nostrip_files = [ + f"usr/{at}/lib/libc++.a", + f"usr/{at}/lib/libc++experimental.a", + ] + + return [f"usr/{at}"] + + depends.append(f"libcxx-mingw-w64-{an}={pkgver}-r{pkgrel}") + + +for _an in _targets: + _at = _an + "-w64-mingw32" + _gen(_an, _at) + + +@subpackage("libunwind-mingw-w64") +def _unw(self): + self.pkgdesc = "LLVM libunwind for Windows development" + self.depends = [] # TODO: determine this + self.options = ["empty"] + for an in _targets: + self.depends.append(f"libunwind-mingw-w64-{an}={pkgver}-r{pkgrel}") + + return [] + + +@subpackage("libcxxabi-mingw-w64") +def _abi(self): + self.pkgdesc = "LLVM libc++abi for Windows development" + self.depends = [f"libunwind-mingw-w64={pkgver}-r{pkgrel}"] + self.options = ["empty"] + for an in _targets: + self.depends.append(f"libcxxabi-mingw-w64-{an}={pkgver}-r{pkgrel}") + + return [] diff --git a/contrib/libcxx-mingw-w64/update.py b/contrib/libcxx-mingw-w64/update.py new file mode 100644 index 00000000000..faff136d0af --- /dev/null +++ b/contrib/libcxx-mingw-w64/update.py @@ -0,0 +1 @@ +pkgname = "llvmorg" diff --git a/contrib/libcxxabi-mingw-w64 b/contrib/libcxxabi-mingw-w64 new file mode 120000 index 00000000000..3217560f7be --- /dev/null +++ b/contrib/libcxxabi-mingw-w64 @@ -0,0 +1 @@ +libcxx-mingw-w64 \ No newline at end of file diff --git a/contrib/libcxxabi-mingw-w64-aarch64 b/contrib/libcxxabi-mingw-w64-aarch64 new file mode 120000 index 00000000000..3217560f7be --- /dev/null +++ b/contrib/libcxxabi-mingw-w64-aarch64 @@ -0,0 +1 @@ +libcxx-mingw-w64 \ No newline at end of file diff --git a/contrib/libcxxabi-mingw-w64-armv7 b/contrib/libcxxabi-mingw-w64-armv7 new file mode 120000 index 00000000000..3217560f7be --- /dev/null +++ b/contrib/libcxxabi-mingw-w64-armv7 @@ -0,0 +1 @@ +libcxx-mingw-w64 \ No newline at end of file diff --git a/contrib/libcxxabi-mingw-w64-i686 b/contrib/libcxxabi-mingw-w64-i686 new file mode 120000 index 00000000000..3217560f7be --- /dev/null +++ b/contrib/libcxxabi-mingw-w64-i686 @@ -0,0 +1 @@ +libcxx-mingw-w64 \ No newline at end of file diff --git a/contrib/libcxxabi-mingw-w64-x86_64 b/contrib/libcxxabi-mingw-w64-x86_64 new file mode 120000 index 00000000000..3217560f7be --- /dev/null +++ b/contrib/libcxxabi-mingw-w64-x86_64 @@ -0,0 +1 @@ +libcxx-mingw-w64 \ No newline at end of file diff --git a/contrib/libunwind-mingw-w64 b/contrib/libunwind-mingw-w64 new file mode 120000 index 00000000000..3217560f7be --- /dev/null +++ b/contrib/libunwind-mingw-w64 @@ -0,0 +1 @@ +libcxx-mingw-w64 \ No newline at end of file diff --git a/contrib/libunwind-mingw-w64-aarch64 b/contrib/libunwind-mingw-w64-aarch64 new file mode 120000 index 00000000000..3217560f7be --- /dev/null +++ b/contrib/libunwind-mingw-w64-aarch64 @@ -0,0 +1 @@ +libcxx-mingw-w64 \ No newline at end of file diff --git a/contrib/libunwind-mingw-w64-armv7 b/contrib/libunwind-mingw-w64-armv7 new file mode 120000 index 00000000000..3217560f7be --- /dev/null +++ b/contrib/libunwind-mingw-w64-armv7 @@ -0,0 +1 @@ +libcxx-mingw-w64 \ No newline at end of file diff --git a/contrib/libunwind-mingw-w64-i686 b/contrib/libunwind-mingw-w64-i686 new file mode 120000 index 00000000000..3217560f7be --- /dev/null +++ b/contrib/libunwind-mingw-w64-i686 @@ -0,0 +1 @@ +libcxx-mingw-w64 \ No newline at end of file diff --git a/contrib/libunwind-mingw-w64-x86_64 b/contrib/libunwind-mingw-w64-x86_64 new file mode 120000 index 00000000000..3217560f7be --- /dev/null +++ b/contrib/libunwind-mingw-w64-x86_64 @@ -0,0 +1 @@ +libcxx-mingw-w64 \ No newline at end of file