On 2026/10/19 12:51, Neth Iafin wrote:
> > Is there some hope to get some of the big set of patches merged
> > upstream?
> >
> > Some #ifdef __OpenBSD__ patches look like they could use a check for
> > the specific thing (at least xattrs, not sure if there are others) and
> > conditioning on that instead of OpenBSD/not.
> 
> I doubt much will be merged upstream. Many updates we have can technically 
> run on other OSes (%gs stubs won't be built on Linux because %gs is correctly 
> set, SIGUSR1 will work but less optimally, etc). However I picked an approach 
> where everything that is done for OpenBSD is just marked as OpenBSD only. I 
> did that purely to simplify my life while I was working on it and clearly 
> mark the changes.
> 
> When I was talking to Wine maintainers a month ago, they were hesitant to 
> accept even patching Wine so it compiles for OpenBSD, mostly because it's 
> another OS they will have to support and keep operational, while the %gs stub 
> fix is something they definitely cannot take upstream. They are very hesitant 
> to take anything that is changing the "emulated" application code.
> 
> The xattr change was a recent addition from Fabien, I suspect mostly to 
> support the Mono installer that creates a lot of symlinks for different 
> framework versions. I guess it can be taken upstream with `#if 
> !defined(HAVE_SYS_XATTR_H) && !defined(HAVE_SYS_EXTATTR_H)`, among other 
> places (server/fd.c) that need this change.
> 
> In short - merging upstream is not a current goal, at least for me. There are 
> still some stability issues, especially with very demanding 3d games. I'll 
> see where we stand in a few months.
> 
> > I'm concerned about this. Really need some information about how to
> > generate these, ideally an automated method that can run from llvm/clang
> > source tarballs as part of the emulators/wine build so that wine doesn't
> > block every lang/clang update, but if not then at least something that
> > can run from a make target.
> 
> I'll leave the details to Fabien/Thomas, but nothing is actually generated. 
> The llvm package strips out clang's freestanding headers (float.h inttypes.h 
> iso646.h limits.h stdarg.h stdbool.h stddef.h stdint.h) and we need them for 
> Windows builds. They are copied unchanged from clang/lib/Headers at the 
> llvmorg tag that matches MODCLANG_VERSION, so it can be automated. It does 
> mean that we have to download ~150 MB distfile for those 8 header files 
> though.

remember that devel/llvm is not set in stone.

here are two patches, for wine, and for devel/llvm, that make this
significantly less annoying to deal with. my build is still running but
I think it should work.

another way to do it: rather than completely removing the stripped-out
headers, devel/llvm could install them under a different dir and
include in packages.


--- Makefile.orig       Mon Oct 19 14:18:12 2026
+++ Makefile    Mon Oct 19 14:43:16 2026
@@ -27,19 +27,14 @@ WANTLIB += lib/inotify/inotify lib/libpcap/pcap
 # loaded with dlopen()
 WANTLIB += SDL2 cups dbus-1 gnutls netapi vulkan xkbregistry
 
-# keep this in sync with MODCLANG_VERSION
-# source for updates/new releases: 
https://thfr.gothub.org/wine-clang-pe-headers
-CLANG_PE_HEADERS =             22.1.8
-DISTFILES.clang-pe-headers =   wine-clang-pe-headers-${CLANG_PE_HEADERS}.tar.gz
-SITES.clang-pe-headers =       https://thfr.info/distfiles/
-
 SITES =                        https://dl.winehq.org/wine/source/11.x/
 EXTRACT_SUFX =         .tar.xz
 
 MODULES =              lang/clang
 
 BUILD_DEPENDS =                devel/bison \
-                       devel/nasm
+                       devel/nasm \
+                       ${_MODCLANG_BUILD_DEPENDS},headerextract:patch
 RUN_DEPENDS =          multimedia/gstreamer1/libav \
                        multimedia/gstreamer1/plugins-bad \
                        multimedia/gstreamer1/plugins-good \
@@ -156,9 +151,9 @@ SUBST_VARS+=                CLANG_PE_RESOURCE 
MODCLANG_VERSION
 
 pre-configure:
        ${INSTALL_DATA_DIR} ${CLANG_PE_RESOURCE}/include
-       cp -R ${CLANG_RESOURCE}/include/. ${CLANG_PE_RESOURCE}/include/
-       cp ${WRKDIR}/wine-clang-pe-headers-${CLANG_PE_HEADERS}/*.h \
+       cp ${WRKDIR}/devel/llvm/*/*/clang/lib/Headers/*.h \
                ${CLANG_PE_RESOURCE}/include/
+       cp -R ${CLANG_RESOURCE}/include/. ${CLANG_PE_RESOURCE}/include/
        ln -sfh ${CLANG_RESOURCE}/lib ${CLANG_PE_RESOURCE}/lib
        ${SUBST_PROGRAM} ${FILESDIR}/clang-pe ${WRKDIR}/bin/clang-pe
 


Index: Makefile.inc
===================================================================
RCS file: /cvs/ports/devel/llvm/Makefile.inc,v
diff -u -p -r1.35 Makefile.inc
--- Makefile.inc        20 Sep 2026 14:25:09 -0000      1.35
+++ Makefile.inc        19 Oct 2026 13:35:06 -0000
@@ -97,9 +97,19 @@ COMPILER =   base-clang ports-gcc
 
 MODULES +=     devel/cmake
 
+# internal use for emulators/wine; reduce extraction size
+FLAVORS=       headerextract
+FLAVOR?=
+
+.if ${FLAVOR} == headerextract
+PATCH_LIST=
+EXTRACT_CASES += llvm*.tar.xz) \
+    xz -T${MAKE_JOBS} -d <${FULLDISTDIR}/$$archive | ${TAR} -xf - -- 
*/clang/lib/Headers;;
+.else
 BUILD_DEPENDS +=       devel/swig \
                        textproc/py-sphinx \
                        textproc/py-recommonmark
+.endif
 
 CONFIGURE_STYLE +=     cmake
 CONFIGURE_ARGS +=      \
@@ -151,7 +161,8 @@ CXXFLAGS-powerpc =  -fno-ret-protector
 CXXFLAGS-mips64 +=     -mxgot
 CXXFLAGS-mips64el +=   -mxgot
 
-CXXFLAGS +=            ${CXXFLAGS-${MACHINE_ARCH}}
+CXXFLAGS +=            ${CXXFLAGS-${MACHINE_ARCH}} \
+                       -D_LIBCPP_USE_LOWER_DEQUE_BLOCK_SIZE
 
 ALL_TARGET =           all docs-llvm-man docs-clang-man
 

Reply via email to