Skip to content

Commit

Permalink
contrib/libcxx-mingw-w64: new package (18.1.8)
Browse files Browse the repository at this point in the history
  • Loading branch information
z-erica committed Jul 23, 2024
1 parent f57c548 commit 95ddd70
Show file tree
Hide file tree
Showing 16 changed files with 185 additions and 0 deletions.
1 change: 1 addition & 0 deletions contrib/libcxx-mingw-w64-aarch64
1 change: 1 addition & 0 deletions contrib/libcxx-mingw-w64-armv7
1 change: 1 addition & 0 deletions contrib/libcxx-mingw-w64-i686
1 change: 1 addition & 0 deletions contrib/libcxx-mingw-w64-x86_64
170 changes: 170 additions & 0 deletions contrib/libcxx-mingw-w64/template.py
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
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 []
1 change: 1 addition & 0 deletions contrib/libcxx-mingw-w64/update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pkgname = "llvmorg"
1 change: 1 addition & 0 deletions contrib/libcxxabi-mingw-w64
1 change: 1 addition & 0 deletions contrib/libcxxabi-mingw-w64-aarch64
1 change: 1 addition & 0 deletions contrib/libcxxabi-mingw-w64-armv7
1 change: 1 addition & 0 deletions contrib/libcxxabi-mingw-w64-i686
1 change: 1 addition & 0 deletions contrib/libcxxabi-mingw-w64-x86_64
1 change: 1 addition & 0 deletions contrib/libunwind-mingw-w64
1 change: 1 addition & 0 deletions contrib/libunwind-mingw-w64-aarch64
1 change: 1 addition & 0 deletions contrib/libunwind-mingw-w64-armv7
1 change: 1 addition & 0 deletions contrib/libunwind-mingw-w64-i686
1 change: 1 addition & 0 deletions contrib/libunwind-mingw-w64-x86_64

0 comments on commit 95ddd70

Please sign in to comment.